@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $this->_columns = array_merge( $columns, $this->_columns ); |
88 | 88 | $this->_primary_column = '_REG_att_checked_in'; |
89 | 89 | if ( ! empty( $evt_id ) |
90 | - && EE_Registry::instance()->CAP->current_user_can( |
|
90 | + && EE_Registry::instance()->CAP->current_user_can( |
|
91 | 91 | 'ee_read_registrations', |
92 | 92 | 'espresso_registrations_registrations_reports', |
93 | 93 | $evt_id |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $checkinstatus = $item->check_in_status_for_datetime( $this->_cur_dtt_id ); |
284 | 284 | $nonce = wp_create_nonce( 'checkin_nonce' ); |
285 | 285 | $toggle_active = ! empty ( $this->_cur_dtt_id ) |
286 | - && EE_Registry::instance()->CAP->current_user_can( |
|
286 | + && EE_Registry::instance()->CAP->current_user_can( |
|
287 | 287 | 'ee_edit_checkin', |
288 | 288 | 'espresso_registrations_toggle_checkin_status', |
289 | 289 | $item->ID() |
@@ -292,11 +292,11 @@ discard block |
||
292 | 292 | : ''; |
293 | 293 | $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
294 | 294 | return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '"' |
295 | - . ' data-_regid="' . $item->ID() . '"' |
|
296 | - . ' data-dttid="' . $this->_cur_dtt_id . '"' |
|
297 | - . ' data-nonce="' . $nonce . '">' |
|
298 | - . '</span>' |
|
299 | - . $mobile_view_content; |
|
295 | + . ' data-_regid="' . $item->ID() . '"' |
|
296 | + . ' data-dttid="' . $this->_cur_dtt_id . '"' |
|
297 | + . ' data-nonce="' . $nonce . '">' |
|
298 | + . '</span>' |
|
299 | + . $mobile_view_content; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | 'espresso_registrations_edit_attendee' |
322 | 322 | ) |
323 | 323 | ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' |
324 | - . $item->attendee()->full_name() |
|
325 | - . '</a>' |
|
324 | + . $item->attendee()->full_name() |
|
325 | + . '</a>' |
|
326 | 326 | : $item->attendee()->full_name(); |
327 | 327 | $name_link .= $item->count() === 1 |
328 | 328 | ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | ? $item->get_latest_related_datetime()->ID() |
355 | 355 | : $DTT_ID; |
356 | 356 | if ( ! empty( $DTT_ID ) |
357 | - && EE_Registry::instance()->CAP->current_user_can( |
|
357 | + && EE_Registry::instance()->CAP->current_user_can( |
|
358 | 358 | 'ee_read_checkins', |
359 | 359 | 'espresso_registrations_registration_checkins' |
360 | 360 | ) |
@@ -454,15 +454,15 @@ discard block |
||
454 | 454 | ) ? ' |
455 | 455 | <span class="reg-pad-rght"> |
456 | 456 | <a class="status-' |
457 | - . $item->transaction()->status_ID() |
|
458 | - . '" href="' |
|
459 | - . $view_txn_lnk_url |
|
460 | - . '" title="' |
|
461 | - . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
462 | - . '"> |
|
457 | + . $item->transaction()->status_ID() |
|
458 | + . '" href="' |
|
459 | + . $view_txn_lnk_url |
|
460 | + . '" title="' |
|
461 | + . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
462 | + . '"> |
|
463 | 463 | ' |
464 | - . $item->transaction()->pretty_paid() |
|
465 | - . ' |
|
464 | + . $item->transaction()->pretty_paid() |
|
465 | + . ' |
|
466 | 466 | </a> |
467 | 467 | <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
468 | 468 | } |
@@ -495,12 +495,12 @@ discard block |
||
495 | 495 | 'ee_read_transaction', |
496 | 496 | 'espresso_transactions_view_transaction' |
497 | 497 | ) ? '<a href="' |
498 | - . $view_txn_url |
|
499 | - . '" title="' |
|
500 | - . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
501 | - . '"><span class="reg-pad-rght">' |
|
502 | - . $txn_total |
|
503 | - . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
498 | + . $view_txn_url |
|
499 | + . '" title="' |
|
500 | + . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
501 | + . '"><span class="reg-pad-rght">' |
|
502 | + . $txn_total |
|
503 | + . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
504 | 504 | } else { |
505 | 505 | return '<span class="reg-pad-rght"></span>'; |
506 | 506 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -42,51 +42,51 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param \Registrations_Admin_Page $admin_page |
44 | 44 | */ |
45 | - public function __construct( $admin_page ) { |
|
46 | - parent::__construct( $admin_page ); |
|
45 | + public function __construct($admin_page) { |
|
46 | + parent::__construct($admin_page); |
|
47 | 47 | $this->_status = $this->_admin_page->get_registration_status_array(); |
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | 52 | protected function _setup_data() { |
53 | - $this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) |
|
54 | - : $this->_admin_page->get_event_attendees( $this->_per_page, false, true ); |
|
53 | + $this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) |
|
54 | + : $this->_admin_page->get_event_attendees($this->_per_page, false, true); |
|
55 | 55 | $this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees( |
56 | 56 | $this->_per_page, |
57 | 57 | true |
58 | - ) : $this->_admin_page->get_event_attendees( $this->_per_page, true, true ); |
|
58 | + ) : $this->_admin_page->get_event_attendees($this->_per_page, true, true); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | |
63 | 63 | protected function _set_properties() { |
64 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null; |
|
64 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
65 | 65 | $this->_wp_list_args = array( |
66 | - 'singular' => __( 'registrant', 'event_espresso' ), |
|
67 | - 'plural' => __( 'registrants', 'event_espresso' ), |
|
66 | + 'singular' => __('registrant', 'event_espresso'), |
|
67 | + 'plural' => __('registrants', 'event_espresso'), |
|
68 | 68 | 'ajax' => true, |
69 | 69 | 'screen' => $this->_admin_page->get_current_screen()->id, |
70 | 70 | ); |
71 | 71 | $columns = array(); |
72 | 72 | //$columns['_Reg_Status'] = ''; |
73 | - if ( ! empty( $evt_id ) ) { |
|
73 | + if ( ! empty($evt_id)) { |
|
74 | 74 | $columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text |
75 | 75 | $this->_has_checkbox_column = true; |
76 | 76 | } |
77 | 77 | $this->_columns = array( |
78 | 78 | '_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>', |
79 | - 'ATT_name' => __( 'Registrant', 'event_espresso' ), |
|
80 | - 'ATT_email' => __( 'Email Address', 'event_espresso' ), |
|
81 | - 'Event' => __( 'Event', 'event_espresso' ), |
|
82 | - 'PRC_name' => __( 'TKT Option', 'event_espresso' ), |
|
83 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
84 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
85 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
79 | + 'ATT_name' => __('Registrant', 'event_espresso'), |
|
80 | + 'ATT_email' => __('Email Address', 'event_espresso'), |
|
81 | + 'Event' => __('Event', 'event_espresso'), |
|
82 | + 'PRC_name' => __('TKT Option', 'event_espresso'), |
|
83 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
84 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
85 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
86 | 86 | ); |
87 | - $this->_columns = array_merge( $columns, $this->_columns ); |
|
87 | + $this->_columns = array_merge($columns, $this->_columns); |
|
88 | 88 | $this->_primary_column = '_REG_att_checked_in'; |
89 | - if ( ! empty( $evt_id ) |
|
89 | + if ( ! empty($evt_id) |
|
90 | 90 | && EE_Registry::instance()->CAP->current_user_can( |
91 | 91 | 'ee_read_registrations', |
92 | 92 | 'espresso_registrations_registrations_reports', |
@@ -99,18 +99,18 @@ discard block |
||
99 | 99 | 'extra_request' => |
100 | 100 | array( |
101 | 101 | 'EVT_ID' => $evt_id, |
102 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ), |
|
102 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
103 | 103 | ), |
104 | 104 | ), |
105 | 105 | ); |
106 | 106 | } |
107 | 107 | $this->_sortable_columns = array( |
108 | 108 | //true means its already sorted |
109 | - 'ATT_name' => array( 'ATT_name' => true ), |
|
110 | - 'Event' => array( 'Event.EVT.Name' => false ), |
|
109 | + 'ATT_name' => array('ATT_name' => true), |
|
110 | + 'Event' => array('Event.EVT.Name' => false), |
|
111 | 111 | ); |
112 | 112 | $this->_hidden_columns = array(); |
113 | - $this->_evt = EEM_Event::instance()->get_one_by_ID( $evt_id ); |
|
113 | + $this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id); |
|
114 | 114 | $this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array(); |
115 | 115 | } |
116 | 116 | |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | * @param \EE_Registration $item |
121 | 121 | * @return string |
122 | 122 | */ |
123 | - protected function _get_row_class( $item ) { |
|
124 | - $class = parent::_get_row_class( $item ); |
|
123 | + protected function _get_row_class($item) { |
|
124 | + $class = parent::_get_row_class($item); |
|
125 | 125 | //add status class |
126 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
127 | - if ( $this->_has_checkbox_column ) { |
|
126 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
127 | + if ($this->_has_checkbox_column) { |
|
128 | 128 | $class .= ' has-checkbox-column'; |
129 | 129 | } |
130 | 130 | return $class; |
@@ -138,60 +138,60 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function _get_table_filters() { |
140 | 140 | $filters = $where = array(); |
141 | - $current_EVT_ID = isset( $this->_req_data['event_id'] ) ? (int) $this->_req_data['event_id'] : 0; |
|
142 | - if ( empty( $this->_dtts_for_event ) || count( $this->_dtts_for_event ) === 1 ) { |
|
141 | + $current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0; |
|
142 | + if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) { |
|
143 | 143 | //this means we don't have an event so let's setup a filter dropdown for all the events to select |
144 | 144 | //note possible capability restrictions |
145 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
146 | - $where['status**'] = array( '!=', 'private' ); |
|
145 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
146 | + $where['status**'] = array('!=', 'private'); |
|
147 | 147 | } |
148 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
148 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
149 | 149 | $where['EVT_wp_user'] = get_current_user_id(); |
150 | 150 | } |
151 | 151 | $events = EEM_Event::instance()->get_all( |
152 | 152 | array( |
153 | 153 | $where, |
154 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ), |
|
154 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'), |
|
155 | 155 | ) |
156 | 156 | ); |
157 | 157 | $evts[] = array( |
158 | 158 | 'id' => 0, |
159 | - 'text' => __( 'To toggle Check-in status, select an event', 'event_espresso' ), |
|
159 | + 'text' => __('To toggle Check-in status, select an event', 'event_espresso'), |
|
160 | 160 | ); |
161 | 161 | $checked = 'checked'; |
162 | 162 | /** @var EE_Event $evt */ |
163 | - foreach ( $events as $evt ) { |
|
163 | + foreach ($events as $evt) { |
|
164 | 164 | //any registrations for this event? |
165 | - if ( ! $evt->get_count_of_all_registrations() ) { |
|
165 | + if ( ! $evt->get_count_of_all_registrations()) { |
|
166 | 166 | continue; |
167 | 167 | } |
168 | 168 | $evts[] = array( |
169 | 169 | 'id' => $evt->ID(), |
170 | - 'text' => $evt->get( 'EVT_name' ), |
|
170 | + 'text' => $evt->get('EVT_name'), |
|
171 | 171 | 'class' => $evt->is_expired() ? 'ee-expired-event' : '', |
172 | 172 | ); |
173 | - if ( $evt->ID() === $current_EVT_ID && $evt->is_expired() ) { |
|
173 | + if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) { |
|
174 | 174 | $checked = ''; |
175 | 175 | } |
176 | 176 | } |
177 | 177 | $event_filter = '<div class="ee-event-filter">'; |
178 | - $event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts, $current_EVT_ID ); |
|
178 | + $event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID); |
|
179 | 179 | $event_filter .= '<span class="ee-event-filter-toggle">'; |
180 | - $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> '; |
|
181 | - $event_filter .= __( 'Hide Expired Events', 'event_espresso' ); |
|
180 | + $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" '.$checked.'> '; |
|
181 | + $event_filter .= __('Hide Expired Events', 'event_espresso'); |
|
182 | 182 | $event_filter .= '</span>'; |
183 | 183 | $event_filter .= '</div>'; |
184 | 184 | $filters[] = $event_filter; |
185 | 185 | } |
186 | - if ( ! empty( $this->_dtts_for_event ) ) { |
|
186 | + if ( ! empty($this->_dtts_for_event)) { |
|
187 | 187 | //DTT datetimes filter |
188 | - $this->_cur_dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0; |
|
189 | - if ( count( $this->_dtts_for_event ) > 1 ) { |
|
190 | - $dtts[0] = __( 'To toggle check-in status, select a datetime.', 'event_espresso' ); |
|
191 | - foreach ( $this->_dtts_for_event as $dtt ) { |
|
192 | - $name = ! empty( $dtt->name() ) ? ' (' . $dtt->name() . ')' : ''; |
|
193 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $name; |
|
194 | - $dtts[ $dtt->ID() ] = $datetime_string; |
|
188 | + $this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
189 | + if (count($this->_dtts_for_event) > 1) { |
|
190 | + $dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso'); |
|
191 | + foreach ($this->_dtts_for_event as $dtt) { |
|
192 | + $name = ! empty($dtt->name()) ? ' ('.$dtt->name().')' : ''; |
|
193 | + $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time().$name; |
|
194 | + $dtts[$dtt->ID()] = $datetime_string; |
|
195 | 195 | } |
196 | 196 | $input = new EE_Select_Input( |
197 | 197 | $dtts, |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | ) |
203 | 203 | ); |
204 | 204 | $filters[] = $input->get_html_for_input(); |
205 | - $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">'; |
|
205 | + $filters[] = '<input type="hidden" name="event_id" value="'.$current_EVT_ID.'">'; |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | return $filters; |
@@ -221,22 +221,22 @@ discard block |
||
221 | 221 | * @throws \EE_Error |
222 | 222 | */ |
223 | 223 | protected function _get_total_event_attendees() { |
224 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : false; |
|
224 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
225 | 225 | $DTT_ID = $this->_cur_dtt_id; |
226 | 226 | $query_params = array(); |
227 | - if ( $EVT_ID ) { |
|
227 | + if ($EVT_ID) { |
|
228 | 228 | $query_params[0]['EVT_ID'] = $EVT_ID; |
229 | 229 | } |
230 | 230 | //if DTT is included we only show for that datetime. Otherwise we're showing for all datetimes (the event). |
231 | - if ( $DTT_ID ) { |
|
231 | + if ($DTT_ID) { |
|
232 | 232 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
233 | 233 | } |
234 | 234 | $status_ids_array = apply_filters( |
235 | 235 | 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', |
236 | - array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) |
|
236 | + array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved) |
|
237 | 237 | ); |
238 | - $query_params[0]['STS_ID'] = array( 'IN', $status_ids_array ); |
|
239 | - return EEM_Registration::instance()->count( $query_params ); |
|
238 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
239 | + return EEM_Registration::instance()->count($query_params); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | * @param \EE_Registration $item |
246 | 246 | * @return string |
247 | 247 | */ |
248 | - public function column__Reg_Status( EE_Registration $item ) { |
|
249 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
248 | + public function column__Reg_Status(EE_Registration $item) { |
|
249 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>'; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | * @return string |
257 | 257 | * @throws \EE_Error |
258 | 258 | */ |
259 | - public function column_cb( $item ) { |
|
260 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() ); |
|
259 | + public function column_cb($item) { |
|
260 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | |
@@ -269,20 +269,20 @@ discard block |
||
269 | 269 | * @return string |
270 | 270 | * @throws \EE_Error |
271 | 271 | */ |
272 | - public function column__REG_att_checked_in( EE_Registration $item ) { |
|
272 | + public function column__REG_att_checked_in(EE_Registration $item) { |
|
273 | 273 | $attendee = $item->attendee(); |
274 | 274 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
275 | 275 | |
276 | - if ( $this->_cur_dtt_id === 0 && count( $this->_dtts_for_event ) === 1 ) { |
|
276 | + if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) { |
|
277 | 277 | $latest_related_datetime = $item->get_latest_related_datetime(); |
278 | - if ( $latest_related_datetime instanceof EE_Datetime ) { |
|
278 | + if ($latest_related_datetime instanceof EE_Datetime) { |
|
279 | 279 | $this->_cur_dtt_id = $latest_related_datetime->ID(); |
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
283 | - $checkinstatus = $item->check_in_status_for_datetime( $this->_cur_dtt_id ); |
|
284 | - $nonce = wp_create_nonce( 'checkin_nonce' ); |
|
285 | - $toggle_active = ! empty ( $this->_cur_dtt_id ) |
|
283 | + $checkinstatus = $item->check_in_status_for_datetime($this->_cur_dtt_id); |
|
284 | + $nonce = wp_create_nonce('checkin_nonce'); |
|
285 | + $toggle_active = ! empty ($this->_cur_dtt_id) |
|
286 | 286 | && EE_Registry::instance()->CAP->current_user_can( |
287 | 287 | 'ee_edit_checkin', |
288 | 288 | 'espresso_registrations_toggle_checkin_status', |
@@ -290,11 +290,11 @@ discard block |
||
290 | 290 | ) |
291 | 291 | ? ' clickable trigger-checkin' |
292 | 292 | : ''; |
293 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
294 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '"' |
|
295 | - . ' data-_regid="' . $item->ID() . '"' |
|
296 | - . ' data-dttid="' . $this->_cur_dtt_id . '"' |
|
297 | - . ' data-nonce="' . $nonce . '">' |
|
293 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>'; |
|
294 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'"' |
|
295 | + . ' data-_regid="'.$item->ID().'"' |
|
296 | + . ' data-dttid="'.$this->_cur_dtt_id.'"' |
|
297 | + . ' data-nonce="'.$nonce.'">' |
|
298 | 298 | . '</span>' |
299 | 299 | . $mobile_view_content; |
300 | 300 | } |
@@ -306,21 +306,21 @@ discard block |
||
306 | 306 | * @return mixed|string|void |
307 | 307 | * @throws \EE_Error |
308 | 308 | */ |
309 | - public function column_ATT_name( EE_Registration $item ) { |
|
309 | + public function column_ATT_name(EE_Registration $item) { |
|
310 | 310 | $attendee = $item->attendee(); |
311 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
312 | - return __( 'No contact record for this registration.', 'event_espresso' ); |
|
311 | + if ( ! $attendee instanceof EE_Attendee) { |
|
312 | + return __('No contact record for this registration.', 'event_espresso'); |
|
313 | 313 | } |
314 | 314 | // edit attendee link |
315 | 315 | $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
316 | - array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), |
|
316 | + array('action' => 'view_registration', '_REG_ID' => $item->ID()), |
|
317 | 317 | REG_ADMIN_URL |
318 | 318 | ); |
319 | 319 | $name_link = EE_Registry::instance()->CAP->current_user_can( |
320 | 320 | 'ee_edit_contacts', |
321 | 321 | 'espresso_registrations_edit_attendee' |
322 | 322 | ) |
323 | - ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' |
|
323 | + ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">' |
|
324 | 324 | . $item->attendee()->full_name() |
325 | 325 | . '</a>' |
326 | 326 | : $item->attendee()->full_name(); |
@@ -328,10 +328,10 @@ discard block |
||
328 | 328 | ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' |
329 | 329 | : ''; |
330 | 330 | //add group details |
331 | - $name_link .= ' ' . sprintf( __( '(%s of %s)', 'event_espresso' ), $item->count(), $item->group_size() ); |
|
331 | + $name_link .= ' '.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
332 | 332 | //add regcode |
333 | 333 | $link = EE_Admin_Page::add_query_args_and_nonce( |
334 | - array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), |
|
334 | + array('action' => 'view_registration', '_REG_ID' => $item->ID()), |
|
335 | 335 | REG_ADMIN_URL |
336 | 336 | ); |
337 | 337 | $name_link .= '<br>'; |
@@ -340,34 +340,34 @@ discard block |
||
340 | 340 | 'view_registration', |
341 | 341 | $item->ID() |
342 | 342 | ) |
343 | - ? '<a href="' . $link . '" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' |
|
343 | + ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">' |
|
344 | 344 | . $item->reg_code() |
345 | 345 | . '</a>' |
346 | 346 | : $item->reg_code(); |
347 | 347 | //status |
348 | 348 | $name_link .= '<br><span class="ee-status-text-small">'; |
349 | - $name_link .= EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ); |
|
349 | + $name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence'); |
|
350 | 350 | $name_link .= '</span>'; |
351 | 351 | $actions = array(); |
352 | 352 | $DTT_ID = $this->_cur_dtt_id; |
353 | - $DTT_ID = empty( $DTT_ID ) && ! empty( $this->_req_data['event_id'] ) && $item instanceof EE_Registration |
|
353 | + $DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration |
|
354 | 354 | ? $item->get_latest_related_datetime()->ID() |
355 | 355 | : $DTT_ID; |
356 | - if ( ! empty( $DTT_ID ) |
|
356 | + if ( ! empty($DTT_ID) |
|
357 | 357 | && EE_Registry::instance()->CAP->current_user_can( |
358 | 358 | 'ee_read_checkins', |
359 | 359 | 'espresso_registrations_registration_checkins' |
360 | 360 | ) |
361 | 361 | ) { |
362 | 362 | $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( |
363 | - array( 'action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID ) |
|
363 | + array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID) |
|
364 | 364 | ); |
365 | - $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__( |
|
365 | + $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__( |
|
366 | 366 | 'View all the check-ins/checkouts for this registrant', |
367 | 367 | 'event_espresso' |
368 | - ) . '">' . __( 'View', 'event_espresso' ) . '</a>'; |
|
368 | + ).'">'.__('View', 'event_espresso').'</a>'; |
|
369 | 369 | } |
370 | - return ! empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions( $actions ) ) : $name_link; |
|
370 | + return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link; |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * @param \EE_Registration $item |
377 | 377 | * @return string |
378 | 378 | */ |
379 | - public function column_ATT_email( EE_Registration $item ) { |
|
379 | + public function column_ATT_email(EE_Registration $item) { |
|
380 | 380 | $attendee = $item->attendee(); |
381 | 381 | return $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
382 | 382 | } |
@@ -388,22 +388,22 @@ discard block |
||
388 | 388 | * @return bool|string |
389 | 389 | * @throws \EE_Error |
390 | 390 | */ |
391 | - public function column_Event( EE_Registration $item ) { |
|
391 | + public function column_Event(EE_Registration $item) { |
|
392 | 392 | try { |
393 | 393 | $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); |
394 | 394 | $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
395 | - array( 'action' => 'event_registrations', 'event_id' => $event->ID() ), |
|
395 | + array('action' => 'event_registrations', 'event_id' => $event->ID()), |
|
396 | 396 | REG_ADMIN_URL |
397 | 397 | ); |
398 | 398 | $event_label = EE_Registry::instance()->CAP->current_user_can( |
399 | 399 | 'ee_read_checkins', |
400 | 400 | 'espresso_registrations_registration_checkins' |
401 | - ) ? '<a href="' . $chkin_lnk_url . '" title="' . esc_attr__( |
|
401 | + ) ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__( |
|
402 | 402 | 'View Checkins for this Event', |
403 | 403 | 'event_espresso' |
404 | - ) . '">' . $event->name() . '</a>' : $event->name(); |
|
405 | - } catch ( \EventEspresso\core\exceptions\EntityNotFoundException $e ) { |
|
406 | - $event_label = esc_html__( 'Unknown', 'event_espresso' ); |
|
404 | + ).'">'.$event->name().'</a>' : $event->name(); |
|
405 | + } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) { |
|
406 | + $event_label = esc_html__('Unknown', 'event_espresso'); |
|
407 | 407 | } |
408 | 408 | return $event_label; |
409 | 409 | } |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | * @param \EE_Registration $item |
415 | 415 | * @return mixed|string|void |
416 | 416 | */ |
417 | - public function column_PRC_name( EE_Registration $item ) { |
|
418 | - return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __( "Unknown", "event_espresso" ); |
|
417 | + public function column_PRC_name(EE_Registration $item) { |
|
418 | + return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso"); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | * @param \EE_Registration $item |
427 | 427 | * @return string |
428 | 428 | */ |
429 | - public function column__REG_final_price( EE_Registration $item ) { |
|
430 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
429 | + public function column__REG_final_price(EE_Registration $item) { |
|
430 | + return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>'; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | * @return string |
440 | 440 | * @throws \EE_Error |
441 | 441 | */ |
442 | - public function column_TXN_paid( EE_Registration $item ) { |
|
443 | - if ( $item->count() === 1 ) { |
|
444 | - if ( $item->transaction()->paid() >= $item->transaction()->total() ) { |
|
442 | + public function column_TXN_paid(EE_Registration $item) { |
|
443 | + if ($item->count() === 1) { |
|
444 | + if ($item->transaction()->paid() >= $item->transaction()->total()) { |
|
445 | 445 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
446 | 446 | } else { |
447 | 447 | $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
448 | - array( 'action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID() ), |
|
448 | + array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()), |
|
449 | 449 | TXN_ADMIN_URL |
450 | 450 | ); |
451 | 451 | return EE_Registry::instance()->CAP->current_user_can( |
@@ -458,13 +458,13 @@ discard block |
||
458 | 458 | . '" href="' |
459 | 459 | . $view_txn_lnk_url |
460 | 460 | . '" title="' |
461 | - . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
461 | + . esc_attr__('View Transaction', 'event_espresso') |
|
462 | 462 | . '"> |
463 | 463 | ' |
464 | 464 | . $item->transaction()->pretty_paid() |
465 | 465 | . ' |
466 | 466 | </a> |
467 | - <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
467 | + <span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
468 | 468 | } |
469 | 469 | } else { |
470 | 470 | return '<span class="reg-pad-rght"></span>'; |
@@ -480,13 +480,13 @@ discard block |
||
480 | 480 | * @return string |
481 | 481 | * @throws \EE_Error |
482 | 482 | */ |
483 | - public function column_TXN_total( EE_Registration $item ) { |
|
483 | + public function column_TXN_total(EE_Registration $item) { |
|
484 | 484 | $txn = $item->transaction(); |
485 | - $view_txn_url = add_query_arg( array( 'action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
|
486 | - if ( $item->get( 'REG_count' ) === 1 ) { |
|
485 | + $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); |
|
486 | + if ($item->get('REG_count') === 1) { |
|
487 | 487 | $line_total_obj = $txn->total_line_item(); |
488 | 488 | $txn_total = $line_total_obj instanceof EE_Line_Item |
489 | - ? $line_total_obj->get_pretty( 'LIN_total' ) |
|
489 | + ? $line_total_obj->get_pretty('LIN_total') |
|
490 | 490 | : __( |
491 | 491 | 'View Transaction', |
492 | 492 | 'event_espresso' |
@@ -497,10 +497,10 @@ discard block |
||
497 | 497 | ) ? '<a href="' |
498 | 498 | . $view_txn_url |
499 | 499 | . '" title="' |
500 | - . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
500 | + . esc_attr__('View Transaction', 'event_espresso') |
|
501 | 501 | . '"><span class="reg-pad-rght">' |
502 | 502 | . $txn_total |
503 | - . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
503 | + . '</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>'; |
|
504 | 504 | } else { |
505 | 505 | return '<span class="reg-pad-rght"></span>'; |
506 | 506 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | ); |
353 | 353 | if ( $this->_current_page === 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to ) ) { |
354 | 354 | if ( ( $this->_req_action === 'event_registrations' && empty( $this->_req_data['event_id'] ) ) |
355 | - || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ) |
|
355 | + || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ) |
|
356 | 356 | ) { |
357 | 357 | echo ''; |
358 | 358 | } else { |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | '<span class="send-selected-newsletter-count">0</span>' |
362 | 362 | ); |
363 | 363 | echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' |
364 | - . $button_text |
|
365 | - . '</button>'; |
|
364 | + . $button_text |
|
365 | + . '</button>'; |
|
366 | 366 | add_action( 'admin_footer', array( $this, 'newsletter_send_form_skeleton' ) ); |
367 | 367 | } |
368 | 368 | } |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | $new_status = $this->_toggle_checkin_status(); |
796 | 796 | //setup new class to return via ajax |
797 | 797 | $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' |
798 | - . $new_status; |
|
798 | + . $new_status; |
|
799 | 799 | $this->_template_args['success'] = true; |
800 | 800 | $this->_return_json(); |
801 | 801 | } |
@@ -1178,8 +1178,8 @@ discard block |
||
1178 | 1178 | 'event_espresso' |
1179 | 1179 | ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
1180 | 1180 | $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' |
1181 | - . $edit_event_lnk |
|
1182 | - . '</span>'; |
|
1181 | + . $edit_event_lnk |
|
1182 | + . '</span>'; |
|
1183 | 1183 | } |
1184 | 1184 | $back_2_reg_url = self::add_query_args_and_nonce( array( 'action' => 'default' ), REG_ADMIN_URL ); |
1185 | 1185 | $back_2_reg_lnk = '<a href="' . $back_2_reg_url . '" title="' . esc_attr__( |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'NO direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -30,20 +30,20 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @param bool $routing |
32 | 32 | */ |
33 | - public function __construct( $routing = true ) { |
|
34 | - parent::__construct( $routing ); |
|
35 | - if ( ! defined( 'REG_CAF_TEMPLATE_PATH' ) ) { |
|
36 | - define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/' ); |
|
37 | - define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/' ); |
|
38 | - define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/' ); |
|
33 | + public function __construct($routing = true) { |
|
34 | + parent::__construct($routing); |
|
35 | + if ( ! defined('REG_CAF_TEMPLATE_PATH')) { |
|
36 | + define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/'); |
|
37 | + define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/'); |
|
38 | + define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/'); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | 42 | |
43 | 43 | |
44 | 44 | protected function _extend_page_config() { |
45 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations'; |
|
46 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) |
|
45 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations'; |
|
46 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) |
|
47 | 47 | ? $this->_req_data['_REG_ID'] |
48 | 48 | : 0; |
49 | 49 | // $att_id = ! empty( $this->_req_data['ATT_ID'] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0; |
@@ -85,16 +85,16 @@ discard block |
||
85 | 85 | 'capability' => 'ee_read_checkins', |
86 | 86 | ), |
87 | 87 | ); |
88 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
88 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
89 | 89 | $new_page_config = array( |
90 | 90 | 'reports' => array( |
91 | 91 | 'nav' => array( |
92 | - 'label' => __( 'Reports', 'event_espresso' ), |
|
92 | + 'label' => __('Reports', 'event_espresso'), |
|
93 | 93 | 'order' => 30, |
94 | 94 | ), |
95 | 95 | 'help_tabs' => array( |
96 | 96 | 'registrations_reports_help_tab' => array( |
97 | - 'title' => __( 'Registration Reports', 'event_espresso' ), |
|
97 | + 'title' => __('Registration Reports', 'event_espresso'), |
|
98 | 98 | 'filename' => 'registrations_reports', |
99 | 99 | ), |
100 | 100 | ), |
@@ -103,41 +103,41 @@ discard block |
||
103 | 103 | ), |
104 | 104 | 'event_registrations' => array( |
105 | 105 | 'nav' => array( |
106 | - 'label' => __( 'Event Check-In', 'event_espresso' ), |
|
106 | + 'label' => __('Event Check-In', 'event_espresso'), |
|
107 | 107 | 'order' => 10, |
108 | 108 | 'persistent' => true, |
109 | 109 | ), |
110 | 110 | 'help_tabs' => array( |
111 | 111 | 'registrations_event_checkin_help_tab' => array( |
112 | - 'title' => __( 'Registrations Event Check-In', 'event_espresso' ), |
|
112 | + 'title' => __('Registrations Event Check-In', 'event_espresso'), |
|
113 | 113 | 'filename' => 'registrations_event_checkin', |
114 | 114 | ), |
115 | 115 | 'registrations_event_checkin_table_column_headings_help_tab' => array( |
116 | - 'title' => __( 'Event Check-In Table Column Headings', 'event_espresso' ), |
|
116 | + 'title' => __('Event Check-In Table Column Headings', 'event_espresso'), |
|
117 | 117 | 'filename' => 'registrations_event_checkin_table_column_headings', |
118 | 118 | ), |
119 | 119 | 'registrations_event_checkin_filters_help_tab' => array( |
120 | - 'title' => __( 'Event Check-In Filters', 'event_espresso' ), |
|
120 | + 'title' => __('Event Check-In Filters', 'event_espresso'), |
|
121 | 121 | 'filename' => 'registrations_event_checkin_filters', |
122 | 122 | ), |
123 | 123 | 'registrations_event_checkin_views_help_tab' => array( |
124 | - 'title' => __( 'Event Check-In Views', 'event_espresso' ), |
|
124 | + 'title' => __('Event Check-In Views', 'event_espresso'), |
|
125 | 125 | 'filename' => 'registrations_event_checkin_views', |
126 | 126 | ), |
127 | 127 | 'registrations_event_checkin_other_help_tab' => array( |
128 | - 'title' => __( 'Event Check-In Other', 'event_espresso' ), |
|
128 | + 'title' => __('Event Check-In Other', 'event_espresso'), |
|
129 | 129 | 'filename' => 'registrations_event_checkin_other', |
130 | 130 | ), |
131 | 131 | ), |
132 | - 'help_tour' => array( 'Event_Checkin_Help_Tour' ), |
|
133 | - 'qtips' => array( 'Registration_List_Table_Tips' ), |
|
132 | + 'help_tour' => array('Event_Checkin_Help_Tour'), |
|
133 | + 'qtips' => array('Registration_List_Table_Tips'), |
|
134 | 134 | 'list_table' => 'EE_Event_Registrations_List_Table', |
135 | 135 | 'metaboxes' => array(), |
136 | 136 | 'require_nonce' => false, |
137 | 137 | ), |
138 | 138 | 'registration_checkins' => array( |
139 | 139 | 'nav' => array( |
140 | - 'label' => __( 'Check-In Records', 'event_espresso' ), |
|
140 | + 'label' => __('Check-In Records', 'event_espresso'), |
|
141 | 141 | 'order' => 15, |
142 | 142 | 'persistent' => false, |
143 | 143 | ), |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | 'require_nonce' => false, |
148 | 148 | ), |
149 | 149 | ); |
150 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
150 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
151 | 151 | $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table'; |
152 | 152 | $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table'; |
153 | 153 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | protected function _ajax_hooks() { |
158 | 158 | parent::_ajax_hooks(); |
159 | - add_action( 'wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content' ) ); |
|
159 | + add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content')); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -164,25 +164,25 @@ discard block |
||
164 | 164 | public function load_scripts_styles() { |
165 | 165 | parent::load_scripts_styles(); |
166 | 166 | //if newsletter message type is active then let's add filter and load js for it. |
167 | - if ( EEH_MSG_Template::is_mt_active( 'newsletter' ) ) { |
|
167 | + if (EEH_MSG_Template::is_mt_active('newsletter')) { |
|
168 | 168 | //enqueue newsletter js |
169 | 169 | wp_enqueue_script( |
170 | 170 | 'ee-newsletter-trigger', |
171 | - REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', |
|
172 | - array( 'ee-dialog' ), |
|
171 | + REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', |
|
172 | + array('ee-dialog'), |
|
173 | 173 | EVENT_ESPRESSO_VERSION, |
174 | 174 | true |
175 | 175 | ); |
176 | 176 | wp_enqueue_style( |
177 | 177 | 'ee-newsletter-trigger-css', |
178 | - REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', |
|
178 | + REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', |
|
179 | 179 | array(), |
180 | 180 | EVENT_ESPRESSO_VERSION |
181 | 181 | ); |
182 | 182 | //hook in buttons for newsletter message type trigger. |
183 | 183 | add_action( |
184 | 184 | 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', |
185 | - array( $this, 'add_newsletter_action_buttons' ), |
|
185 | + array($this, 'add_newsletter_action_buttons'), |
|
186 | 186 | 10 |
187 | 187 | ); |
188 | 188 | } |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | public function load_scripts_styles_reports() { |
194 | 194 | wp_register_script( |
195 | 195 | 'ee-reg-reports-js', |
196 | - REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js', |
|
197 | - array( 'google-charts' ), |
|
196 | + REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js', |
|
197 | + array('google-charts'), |
|
198 | 198 | EVENT_ESPRESSO_VERSION, |
199 | 199 | true |
200 | 200 | ); |
201 | - wp_enqueue_script( 'ee-reg-reports-js' ); |
|
201 | + wp_enqueue_script('ee-reg-reports-js'); |
|
202 | 202 | $this->_registration_reports_js_setup(); |
203 | 203 | } |
204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | protected function _add_screen_options_registration_checkins() { |
214 | 214 | $page_title = $this->_admin_page_title; |
215 | - $this->_admin_page_title = __( 'Check-In Records', 'event_espresso' ); |
|
215 | + $this->_admin_page_title = __('Check-In Records', 'event_espresso'); |
|
216 | 216 | $this->_per_page_screen_option(); |
217 | 217 | $this->_admin_page_title = $page_title; |
218 | 218 | } |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | $this->_views = array( |
224 | 224 | 'all' => array( |
225 | 225 | 'slug' => 'all', |
226 | - 'label' => __( 'All', 'event_espresso' ), |
|
226 | + 'label' => __('All', 'event_espresso'), |
|
227 | 227 | 'count' => 0, |
228 | - 'bulk_action' => ! isset( $this->_req_data['event_id'] ) |
|
228 | + 'bulk_action' => ! isset($this->_req_data['event_id']) |
|
229 | 229 | ? array() |
230 | 230 | : array( |
231 | - 'toggle_checkin_status' => __( 'Toggle Check-In', 'event_espresso' ), |
|
231 | + 'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'), |
|
232 | 232 | //'trash_registrations' => __('Trash Registrations', 'event_espresso') |
233 | 233 | ), |
234 | 234 | ), |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | $this->_views = array( |
242 | 242 | 'all' => array( |
243 | 243 | 'slug' => 'all', |
244 | - 'label' => __( 'All', 'event_espresso' ), |
|
244 | + 'label' => __('All', 'event_espresso'), |
|
245 | 245 | 'count' => 0, |
246 | - 'bulk_action' => array( 'delete_checkin_rows' => __( 'Delete Check-In Rows', 'event_espresso' ) ), |
|
246 | + 'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso')), |
|
247 | 247 | ), |
248 | 248 | ); |
249 | 249 | } |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function get_newsletter_form_content() { |
261 | 261 | //do a nonce check cause we're not coming in from an normal route here. |
262 | - $nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( |
|
262 | + $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field( |
|
263 | 263 | $this->_req_data['get_newsletter_form_content_nonce'] |
264 | 264 | ) : ''; |
265 | 265 | $nonce_ref = 'get_newsletter_form_content_nonce'; |
266 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
266 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
267 | 267 | //let's get the mtp for the incoming MTP_ ID |
268 | - if ( ! isset( $this->_req_data['GRP_ID'] ) ) { |
|
268 | + if ( ! isset($this->_req_data['GRP_ID'])) { |
|
269 | 269 | EE_Error::add_error( |
270 | 270 | __( |
271 | 271 | 'There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | $this->_template_args['error'] = true; |
280 | 280 | $this->_return_json(); |
281 | 281 | } |
282 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] ); |
|
283 | - if ( ! $MTPG instanceof EE_Message_Template_Group ) { |
|
282 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']); |
|
283 | + if ( ! $MTPG instanceof EE_Message_Template_Group) { |
|
284 | 284 | EE_Error::add_error( |
285 | 285 | sprintf( |
286 | 286 | __( |
@@ -301,27 +301,27 @@ discard block |
||
301 | 301 | $MTPs = $MTPs['attendee']; |
302 | 302 | $template_fields = array(); |
303 | 303 | /** @var EE_Message_Template $MTP */ |
304 | - foreach ( $MTPs as $MTP ) { |
|
305 | - $field = $MTP->get( 'MTP_template_field' ); |
|
306 | - if ( $field === 'content' ) { |
|
307 | - $content = $MTP->get( 'MTP_content' ); |
|
308 | - if ( ! empty( $content['newsletter_content'] ) ) { |
|
304 | + foreach ($MTPs as $MTP) { |
|
305 | + $field = $MTP->get('MTP_template_field'); |
|
306 | + if ($field === 'content') { |
|
307 | + $content = $MTP->get('MTP_content'); |
|
308 | + if ( ! empty($content['newsletter_content'])) { |
|
309 | 309 | $template_fields['newsletter_content'] = $content['newsletter_content']; |
310 | 310 | } |
311 | 311 | continue; |
312 | 312 | } |
313 | - $template_fields[ $MTP->get( 'MTP_template_field' ) ] = $MTP->get( 'MTP_content' ); |
|
313 | + $template_fields[$MTP->get('MTP_template_field')] = $MTP->get('MTP_content'); |
|
314 | 314 | } |
315 | 315 | $this->_template_args['success'] = true; |
316 | 316 | $this->_template_args['error'] = false; |
317 | 317 | $this->_template_args['data'] = array( |
318 | - 'batch_message_from' => isset( $template_fields['from'] ) |
|
318 | + 'batch_message_from' => isset($template_fields['from']) |
|
319 | 319 | ? $template_fields['from'] |
320 | 320 | : '', |
321 | - 'batch_message_subject' => isset( $template_fields['subject'] ) |
|
321 | + 'batch_message_subject' => isset($template_fields['subject']) |
|
322 | 322 | ? $template_fields['subject'] |
323 | 323 | : '', |
324 | - 'batch_message_content' => isset( $template_fields['newsletter_content'] ) |
|
324 | + 'batch_message_content' => isset($template_fields['newsletter_content']) |
|
325 | 325 | ? $template_fields['newsletter_content'] |
326 | 326 | : '', |
327 | 327 | ); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @param EE_Admin_List_Table $list_table |
338 | 338 | * @return void |
339 | 339 | */ |
340 | - public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) { |
|
340 | + public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) { |
|
341 | 341 | if ( ! EE_Registry::instance()->CAP->current_user_can( |
342 | 342 | 'ee_send_message', |
343 | 343 | 'espresso_registrations_newsletter_selected_send' |
@@ -350,20 +350,20 @@ discard block |
||
350 | 350 | 'event_registrations', |
351 | 351 | 'default', |
352 | 352 | ); |
353 | - if ( $this->_current_page === 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to ) ) { |
|
354 | - if ( ( $this->_req_action === 'event_registrations' && empty( $this->_req_data['event_id'] ) ) |
|
355 | - || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ) |
|
353 | + if ($this->_current_page === 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) { |
|
354 | + if (($this->_req_action === 'event_registrations' && empty($this->_req_data['event_id'])) |
|
355 | + || (isset($this->_req_data['status']) && $this->_req_data['status'] === 'trash') |
|
356 | 356 | ) { |
357 | 357 | echo ''; |
358 | 358 | } else { |
359 | 359 | $button_text = sprintf( |
360 | - __( 'Send Batch Message (%s selected)', 'event_espresso' ), |
|
360 | + __('Send Batch Message (%s selected)', 'event_espresso'), |
|
361 | 361 | '<span class="send-selected-newsletter-count">0</span>' |
362 | 362 | ); |
363 | 363 | echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' |
364 | 364 | . $button_text |
365 | 365 | . '</button>'; |
366 | - add_action( 'admin_footer', array( $this, 'newsletter_send_form_skeleton' ) ); |
|
366 | + add_action('admin_footer', array($this, 'newsletter_send_form_skeleton')); |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | } |
@@ -374,36 +374,36 @@ discard block |
||
374 | 374 | $list_table = $this->_list_table_object; |
375 | 375 | $codes = array(); |
376 | 376 | //need to templates for the newsletter message type for the template selector. |
377 | - $values[] = array( 'text' => __( 'Select Template to Use', 'event_espresso' ), 'id' => 0 ); |
|
377 | + $values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0); |
|
378 | 378 | $mtps = EEM_Message_Template_Group::instance()->get_all( |
379 | - array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) |
|
379 | + array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email')) |
|
380 | 380 | ); |
381 | - foreach ( $mtps as $mtp ) { |
|
381 | + foreach ($mtps as $mtp) { |
|
382 | 382 | $name = $mtp->name(); |
383 | 383 | $values[] = array( |
384 | - 'text' => empty( $name ) ? __( 'Global', 'event_espresso' ) : $name, |
|
384 | + 'text' => empty($name) ? __('Global', 'event_espresso') : $name, |
|
385 | 385 | 'id' => $mtp->ID(), |
386 | 386 | ); |
387 | 387 | } |
388 | 388 | //need to get a list of shortcodes that are available for the newsletter message type. |
389 | - $shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', false ); |
|
390 | - foreach ( $shortcodes as $field => $shortcode_array ) { |
|
391 | - $codes[ $field ] = implode( ', ', array_keys( $shortcode_array ) ); |
|
389 | + $shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', false); |
|
390 | + foreach ($shortcodes as $field => $shortcode_array) { |
|
391 | + $codes[$field] = implode(', ', array_keys($shortcode_array)); |
|
392 | 392 | } |
393 | 393 | $shortcodes = $codes; |
394 | - $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php'; |
|
394 | + $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php'; |
|
395 | 395 | $form_template_args = array( |
396 | - 'form_action' => admin_url( 'admin.php?page=espresso_registrations' ), |
|
396 | + 'form_action' => admin_url('admin.php?page=espresso_registrations'), |
|
397 | 397 | 'form_route' => 'newsletter_selected_send', |
398 | 398 | 'form_nonce_name' => 'newsletter_selected_send_nonce', |
399 | - 'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ), |
|
399 | + 'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'), |
|
400 | 400 | 'redirect_back_to' => $this->_req_action, |
401 | - 'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce' ), |
|
402 | - 'template_selector' => EEH_Form_Fields::select_input( 'newsletter_mtp_selected', $values ), |
|
401 | + 'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'), |
|
402 | + 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values), |
|
403 | 403 | 'shortcodes' => $shortcodes, |
404 | 404 | 'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration', |
405 | 405 | ); |
406 | - EEH_Template::display_template( $form_template, $form_template_args ); |
|
406 | + EEH_Template::display_template($form_template, $form_template_args); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | protected function _newsletter_selected_send() { |
419 | 419 | $success = true; |
420 | 420 | //first we need to make sure we have a GRP_ID so we know what template we're sending and updating! |
421 | - if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) { |
|
421 | + if (empty($this->_req_data['newsletter_mtp_selected'])) { |
|
422 | 422 | EE_Error::add_error( |
423 | 423 | __( |
424 | 424 | 'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | ); |
431 | 431 | $success = false; |
432 | 432 | } |
433 | - if ( $success ) { |
|
433 | + if ($success) { |
|
434 | 434 | //update Message template in case there are any changes |
435 | 435 | $Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID( |
436 | 436 | $this->_req_data['newsletter_mtp_selected'] |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group |
439 | 439 | ? $Message_Template_Group->context_templates() |
440 | 440 | : array(); |
441 | - if ( empty( $Message_Templates ) ) { |
|
441 | + if (empty($Message_Templates)) { |
|
442 | 442 | EE_Error::add_error( |
443 | 443 | __( |
444 | 444 | 'Unable to retrieve message template fields from the db. Messages not sent.', |
@@ -450,25 +450,25 @@ discard block |
||
450 | 450 | ); |
451 | 451 | } |
452 | 452 | //let's just update the specific fields |
453 | - foreach ( $Message_Templates['attendee'] as $Message_Template ) { |
|
454 | - if ( $Message_Template instanceof EE_Message_Template ) { |
|
455 | - $field = $Message_Template->get( 'MTP_template_field' ); |
|
456 | - $content = $Message_Template->get( 'MTP_content' ); |
|
453 | + foreach ($Message_Templates['attendee'] as $Message_Template) { |
|
454 | + if ($Message_Template instanceof EE_Message_Template) { |
|
455 | + $field = $Message_Template->get('MTP_template_field'); |
|
456 | + $content = $Message_Template->get('MTP_content'); |
|
457 | 457 | $new_content = $content; |
458 | - switch ( $field ) { |
|
458 | + switch ($field) { |
|
459 | 459 | case 'from' : |
460 | - $new_content = ! empty( $this->_req_data['batch_message']['from'] ) |
|
460 | + $new_content = ! empty($this->_req_data['batch_message']['from']) |
|
461 | 461 | ? $this->_req_data['batch_message']['from'] |
462 | 462 | : $content; |
463 | 463 | break; |
464 | 464 | case 'subject' : |
465 | - $new_content = ! empty( $this->_req_data['batch_message']['subject'] ) |
|
465 | + $new_content = ! empty($this->_req_data['batch_message']['subject']) |
|
466 | 466 | ? $this->_req_data['batch_message']['subject'] |
467 | 467 | : $content; |
468 | 468 | break; |
469 | 469 | case 'content' : |
470 | 470 | $new_content = $content; |
471 | - $new_content['newsletter_content'] = ! empty( $this->_req_data['batch_message']['content'] ) |
|
471 | + $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) |
|
472 | 472 | ? $this->_req_data['batch_message']['content'] |
473 | 473 | : $content['newsletter_content']; |
474 | 474 | break; |
@@ -476,32 +476,32 @@ discard block |
||
476 | 476 | continue; |
477 | 477 | break; |
478 | 478 | } |
479 | - $Message_Template->set( 'MTP_content', $new_content ); |
|
479 | + $Message_Template->set('MTP_content', $new_content); |
|
480 | 480 | $Message_Template->save(); |
481 | 481 | } |
482 | 482 | } |
483 | 483 | //great fields are updated! now let's make sure we just have contact objects (EE_Attendee). |
484 | - $id_type = ! empty( $this->_req_data['batch_message']['id_type'] ) |
|
484 | + $id_type = ! empty($this->_req_data['batch_message']['id_type']) |
|
485 | 485 | ? $this->_req_data['batch_message']['id_type'] |
486 | 486 | : 'registration'; |
487 | 487 | //id_type will affect how we assemble the ids. |
488 | - $ids = ! empty( $this->_req_data['batch_message']['ids'] ) |
|
489 | - ? json_decode( stripslashes( $this->_req_data['batch_message']['ids'] ) ) |
|
488 | + $ids = ! empty($this->_req_data['batch_message']['ids']) |
|
489 | + ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) |
|
490 | 490 | : array(); |
491 | 491 | $registrations_used_for_contact_data = array(); |
492 | 492 | //using switch because eventually we'll have other contexts that will be used for generating messages. |
493 | - switch ( $id_type ) { |
|
493 | + switch ($id_type) { |
|
494 | 494 | case 'registration' : |
495 | 495 | $registrations_used_for_contact_data = EEM_Registration::instance()->get_all( |
496 | 496 | array( |
497 | 497 | array( |
498 | - 'REG_ID' => array( 'IN', $ids ), |
|
498 | + 'REG_ID' => array('IN', $ids), |
|
499 | 499 | ), |
500 | 500 | ) |
501 | 501 | ); |
502 | 502 | break; |
503 | 503 | case 'contact' : |
504 | - $registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts( $ids ); |
|
504 | + $registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts($ids); |
|
505 | 505 | break; |
506 | 506 | } |
507 | 507 | do_action( |
@@ -512,8 +512,8 @@ discard block |
||
512 | 512 | //kept for backward compat, internally we no longer use this action. |
513 | 513 | //@deprecated 4.8.36.rc.002 |
514 | 514 | $contacts = $id_type === 'registration' |
515 | - ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) |
|
516 | - : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array( 'in', $ids ) ) ) ); |
|
515 | + ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) |
|
516 | + : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids)))); |
|
517 | 517 | do_action( |
518 | 518 | 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', |
519 | 519 | $contacts, |
@@ -521,11 +521,11 @@ discard block |
||
521 | 521 | ); |
522 | 522 | } |
523 | 523 | $query_args = array( |
524 | - 'action' => ! empty( $this->_req_data['redirect_back_to'] ) |
|
524 | + 'action' => ! empty($this->_req_data['redirect_back_to']) |
|
525 | 525 | ? $this->_req_data['redirect_back_to'] |
526 | 526 | : 'default', |
527 | 527 | ); |
528 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
528 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @return void |
549 | 549 | */ |
550 | 550 | protected function _registration_reports() { |
551 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
551 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
552 | 552 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
553 | 553 | $template_path, |
554 | 554 | $this->_reports_template_data, |
@@ -566,26 +566,26 @@ discard block |
||
566 | 566 | * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
567 | 567 | * @return string |
568 | 568 | */ |
569 | - private function _registrations_per_day_report( $period = '-1 month' ) { |
|
569 | + private function _registrations_per_day_report($period = '-1 month') { |
|
570 | 570 | $report_ID = 'reg-admin-registrations-per-day-report-dv'; |
571 | - $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report( $period ); |
|
571 | + $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period); |
|
572 | 572 | $results = (array) $results; |
573 | 573 | $regs = array(); |
574 | 574 | $subtitle = ''; |
575 | - if ( $results ) { |
|
575 | + if ($results) { |
|
576 | 576 | $column_titles = array(); |
577 | 577 | $tracker = 0; |
578 | - foreach ( $results as $result ) { |
|
578 | + foreach ($results as $result) { |
|
579 | 579 | $report_column_values = array(); |
580 | - foreach ( $result as $property_name => $property_value ) { |
|
580 | + foreach ($result as $property_name => $property_value) { |
|
581 | 581 | $property_value = $property_name === 'Registration_REG_date' ? $property_value |
582 | 582 | : (int) $property_value; |
583 | 583 | $report_column_values[] = $property_value; |
584 | - if ( $tracker === 0 ) { |
|
585 | - if ( $property_name === 'Registration_REG_date' ) { |
|
586 | - $column_titles[] = __( 'Date (only days with registrations are shown)', 'event_espresso' ); |
|
584 | + if ($tracker === 0) { |
|
585 | + if ($property_name === 'Registration_REG_date') { |
|
586 | + $column_titles[] = __('Date (only days with registrations are shown)', 'event_espresso'); |
|
587 | 587 | } else { |
588 | - $column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' ); |
|
588 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
589 | 589 | } |
590 | 590 | } |
591 | 591 | } |
@@ -593,34 +593,34 @@ discard block |
||
593 | 593 | $regs[] = $report_column_values; |
594 | 594 | } |
595 | 595 | //make sure the column_titles is pushed to the beginning of the array |
596 | - array_unshift( $regs, $column_titles ); |
|
596 | + array_unshift($regs, $column_titles); |
|
597 | 597 | //setup the date range. |
598 | - $DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() ); |
|
599 | - $beginning_date = new DateTime( "now " . $period, $DateTimeZone ); |
|
600 | - $ending_date = new DateTime( "now", $DateTimeZone ); |
|
598 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
599 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
600 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
601 | 601 | $subtitle = sprintf( |
602 | - _x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ), |
|
603 | - $beginning_date->format( 'Y-m-d' ), |
|
604 | - $ending_date->format( 'Y-m-d' ) |
|
602 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'), |
|
603 | + $beginning_date->format('Y-m-d'), |
|
604 | + $ending_date->format('Y-m-d') |
|
605 | 605 | ); |
606 | 606 | } |
607 | - $report_title = __( 'Total Registrations per Day', 'event_espresso' ); |
|
607 | + $report_title = __('Total Registrations per Day', 'event_espresso'); |
|
608 | 608 | $report_params = array( |
609 | 609 | 'title' => $report_title, |
610 | 610 | 'subtitle' => $subtitle, |
611 | 611 | 'id' => $report_ID, |
612 | 612 | 'regs' => $regs, |
613 | - 'noResults' => empty( $regs ), |
|
613 | + 'noResults' => empty($regs), |
|
614 | 614 | 'noRegsMsg' => sprintf( |
615 | 615 | __( |
616 | 616 | '%sThere are currently no registration records in the last month for this report.%s', |
617 | 617 | 'event_espresso' |
618 | 618 | ), |
619 | - '<h2>' . $report_title . '</h2><p>', |
|
619 | + '<h2>'.$report_title.'</h2><p>', |
|
620 | 620 | '</p>' |
621 | 621 | ), |
622 | 622 | ); |
623 | - wp_localize_script( 'ee-reg-reports-js', 'regPerDay', $report_params ); |
|
623 | + wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params); |
|
624 | 624 | return $report_ID; |
625 | 625 | } |
626 | 626 | |
@@ -632,29 +632,29 @@ discard block |
||
632 | 632 | * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated. |
633 | 633 | * @return string |
634 | 634 | */ |
635 | - private function _registrations_per_event_report( $period = '-1 month' ) { |
|
635 | + private function _registrations_per_event_report($period = '-1 month') { |
|
636 | 636 | $report_ID = 'reg-admin-registrations-per-event-report-dv'; |
637 | - $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report( $period ); |
|
637 | + $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period); |
|
638 | 638 | $results = (array) $results; |
639 | 639 | $regs = array(); |
640 | 640 | $subtitle = ''; |
641 | - if ( $results ) { |
|
641 | + if ($results) { |
|
642 | 642 | $column_titles = array(); |
643 | 643 | $tracker = 0; |
644 | - foreach ( $results as $result ) { |
|
644 | + foreach ($results as $result) { |
|
645 | 645 | $report_column_values = array(); |
646 | - foreach ( $result as $property_name => $property_value ) { |
|
646 | + foreach ($result as $property_name => $property_value) { |
|
647 | 647 | $property_value = $property_name === 'Registration_Event' ? wp_trim_words( |
648 | 648 | $property_value, |
649 | 649 | 4, |
650 | 650 | '...' |
651 | 651 | ) : (int) $property_value; |
652 | 652 | $report_column_values[] = $property_value; |
653 | - if ( $tracker === 0 ) { |
|
654 | - if ( $property_name === 'Registration_Event' ) { |
|
655 | - $column_titles[] = __( 'Event', 'event_espresso' ); |
|
653 | + if ($tracker === 0) { |
|
654 | + if ($property_name === 'Registration_Event') { |
|
655 | + $column_titles[] = __('Event', 'event_espresso'); |
|
656 | 656 | } else { |
657 | - $column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' ); |
|
657 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
658 | 658 | } |
659 | 659 | } |
660 | 660 | } |
@@ -662,34 +662,34 @@ discard block |
||
662 | 662 | $regs[] = $report_column_values; |
663 | 663 | } |
664 | 664 | //make sure the column_titles is pushed to the beginning of the array |
665 | - array_unshift( $regs, $column_titles ); |
|
665 | + array_unshift($regs, $column_titles); |
|
666 | 666 | //setup the date range. |
667 | - $DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() ); |
|
668 | - $beginning_date = new DateTime( "now " . $period, $DateTimeZone ); |
|
669 | - $ending_date = new DateTime( "now", $DateTimeZone ); |
|
667 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
668 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
669 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
670 | 670 | $subtitle = sprintf( |
671 | - _x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ), |
|
672 | - $beginning_date->format( 'Y-m-d' ), |
|
673 | - $ending_date->format( 'Y-m-d' ) |
|
671 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'), |
|
672 | + $beginning_date->format('Y-m-d'), |
|
673 | + $ending_date->format('Y-m-d') |
|
674 | 674 | ); |
675 | 675 | } |
676 | - $report_title = __( 'Total Registrations per Event', 'event_espresso' ); |
|
676 | + $report_title = __('Total Registrations per Event', 'event_espresso'); |
|
677 | 677 | $report_params = array( |
678 | 678 | 'title' => $report_title, |
679 | 679 | 'subtitle' => $subtitle, |
680 | 680 | 'id' => $report_ID, |
681 | 681 | 'regs' => $regs, |
682 | - 'noResults' => empty( $regs ), |
|
682 | + 'noResults' => empty($regs), |
|
683 | 683 | 'noRegsMsg' => sprintf( |
684 | 684 | __( |
685 | 685 | '%sThere are currently no registration records in the last month for this report.%s', |
686 | 686 | 'event_espresso' |
687 | 687 | ), |
688 | - '<h2>' . $report_title . '</h2><p>', |
|
688 | + '<h2>'.$report_title.'</h2><p>', |
|
689 | 689 | '</p>' |
690 | 690 | ), |
691 | 691 | ); |
692 | - wp_localize_script( 'ee-reg-reports-js', 'regPerEvent', $report_params ); |
|
692 | + wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params); |
|
693 | 693 | return $report_ID; |
694 | 694 | } |
695 | 695 | |
@@ -703,63 +703,63 @@ discard block |
||
703 | 703 | * @throws \EE_Error |
704 | 704 | */ |
705 | 705 | protected function _registration_checkin_list_table() { |
706 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
707 | - $reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null; |
|
706 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
707 | + $reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null; |
|
708 | 708 | /** @var EE_Registration $reg */ |
709 | - $reg = EEM_Registration::instance()->get_one_by_ID( $reg_id ); |
|
709 | + $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
|
710 | 710 | $this->_admin_page_title .= $this->get_action_link_or_button( |
711 | 711 | 'new_registration', |
712 | 712 | 'add-registrant', |
713 | - array( 'event_id' => $reg->event_ID() ), |
|
713 | + array('event_id' => $reg->event_ID()), |
|
714 | 714 | 'add-new-h2' |
715 | 715 | ); |
716 | 716 | $legend_items = array( |
717 | 717 | 'checkin' => array( |
718 | 718 | 'class' => 'ee-icon ee-icon-check-in', |
719 | - 'desc' => __( 'This indicates the attendee has been checked in', 'event_espresso' ), |
|
719 | + 'desc' => __('This indicates the attendee has been checked in', 'event_espresso'), |
|
720 | 720 | ), |
721 | 721 | 'checkout' => array( |
722 | 722 | 'class' => 'ee-icon ee-icon-check-out', |
723 | - 'desc' => __( 'This indicates the attendee has been checked out', 'event_espresso' ), |
|
723 | + 'desc' => __('This indicates the attendee has been checked out', 'event_espresso'), |
|
724 | 724 | ), |
725 | 725 | ); |
726 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
727 | - $dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : null; |
|
728 | - $go_back_url = ! empty( $reg_id ) ? EE_Admin_Page::add_query_args_and_nonce( |
|
726 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
727 | + $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null; |
|
728 | + $go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce( |
|
729 | 729 | array( |
730 | 730 | 'action' => 'event_registrations', |
731 | - 'event_id' => EEM_Registration::instance()->get_one_by_ID( $reg_id )->get_first_related( 'Event' )->ID( |
|
731 | + 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID( |
|
732 | 732 | ), |
733 | 733 | 'DTT_ID' => $dtt_id, |
734 | 734 | ), |
735 | 735 | $this->_admin_base_url |
736 | 736 | ) : ''; |
737 | - $this->_template_args['before_list_table'] = ! empty( $reg_id ) && ! empty( $dtt_id ) |
|
738 | - ? '<h2>' . sprintf( |
|
739 | - __( "%s's check in records for %s at the event, %s", 'event_espresso' ), |
|
737 | + $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) |
|
738 | + ? '<h2>'.sprintf( |
|
739 | + __("%s's check in records for %s at the event, %s", 'event_espresso'), |
|
740 | 740 | '<span id="checkin-attendee-name">' |
741 | 741 | . EEM_Registration::instance() |
742 | - ->get_one_by_ID( $reg_id ) |
|
743 | - ->get_first_related( 'Attendee' ) |
|
744 | - ->full_name() . '</span>', |
|
745 | - '<span id="checkin-dtt"><a href="' . $go_back_url . '">' |
|
742 | + ->get_one_by_ID($reg_id) |
|
743 | + ->get_first_related('Attendee') |
|
744 | + ->full_name().'</span>', |
|
745 | + '<span id="checkin-dtt"><a href="'.$go_back_url.'">' |
|
746 | 746 | . EEM_Datetime::instance() |
747 | - ->get_one_by_ID( $dtt_id ) |
|
748 | - ->start_date_and_time() . ' - ' |
|
747 | + ->get_one_by_ID($dtt_id) |
|
748 | + ->start_date_and_time().' - ' |
|
749 | 749 | . EEM_Datetime::instance() |
750 | - ->get_one_by_ID( $dtt_id ) |
|
751 | - ->end_date_and_time() . '</a></span>', |
|
750 | + ->get_one_by_ID($dtt_id) |
|
751 | + ->end_date_and_time().'</a></span>', |
|
752 | 752 | '<span id="checkin-event-name">' |
753 | 753 | . EEM_Datetime::instance() |
754 | - ->get_one_by_ID( $dtt_id ) |
|
755 | - ->get_first_related( 'Event' ) |
|
756 | - ->get( 'EVT_name' ) . '</span>' |
|
757 | - ) . '</h2>' |
|
754 | + ->get_one_by_ID($dtt_id) |
|
755 | + ->get_first_related('Event') |
|
756 | + ->get('EVT_name').'</span>' |
|
757 | + ).'</h2>' |
|
758 | 758 | : ''; |
759 | - $this->_template_args['list_table_hidden_fields'] = ! empty( $reg_id ) |
|
760 | - ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : ''; |
|
761 | - $this->_template_args['list_table_hidden_fields'] .= ! empty( $dtt_id ) |
|
762 | - ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : ''; |
|
759 | + $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) |
|
760 | + ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : ''; |
|
761 | + $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) |
|
762 | + ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : ''; |
|
763 | 763 | $this->display_admin_list_table_page_with_no_sidebar(); |
764 | 764 | } |
765 | 765 | |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | */ |
773 | 773 | public function toggle_checkin_status() { |
774 | 774 | //first make sure we have the necessary data |
775 | - if ( ! isset( $this->_req_data['_regid'] ) ) { |
|
775 | + if ( ! isset($this->_req_data['_regid'])) { |
|
776 | 776 | EE_Error::add_error( |
777 | 777 | __( |
778 | 778 | 'There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', |
@@ -787,10 +787,10 @@ discard block |
||
787 | 787 | $this->_return_json(); |
788 | 788 | }; |
789 | 789 | //do a nonce check cause we're not coming in from an normal route here. |
790 | - $nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) |
|
790 | + $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) |
|
791 | 791 | : ''; |
792 | 792 | $nonce_ref = 'checkin_nonce'; |
793 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
793 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
794 | 794 | //beautiful! Made it this far so let's get the status. |
795 | 795 | $new_status = $this->_toggle_checkin_status(); |
796 | 796 | //setup new class to return via ajax |
@@ -812,34 +812,34 @@ discard block |
||
812 | 812 | //first let's get the query args out of the way for the redirect |
813 | 813 | $query_args = array( |
814 | 814 | 'action' => 'event_registrations', |
815 | - 'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, |
|
816 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : null, |
|
815 | + 'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
816 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null, |
|
817 | 817 | ); |
818 | 818 | $new_status = false; |
819 | 819 | // bulk action check in toggle |
820 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
820 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
821 | 821 | // cycle thru checkboxes |
822 | - while ( list( $REG_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
823 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : null; |
|
824 | - $new_status = $this->_toggle_checkin( $REG_ID, $DTT_ID ); |
|
822 | + while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) { |
|
823 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null; |
|
824 | + $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID); |
|
825 | 825 | } |
826 | - } elseif ( isset( $this->_req_data['_regid'] ) ) { |
|
826 | + } elseif (isset($this->_req_data['_regid'])) { |
|
827 | 827 | //coming from ajax request |
828 | - $DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : null; |
|
828 | + $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : null; |
|
829 | 829 | $query_args['DTT_ID'] = $DTT_ID; |
830 | - $new_status = $this->_toggle_checkin( $this->_req_data['_regid'], $DTT_ID ); |
|
830 | + $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID); |
|
831 | 831 | } else { |
832 | 832 | EE_Error::add_error( |
833 | - __( 'Missing some required data to toggle the Check-in', 'event_espresso' ), |
|
833 | + __('Missing some required data to toggle the Check-in', 'event_espresso'), |
|
834 | 834 | __FILE__, |
835 | 835 | __FUNCTION__, |
836 | 836 | __LINE__ |
837 | 837 | ); |
838 | 838 | } |
839 | - if ( defined( 'DOING_AJAX' ) ) { |
|
839 | + if (defined('DOING_AJAX')) { |
|
840 | 840 | return $new_status; |
841 | 841 | } |
842 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
842 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | |
@@ -854,14 +854,14 @@ discard block |
||
854 | 854 | * @return int The new status toggled to. |
855 | 855 | * @throws \EE_Error |
856 | 856 | */ |
857 | - private function _toggle_checkin( $REG_ID, $DTT_ID ) { |
|
857 | + private function _toggle_checkin($REG_ID, $DTT_ID) { |
|
858 | 858 | /** @var EE_Registration $REG */ |
859 | - $REG = EEM_Registration::instance()->get_one_by_ID( $REG_ID ); |
|
860 | - $new_status = $REG->toggle_checkin_status( $DTT_ID ); |
|
861 | - if ( $new_status !== false ) { |
|
862 | - EE_Error::add_success( $REG->get_checkin_msg( $DTT_ID ) ); |
|
859 | + $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID); |
|
860 | + $new_status = $REG->toggle_checkin_status($DTT_ID); |
|
861 | + if ($new_status !== false) { |
|
862 | + EE_Error::add_success($REG->get_checkin_msg($DTT_ID)); |
|
863 | 863 | } else { |
864 | - EE_Error::add_error( $REG->get_checkin_msg( $DTT_ID, true ), __FILE__, __FUNCTION__, __LINE__ ); |
|
864 | + EE_Error::add_error($REG->get_checkin_msg($DTT_ID, true), __FILE__, __FUNCTION__, __LINE__); |
|
865 | 865 | $new_status = false; |
866 | 866 | } |
867 | 867 | return $new_status; |
@@ -879,13 +879,13 @@ discard block |
||
879 | 879 | protected function _delete_checkin_rows() { |
880 | 880 | $query_args = array( |
881 | 881 | 'action' => 'registration_checkins', |
882 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
883 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0, |
|
882 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
883 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0, |
|
884 | 884 | ); |
885 | 885 | $errors = 0; |
886 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
887 | - while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
888 | - if ( ! EEM_Checkin::instance()->delete_by_ID( $CHK_ID ) ) { |
|
886 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
887 | + while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) { |
|
888 | + if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { |
|
889 | 889 | $errors++; |
890 | 890 | } |
891 | 891 | } |
@@ -899,19 +899,19 @@ discard block |
||
899 | 899 | __FUNCTION__, |
900 | 900 | __LINE__ |
901 | 901 | ); |
902 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
902 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
903 | 903 | } |
904 | - if ( $errors > 0 ) { |
|
904 | + if ($errors > 0) { |
|
905 | 905 | EE_Error::add_error( |
906 | - sprintf( __( 'There were %d records that did not delete successfully', 'event_espresso' ), $errors ), |
|
906 | + sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), |
|
907 | 907 | __FILE__, |
908 | 908 | __FUNCTION__, |
909 | 909 | __LINE__ |
910 | 910 | ); |
911 | 911 | } else { |
912 | - EE_Error::add_success( __( 'Records were successfully deleted', 'event_espresso' ) ); |
|
912 | + EE_Error::add_success(__('Records were successfully deleted', 'event_espresso')); |
|
913 | 913 | } |
914 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
914 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | |
@@ -925,19 +925,19 @@ discard block |
||
925 | 925 | protected function _delete_checkin_row() { |
926 | 926 | $query_args = array( |
927 | 927 | 'action' => 'registration_checkins', |
928 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
929 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0, |
|
928 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
929 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0, |
|
930 | 930 | ); |
931 | - if ( ! empty( $this->_req_data['CHK_ID'] ) ) { |
|
932 | - if ( ! EEM_Checkin::instance()->delete_by_ID( $this->_req_data['CHK_ID'] ) ) { |
|
931 | + if ( ! empty($this->_req_data['CHK_ID'])) { |
|
932 | + if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { |
|
933 | 933 | EE_Error::add_error( |
934 | - __( 'Something went wrong and this check-in record was not deleted', 'event_espresso' ), |
|
934 | + __('Something went wrong and this check-in record was not deleted', 'event_espresso'), |
|
935 | 935 | __FILE__, |
936 | 936 | __FUNCTION__, |
937 | 937 | __LINE__ |
938 | 938 | ); |
939 | 939 | } else { |
940 | - EE_Error::add_success( __( 'Check-In record successfully deleted', 'event_espresso' ) ); |
|
940 | + EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso')); |
|
941 | 941 | } |
942 | 942 | } else { |
943 | 943 | EE_Error::add_error( |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | __LINE__ |
951 | 951 | ); |
952 | 952 | } |
953 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
953 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
954 | 954 | } |
955 | 955 | |
956 | 956 | |
@@ -963,12 +963,12 @@ discard block |
||
963 | 963 | * @throws \EE_Error |
964 | 964 | */ |
965 | 965 | protected function _event_registrations_list_table() { |
966 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
967 | - $this->_admin_page_title .= isset( $this->_req_data['event_id'] ) |
|
966 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
967 | + $this->_admin_page_title .= isset($this->_req_data['event_id']) |
|
968 | 968 | ? $this->get_action_link_or_button( |
969 | 969 | 'new_registration', |
970 | 970 | 'add-registrant', |
971 | - array( 'event_id' => $this->_req_data['event_id'] ), |
|
971 | + array('event_id' => $this->_req_data['event_id']), |
|
972 | 972 | 'add-new-h2', |
973 | 973 | '', |
974 | 974 | false |
@@ -977,83 +977,83 @@ discard block |
||
977 | 977 | $legend_items = array( |
978 | 978 | 'star-icon' => array( |
979 | 979 | 'class' => 'dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8', |
980 | - 'desc' => __( 'This Registrant is the Primary Registrant', 'event_espresso' ), |
|
980 | + 'desc' => __('This Registrant is the Primary Registrant', 'event_espresso'), |
|
981 | 981 | ), |
982 | 982 | 'checkin' => array( |
983 | 983 | 'class' => 'ee-icon ee-icon-check-in', |
984 | - 'desc' => __( 'This Registrant has been Checked In', 'event_espresso' ), |
|
984 | + 'desc' => __('This Registrant has been Checked In', 'event_espresso'), |
|
985 | 985 | ), |
986 | 986 | 'checkout' => array( |
987 | 987 | 'class' => 'ee-icon ee-icon-check-out', |
988 | - 'desc' => __( 'This Registrant has been Checked Out', 'event_espresso' ), |
|
988 | + 'desc' => __('This Registrant has been Checked Out', 'event_espresso'), |
|
989 | 989 | ), |
990 | 990 | 'nocheckinrecord' => array( |
991 | 991 | 'class' => 'dashicons dashicons-no', |
992 | - 'desc' => __( 'No Check-in Record has been Created for this Registrant', 'event_espresso' ), |
|
992 | + 'desc' => __('No Check-in Record has been Created for this Registrant', 'event_espresso'), |
|
993 | 993 | ), |
994 | 994 | 'view_details' => array( |
995 | 995 | 'class' => 'dashicons dashicons-search', |
996 | - 'desc' => __( 'View All Check-in Records for this Registrant', 'event_espresso' ), |
|
996 | + 'desc' => __('View All Check-in Records for this Registrant', 'event_espresso'), |
|
997 | 997 | ), |
998 | 998 | 'approved_status' => array( |
999 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
1000 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ), |
|
999 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
1000 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'), |
|
1001 | 1001 | ), |
1002 | 1002 | 'cancelled_status' => array( |
1003 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
1004 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ), |
|
1003 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
1004 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'), |
|
1005 | 1005 | ), |
1006 | 1006 | 'declined_status' => array( |
1007 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
1008 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ), |
|
1007 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
1008 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'), |
|
1009 | 1009 | ), |
1010 | 1010 | 'not_approved' => array( |
1011 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
1012 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ), |
|
1011 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
1012 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'), |
|
1013 | 1013 | ), |
1014 | 1014 | 'pending_status' => array( |
1015 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
1016 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ), |
|
1015 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
1016 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'), |
|
1017 | 1017 | ), |
1018 | 1018 | 'wait_list' => array( |
1019 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list, |
|
1020 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' ), |
|
1019 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list, |
|
1020 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'), |
|
1021 | 1021 | ), |
1022 | 1022 | ); |
1023 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
1024 | - $event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null; |
|
1025 | - $this->_template_args['before_list_table'] = ! empty( $event_id ) |
|
1026 | - ? '<h2>' . sprintf( |
|
1027 | - __( 'Viewing Registrations for Event: %s', 'event_espresso' ), |
|
1028 | - EEM_Event::instance()->get_one_by_ID( $event_id )->get( 'EVT_name' ) |
|
1029 | - ) . '</h2>' |
|
1023 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
1024 | + $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
1025 | + $this->_template_args['before_list_table'] = ! empty($event_id) |
|
1026 | + ? '<h2>'.sprintf( |
|
1027 | + __('Viewing Registrations for Event: %s', 'event_espresso'), |
|
1028 | + EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') |
|
1029 | + ).'</h2>' |
|
1030 | 1030 | : ''; |
1031 | 1031 | //need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on the event. |
1032 | 1032 | /** @var EE_Event $event */ |
1033 | - $event = EEM_Event::instance()->get_one_by_ID( $event_id ); |
|
1034 | - $DTT_ID = ! empty( $this->_req_data['DTT_ID'] ) ? absint( $this->_req_data['DTT_ID'] ) : 0; |
|
1033 | + $event = EEM_Event::instance()->get_one_by_ID($event_id); |
|
1034 | + $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? absint($this->_req_data['DTT_ID']) : 0; |
|
1035 | 1035 | $datetime = null; |
1036 | - if ( $event instanceof EE_Event ) { |
|
1036 | + if ($event instanceof EE_Event) { |
|
1037 | 1037 | $datetimes_on_event = $event->datetimes(); |
1038 | - if ( count( $datetimes_on_event ) === 1 ) { |
|
1039 | - $datetime = reset( $datetimes_on_event ); |
|
1038 | + if (count($datetimes_on_event) === 1) { |
|
1039 | + $datetime = reset($datetimes_on_event); |
|
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | |
1043 | - $datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID( $DTT_ID ); |
|
1044 | - if ( $datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '' ) { |
|
1045 | - $this->_template_args['before_list_table'] = substr( $this->_template_args['before_list_table'], 0, -5 ); |
|
1043 | + $datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID($DTT_ID); |
|
1044 | + if ($datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '') { |
|
1045 | + $this->_template_args['before_list_table'] = substr($this->_template_args['before_list_table'], 0, -5); |
|
1046 | 1046 | $this->_template_args['before_list_table'] .= ' <span class="drk-grey-text">'; |
1047 | 1047 | $this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>'; |
1048 | 1048 | $this->_template_args['before_list_table'] .= $datetime->name(); |
1049 | - $this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )'; |
|
1049 | + $this->_template_args['before_list_table'] .= ' ( '.$datetime->date_and_time_range().' )'; |
|
1050 | 1050 | $this->_template_args['before_list_table'] .= '</span></h2>'; |
1051 | 1051 | } |
1052 | 1052 | |
1053 | 1053 | //if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status column |
1054 | 1054 | //represents |
1055 | - if ( ! $datetime instanceof EE_Datetime ) { |
|
1056 | - $this->_template_args['before_list_table'] .= '<br><p class="description">' . __( 'In this view, the check-in status represents the latest check-in record for the registration in that row.', 'event_espresso' ) . '</p>'; |
|
1055 | + if ( ! $datetime instanceof EE_Datetime) { |
|
1056 | + $this->_template_args['before_list_table'] .= '<br><p class="description">'.__('In this view, the check-in status represents the latest check-in record for the registration in that row.', 'event_espresso').'</p>'; |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -1072,15 +1072,15 @@ discard block |
||
1072 | 1072 | * @throws \EE_Error |
1073 | 1073 | * @access public |
1074 | 1074 | */ |
1075 | - public function get_event_attendees( $per_page = 10, $count = false, $trash = false, $orderby = '' ) { |
|
1076 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1077 | - require_once( EE_MODELS . 'EEM_Attendee.model.php' ); |
|
1075 | + public function get_event_attendees($per_page = 10, $count = false, $trash = false, $orderby = '') { |
|
1076 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1077 | + require_once(EE_MODELS.'EEM_Attendee.model.php'); |
|
1078 | 1078 | //$ATT_MDL = EEM_Attendee::instance(); |
1079 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : false; |
|
1080 | - $CAT_ID = isset( $this->_req_data['category_id'] ) ? absint( $this->_req_data['category_id'] ) : false; |
|
1081 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : null; |
|
1082 | - $this->_req_data['orderby'] = ! empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : $orderby; |
|
1083 | - switch ( $this->_req_data['orderby'] ) { |
|
1079 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
1080 | + $CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : false; |
|
1081 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null; |
|
1082 | + $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby; |
|
1083 | + switch ($this->_req_data['orderby']) { |
|
1084 | 1084 | case '_REG_date': |
1085 | 1085 | $orderby = 'REG_date'; |
1086 | 1086 | break; |
@@ -1088,109 +1088,109 @@ discard block |
||
1088 | 1088 | $orderby = 'Attendee.ATT_lname'; |
1089 | 1089 | // $orderby = 'reg.REG_final_price'; |
1090 | 1090 | } |
1091 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) |
|
1091 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) |
|
1092 | 1092 | ? $this->_req_data['order'] : 'ASC'; |
1093 | - $current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] ) |
|
1093 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1094 | 1094 | ? $this->_req_data['paged'] : 1; |
1095 | - $per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] ) |
|
1095 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1096 | 1096 | ? $this->_req_data['perpage'] : $per_page; |
1097 | - $offset = ( $current_page - 1 ) * $per_page; |
|
1098 | - $limit = $count ? null : array( $offset, $per_page ); |
|
1097 | + $offset = ($current_page - 1) * $per_page; |
|
1098 | + $limit = $count ? null : array($offset, $per_page); |
|
1099 | 1099 | $query_params = array( |
1100 | 1100 | array( |
1101 | 1101 | 'Event.status' => array( |
1102 | 1102 | 'IN', |
1103 | - array_keys( EEM_Event::instance()->get_status_array() ), |
|
1103 | + array_keys(EEM_Event::instance()->get_status_array()), |
|
1104 | 1104 | ), |
1105 | 1105 | ), |
1106 | 1106 | ); |
1107 | - if ( $EVT_ID ) { |
|
1107 | + if ($EVT_ID) { |
|
1108 | 1108 | $query_params[0]['EVT_ID'] = $EVT_ID; |
1109 | 1109 | } |
1110 | - if ( $CAT_ID ) { |
|
1110 | + if ($CAT_ID) { |
|
1111 | 1111 | throw new EE_Error( |
1112 | 1112 | "You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?" |
1113 | 1113 | ); |
1114 | 1114 | } |
1115 | 1115 | //if DTT is included we do multiple datetimes. |
1116 | - if ( $DTT_ID ) { |
|
1116 | + if ($DTT_ID) { |
|
1117 | 1117 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
1118 | 1118 | } |
1119 | 1119 | //make sure we only have default where on the current regs |
1120 | 1120 | $query_params['default_where_conditions'] = 'this_model_only'; |
1121 | 1121 | $status_ids_array = apply_filters( |
1122 | 1122 | 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', |
1123 | - array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) |
|
1123 | + array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved) |
|
1124 | 1124 | ); |
1125 | - $query_params[0]['STS_ID'] = array( 'IN', $status_ids_array ); |
|
1126 | - if ( $trash ) { |
|
1125 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
1126 | + if ($trash) { |
|
1127 | 1127 | $query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed; |
1128 | 1128 | } |
1129 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1130 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1129 | + if (isset($this->_req_data['s'])) { |
|
1130 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1131 | 1131 | $query_params[0]['OR'] = array( |
1132 | - 'Event.EVT_name' => array( 'LIKE', $sstr ), |
|
1133 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1134 | - 'Event.EVT_short_desc' => array( 'LIKE', $sstr ), |
|
1135 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1136 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1137 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1138 | - 'Attendee.ATT_email' => array( 'LIKE', $sstr ), |
|
1139 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1140 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1141 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1142 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1143 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1144 | - 'REG_count' => array( 'LIKE', $sstr ), |
|
1145 | - 'REG_group_size' => array( 'LIKE', $sstr ), |
|
1146 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1147 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
1132 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1133 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1134 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1135 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1136 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1137 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1138 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1139 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1140 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1141 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1142 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1143 | + 'REG_code' => array('LIKE', $sstr), |
|
1144 | + 'REG_count' => array('LIKE', $sstr), |
|
1145 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1146 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1147 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
1148 | 1148 | ); |
1149 | 1149 | } |
1150 | - $query_params['order_by'][ $orderby ] = $sort; |
|
1150 | + $query_params['order_by'][$orderby] = $sort; |
|
1151 | 1151 | $query_params['limit'] = $limit; |
1152 | - $query_params['force_join'] = array( 'Attendee' );//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
1153 | - if ( $count ) { |
|
1152 | + $query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
1153 | + if ($count) { |
|
1154 | 1154 | $registrations = EEM_Registration::instance()->count( |
1155 | - array( $query_params[0], 'default_where_conditions' => 'this_model_only' ) |
|
1155 | + array($query_params[0], 'default_where_conditions' => 'this_model_only') |
|
1156 | 1156 | ); |
1157 | 1157 | } else { |
1158 | - $registrations = EEM_Registration::instance()->get_all( $query_params ); |
|
1158 | + $registrations = EEM_Registration::instance()->get_all($query_params); |
|
1159 | 1159 | // $registrations = EEM_Registration::instance(); |
1160 | 1160 | // $all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output ); |
1161 | - if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) { |
|
1161 | + if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) { |
|
1162 | 1162 | //EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0] <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1163 | 1163 | // name |
1164 | 1164 | /** @var EE_Registration $first_registration */ |
1165 | 1165 | $first_registration = $registrations[0]; |
1166 | 1166 | $event_obj = $first_registration->event_obj(); |
1167 | - if ( $event_obj ) { |
|
1167 | + if ($event_obj) { |
|
1168 | 1168 | $event_name = $first_registration->event_obj()->name(); |
1169 | - $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1169 | + $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1170 | 1170 | // edit event link |
1171 | - if ( $event_name !== '' ) { |
|
1171 | + if ($event_name !== '') { |
|
1172 | 1172 | $edit_event_url = self::add_query_args_and_nonce( |
1173 | - array( 'action' => 'edit_event', 'EVT_ID' => $EVT_ID ), |
|
1173 | + array('action' => 'edit_event', 'EVT_ID' => $EVT_ID), |
|
1174 | 1174 | EVENTS_ADMIN_URL |
1175 | 1175 | ); |
1176 | - $edit_event_lnk = '<a href="' . $edit_event_url . '" title="' . esc_attr__( |
|
1176 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__( |
|
1177 | 1177 | 'Edit ', |
1178 | 1178 | 'event_espresso' |
1179 | - ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1179 | + ).$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1180 | 1180 | $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' |
1181 | 1181 | . $edit_event_lnk |
1182 | 1182 | . '</span>'; |
1183 | 1183 | } |
1184 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action' => 'default' ), REG_ADMIN_URL ); |
|
1185 | - $back_2_reg_lnk = '<a href="' . $back_2_reg_url . '" title="' . esc_attr__( |
|
1184 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action' => 'default'), REG_ADMIN_URL); |
|
1185 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__( |
|
1186 | 1186 | 'click to return to viewing all registrations ', |
1187 | 1187 | 'event_espresso' |
1188 | - ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1188 | + ).'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1189 | 1189 | $this->_template_args['before_admin_page_content'] = ' |
1190 | 1190 | <div id="admin-page-header"> |
1191 | - <h1><span class="small-text not-bold">' . __( 'Event: ', 'event_espresso' ) . '</span>' . $event_name . '</h1> |
|
1192 | - <h3><span class="small-text not-bold">' . __( 'Date: ', 'event_espresso' ) . '</span>' . $event_date . '</h3> |
|
1193 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1191 | + <h1><span class="small-text not-bold">' . __('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1192 | + <h3><span class="small-text not-bold">' . __('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1193 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1194 | 1194 | </div> |
1195 | 1195 | '; |
1196 | 1196 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\domain\services\capabilities\PublicCapabilities; |
2 | 2 | use EventEspresso\core\exceptions\InvalidEntityException; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
5 | 5 | /** |
6 | 6 | * Single Page Checkout (SPCO) |
7 | 7 | * |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * @return EED_Single_Page_Checkout |
51 | 51 | */ |
52 | 52 | public static function instance() { |
53 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
54 | - return parent::get_instance( __CLASS__ ); |
|
53 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
54 | + return parent::get_instance(__CLASS__); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -96,22 +96,22 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public static function set_hooks_admin() { |
98 | 98 | EED_Single_Page_Checkout::set_definitions(); |
99 | - if ( defined( 'DOING_AJAX' )) { |
|
99 | + if (defined('DOING_AJAX')) { |
|
100 | 100 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
101 | 101 | ob_start(); |
102 | 102 | EED_Single_Page_Checkout::load_request_handler(); |
103 | 103 | EED_Single_Page_Checkout::load_reg_steps(); |
104 | 104 | } else { |
105 | 105 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
106 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
106 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
107 | 107 | } |
108 | 108 | // set ajax hooks |
109 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
110 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
111 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
112 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
113 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
114 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
109 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
110 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
111 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
112 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
113 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
114 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param string $ajax_action |
123 | 123 | * @throws \EE_Error |
124 | 124 | */ |
125 | - public static function process_ajax_request( $ajax_action ) { |
|
126 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
125 | + public static function process_ajax_request($ajax_action) { |
|
126 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
127 | 127 | EED_Single_Page_Checkout::instance()->_initialize(); |
128 | 128 | } |
129 | 129 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @throws \EE_Error |
136 | 136 | */ |
137 | 137 | public static function display_reg_step() { |
138 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
138 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @throws \EE_Error |
147 | 147 | */ |
148 | 148 | public static function process_reg_step() { |
149 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
149 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @throws \EE_Error |
158 | 158 | */ |
159 | 159 | public static function update_reg_step() { |
160 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
160 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @throws \EE_Error |
171 | 171 | */ |
172 | 172 | public static function update_checkout() { |
173 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
173 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public static function load_request_handler() { |
185 | 185 | // load core Request_Handler class |
186 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
187 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
186 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
187 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | * @throws \EE_Error |
199 | 199 | */ |
200 | 200 | public static function set_definitions() { |
201 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
202 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
203 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
204 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
205 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
206 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
207 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
208 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
201 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
202 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
203 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
204 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
205 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
206 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
207 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
208 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public static function load_reg_steps() { |
222 | 222 | static $reg_steps_loaded = FALSE; |
223 | - if ( $reg_steps_loaded ) { |
|
223 | + if ($reg_steps_loaded) { |
|
224 | 224 | return; |
225 | 225 | } |
226 | 226 | // filter list of reg_steps |
@@ -229,24 +229,24 @@ discard block |
||
229 | 229 | EED_Single_Page_Checkout::get_reg_steps() |
230 | 230 | ); |
231 | 231 | // sort by key (order) |
232 | - ksort( $reg_steps_to_load ); |
|
232 | + ksort($reg_steps_to_load); |
|
233 | 233 | // loop through folders |
234 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
234 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
235 | 235 | // we need a |
236 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
236 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
237 | 237 | // copy over to the reg_steps_array |
238 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
238 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
239 | 239 | // register custom key route for each reg step |
240 | 240 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
241 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
241 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
242 | 242 | // add AJAX or other hooks |
243 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
243 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
244 | 244 | // setup autoloaders if necessary |
245 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
246 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
245 | + if ( ! class_exists($reg_step['class_name'])) { |
|
246 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
247 | 247 | } |
248 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
249 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
248 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
249 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
@@ -265,28 +265,28 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public static function get_reg_steps() { |
267 | 267 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
268 | - if ( empty( $reg_steps )) { |
|
268 | + if (empty($reg_steps)) { |
|
269 | 269 | $reg_steps = array( |
270 | 270 | 10 => array( |
271 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
271 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
272 | 272 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
273 | 273 | 'slug' => 'attendee_information', |
274 | 274 | 'has_hooks' => FALSE |
275 | 275 | ), |
276 | 276 | 20 => array( |
277 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
277 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
278 | 278 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
279 | 279 | 'slug' => 'registration_confirmation', |
280 | 280 | 'has_hooks' => FALSE |
281 | 281 | ), |
282 | 282 | 30 => array( |
283 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
283 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
284 | 284 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
285 | 285 | 'slug' => 'payment_options', |
286 | 286 | 'has_hooks' => TRUE |
287 | 287 | ), |
288 | 288 | 999 => array( |
289 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
289 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
290 | 290 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
291 | 291 | 'slug' => 'finalize_registration', |
292 | 292 | 'has_hooks' => FALSE |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public static function registration_checkout_for_admin() { |
309 | 309 | EED_Single_Page_Checkout::load_reg_steps(); |
310 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
311 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
312 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
310 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
311 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
312 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
313 | 313 | EED_Single_Page_Checkout::instance()->_initialize(); |
314 | 314 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
315 | 315 | return EE_Registry::instance()->REQ->get_output(); |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public static function process_registration_from_admin() { |
328 | 328 | EED_Single_Page_Checkout::load_reg_steps(); |
329 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
330 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
331 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
329 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
330 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
331 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
332 | 332 | EED_Single_Page_Checkout::instance()->_initialize(); |
333 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
334 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
335 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
336 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
337 | - if ( $final_reg_step->process_reg_step() ) { |
|
333 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
334 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
335 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
336 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
337 | + if ($final_reg_step->process_reg_step()) { |
|
338 | 338 | $final_reg_step->set_completed(); |
339 | 339 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
340 | 340 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -354,11 +354,11 @@ discard block |
||
354 | 354 | * @return void |
355 | 355 | * @throws \EE_Error |
356 | 356 | */ |
357 | - public function run( $WP_Query ) { |
|
357 | + public function run($WP_Query) { |
|
358 | 358 | if ( |
359 | 359 | $WP_Query instanceof WP_Query |
360 | 360 | && $WP_Query->is_main_query() |
361 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
361 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
362 | 362 | ) { |
363 | 363 | $this->_initialize(); |
364 | 364 | } |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | * @return void |
375 | 375 | * @throws \EE_Error |
376 | 376 | */ |
377 | - public static function init( $WP_Query ) { |
|
378 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
377 | + public static function init($WP_Query) { |
|
378 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | |
@@ -389,34 +389,34 @@ discard block |
||
389 | 389 | */ |
390 | 390 | private function _initialize() { |
391 | 391 | // ensure SPCO doesn't run twice |
392 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
392 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
393 | 393 | return; |
394 | 394 | } |
395 | 395 | try { |
396 | 396 | // setup the EE_Checkout object |
397 | 397 | $this->checkout = $this->_initialize_checkout(); |
398 | 398 | // filter checkout |
399 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
399 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
400 | 400 | // get the $_GET |
401 | 401 | $this->_get_request_vars(); |
402 | 402 | // filter continue_reg |
403 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
403 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
404 | 404 | // load the reg steps array |
405 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
405 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
406 | 406 | EED_Single_Page_Checkout::$_initialized = true; |
407 | 407 | return; |
408 | 408 | } |
409 | 409 | // set the current step |
410 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
410 | + $this->checkout->set_current_step($this->checkout->step); |
|
411 | 411 | // and the next step |
412 | 412 | $this->checkout->set_next_step(); |
413 | 413 | // was there already a valid transaction in the checkout from the session ? |
414 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
414 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
415 | 415 | // get transaction from db or session |
416 | 416 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
417 | 417 | ? $this->_get_transaction_and_cart_for_previous_visit() |
418 | 418 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
419 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
419 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
420 | 420 | // add some style and make it dance |
421 | 421 | $this->checkout->transaction = EE_Transaction::new_instance(); |
422 | 422 | $this->add_styles_and_scripts(); |
@@ -424,10 +424,10 @@ discard block |
||
424 | 424 | return; |
425 | 425 | } |
426 | 426 | // and the registrations for the transaction |
427 | - $this->_get_registrations( $this->checkout->transaction ); |
|
427 | + $this->_get_registrations($this->checkout->transaction); |
|
428 | 428 | } |
429 | 429 | // verify that everything has been setup correctly |
430 | - if ( ! $this->_final_verifications() ) { |
|
430 | + if ( ! $this->_final_verifications()) { |
|
431 | 431 | EED_Single_Page_Checkout::$_initialized = true; |
432 | 432 | return; |
433 | 433 | } |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | // set no cache headers and constants |
453 | 453 | EE_System::do_not_cache(); |
454 | 454 | // add anchor |
455 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
456 | - } catch ( Exception $e ) { |
|
457 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
455 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
456 | + } catch (Exception $e) { |
|
457 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 | |
@@ -472,20 +472,20 @@ discard block |
||
472 | 472 | // look in session for existing checkout |
473 | 473 | $checkout = EE_Registry::instance()->SSN->checkout(); |
474 | 474 | // verify |
475 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
475 | + if ( ! $checkout instanceof EE_Checkout) { |
|
476 | 476 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
477 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
477 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
478 | 478 | } else { |
479 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
479 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
480 | 480 | $this->unlock_transaction(); |
481 | - wp_safe_redirect( $checkout->redirect_url ); |
|
481 | + wp_safe_redirect($checkout->redirect_url); |
|
482 | 482 | exit(); |
483 | 483 | } |
484 | 484 | } |
485 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
485 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
486 | 486 | // verify again |
487 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
488 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
487 | + if ( ! $checkout instanceof EE_Checkout) { |
|
488 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
489 | 489 | } |
490 | 490 | // reset anything that needs a clean slate for each request |
491 | 491 | $checkout->reset_for_current_request(); |
@@ -505,24 +505,24 @@ discard block |
||
505 | 505 | // load classes |
506 | 506 | EED_Single_Page_Checkout::load_request_handler(); |
507 | 507 | //make sure this request is marked as belonging to EE |
508 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
508 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
509 | 509 | // which step is being requested ? |
510 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
510 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
511 | 511 | // which step is being edited ? |
512 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
512 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
513 | 513 | // and what we're doing on the current step |
514 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
514 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
515 | 515 | // returning to edit ? |
516 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
516 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
517 | 517 | // or some other kind of revisit ? |
518 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
518 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
519 | 519 | // and whether or not to generate a reg form for this request |
520 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
520 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
521 | 521 | // and whether or not to process a reg form submission for this request |
522 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
522 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
523 | 523 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
524 | 524 | ? $this->checkout->process_form_submission |
525 | - : FALSE; // TRUE FALSE |
|
525 | + : FALSE; // TRUE FALSE |
|
526 | 526 | // $this->_display_request_vars(); |
527 | 527 | } |
528 | 528 | |
@@ -535,17 +535,17 @@ discard block |
||
535 | 535 | * @return void |
536 | 536 | */ |
537 | 537 | protected function _display_request_vars() { |
538 | - if ( ! WP_DEBUG ) { |
|
538 | + if ( ! WP_DEBUG) { |
|
539 | 539 | return; |
540 | 540 | } |
541 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
542 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
543 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
544 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
545 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
546 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
547 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
548 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
541 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
542 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
543 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
544 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
545 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
546 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
547 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
548 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | * @return array |
560 | 560 | */ |
561 | 561 | private function _get_first_step() { |
562 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
563 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
562 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
563 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -576,27 +576,27 @@ discard block |
||
576 | 576 | private function _load_and_instantiate_reg_steps() { |
577 | 577 | // have reg_steps already been instantiated ? |
578 | 578 | if ( |
579 | - empty( $this->checkout->reg_steps ) || |
|
580 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
579 | + empty($this->checkout->reg_steps) || |
|
580 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
581 | 581 | ) { |
582 | 582 | // if not, then loop through raw reg steps array |
583 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
584 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
583 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
584 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
585 | 585 | return false; |
586 | 586 | } |
587 | 587 | } |
588 | 588 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
589 | 589 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
590 | 590 | // skip the registration_confirmation page ? |
591 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
591 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
592 | 592 | // just remove it from the reg steps array |
593 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
593 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
594 | 594 | } else if ( |
595 | - isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
595 | + isset($this->checkout->reg_steps['registration_confirmation']) |
|
596 | 596 | && EE_Registry::instance()->CFG->registration->reg_confirmation_last |
597 | 597 | ) { |
598 | 598 | // set the order to something big like 100 |
599 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
599 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
600 | 600 | } |
601 | 601 | // filter the array for good luck |
602 | 602 | $this->checkout->reg_steps = apply_filters( |
@@ -606,13 +606,13 @@ discard block |
||
606 | 606 | // finally re-sort based on the reg step class order properties |
607 | 607 | $this->checkout->sort_reg_steps(); |
608 | 608 | } else { |
609 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
609 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
610 | 610 | // set all current step stati to FALSE |
611 | - $reg_step->set_is_current_step( FALSE ); |
|
611 | + $reg_step->set_is_current_step(FALSE); |
|
612 | 612 | } |
613 | 613 | } |
614 | - if ( empty( $this->checkout->reg_steps )) { |
|
615 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
614 | + if (empty($this->checkout->reg_steps)) { |
|
615 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
616 | 616 | return false; |
617 | 617 | } |
618 | 618 | // make reg step details available to JS |
@@ -630,10 +630,10 @@ discard block |
||
630 | 630 | * @param int $order |
631 | 631 | * @return bool |
632 | 632 | */ |
633 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
633 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
634 | 634 | |
635 | 635 | // we need a file_path, class_name, and slug to add a reg step |
636 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
636 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
637 | 637 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
638 | 638 | if ( |
639 | 639 | $this->checkout->reg_url_link |
@@ -651,26 +651,26 @@ discard block |
||
651 | 651 | FALSE |
652 | 652 | ); |
653 | 653 | // did we gets the goods ? |
654 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
654 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
655 | 655 | // set reg step order based on config |
656 | - $reg_step_obj->set_order( $order ); |
|
656 | + $reg_step_obj->set_order($order); |
|
657 | 657 | // add instantiated reg step object to the master reg steps array |
658 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
658 | + $this->checkout->add_reg_step($reg_step_obj); |
|
659 | 659 | } else { |
660 | 660 | EE_Error::add_error( |
661 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
661 | + __('The current step could not be set.', 'event_espresso'), |
|
662 | 662 | __FILE__, __FUNCTION__, __LINE__ |
663 | 663 | ); |
664 | 664 | return false; |
665 | 665 | } |
666 | 666 | } else { |
667 | - if ( WP_DEBUG ) { |
|
667 | + if (WP_DEBUG) { |
|
668 | 668 | EE_Error::add_error( |
669 | 669 | sprintf( |
670 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
671 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
672 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
673 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
670 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
671 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
672 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
673 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
674 | 674 | '<ul>', |
675 | 675 | '<li>', |
676 | 676 | '</li>', |
@@ -694,16 +694,16 @@ discard block |
||
694 | 694 | */ |
695 | 695 | private function _get_transaction_and_cart_for_previous_visit() { |
696 | 696 | /** @var $TXN_model EEM_Transaction */ |
697 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
697 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
698 | 698 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
699 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
699 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
700 | 700 | // verify transaction |
701 | - if ( $transaction instanceof EE_Transaction ) { |
|
701 | + if ($transaction instanceof EE_Transaction) { |
|
702 | 702 | // and get the cart that was used for that transaction |
703 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
703 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
704 | 704 | return $transaction; |
705 | 705 | } else { |
706 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
706 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
707 | 707 | return NULL; |
708 | 708 | } |
709 | 709 | } |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | * @param EE_Transaction $transaction |
718 | 718 | * @return EE_Cart |
719 | 719 | */ |
720 | - private function _get_cart_for_transaction( $transaction ) { |
|
721 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
720 | + private function _get_cart_for_transaction($transaction) { |
|
721 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | * @param EE_Transaction $transaction |
731 | 731 | * @return EE_Cart |
732 | 732 | */ |
733 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
734 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
733 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
734 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | |
@@ -747,17 +747,17 @@ discard block |
||
747 | 747 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
748 | 748 | // if there's no transaction, then this is the FIRST visit to SPCO |
749 | 749 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
750 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
750 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
751 | 751 | // and then create a new transaction |
752 | 752 | $transaction = $this->_initialize_transaction(); |
753 | 753 | // verify transaction |
754 | - if ( $transaction instanceof EE_Transaction ) { |
|
754 | + if ($transaction instanceof EE_Transaction) { |
|
755 | 755 | // save it so that we have an ID for other objects to use |
756 | 756 | $transaction->save(); |
757 | 757 | // and save TXN data to the cart |
758 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
758 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
759 | 759 | } else { |
760 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
760 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
761 | 761 | } |
762 | 762 | return $transaction; |
763 | 763 | } |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | 'STS_ID' => EEM_Transaction::failed_status_code, |
786 | 786 | ) |
787 | 787 | ); |
788 | - } catch( Exception $e ) { |
|
789 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
788 | + } catch (Exception $e) { |
|
789 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
790 | 790 | } |
791 | 791 | return NULL; |
792 | 792 | } |
@@ -801,38 +801,38 @@ discard block |
||
801 | 801 | * @return EE_Cart |
802 | 802 | * @throws \EE_Error |
803 | 803 | */ |
804 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
804 | + private function _get_registrations(EE_Transaction $transaction) { |
|
805 | 805 | // first step: grab the registrants { : o |
806 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
806 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
807 | 807 | // verify registrations have been set |
808 | - if ( empty( $registrations )) { |
|
808 | + if (empty($registrations)) { |
|
809 | 809 | // if no cached registrations, then check the db |
810 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
810 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
811 | 811 | // still nothing ? well as long as this isn't a revisit |
812 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
812 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
813 | 813 | // generate new registrations from scratch |
814 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
814 | + $registrations = $this->_initialize_registrations($transaction); |
|
815 | 815 | } |
816 | 816 | } |
817 | 817 | // sort by their original registration order |
818 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
818 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
819 | 819 | // then loop thru the array |
820 | - foreach ( $registrations as $registration ) { |
|
820 | + foreach ($registrations as $registration) { |
|
821 | 821 | // verify each registration |
822 | - if ( $registration instanceof EE_Registration ) { |
|
822 | + if ($registration instanceof EE_Registration) { |
|
823 | 823 | // we display all attendee info for the primary registrant |
824 | - if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
|
824 | + if ($this->checkout->reg_url_link === $registration->reg_url_link() |
|
825 | 825 | && $registration->is_primary_registrant() |
826 | 826 | ) { |
827 | 827 | $this->checkout->primary_revisit = true; |
828 | 828 | break; |
829 | - } else if ( $this->checkout->revisit |
|
829 | + } else if ($this->checkout->revisit |
|
830 | 830 | && $this->checkout->reg_url_link !== $registration->reg_url_link() |
831 | 831 | ) { |
832 | 832 | // but hide info if it doesn't belong to you |
833 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
833 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
834 | 834 | } |
835 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
835 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
836 | 836 | } |
837 | 837 | } |
838 | 838 | } |
@@ -847,17 +847,17 @@ discard block |
||
847 | 847 | * @return array |
848 | 848 | * @throws \EE_Error |
849 | 849 | */ |
850 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
850 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
851 | 851 | $att_nmbr = 0; |
852 | 852 | $registrations = array(); |
853 | - if ( $transaction instanceof EE_Transaction ) { |
|
853 | + if ($transaction instanceof EE_Transaction) { |
|
854 | 854 | /** @type EE_Registration_Processor $registration_processor */ |
855 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
855 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
856 | 856 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
857 | 857 | // now let's add the cart items to the $transaction |
858 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
858 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
859 | 859 | //do the following for each ticket of this type they selected |
860 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
860 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
861 | 861 | $att_nmbr++; |
862 | 862 | /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
863 | 863 | $CreateRegistrationCommand = EE_Registry::instance() |
@@ -873,17 +873,17 @@ discard block |
||
873 | 873 | // override capabilities for frontend registrations |
874 | 874 | if ( ! is_admin()) { |
875 | 875 | $CreateRegistrationCommand->setCapCheck( |
876 | - new PublicCapabilities( '', 'create_new_registration' ) |
|
876 | + new PublicCapabilities('', 'create_new_registration') |
|
877 | 877 | ); |
878 | 878 | } |
879 | - $registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand ); |
|
880 | - if ( ! $registration instanceof EE_Registration ) { |
|
881 | - throw new InvalidEntityException( $registration, 'EE_Registration' ); |
|
879 | + $registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand); |
|
880 | + if ( ! $registration instanceof EE_Registration) { |
|
881 | + throw new InvalidEntityException($registration, 'EE_Registration'); |
|
882 | 882 | } |
883 | - $registrations[ $registration->ID() ] = $registration; |
|
883 | + $registrations[$registration->ID()] = $registration; |
|
884 | 884 | } |
885 | 885 | } |
886 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
886 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
887 | 887 | } |
888 | 888 | return $registrations; |
889 | 889 | } |
@@ -898,12 +898,12 @@ discard block |
||
898 | 898 | * @param EE_Registration $reg_B |
899 | 899 | * @return int |
900 | 900 | */ |
901 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
901 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
902 | 902 | // this shouldn't ever happen within the same TXN, but oh well |
903 | - if ( $reg_A->count() === $reg_B->count() ) { |
|
903 | + if ($reg_A->count() === $reg_B->count()) { |
|
904 | 904 | return 0; |
905 | 905 | } |
906 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
906 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | |
@@ -918,21 +918,21 @@ discard block |
||
918 | 918 | */ |
919 | 919 | private function _final_verifications() { |
920 | 920 | // filter checkout |
921 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
921 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
922 | 922 | //verify that current step is still set correctly |
923 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
924 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
923 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
924 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
925 | 925 | return false; |
926 | 926 | } |
927 | 927 | // if returning to SPCO, then verify that primary registrant is set |
928 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
928 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
929 | 929 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
930 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
931 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
930 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
931 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
932 | 932 | return false; |
933 | 933 | } |
934 | 934 | $valid_registrant = null; |
935 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
935 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
936 | 936 | if ( |
937 | 937 | $registration instanceof EE_Registration |
938 | 938 | && $registration->reg_url_link() === $this->checkout->reg_url_link |
@@ -940,9 +940,9 @@ discard block |
||
940 | 940 | $valid_registrant = $registration; |
941 | 941 | } |
942 | 942 | } |
943 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
943 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
944 | 944 | // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? |
945 | - if ( EED_Single_Page_Checkout::$_checkout_verified ) { |
|
945 | + if (EED_Single_Page_Checkout::$_checkout_verified) { |
|
946 | 946 | // clear the session, mark the checkout as unverified, and try again |
947 | 947 | EE_Registry::instance()->SSN->clear_session(); |
948 | 948 | EED_Single_Page_Checkout::$_initialized = false; |
@@ -951,13 +951,13 @@ discard block |
||
951 | 951 | EE_Error::reset_notices(); |
952 | 952 | return false; |
953 | 953 | } |
954 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
954 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
955 | 955 | return false; |
956 | 956 | } |
957 | 957 | } |
958 | 958 | // now that things have been kinda sufficiently verified, |
959 | 959 | // let's add the checkout to the session so that's available other systems |
960 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
960 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
961 | 961 | return true; |
962 | 962 | } |
963 | 963 | |
@@ -972,15 +972,15 @@ discard block |
||
972 | 972 | * @param bool $reinitializing |
973 | 973 | * @throws \EE_Error |
974 | 974 | */ |
975 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
976 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
975 | + private function _initialize_reg_steps($reinitializing = false) { |
|
976 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
977 | 977 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
978 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
979 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
978 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
979 | + if ( ! $reg_step->initialize_reg_step()) { |
|
980 | 980 | // if not initialized then maybe this step is being removed... |
981 | - if ( ! $reinitializing && $reg_step->is_current_step() ) { |
|
981 | + if ( ! $reinitializing && $reg_step->is_current_step()) { |
|
982 | 982 | // if it was the current step, then we need to start over here |
983 | - $this->_initialize_reg_steps( true ); |
|
983 | + $this->_initialize_reg_steps(true); |
|
984 | 984 | return; |
985 | 985 | } |
986 | 986 | continue; |
@@ -989,13 +989,13 @@ discard block |
||
989 | 989 | $reg_step->enqueue_styles_and_scripts(); |
990 | 990 | // i18n |
991 | 991 | $reg_step->translate_js_strings(); |
992 | - if ( $reg_step->is_current_step() ) { |
|
992 | + if ($reg_step->is_current_step()) { |
|
993 | 993 | // the text that appears on the reg step form submit button |
994 | 994 | $reg_step->set_submit_button_text(); |
995 | 995 | } |
996 | 996 | } |
997 | 997 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
998 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
998 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
@@ -1008,43 +1008,43 @@ discard block |
||
1008 | 1008 | */ |
1009 | 1009 | private function _check_form_submission() { |
1010 | 1010 | //does this request require the reg form to be generated ? |
1011 | - if ( $this->checkout->generate_reg_form ) { |
|
1011 | + if ($this->checkout->generate_reg_form) { |
|
1012 | 1012 | // ever heard that song by Blue Rodeo ? |
1013 | 1013 | try { |
1014 | 1014 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
1015 | 1015 | // if not displaying a form, then check for form submission |
1016 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
1016 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
1017 | 1017 | // clear out any old data in case this step is being run again |
1018 | - $this->checkout->current_step->set_valid_data( array() ); |
|
1018 | + $this->checkout->current_step->set_valid_data(array()); |
|
1019 | 1019 | // capture submitted form data |
1020 | 1020 | $this->checkout->current_step->reg_form->receive_form_submission( |
1021 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
1021 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
1022 | 1022 | ); |
1023 | 1023 | // validate submitted form data |
1024 | - if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) { |
|
1024 | + if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) { |
|
1025 | 1025 | // thou shall not pass !!! |
1026 | 1026 | $this->checkout->continue_reg = FALSE; |
1027 | 1027 | // any form validation errors? |
1028 | - if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) { |
|
1028 | + if ($this->checkout->current_step->reg_form->submission_error_message() !== '') { |
|
1029 | 1029 | $submission_error_messages = array(); |
1030 | 1030 | // bad, bad, bad registrant |
1031 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1032 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1031 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1032 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1033 | 1033 | $submission_error_messages[] = sprintf( |
1034 | - __( '%s : %s', 'event_espresso' ), |
|
1034 | + __('%s : %s', 'event_espresso'), |
|
1035 | 1035 | $validation_error->get_form_section()->html_label_text(), |
1036 | 1036 | $validation_error->getMessage() |
1037 | 1037 | ); |
1038 | 1038 | } |
1039 | 1039 | } |
1040 | - EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1040 | + EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1041 | 1041 | } |
1042 | 1042 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1043 | 1043 | $this->go_to_next_step(); |
1044 | 1044 | return; |
1045 | 1045 | } |
1046 | 1046 | } |
1047 | - } catch( EE_Error $e ) { |
|
1047 | + } catch (EE_Error $e) { |
|
1048 | 1048 | $e->get_error(); |
1049 | 1049 | } |
1050 | 1050 | } |
@@ -1061,22 +1061,22 @@ discard block |
||
1061 | 1061 | */ |
1062 | 1062 | private function _process_form_action() { |
1063 | 1063 | // what cha wanna do? |
1064 | - switch( $this->checkout->action ) { |
|
1064 | + switch ($this->checkout->action) { |
|
1065 | 1065 | // AJAX next step reg form |
1066 | 1066 | case 'display_spco_reg_step' : |
1067 | 1067 | $this->checkout->redirect = FALSE; |
1068 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1069 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1068 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1069 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1070 | 1070 | } |
1071 | 1071 | break; |
1072 | 1072 | |
1073 | 1073 | default : |
1074 | 1074 | // meh... do one of those other steps first |
1075 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1075 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1076 | 1076 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1077 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1077 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1078 | 1078 | // call action on current step |
1079 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1079 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1080 | 1080 | // good registrant, you get to proceed |
1081 | 1081 | if ( |
1082 | 1082 | $this->checkout->current_step->success_message() !== '' |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | ) { |
1088 | 1088 | EE_Error::add_success( |
1089 | 1089 | $this->checkout->current_step->success_message() |
1090 | - . '<br />' . $this->checkout->next_step->_instructions() |
|
1090 | + . '<br />'.$this->checkout->next_step->_instructions() |
|
1091 | 1091 | ); |
1092 | 1092 | |
1093 | 1093 | } |
@@ -1095,12 +1095,12 @@ discard block |
||
1095 | 1095 | $this->_setup_redirect(); |
1096 | 1096 | } |
1097 | 1097 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1098 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1098 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1099 | 1099 | |
1100 | 1100 | } else { |
1101 | 1101 | EE_Error::add_error( |
1102 | 1102 | sprintf( |
1103 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1103 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1104 | 1104 | $this->checkout->action, |
1105 | 1105 | $this->checkout->current_step->name() |
1106 | 1106 | ), |
@@ -1126,10 +1126,10 @@ discard block |
||
1126 | 1126 | public function add_styles_and_scripts() { |
1127 | 1127 | // i18n |
1128 | 1128 | $this->translate_js_strings(); |
1129 | - if ( $this->checkout->admin_request ) { |
|
1130 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1129 | + if ($this->checkout->admin_request) { |
|
1130 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1131 | 1131 | } else { |
1132 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1132 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1133 | 1133 | } |
1134 | 1134 | } |
1135 | 1135 | |
@@ -1145,42 +1145,42 @@ discard block |
||
1145 | 1145 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1146 | 1146 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1147 | 1147 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1148 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1149 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1150 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1148 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1149 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1150 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1151 | 1151 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1152 | 1152 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1153 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1154 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1153 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1154 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1155 | 1155 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1156 | 1156 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1157 | 1157 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1158 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1159 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1160 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1161 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1162 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1163 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1164 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1165 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1166 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1167 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1168 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1169 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1170 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1171 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1158 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1159 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1160 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1161 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1162 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1163 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1164 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1165 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1166 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1167 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1168 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1169 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1170 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1171 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1172 | 1172 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1173 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1173 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1174 | 1174 | '<h4 class="important-notice">', |
1175 | 1175 | '</h4>', |
1176 | 1176 | '<br />', |
1177 | 1177 | '<p>', |
1178 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1178 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1179 | 1179 | '">', |
1180 | 1180 | '</a>', |
1181 | 1181 | '</p>' |
1182 | 1182 | ); |
1183 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1183 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | |
@@ -1193,25 +1193,25 @@ discard block |
||
1193 | 1193 | */ |
1194 | 1194 | public function enqueue_styles_and_scripts() { |
1195 | 1195 | // load css |
1196 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1197 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1196 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1197 | + wp_enqueue_style('single_page_checkout'); |
|
1198 | 1198 | // load JS |
1199 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1200 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1201 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1202 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1199 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1200 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1201 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1202 | + wp_enqueue_script('single_page_checkout'); |
|
1203 | 1203 | |
1204 | 1204 | /** |
1205 | 1205 | * global action hook for enqueueing styles and scripts with |
1206 | 1206 | * spco calls. |
1207 | 1207 | */ |
1208 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1208 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1209 | 1209 | |
1210 | 1210 | /** |
1211 | 1211 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1212 | 1212 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1213 | 1213 | */ |
1214 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1214 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1215 | 1215 | |
1216 | 1216 | } |
1217 | 1217 | |
@@ -1226,19 +1226,19 @@ discard block |
||
1226 | 1226 | */ |
1227 | 1227 | private function _display_spco_reg_form() { |
1228 | 1228 | // if registering via the admin, just display the reg form for the current step |
1229 | - if ( $this->checkout->admin_request ) { |
|
1230 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1229 | + if ($this->checkout->admin_request) { |
|
1230 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1231 | 1231 | } else { |
1232 | 1232 | // add powered by EE msg |
1233 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1233 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1234 | 1234 | |
1235 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1235 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1236 | 1236 | $cookies_not_set_msg = ''; |
1237 | - if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1237 | + if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) { |
|
1238 | 1238 | $cookies_not_set_msg = apply_filters( |
1239 | 1239 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1240 | 1240 | sprintf( |
1241 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1241 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1242 | 1242 | '<div class="ee-attention">', |
1243 | 1243 | '</div>', |
1244 | 1244 | '<h6 class="important-notice">', |
@@ -1258,7 +1258,7 @@ discard block |
||
1258 | 1258 | 'layout_strategy' => |
1259 | 1259 | new EE_Template_Layout( |
1260 | 1260 | array( |
1261 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1261 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1262 | 1262 | 'template_args' => array( |
1263 | 1263 | 'empty_cart' => $empty_cart, |
1264 | 1264 | 'revisit' => $this->checkout->revisit, |
@@ -1267,8 +1267,8 @@ discard block |
||
1267 | 1267 | 'empty_msg' => apply_filters( |
1268 | 1268 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1269 | 1269 | sprintf( |
1270 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1271 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1270 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1271 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1272 | 1272 | '">', |
1273 | 1273 | '</a>' |
1274 | 1274 | ) |
@@ -1276,14 +1276,14 @@ discard block |
||
1276 | 1276 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1277 | 1277 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1278 | 1278 | 'session_expiration' => |
1279 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1279 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1280 | 1280 | ) |
1281 | 1281 | ) |
1282 | 1282 | ) |
1283 | 1283 | ) |
1284 | 1284 | ); |
1285 | 1285 | // load template and add to output sent that gets filtered into the_content() |
1286 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1286 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | |
@@ -1297,8 +1297,8 @@ discard block |
||
1297 | 1297 | * @internal param string $label |
1298 | 1298 | * @return string |
1299 | 1299 | */ |
1300 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1301 | - if ( $next_step === 'finalize_registration' ) { |
|
1300 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1301 | + if ($next_step === 'finalize_registration') { |
|
1302 | 1302 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1303 | 1303 | } |
1304 | 1304 | } |
@@ -1320,8 +1320,8 @@ discard block |
||
1320 | 1320 | ) { |
1321 | 1321 | add_filter( |
1322 | 1322 | 'FHEE__EEH_Template__powered_by_event_espresso__url', |
1323 | - function( $url) { |
|
1324 | - return apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1323 | + function($url) { |
|
1324 | + return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1325 | 1325 | } |
1326 | 1326 | ); |
1327 | 1327 | echo apply_filters( |
@@ -1329,7 +1329,7 @@ discard block |
||
1329 | 1329 | \EEH_Template::powered_by_event_espresso( |
1330 | 1330 | '', |
1331 | 1331 | 'espresso-registration-footer-dv', |
1332 | - array( 'utm_content' => 'registration_checkout' ) |
|
1332 | + array('utm_content' => 'registration_checkout') |
|
1333 | 1333 | ) |
1334 | 1334 | ); |
1335 | 1335 | } |
@@ -1346,7 +1346,7 @@ discard block |
||
1346 | 1346 | * @throws \EE_Error |
1347 | 1347 | */ |
1348 | 1348 | public function unlock_transaction() { |
1349 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1349 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1350 | 1350 | $this->checkout->transaction->unlock(); |
1351 | 1351 | } |
1352 | 1352 | } |
@@ -1361,12 +1361,12 @@ discard block |
||
1361 | 1361 | * @return array |
1362 | 1362 | */ |
1363 | 1363 | private function _setup_redirect() { |
1364 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1364 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1365 | 1365 | $this->checkout->redirect = TRUE; |
1366 | - if ( empty( $this->checkout->redirect_url )) { |
|
1366 | + if (empty($this->checkout->redirect_url)) { |
|
1367 | 1367 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1368 | 1368 | } |
1369 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1369 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1370 | 1370 | } |
1371 | 1371 | } |
1372 | 1372 | |
@@ -1380,9 +1380,9 @@ discard block |
||
1380 | 1380 | * @throws \EE_Error |
1381 | 1381 | */ |
1382 | 1382 | public function go_to_next_step() { |
1383 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1383 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1384 | 1384 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1385 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1385 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1386 | 1386 | } |
1387 | 1387 | $this->unlock_transaction(); |
1388 | 1388 | // just return for these conditions |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | */ |
1412 | 1412 | protected function _handle_json_response() { |
1413 | 1413 | // if this is an ajax request |
1414 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1414 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1415 | 1415 | // DEBUG LOG |
1416 | 1416 | //$this->checkout->log( |
1417 | 1417 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1424,7 +1424,7 @@ discard block |
||
1424 | 1424 | $this->checkout->json_response->set_registration_time_limit( |
1425 | 1425 | $this->checkout->get_registration_time_limit() |
1426 | 1426 | ); |
1427 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1427 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1428 | 1428 | // just send the ajax ( |
1429 | 1429 | $json_response = apply_filters( |
1430 | 1430 | 'FHEE__EE_Single_Page_Checkout__JSON_response', |
@@ -1445,9 +1445,9 @@ discard block |
||
1445 | 1445 | */ |
1446 | 1446 | protected function _handle_html_redirects() { |
1447 | 1447 | // going somewhere ? |
1448 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1448 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1449 | 1449 | // store notices in a transient |
1450 | - EE_Error::get_notices( false, true, true ); |
|
1450 | + EE_Error::get_notices(false, true, true); |
|
1451 | 1451 | // DEBUG LOG |
1452 | 1452 | //$this->checkout->log( |
1453 | 1453 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1457,7 +1457,7 @@ discard block |
||
1457 | 1457 | // 'headers_list' => headers_list(), |
1458 | 1458 | // ) |
1459 | 1459 | //); |
1460 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1460 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1461 | 1461 | exit(); |
1462 | 1462 | } |
1463 | 1463 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function instance() { |
42 | 42 | // check if class object is instantiated |
43 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
43 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
44 | 44 | self::$_instance = new self(); |
45 | 45 | } |
46 | 46 | return self::$_instance; |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | // define global EE_Admin constants |
58 | 58 | $this->_define_all_constants(); |
59 | 59 | // set autoloaders for our admin page classes based on included path information |
60 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
60 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
61 | 61 | // admin hooks |
62 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
62 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
63 | 63 | // load EE_Request_Handler early |
64 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
65 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
64 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
65 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
66 | 66 | // post shortcode tracking |
67 | 67 | add_action( |
68 | 68 | 'AHEE__EE_System__initialize_last', |
69 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' ) |
|
69 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin') |
|
70 | 70 | ); |
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | * @param string $plugin |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function filter_plugin_actions( $links, $plugin ) { |
|
115 | + public function filter_plugin_actions($links, $plugin) { |
|
116 | 116 | // set $main_file in stone |
117 | 117 | static $main_file; |
118 | 118 | // if $main_file is not set yet |
119 | - if ( ! $main_file ) { |
|
120 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
119 | + if ( ! $main_file) { |
|
120 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
121 | 121 | } |
122 | - if ( $plugin === $main_file ) { |
|
122 | + if ($plugin === $main_file) { |
|
123 | 123 | // compare current plugin to this one |
124 | - if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
125 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
126 | - array_unshift( $links, $maintenance_link ); |
|
124 | + if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
125 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
126 | + array_unshift($links, $maintenance_link); |
|
127 | 127 | } else { |
128 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
129 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
128 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
129 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
130 | 130 | // add before other links |
131 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
131 | + array_unshift($links, $org_settings_link, $events_link); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $links; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function get_request() { |
146 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
147 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
146 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
147 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @param array $admin_page_folder_names |
157 | 157 | * @return array |
158 | 158 | */ |
159 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
159 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
160 | 160 | return array( |
161 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
162 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
163 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
161 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
162 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
163 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
@@ -174,31 +174,31 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function init() { |
176 | 176 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
177 | - if ( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
177 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
178 | 178 | //ok so we want to enable the entire admin |
179 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
180 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
179 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
180 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
181 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
182 | 182 | //at a glance dashboard widget |
183 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 ); |
|
183 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
184 | 184 | //filter for get_edit_post_link used on comments for custom post types |
185 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 ); |
|
185 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2); |
|
186 | 186 | } |
187 | 187 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
188 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
188 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
189 | 189 | try { |
190 | 190 | //this loads the controller for the admin pages which will setup routing etc |
191 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
192 | - } catch ( EE_Error $e ) { |
|
191 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
192 | + } catch (EE_Error $e) { |
|
193 | 193 | $e->get_error(); |
194 | 194 | } |
195 | 195 | } |
196 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
196 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
197 | 197 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
198 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
199 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
198 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
199 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
200 | 200 | //exclude EE critical pages from all nav menus and wp_list_pages |
201 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
201 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | * @param object $post_type WP post type object |
212 | 212 | * @return object WP post type object |
213 | 213 | */ |
214 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
214 | + public function remove_pages_from_nav_menu($post_type) { |
|
215 | 215 | //if this isn't the "pages" post type let's get out |
216 | - if ( $post_type->name !== 'page' ) { |
|
216 | + if ($post_type->name !== 'page') { |
|
217 | 217 | return $post_type; |
218 | 218 | } |
219 | 219 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -233,28 +233,28 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function enable_hidden_ee_nav_menu_metaboxes() { |
235 | 235 | global $wp_meta_boxes, $pagenow; |
236 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
236 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
237 | 237 | return; |
238 | 238 | } |
239 | 239 | $user = wp_get_current_user(); |
240 | 240 | //has this been done yet? |
241 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
241 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | |
245 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
246 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
245 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
246 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
247 | 247 | |
248 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
249 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
250 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
251 | - unset( $hidden_meta_boxes[ $key ] ); |
|
248 | + if (is_array($hidden_meta_boxes)) { |
|
249 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
250 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
251 | + unset($hidden_meta_boxes[$key]); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
257 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
256 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
257 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return void |
274 | 274 | */ |
275 | 275 | public function register_custom_nav_menu_boxes() { |
276 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
276 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return string the (maybe) modified link |
291 | 291 | */ |
292 | - public function modify_edit_post_link( $link, $id ) { |
|
293 | - if ( ! $post = get_post( $id ) ){ |
|
292 | + public function modify_edit_post_link($link, $id) { |
|
293 | + if ( ! $post = get_post($id)) { |
|
294 | 294 | return $link; |
295 | 295 | } |
296 | - if ( $post->post_type === 'espresso_attendees' ) { |
|
296 | + if ($post->post_type === 'espresso_attendees') { |
|
297 | 297 | $query_args = array( |
298 | 298 | 'action' => 'edit_attendee', |
299 | 299 | 'post' => $id |
300 | 300 | ); |
301 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
301 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
302 | 302 | } |
303 | 303 | return $link; |
304 | 304 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | global $nav_menu_selected_id; |
311 | 311 | |
312 | 312 | $db_fields = false; |
313 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
313 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
314 | 314 | $current_tab = 'event-archives'; |
315 | 315 | |
316 | 316 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | ?> |
330 | 330 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
331 | 331 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
332 | - <li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>> |
|
333 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
332 | + <li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>> |
|
333 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
335 | 335 | </a> |
336 | 336 | </li> |
337 | 337 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | <?php */ ?> |
350 | 350 | |
351 | 351 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
352 | - echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
352 | + echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
353 | 353 | ?>"> |
354 | 354 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
355 | 355 | <?php |
356 | 356 | $pages = $this->_get_extra_nav_menu_pages_items(); |
357 | 357 | $args['walker'] = $walker; |
358 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
358 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
359 | 359 | ?> |
360 | 360 | </ul> |
361 | 361 | </div><!-- /.tabs-panel --> |
@@ -363,18 +363,18 @@ discard block |
||
363 | 363 | <p class="button-controls"> |
364 | 364 | <span class="list-controls"> |
365 | 365 | <a href="<?php |
366 | - echo esc_url( add_query_arg( |
|
366 | + echo esc_url(add_query_arg( |
|
367 | 367 | array( |
368 | 368 | 'extra-nav-menu-pages-tab' => 'event-archives', |
369 | 369 | 'selectall' => 1, |
370 | 370 | ), |
371 | - remove_query_arg( $removed_args ) |
|
371 | + remove_query_arg($removed_args) |
|
372 | 372 | )); |
373 | 373 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
374 | 374 | </span> |
375 | 375 | |
376 | 376 | <span class="add-to-menu"> |
377 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
377 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
378 | 378 | <span class="spinner"></span> |
379 | 379 | </span> |
380 | 380 | </p> |
@@ -395,10 +395,10 @@ discard block |
||
395 | 395 | private function _get_extra_nav_menu_pages_items() { |
396 | 396 | $menuitems[] = array( |
397 | 397 | 'title' => __('Event List', 'event_espresso'), |
398 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
398 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
399 | 399 | 'description' => __('Archive page for all events.', 'event_espresso') |
400 | 400 | ); |
401 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
401 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @param $menu_item_values |
411 | 411 | * @return stdClass |
412 | 412 | */ |
413 | - private function _setup_extra_nav_menu_pages_items( $menu_item_values ) { |
|
413 | + private function _setup_extra_nav_menu_pages_items($menu_item_values) { |
|
414 | 414 | $menu_item = new stdClass(); |
415 | 415 | $keys = array( |
416 | 416 | 'ID' => 0, |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | 'xfn' => '' |
431 | 431 | ); |
432 | 432 | |
433 | - foreach ( $keys as $key => $value) { |
|
434 | - $menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value; |
|
433 | + foreach ($keys as $key => $value) { |
|
434 | + $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value; |
|
435 | 435 | } |
436 | 436 | return $menu_item; |
437 | 437 | } |
@@ -470,9 +470,9 @@ discard block |
||
470 | 470 | * - check if doing post processing of one of EE CPTs |
471 | 471 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
472 | 472 | */ |
473 | - if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) { |
|
474 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
475 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
473 | + if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') { |
|
474 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
475 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
482 | 482 | */ |
483 | 483 | global $pagenow; |
484 | - if ( $pagenow === 'options-reading.php' ) { |
|
485 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
484 | + if ($pagenow === 'options-reading.php') { |
|
485 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | } |
@@ -494,25 +494,25 @@ discard block |
||
494 | 494 | * @param string $output Current output. |
495 | 495 | * @return string |
496 | 496 | */ |
497 | - public function modify_dropdown_pages( $output ) { |
|
497 | + public function modify_dropdown_pages($output) { |
|
498 | 498 | //get critical pages |
499 | 499 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
500 | 500 | |
501 | 501 | //split current output by line break for easier parsing. |
502 | - $split_output = explode( "\n", $output ); |
|
502 | + $split_output = explode("\n", $output); |
|
503 | 503 | |
504 | 504 | //loop through to remove any critical pages from the array. |
505 | - foreach ( $critical_pages as $page_id ) { |
|
506 | - $needle = 'value="' . $page_id . '"'; |
|
507 | - foreach( $split_output as $key => $haystack ) { |
|
508 | - if( strpos( $haystack, $needle ) !== false ) { |
|
509 | - unset( $split_output[$key] ); |
|
505 | + foreach ($critical_pages as $page_id) { |
|
506 | + $needle = 'value="'.$page_id.'"'; |
|
507 | + foreach ($split_output as $key => $haystack) { |
|
508 | + if (strpos($haystack, $needle) !== false) { |
|
509 | + unset($split_output[$key]); |
|
510 | 510 | } |
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
514 | 514 | //replace output with the new contents |
515 | - return implode( "\n", $split_output ); |
|
515 | + return implode("\n", $split_output); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | |
@@ -526,36 +526,36 @@ discard block |
||
526 | 526 | public function enqueue_admin_scripts() { |
527 | 527 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
528 | 528 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
529 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
529 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
530 | 530 | // register cookie script for future dependencies |
531 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
531 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
532 | 532 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
533 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
533 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
534 | 534 | // register jQuery Validate |
535 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
535 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
536 | 536 | } |
537 | 537 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
538 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
538 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
539 | 539 | //joyride style |
540 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
542 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
540 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
542 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
543 | 543 | //joyride JS |
544 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
544 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
545 | 545 | // wanna go for a joyride? |
546 | 546 | wp_enqueue_style('ee-joyride-css'); |
547 | 547 | wp_enqueue_script('jquery-joyride'); |
548 | 548 | } |
549 | 549 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
550 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
550 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
551 | 551 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
552 | 552 | } |
553 | 553 | //accounting.js library |
554 | 554 | // @link http://josscrowcroft.github.io/accounting.js/ |
555 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
556 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
557 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
558 | - wp_enqueue_script( 'ee-accounting' ); |
|
555 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
556 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
557 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
558 | + wp_enqueue_script('ee-accounting'); |
|
559 | 559 | // array of settings to get converted to JSON array via wp_localize_script |
560 | 560 | $currency_config = array( |
561 | 561 | 'currency' => array( |
@@ -602,11 +602,11 @@ discard block |
||
602 | 602 | public function get_persistent_admin_notices() { |
603 | 603 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
604 | 604 | $args = array( |
605 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
606 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
605 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
606 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
607 | 607 | ); |
608 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
609 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
608 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
609 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | |
@@ -627,26 +627,26 @@ discard block |
||
627 | 627 | * @param $elements |
628 | 628 | * @return array |
629 | 629 | */ |
630 | - public function dashboard_glance_items( $elements ) { |
|
630 | + public function dashboard_glance_items($elements) { |
|
631 | 631 | $events = EEM_Event::instance()->count(); |
632 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
633 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
632 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
633 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
634 | 634 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
635 | 635 | $registrations = EEM_Registration::instance()->count( |
636 | 636 | array( |
637 | 637 | array( |
638 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
638 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
639 | 639 | ) |
640 | 640 | ) |
641 | 641 | ); |
642 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
643 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
642 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
643 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
644 | 644 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
645 | 645 | |
646 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
646 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
647 | 647 | |
648 | - foreach ( $items as $type => $item_properties ) { |
|
649 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
648 | + foreach ($items as $type => $item_properties) { |
|
649 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
650 | 650 | } |
651 | 651 | return $elements; |
652 | 652 | } |
@@ -663,31 +663,31 @@ discard block |
||
663 | 663 | * @throws EE_Error |
664 | 664 | * @return string |
665 | 665 | */ |
666 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
666 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
667 | 667 | // check for date_format or time_format |
668 | - switch ( $option ) { |
|
668 | + switch ($option) { |
|
669 | 669 | case 'date_format' : |
670 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
670 | + $date_time_format = $value.' '.get_option('time_format'); |
|
671 | 671 | break; |
672 | 672 | case 'time_format' : |
673 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
673 | + $date_time_format = get_option('date_format').' '.$value; |
|
674 | 674 | break; |
675 | 675 | default : |
676 | 676 | $date_time_format = FALSE; |
677 | 677 | } |
678 | 678 | // do we have a date_time format to check ? |
679 | - if ( $date_time_format ) { |
|
680 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
679 | + if ($date_time_format) { |
|
680 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
681 | 681 | |
682 | - if ( is_array( $error_msg ) ) { |
|
683 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
682 | + if (is_array($error_msg)) { |
|
683 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
684 | 684 | |
685 | 685 | |
686 | - foreach ( $error_msg as $error ) { |
|
687 | - $msg .= '<li>' . $error . '</li>'; |
|
686 | + foreach ($error_msg as $error) { |
|
687 | + $msg .= '<li>'.$error.'</li>'; |
|
688 | 688 | } |
689 | 689 | |
690 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
690 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
691 | 691 | |
692 | 692 | // trigger WP settings error |
693 | 693 | add_settings_error( |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ); |
698 | 698 | |
699 | 699 | // set format to something valid |
700 | - switch ( $option ) { |
|
700 | + switch ($option) { |
|
701 | 701 | case 'date_format' : |
702 | 702 | $value = 'F j, Y'; |
703 | 703 | break; |
@@ -719,8 +719,8 @@ discard block |
||
719 | 719 | * @param $content |
720 | 720 | * @return string |
721 | 721 | */ |
722 | - public function its_eSpresso( $content ) { |
|
723 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
722 | + public function its_eSpresso($content) { |
|
723 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * @return string |
733 | 733 | */ |
734 | 734 | public function espresso_admin_footer() { |
735 | - return \EEH_Template::powered_by_event_espresso( 'aln-cntr', '', array( 'utm_content' => 'admin_footer' )); |
|
735 | + return \EEH_Template::powered_by_event_espresso('aln-cntr', '', array('utm_content' => 'admin_footer')); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | |
@@ -751,12 +751,12 @@ discard block |
||
751 | 751 | * @param array $config |
752 | 752 | * @return void |
753 | 753 | */ |
754 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
755 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
756 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
754 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
755 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
756 | + if (class_exists('EE_Register_Admin_Page')) { |
|
757 | 757 | $config['page_path'] = $page_path; |
758 | 758 | } |
759 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
759 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
760 | 760 | |
761 | 761 | } |
762 | 762 | |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | * @param \WP_Post $post |
770 | 770 | * @return void |
771 | 771 | */ |
772 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
772 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
773 | 773 | EE_Error::doing_it_wrong( |
774 | 774 | __METHOD__, |
775 | 775 | __( |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | ), |
779 | 779 | '4.8.41' |
780 | 780 | ); |
781 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post ); |
|
781 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | * @param $value |
792 | 792 | * @return void |
793 | 793 | */ |
794 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
794 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
795 | 795 | EE_Error::doing_it_wrong( |
796 | 796 | __METHOD__, |
797 | 797 | __( |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | ), |
801 | 801 | '4.8.41' |
802 | 802 | ); |
803 | - EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value ); |
|
803 | + EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,81 +210,81 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | // loop through $templates |
239 | - foreach ( $templates as $template ) { |
|
239 | + foreach ($templates as $template) { |
|
240 | 240 | // normalize directory separators |
241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
242 | - $file_name = basename( $template ); |
|
243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
241 | + $template = EEH_File::standardise_directory_separators($template); |
|
242 | + $file_name = basename($template); |
|
243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
244 | 244 | // while looping through all template folder paths |
245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
246 | 246 | // normalize directory separators |
247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
248 | 248 | // determine if any common base path exists between the two paths |
249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
250 | + array($template_folder_path, $template_path_minus_file_name) |
|
251 | 251 | ); |
252 | - if ( $common_base_path !== '' ) { |
|
252 | + if ($common_base_path !== '') { |
|
253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
255 | 255 | } else { |
256 | 256 | // no common base path, so let's just concatenate |
257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
258 | 258 | } |
259 | 259 | // build up our template locations array by adding our resolved paths |
260 | 260 | $full_template_paths[] = $resolved_path; |
261 | 261 | } |
262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
263 | - array_unshift( $full_template_paths, $template ); |
|
263 | + array_unshift($full_template_paths, $template); |
|
264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
266 | 266 | } |
267 | 267 | // filter final array of full template paths |
268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
269 | 269 | // now loop through our final array of template location paths and check each location |
270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
271 | - if ( is_readable( $full_template_path )) { |
|
272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
271 | + if (is_readable($full_template_path)) { |
|
272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
273 | 273 | // hook that can be used to display the full template path that will be used |
274 | - do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path ); |
|
274 | + do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
279 | 279 | // if we got it and you want to see it... |
280 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
281 | - if ( $return_string ) { |
|
282 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
280 | + if ($template_path && $load && ! $check_if_custom) { |
|
281 | + if ($return_string) { |
|
282 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
283 | 283 | } else { |
284 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
284 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
285 | 285 | } |
286 | 286 | } |
287 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
287 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -297,21 +297,21 @@ discard block |
||
297 | 297 | * @param array $paths |
298 | 298 | * @return string |
299 | 299 | */ |
300 | - protected static function _find_common_base_path( $paths ) { |
|
300 | + protected static function _find_common_base_path($paths) { |
|
301 | 301 | $last_offset = 0; |
302 | 302 | $common_base_path = ''; |
303 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
303 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
304 | 304 | $dir_length = $index - $last_offset + 1; |
305 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
306 | - foreach ( $paths as $path ) { |
|
307 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
305 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
306 | + foreach ($paths as $path) { |
|
307 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
308 | 308 | return $common_base_path; |
309 | 309 | } |
310 | 310 | } |
311 | 311 | $common_base_path .= $directory; |
312 | 312 | $last_offset = $index + 1; |
313 | 313 | } |
314 | - return substr( $common_base_path, 0, -1 ); |
|
314 | + return substr($common_base_path, 0, -1); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
324 | 324 | * @return mixed string |
325 | 325 | */ |
326 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
326 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -334,26 +334,26 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @since 4.6.0 |
336 | 336 | */ |
337 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
338 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
337 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
338 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
339 | 339 | |
340 | 340 | // you gimme nuttin - YOU GET NUTTIN !! |
341 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
341 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | // if $template_args are not in an array, then make it so |
345 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
346 | - $template_args = array( $template_args ); |
|
345 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
346 | + $template_args = array($template_args); |
|
347 | 347 | } |
348 | - extract( (array) $template_args); |
|
348 | + extract((array) $template_args); |
|
349 | 349 | |
350 | - if ( $return_string ) { |
|
350 | + if ($return_string) { |
|
351 | 351 | // because we want to return a string, we are going to capture the output |
352 | 352 | ob_start(); |
353 | - include( $template_path ); |
|
353 | + include($template_path); |
|
354 | 354 | return ob_get_clean(); |
355 | 355 | } else { |
356 | - include( $template_path ); |
|
356 | + include($template_path); |
|
357 | 357 | } |
358 | 358 | return ''; |
359 | 359 | } |
@@ -371,27 +371,27 @@ discard block |
||
371 | 371 | * @param string $suffix added to the end of the generated class |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
374 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
375 | 375 | // in the beginning... |
376 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
376 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
377 | 377 | // da muddle |
378 | 378 | $class = ''; |
379 | 379 | // the end |
380 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
380 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
381 | 381 | // is the passed object an EE object ? |
382 | - if ( $object instanceof EE_Base_Class ) { |
|
382 | + if ($object instanceof EE_Base_Class) { |
|
383 | 383 | // grab the exact type of object |
384 | - $obj_class = get_class( $object ); |
|
384 | + $obj_class = get_class($object); |
|
385 | 385 | // depending on the type of object... |
386 | - switch ( $obj_class ) { |
|
386 | + switch ($obj_class) { |
|
387 | 387 | // no specifics just yet... |
388 | 388 | default : |
389 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
390 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
389 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
390 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | } |
394 | - return $prefix . $class . $suffix; |
|
394 | + return $prefix.$class.$suffix; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -407,54 +407,54 @@ discard block |
||
407 | 407 | * @param string $cur_code_span_class |
408 | 408 | * @return string the html output for the formatted money value |
409 | 409 | */ |
410 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
410 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
411 | 411 | // ensure amount was received |
412 | - if ( is_null( $amount ) ) { |
|
413 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
414 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
412 | + if (is_null($amount)) { |
|
413 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
414 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
415 | 415 | return ''; |
416 | 416 | } |
417 | 417 | //ensure amount is float |
418 | - $amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount ); |
|
419 | - $CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount ); |
|
418 | + $amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount); |
|
419 | + $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount); |
|
420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
422 | 422 | // still a number or was amount converted to a string like "free" ? |
423 | - if ( is_float( $amount_formatted )) { |
|
423 | + if (is_float($amount_formatted)) { |
|
424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
426 | 426 | // verify results |
427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
428 | 428 | // set default config country currency settings |
429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
430 | 430 | } |
431 | 431 | // format float |
432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
433 | 433 | // add formatting ? |
434 | - if ( ! $return_raw ) { |
|
434 | + if ( ! $return_raw) { |
|
435 | 435 | // add currency sign |
436 | - if( $mny->sign_b4 ){ |
|
437 | - if( $amount >= 0 ){ |
|
438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
439 | - }else{ |
|
440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
436 | + if ($mny->sign_b4) { |
|
437 | + if ($amount >= 0) { |
|
438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
439 | + } else { |
|
440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
441 | 441 | } |
442 | 442 | |
443 | - }else{ |
|
444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
443 | + } else { |
|
444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | // filter to allow global setting of display_code |
448 | - $display_code = apply_filters( 'FHEE__EEH_Template__format_currency__display_code', $display_code ); |
|
448 | + $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code); |
|
449 | 449 | |
450 | 450 | // add currency code ? |
451 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
451 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
452 | 452 | } |
453 | 453 | // filter results |
454 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
454 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
455 | 455 | } |
456 | 456 | // clean up vars |
457 | - unset( $mny ); |
|
457 | + unset($mny); |
|
458 | 458 | // return formatted currency amount |
459 | 459 | return $amount_formatted; |
460 | 460 | } |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
470 | 470 | * @return string The localized label for the status id. |
471 | 471 | */ |
472 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
472 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
473 | 473 | /** @type EEM_Status $EEM_Status */ |
474 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
475 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
476 | - return $status[ $status_id ]; |
|
474 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
475 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
476 | + return $status[$status_id]; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -488,21 +488,21 @@ discard block |
||
488 | 488 | * @param string $title |
489 | 489 | * @return string the html output for the button |
490 | 490 | */ |
491 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '', $title = '' ) { |
|
491 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '') { |
|
492 | 492 | $icon_html = ''; |
493 | - if ( ! empty( $icon ) ) { |
|
494 | - $dashicons = preg_split( "(ee-icon |dashicons )", $icon ); |
|
495 | - $dashicons = array_filter( $dashicons ); |
|
496 | - $count = count( $dashicons ); |
|
493 | + if ( ! empty($icon)) { |
|
494 | + $dashicons = preg_split("(ee-icon |dashicons )", $icon); |
|
495 | + $dashicons = array_filter($dashicons); |
|
496 | + $count = count($dashicons); |
|
497 | 497 | $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : ''; |
498 | - foreach ( $dashicons as $dashicon ) { |
|
499 | - $type = strpos( $dashicon, 'ee-icon' ) !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | - $icon_html .= '<span class="' . $type . $dashicon . '"></span>'; |
|
498 | + foreach ($dashicons as $dashicon) { |
|
499 | + $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | + $icon_html .= '<span class="'.$type.$dashicon.'"></span>'; |
|
501 | 501 | } |
502 | 502 | $icon_html .= $count > 1 ? '</span>' : ''; |
503 | 503 | } |
504 | - $label = ! empty( $icon ) ? $icon_html . $label : $label; |
|
505 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>'; |
|
504 | + $label = ! empty($icon) ? $icon_html.$label : $label; |
|
505 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'" title="'.$title.'">'.$label.'</a>'; |
|
506 | 506 | return $button; |
507 | 507 | } |
508 | 508 | |
@@ -519,21 +519,21 @@ discard block |
||
519 | 519 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
520 | 520 | * @return string generated link |
521 | 521 | */ |
522 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
522 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
523 | 523 | |
524 | - if ( ! $page ) |
|
525 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
524 | + if ( ! $page) |
|
525 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
526 | 526 | |
527 | - if ( ! $action ) |
|
528 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
527 | + if ( ! $action) |
|
528 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
529 | 529 | |
530 | 530 | $action = empty($action) ? 'default' : $action; |
531 | 531 | |
532 | 532 | |
533 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
534 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | - $help_text = !$help_text ? '' : $help_text; |
|
536 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
533 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
534 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | + $help_text = ! $help_text ? '' : $help_text; |
|
536 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -545,31 +545,31 @@ discard block |
||
545 | 545 | * @param EE_Help_Tour |
546 | 546 | * @return string html |
547 | 547 | */ |
548 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
548 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
549 | 549 | $id = $tour->get_slug(); |
550 | 550 | $stops = $tour->get_stops(); |
551 | 551 | |
552 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
552 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
553 | 553 | |
554 | - foreach ( $stops as $stop ) { |
|
555 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
556 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
554 | + foreach ($stops as $stop) { |
|
555 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
556 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
557 | 557 | |
558 | 558 | //if container is set to modal then let's make sure we set the options accordingly |
559 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
559 | + if (empty($data_id) && empty($data_class)) { |
|
560 | 560 | $stop['options']['modal'] = true; |
561 | 561 | $stop['options']['expose'] = true; |
562 | 562 | } |
563 | 563 | |
564 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
565 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
564 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
565 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
566 | 566 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
567 | 567 | |
568 | 568 | //options |
569 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
569 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
570 | 570 | $options = ' data-options="'; |
571 | - foreach ( $stop['options'] as $option => $value ) { |
|
572 | - $options .= $option . ':' . $value . ';'; |
|
571 | + foreach ($stop['options'] as $option => $value) { |
|
572 | + $options .= $option.':'.$value.';'; |
|
573 | 573 | } |
574 | 574 | $options .= '"'; |
575 | 575 | } else { |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | } |
578 | 578 | |
579 | 579 | //let's put all together |
580 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
580 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | $content .= '</ol>'; |
@@ -598,31 +598,31 @@ discard block |
||
598 | 598 | * @throws EE_Error |
599 | 599 | * @return string html structure for status. |
600 | 600 | */ |
601 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
602 | - if ( !is_array( $status_array ) ) |
|
603 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
601 | + public static function status_legend($status_array, $active_status = '') { |
|
602 | + if ( ! is_array($status_array)) |
|
603 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
604 | 604 | |
605 | 605 | $setup_array = array(); |
606 | - foreach ( $status_array as $item => $status ) { |
|
606 | + foreach ($status_array as $item => $status) { |
|
607 | 607 | $setup_array[$item] = array( |
608 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
609 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
608 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
609 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
610 | 610 | 'status' => $status |
611 | 611 | ); |
612 | 612 | } |
613 | 613 | |
614 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
615 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
616 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
617 | - foreach ( $setup_array as $item => $details ) { |
|
614 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
615 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
616 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
617 | + foreach ($setup_array as $item => $details) { |
|
618 | 618 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
619 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
620 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
621 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
622 | - $content .= '</dt>' . "\n"; |
|
619 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
620 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
621 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
622 | + $content .= '</dt>'."\n"; |
|
623 | 623 | } |
624 | - $content .= '</dl>' . "\n"; |
|
625 | - $content .= '</div>' . "\n"; |
|
624 | + $content .= '</dl>'."\n"; |
|
625 | + $content .= '</div>'."\n"; |
|
626 | 626 | return $content; |
627 | 627 | } |
628 | 628 | |
@@ -635,8 +635,8 @@ discard block |
||
635 | 635 | * @return string |
636 | 636 | */ |
637 | 637 | public static function layout_array_as_table($data) { |
638 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
639 | - $data = (array)$data; |
|
638 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
639 | + $data = (array) $data; |
|
640 | 640 | } |
641 | 641 | ob_start(); |
642 | 642 | if (is_array($data)) { |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | ?> |
650 | 650 | <tr> |
651 | 651 | <td> |
652 | - <?php echo $data_key;?> |
|
652 | + <?php echo $data_key; ?> |
|
653 | 653 | </td> |
654 | 654 | <td> |
655 | - <?php echo self::layout_array_as_table($data_values);?> |
|
655 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
656 | 656 | </td> |
657 | 657 | </tr> |
658 | 658 | <?php |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | <ul> |
667 | 667 | <?php |
668 | 668 | foreach ($data as $datum) { |
669 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
669 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
670 | 670 | }?> |
671 | 671 | </ul> |
672 | 672 | <?php |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @return string |
698 | 698 | */ |
699 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
700 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
699 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
700 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | * ) |
722 | 722 | * @return string |
723 | 723 | */ |
724 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
724 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
725 | 725 | $page_links = array(); |
726 | 726 | $disable_first = $disable_last = ''; |
727 | 727 | $total_items = (int) $total_items; |
728 | 728 | $per_page = (int) $per_page; |
729 | 729 | $current = (int) $current; |
730 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
730 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
731 | 731 | |
732 | 732 | //filter items_label |
733 | 733 | $items_label = apply_filters( |
@@ -735,68 +735,68 @@ discard block |
||
735 | 735 | $items_label |
736 | 736 | ); |
737 | 737 | |
738 | - if ( empty( $items_label ) |
|
739 | - || ! is_array( $items_label ) |
|
740 | - || ! isset( $items_label['single'] ) |
|
741 | - || ! isset( $items_label['plural'] ) ) { |
|
738 | + if (empty($items_label) |
|
739 | + || ! is_array($items_label) |
|
740 | + || ! isset($items_label['single']) |
|
741 | + || ! isset($items_label['plural'])) { |
|
742 | 742 | $items_label = array( |
743 | - 'single' => __( '1 item', 'event_espresso' ), |
|
744 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
743 | + 'single' => __('1 item', 'event_espresso'), |
|
744 | + 'plural' => __('%s items', 'event_espresso') |
|
745 | 745 | ); |
746 | 746 | } else { |
747 | 747 | $items_label = array( |
748 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
749 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
748 | + 'single' => '1 '.esc_html($items_label['single']), |
|
749 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
750 | 750 | ); |
751 | 751 | } |
752 | 752 | |
753 | - $total_pages = ceil( $total_items / $per_page ); |
|
753 | + $total_pages = ceil($total_items / $per_page); |
|
754 | 754 | |
755 | - if ( $total_pages <= 1 ) |
|
755 | + if ($total_pages <= 1) |
|
756 | 756 | return ''; |
757 | 757 | |
758 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
758 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
759 | 759 | |
760 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
760 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
761 | 761 | |
762 | - if ( $current === 1 ) { |
|
762 | + if ($current === 1) { |
|
763 | 763 | $disable_first = ' disabled'; |
764 | 764 | } |
765 | - if ( $current == $total_pages ) { |
|
765 | + if ($current == $total_pages) { |
|
766 | 766 | $disable_last = ' disabled'; |
767 | 767 | } |
768 | 768 | |
769 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | - 'first-page' . $disable_first, |
|
771 | - esc_attr__( 'Go to the first page' ), |
|
772 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
769 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | + 'first-page'.$disable_first, |
|
771 | + esc_attr__('Go to the first page'), |
|
772 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
773 | 773 | '«' |
774 | 774 | ); |
775 | 775 | |
776 | 776 | $page_links[] = sprintf( |
777 | 777 | '<a class="%s" title="%s" href="%s">%s</a>', |
778 | - 'prev-page' . $disable_first, |
|
779 | - esc_attr__( 'Go to the previous page' ), |
|
780 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
778 | + 'prev-page'.$disable_first, |
|
779 | + esc_attr__('Go to the previous page'), |
|
780 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
781 | 781 | '‹' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( ! $show_num_field ) { |
|
784 | + if ( ! $show_num_field) { |
|
785 | 785 | $html_current_page = $current; |
786 | 786 | } else { |
787 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | - esc_attr__( 'Current page' ), |
|
787 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | + esc_attr__('Current page'), |
|
789 | 789 | $current, |
790 | - strlen( $total_pages ) |
|
790 | + strlen($total_pages) |
|
791 | 791 | ); |
792 | 792 | } |
793 | 793 | |
794 | 794 | $html_total_pages = sprintf( |
795 | 795 | '<span class="total-pages">%s</span>', |
796 | - number_format_i18n( $total_pages ) |
|
796 | + number_format_i18n($total_pages) |
|
797 | 797 | ); |
798 | 798 | $page_links[] = sprintf( |
799 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
799 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
800 | 800 | $html_current_page, |
801 | 801 | $html_total_pages, |
802 | 802 | '<span class="paging-input">', |
@@ -805,29 +805,29 @@ discard block |
||
805 | 805 | |
806 | 806 | $page_links[] = sprintf( |
807 | 807 | '<a class="%s" title="%s" href="%s">%s</a>', |
808 | - 'next-page' . $disable_last, |
|
809 | - esc_attr__( 'Go to the next page' ), |
|
810 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
808 | + 'next-page'.$disable_last, |
|
809 | + esc_attr__('Go to the next page'), |
|
810 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
811 | 811 | '›' |
812 | 812 | ); |
813 | 813 | |
814 | 814 | $page_links[] = sprintf( |
815 | 815 | '<a class="%s" title="%s" href="%s">%s</a>', |
816 | - 'last-page' . $disable_last, |
|
817 | - esc_attr__( 'Go to the last page' ), |
|
818 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
816 | + 'last-page'.$disable_last, |
|
817 | + esc_attr__('Go to the last page'), |
|
818 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
819 | 819 | '»' |
820 | 820 | ); |
821 | 821 | |
822 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
822 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
823 | 823 | // set page class |
824 | - if ( $total_pages ) { |
|
824 | + if ($total_pages) { |
|
825 | 825 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
826 | 826 | } else { |
827 | 827 | $page_class = ' no-pages'; |
828 | 828 | } |
829 | 829 | |
830 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
830 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | * @param string $wrap_id |
838 | 838 | * @return string |
839 | 839 | */ |
840 | - public static function powered_by_event_espresso( $wrap_class = '', $wrap_id = '', array $query_args = array() ) { |
|
841 | - $admin = is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
840 | + public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = array()) { |
|
841 | + $admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX); |
|
842 | 842 | if ( |
843 | 843 | ! $admin && |
844 | 844 | ! apply_filters( |
@@ -849,9 +849,9 @@ discard block |
||
849 | 849 | return ''; |
850 | 850 | } |
851 | 851 | $tag = $admin ? 'span' : 'div'; |
852 | - $attributes = ! empty( $wrap_id ) ? " id=\"{$wrap_id}\"" : ''; |
|
852 | + $attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : ''; |
|
853 | 853 | $wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class; |
854 | - $attributes .= ! empty( $wrap_class ) |
|
854 | + $attributes .= ! empty($wrap_class) |
|
855 | 855 | ? " class=\"{$wrap_class} powered-by-event-espresso-credit\"" |
856 | 856 | : ' class="powered-by-event-espresso-credit"'; |
857 | 857 | $query_args = array_merge( |
@@ -863,9 +863,9 @@ discard block |
||
863 | 863 | ), |
864 | 864 | $query_args |
865 | 865 | ); |
866 | - $powered_by = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso' ); |
|
867 | - $url = add_query_arg( $query_args, 'https://eventespresso.com/' ); |
|
868 | - $url = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso__url', $url ); |
|
866 | + $powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - '.EVENT_ESPRESSO_VERSION : 'Event Espresso'); |
|
867 | + $url = add_query_arg($query_args, 'https://eventespresso.com/'); |
|
868 | + $url = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url); |
|
869 | 869 | return (string) apply_filters( |
870 | 870 | 'FHEE__EEH_Template__powered_by_event_espresso__html', |
871 | 871 | sprintf( |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
898 | 898 | |
899 | 899 | |
900 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
900 | +if ( ! function_exists('espresso_pagination')) { |
|
901 | 901 | /** |
902 | 902 | * espresso_pagination |
903 | 903 | * |
@@ -909,21 +909,21 @@ discard block |
||
909 | 909 | $big = 999999999; // need an unlikely integer |
910 | 910 | $pagination = paginate_links( |
911 | 911 | array( |
912 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
912 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
913 | 913 | 'format' => '?paged=%#%', |
914 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
914 | + 'current' => max(1, get_query_var('paged')), |
|
915 | 915 | 'total' => $wp_query->max_num_pages, |
916 | 916 | 'show_all' => true, |
917 | 917 | 'end_size' => 10, |
918 | 918 | 'mid_size' => 6, |
919 | 919 | 'prev_next' => true, |
920 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
921 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
920 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
921 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
922 | 922 | 'type' => 'plain', |
923 | 923 | 'add_args' => false, |
924 | 924 | 'add_fragment' => '' |
925 | 925 | ) |
926 | 926 | ); |
927 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
927 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'NO direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | public function __construct() { |
44 | 44 | //set properties |
45 | 45 | $this->name = 'html'; |
46 | - $this->description = __( 'This messenger outputs a message to a browser for display.', 'event_espresso' ); |
|
46 | + $this->description = __('This messenger outputs a message to a browser for display.', 'event_espresso'); |
|
47 | 47 | $this->label = array( |
48 | - 'singular' => __( 'html', 'event_espresso' ), |
|
49 | - 'plural' => __( 'html', 'event_espresso' ), |
|
48 | + 'singular' => __('html', 'event_espresso'), |
|
49 | + 'plural' => __('html', 'event_espresso'), |
|
50 | 50 | ); |
51 | 51 | $this->activate_on_install = true; |
52 | 52 | // add the "powered by EE" credit link to the HTML receipt and invoice |
53 | 53 | add_filter( |
54 | 54 | 'FHEE__EE_Html_messenger___send_message__main_body', |
55 | - array( $this, 'add_powered_by_credit_link_to_receipt_and_invoice' ), |
|
55 | + array($this, 'add_powered_by_credit_link_to_receipt_and_invoice'), |
|
56 | 56 | 10, |
57 | 57 | 3 |
58 | 58 | ); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @see abstract declaration in EE_messenger for details. |
92 | 92 | */ |
93 | 93 | protected function _set_admin_pages() { |
94 | - $this->admin_registered_pages = array( 'events_edit' => true ); |
|
94 | + $this->admin_registered_pages = array('events_edit' => true); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | protected function _set_validator_config() { |
112 | 112 | $this->_validator_config = array( |
113 | 113 | 'subject' => array( |
114 | - 'shortcodes' => array( 'organization', 'primary_registration_details', 'email', 'transaction' ), |
|
114 | + 'shortcodes' => array('organization', 'primary_registration_details', 'email', 'transaction'), |
|
115 | 115 | ), |
116 | 116 | 'content' => array( |
117 | 117 | 'shortcodes' => array( |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | 'primary_registration_list', |
138 | 138 | 'event_author', |
139 | 139 | ), |
140 | - 'required' => array( '[EVENT_LIST]' ), |
|
140 | + 'required' => array('[EVENT_LIST]'), |
|
141 | 141 | ), |
142 | 142 | 'ticket_list' => array( |
143 | 143 | 'shortcodes' => array( |
@@ -148,39 +148,39 @@ discard block |
||
148 | 148 | 'line_item_list', |
149 | 149 | 'venue', |
150 | 150 | ), |
151 | - 'required' => array( '[TICKET_LIST]' ), |
|
151 | + 'required' => array('[TICKET_LIST]'), |
|
152 | 152 | ), |
153 | 153 | 'ticket_line_item_no_pms' => array( |
154 | - 'shortcodes' => array( 'line_item', 'ticket' ), |
|
155 | - 'required' => array( '[TICKET_LINE_ITEM_LIST]' ), |
|
154 | + 'shortcodes' => array('line_item', 'ticket'), |
|
155 | + 'required' => array('[TICKET_LINE_ITEM_LIST]'), |
|
156 | 156 | ), |
157 | 157 | 'ticket_line_item_pms' => array( |
158 | - 'shortcodes' => array( 'line_item', 'ticket', 'line_item_list' ), |
|
159 | - 'required' => array( '[TICKET_LINE_ITEM_LIST]' ), |
|
158 | + 'shortcodes' => array('line_item', 'ticket', 'line_item_list'), |
|
159 | + 'required' => array('[TICKET_LINE_ITEM_LIST]'), |
|
160 | 160 | ), |
161 | 161 | 'price_modifier_line_item_list' => array( |
162 | - 'shortcodes' => array( 'line_item' ), |
|
163 | - 'required' => array( '[PRICE_MODIFIER_LINE_ITEM_LIST]' ), |
|
162 | + 'shortcodes' => array('line_item'), |
|
163 | + 'required' => array('[PRICE_MODIFIER_LINE_ITEM_LIST]'), |
|
164 | 164 | ), |
165 | 165 | 'datetime_list' => array( |
166 | - 'shortcodes' => array( 'datetime' ), |
|
167 | - 'required' => array( '[DATETIME_LIST]' ), |
|
166 | + 'shortcodes' => array('datetime'), |
|
167 | + 'required' => array('[DATETIME_LIST]'), |
|
168 | 168 | ), |
169 | 169 | 'attendee_list' => array( |
170 | - 'shortcodes' => array( 'attendee' ), |
|
171 | - 'required' => array( '[ATTENDEE_LIST]' ), |
|
170 | + 'shortcodes' => array('attendee'), |
|
171 | + 'required' => array('[ATTENDEE_LIST]'), |
|
172 | 172 | ), |
173 | 173 | 'tax_line_item_list' => array( |
174 | - 'shortcodes' => array( 'line_item' ), |
|
175 | - 'required' => array( '[TAX_LINE_ITEM_LIST]' ), |
|
174 | + 'shortcodes' => array('line_item'), |
|
175 | + 'required' => array('[TAX_LINE_ITEM_LIST]'), |
|
176 | 176 | ), |
177 | 177 | 'additional_line_item_list' => array( |
178 | - 'shortcodes' => array( 'line_item' ), |
|
179 | - 'required' => array( '[ADDITIONAL_LINE_ITEM_LIST]' ), |
|
178 | + 'shortcodes' => array('line_item'), |
|
179 | + 'required' => array('[ADDITIONAL_LINE_ITEM_LIST]'), |
|
180 | 180 | ), |
181 | 181 | 'payment_list' => array( |
182 | - 'shortcodes' => array( 'payment' ), |
|
183 | - 'required' => array( '[PAYMENT_LIST_*]' ), |
|
182 | + 'shortcodes' => array('payment'), |
|
183 | + 'required' => array('[PAYMENT_LIST_*]'), |
|
184 | 184 | ), |
185 | 185 | ); |
186 | 186 | } |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | * @param string $sending_messenger_name the name of the sending messenger so we only set the hooks needed. |
197 | 197 | * @return void |
198 | 198 | */ |
199 | - public function do_secondary_messenger_hooks( $sending_messenger_name ) { |
|
200 | - if ( $sending_messenger_name = 'pdf' ) { |
|
201 | - add_filter( 'EE_messenger__get_variation__variation', array( $this, 'add_html_css' ), 10, 8 ); |
|
199 | + public function do_secondary_messenger_hooks($sending_messenger_name) { |
|
200 | + if ($sending_messenger_name = 'pdf') { |
|
201 | + add_filter('EE_messenger__get_variation__variation', array($this, 'add_html_css'), 10, 8); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function enqueue_scripts_styles() { |
249 | 249 | parent::enqueue_scripts_styles(); |
250 | - do_action( 'AHEE__EE_Html_messenger__enqueue_scripts_styles' ); |
|
250 | + do_action('AHEE__EE_Html_messenger__enqueue_scripts_styles'); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $this->_template_fields = array( |
276 | 276 | 'subject' => array( |
277 | 277 | 'input' => 'text', |
278 | - 'label' => __( 'Page Title', 'event_espresso' ), |
|
278 | + 'label' => __('Page Title', 'event_espresso'), |
|
279 | 279 | 'type' => 'string', |
280 | 280 | 'required' => true, |
281 | 281 | 'validation' => true, |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | 'content' => array( |
289 | 289 | 'main' => array( |
290 | 290 | 'input' => 'wp_editor', |
291 | - 'label' => __( 'Main Content', 'event_espresso' ), |
|
291 | + 'label' => __('Main Content', 'event_espresso'), |
|
292 | 292 | 'type' => 'string', |
293 | 293 | 'required' => true, |
294 | 294 | 'validation' => true, |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | 'validation' => true, |
304 | 304 | 'format' => '%s', |
305 | 305 | 'rows' => '15', |
306 | - 'shortcodes_required' => array( '[EVENT_LIST]' ), |
|
306 | + 'shortcodes_required' => array('[EVENT_LIST]'), |
|
307 | 307 | ), |
308 | 308 | 'ticket_list' => array( |
309 | 309 | 'input' => 'textarea', |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | 'format' => '%s', |
315 | 315 | 'css_class' => 'large-text', |
316 | 316 | 'rows' => '10', |
317 | - 'shortcodes_required' => array( '[TICKET_LIST]' ), |
|
317 | + 'shortcodes_required' => array('[TICKET_LIST]'), |
|
318 | 318 | ), |
319 | 319 | 'ticket_line_item_no_pms' => array( |
320 | 320 | 'input' => 'textarea', |
321 | - 'label' => '[TICKET_LINE_ITEM_LIST] <br>' . __( |
|
321 | + 'label' => '[TICKET_LINE_ITEM_LIST] <br>'.__( |
|
322 | 322 | 'Ticket Line Item List with no Price Modifiers', |
323 | 323 | 'event_espresso' |
324 | 324 | ), |
@@ -328,11 +328,11 @@ discard block |
||
328 | 328 | 'format' => '%s', |
329 | 329 | 'css_class' => 'large-text', |
330 | 330 | 'rows' => '5', |
331 | - 'shortcodes_required' => array( '[TICKET_LINE_ITEM_LIST]' ), |
|
331 | + 'shortcodes_required' => array('[TICKET_LINE_ITEM_LIST]'), |
|
332 | 332 | ), |
333 | 333 | 'ticket_line_item_pms' => array( |
334 | 334 | 'input' => 'textarea', |
335 | - 'label' => '[TICKET_LINE_ITEM_LIST] <br>' . __( |
|
335 | + 'label' => '[TICKET_LINE_ITEM_LIST] <br>'.__( |
|
336 | 336 | 'Ticket Line Item List with Price Modifiers', |
337 | 337 | 'event_espresso' |
338 | 338 | ), |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | 'format' => '%s', |
343 | 343 | 'css_class' => 'large-text', |
344 | 344 | 'rows' => '5', |
345 | - 'shortcodes_required' => array( '[TICKET_LINE_ITEM_LIST]' ), |
|
345 | + 'shortcodes_required' => array('[TICKET_LINE_ITEM_LIST]'), |
|
346 | 346 | ), |
347 | 347 | 'price_modifier_line_item_list' => array( |
348 | 348 | 'input' => 'textarea', |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | 'format' => '%s', |
354 | 354 | 'css_class' => 'large-text', |
355 | 355 | 'rows' => '5', |
356 | - 'shortcodes_required' => array( '[PRICE_MODIFIER_LINE_ITEM_LIST]' ), |
|
356 | + 'shortcodes_required' => array('[PRICE_MODIFIER_LINE_ITEM_LIST]'), |
|
357 | 357 | ), |
358 | 358 | 'datetime_list' => array( |
359 | 359 | 'input' => 'textarea', |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | 'format' => '%s', |
365 | 365 | 'css_class' => 'large-text', |
366 | 366 | 'rows' => '5', |
367 | - 'shortcodes_required' => array( '[DATETIME_LIST]' ), |
|
367 | + 'shortcodes_required' => array('[DATETIME_LIST]'), |
|
368 | 368 | ), |
369 | 369 | 'attendee_list' => array( |
370 | 370 | 'input' => 'textarea', |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | 'format' => '%s', |
376 | 376 | 'css_class' => 'large-text', |
377 | 377 | 'rows' => '5', |
378 | - 'shortcodes_required' => array( '[ATTENDEE_LIST]' ), |
|
378 | + 'shortcodes_required' => array('[ATTENDEE_LIST]'), |
|
379 | 379 | ), |
380 | 380 | 'tax_line_item_list' => array( |
381 | 381 | 'input' => 'textarea', |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | 'format' => '%s', |
387 | 387 | 'css_class' => 'large-text', |
388 | 388 | 'rows' => '5', |
389 | - 'shortcodes_required' => array( '[TAX_LINE_ITEM_LIST]' ), |
|
389 | + 'shortcodes_required' => array('[TAX_LINE_ITEM_LIST]'), |
|
390 | 390 | ), |
391 | 391 | 'additional_line_item_list' => array( |
392 | 392 | 'input' => 'textarea', |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | 'format' => '%s', |
398 | 398 | 'css_class' => 'large-text', |
399 | 399 | 'rows' => '5', |
400 | - 'shortcodes_required' => array( '[ADDITIONAL_LINE_ITEM_LIST]' ), |
|
400 | + 'shortcodes_required' => array('[ADDITIONAL_LINE_ITEM_LIST]'), |
|
401 | 401 | ), |
402 | 402 | 'payment_list' => array( |
403 | 403 | 'input' => 'textarea', |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | 'format' => '%s', |
409 | 409 | 'css_class' => 'large-text', |
410 | 410 | 'rows' => '5', |
411 | - 'shortcodes_required' => array( '[PAYMENT_LIST_*]' ), |
|
411 | + 'shortcodes_required' => array('[PAYMENT_LIST_*]'), |
|
412 | 412 | ), |
413 | 413 | ), |
414 | 414 | ), |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @since 4.5.0 |
423 | 423 | */ |
424 | 424 | protected function _set_default_message_types() { |
425 | - $this->_default_message_types = array( 'receipt', 'invoice' ); |
|
425 | + $this->_default_message_types = array('receipt', 'invoice'); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * @since 4.5.0 |
433 | 433 | */ |
434 | 434 | protected function _set_valid_message_types() { |
435 | - $this->_valid_message_types = array( 'receipt', 'invoice' ); |
|
435 | + $this->_valid_message_types = array('receipt', 'invoice'); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | */ |
446 | 446 | protected function _send_message() { |
447 | 447 | $this->_template_args = array( |
448 | - 'page_title' => html_entity_decode( stripslashes( $this->_subject ), ENT_QUOTES, "UTF-8" ), |
|
448 | + 'page_title' => html_entity_decode(stripslashes($this->_subject), ENT_QUOTES, "UTF-8"), |
|
449 | 449 | 'base_css' => $this->get_variation( |
450 | 450 | $this->_tmp_pack, |
451 | 451 | $this->_incoming_message_type->name, |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | ), |
484 | 484 | ); |
485 | 485 | $this->_deregister_wp_hooks(); |
486 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) ); |
|
486 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
487 | 487 | echo $this->_get_main_template(); |
488 | 488 | exit(); |
489 | 489 | } |
@@ -499,16 +499,16 @@ discard block |
||
499 | 499 | * @return void |
500 | 500 | */ |
501 | 501 | protected function _deregister_wp_hooks() { |
502 | - remove_all_actions( 'wp_head' ); |
|
503 | - remove_all_actions( 'wp_footer' ); |
|
504 | - remove_all_actions( 'wp_print_footer_scripts' ); |
|
505 | - remove_all_actions( 'wp_enqueue_scripts' ); |
|
502 | + remove_all_actions('wp_head'); |
|
503 | + remove_all_actions('wp_footer'); |
|
504 | + remove_all_actions('wp_print_footer_scripts'); |
|
505 | + remove_all_actions('wp_enqueue_scripts'); |
|
506 | 506 | global $wp_scripts, $wp_styles; |
507 | 507 | $wp_scripts = $wp_styles = array(); |
508 | 508 | //just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load. |
509 | - add_action( 'wp_footer', 'wp_print_footer_scripts' ); |
|
510 | - add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' ); |
|
511 | - add_action( 'wp_head', 'wp_enqueue_scripts' ); |
|
509 | + add_action('wp_footer', 'wp_print_footer_scripts'); |
|
510 | + add_action('wp_print_footer_scripts', '_wp_footer_scripts'); |
|
511 | + add_action('wp_head', 'wp_enqueue_scripts'); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | |
@@ -520,11 +520,11 @@ discard block |
||
520 | 520 | * @param bool $preview |
521 | 521 | * @return string |
522 | 522 | */ |
523 | - protected function _get_main_template( $preview = false ) { |
|
524 | - $wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, 'main' ); |
|
523 | + protected function _get_main_template($preview = false) { |
|
524 | + $wrapper_template = $this->_tmp_pack->get_wrapper($this->name, 'main'); |
|
525 | 525 | //include message type as a template arg |
526 | 526 | $this->_template_args['message_type'] = $this->_incoming_message_type; |
527 | - return EEH_Template::display_template( $wrapper_template, $this->_template_args, true ); |
|
527 | + return EEH_Template::display_template($wrapper_template, $this->_template_args, true); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | |
@@ -557,15 +557,15 @@ discard block |
||
557 | 557 | EE_message_type $incoming_message_type |
558 | 558 | ) { |
559 | 559 | if ( |
560 | - ( $incoming_message_type->name === 'invoice' || $incoming_message_type->name === 'receipt' ) |
|
561 | - && apply_filters( 'FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', true ) |
|
560 | + ($incoming_message_type->name === 'invoice' || $incoming_message_type->name === 'receipt') |
|
561 | + && apply_filters('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', true) |
|
562 | 562 | ) { |
563 | 563 | $content .= \EEH_Template::powered_by_event_espresso( |
564 | 564 | 'aln-cntr', |
565 | 565 | '', |
566 | - array( 'utm_content' => 'messages_system' ) |
|
566 | + array('utm_content' => 'messages_system') |
|
567 | 567 | ) |
568 | - . EEH_HTML::div( EEH_HTML::p(' ') ); |
|
568 | + . EEH_HTML::div(EEH_HTML::p(' ')); |
|
569 | 569 | } |
570 | 570 | return $content; |
571 | 571 | } |
@@ -20,81 +20,81 @@ |
||
20 | 20 | */ |
21 | 21 | class EE_Newsletter_Shortcodes extends EE_Shortcodes { |
22 | 22 | |
23 | - protected function _init_props() { |
|
24 | - $this->label = __("Batch Messages Shortcodes", 'event_espresso'); |
|
25 | - $this->description = __('All shortcodes used for the batch message type', 'event_espresso'); |
|
26 | - $this->_shortcodes = array( |
|
27 | - '[NEWSLETTER_CONTENT]' => __('This will parse to whatever is found in the related [newsletter_content] field. Note that when triggering a batch message, whatever is added for the custom message will be inserted where this shortcode is placed.', 'event_espresso') |
|
28 | - ); |
|
29 | - } |
|
23 | + protected function _init_props() { |
|
24 | + $this->label = __("Batch Messages Shortcodes", 'event_espresso'); |
|
25 | + $this->description = __('All shortcodes used for the batch message type', 'event_espresso'); |
|
26 | + $this->_shortcodes = array( |
|
27 | + '[NEWSLETTER_CONTENT]' => __('This will parse to whatever is found in the related [newsletter_content] field. Note that when triggering a batch message, whatever is added for the custom message will be inserted where this shortcode is placed.', 'event_espresso') |
|
28 | + ); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | - protected function _parser( $shortcode ) { |
|
34 | - if ( $shortcode == '[NEWSLETTER_CONTENT]' ) { |
|
35 | - $this->_validate_list_requirements(); |
|
36 | - $valid_shortcodes = array('recipient_details', 'organization'); |
|
37 | - $template = $this->_data['template']['newsletter_content']; |
|
38 | - $data = $this->_data; |
|
39 | - return $this->_shortcode_helper->parse_message_template( $template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
40 | - } |
|
41 | - } |
|
33 | + protected function _parser( $shortcode ) { |
|
34 | + if ( $shortcode == '[NEWSLETTER_CONTENT]' ) { |
|
35 | + $this->_validate_list_requirements(); |
|
36 | + $valid_shortcodes = array('recipient_details', 'organization'); |
|
37 | + $template = $this->_data['template']['newsletter_content']; |
|
38 | + $data = $this->_data; |
|
39 | + return $this->_shortcode_helper->parse_message_template( $template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
40 | + } |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * Callback set in args for EE_Register_Messages_Shortcode_Library::register for 'msgr_validator_callback'. |
|
46 | - * |
|
47 | - * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
48 | - * 'FHEE__EE_messenger__get_validator_config' filter. |
|
49 | - * |
|
50 | - * @since 4.3.0 |
|
51 | - * @param array $validator_config current validator configuration array |
|
52 | - * @param EE_messenger $messenger |
|
53 | - * @return array new validator config. |
|
54 | - */ |
|
55 | - public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) { |
|
56 | - if ( $messenger->name !== 'email' ) |
|
57 | - return $validator_config; |
|
44 | + /** |
|
45 | + * Callback set in args for EE_Register_Messages_Shortcode_Library::register for 'msgr_validator_callback'. |
|
46 | + * |
|
47 | + * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
48 | + * 'FHEE__EE_messenger__get_validator_config' filter. |
|
49 | + * |
|
50 | + * @since 4.3.0 |
|
51 | + * @param array $validator_config current validator configuration array |
|
52 | + * @param EE_messenger $messenger |
|
53 | + * @return array new validator config. |
|
54 | + */ |
|
55 | + public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) { |
|
56 | + if ( $messenger->name !== 'email' ) |
|
57 | + return $validator_config; |
|
58 | 58 | |
59 | - $validator_config['content']['shortcodes'][] = 'newsletter'; |
|
60 | - $validator_config['newsletter_content'] = array( |
|
61 | - 'shortcodes' => array('recipient_details', 'organization'), |
|
62 | - 'required' => array('[NEWSLETTER_CONTENT]') |
|
63 | - ); |
|
64 | - return $validator_config; |
|
65 | - } |
|
59 | + $validator_config['content']['shortcodes'][] = 'newsletter'; |
|
60 | + $validator_config['newsletter_content'] = array( |
|
61 | + 'shortcodes' => array('recipient_details', 'organization'), |
|
62 | + 'required' => array('[NEWSLETTER_CONTENT]') |
|
63 | + ); |
|
64 | + return $validator_config; |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | - /** |
|
71 | - * Callback set in args for EE_Register_Messages_Shortcode_Library::register for |
|
72 | - * 'msgr_template_fields_callback'. |
|
73 | - * |
|
74 | - * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
75 | - * FHEE__EE_messenger__get_template_fields filter. |
|
76 | - * |
|
77 | - * @since 4.3.0 |
|
78 | - * |
|
79 | - * @param array $template_fields current template fields setup array. |
|
80 | - * @param EE_messenger $messenger |
|
81 | - * @return array new/modified template fields array. |
|
82 | - */ |
|
83 | - public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) { |
|
84 | - if ( $messenger->name !== 'email' ) |
|
85 | - return $template_fields; |
|
70 | + /** |
|
71 | + * Callback set in args for EE_Register_Messages_Shortcode_Library::register for |
|
72 | + * 'msgr_template_fields_callback'. |
|
73 | + * |
|
74 | + * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
75 | + * FHEE__EE_messenger__get_template_fields filter. |
|
76 | + * |
|
77 | + * @since 4.3.0 |
|
78 | + * |
|
79 | + * @param array $template_fields current template fields setup array. |
|
80 | + * @param EE_messenger $messenger |
|
81 | + * @return array new/modified template fields array. |
|
82 | + */ |
|
83 | + public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) { |
|
84 | + if ( $messenger->name !== 'email' ) |
|
85 | + return $template_fields; |
|
86 | 86 | |
87 | - $template_fields['extra']['content']['newsletter_content'] = array( |
|
88 | - 'input' => 'wp_editor', |
|
89 | - 'label' => '[NEWSLETTER_CONTENT]', |
|
90 | - 'type' => 'string', |
|
91 | - 'required' => TRUE, |
|
92 | - 'validation' => TRUE, |
|
93 | - 'format' => '%s', |
|
94 | - 'rows' => '15', |
|
95 | - 'shortcodes_required' => array('[NEWSLETTER_CONTENT]') |
|
96 | - ); |
|
97 | - return $template_fields; |
|
98 | - } |
|
87 | + $template_fields['extra']['content']['newsletter_content'] = array( |
|
88 | + 'input' => 'wp_editor', |
|
89 | + 'label' => '[NEWSLETTER_CONTENT]', |
|
90 | + 'type' => 'string', |
|
91 | + 'required' => TRUE, |
|
92 | + 'validation' => TRUE, |
|
93 | + 'format' => '%s', |
|
94 | + 'rows' => '15', |
|
95 | + 'shortcodes_required' => array('[NEWSLETTER_CONTENT]') |
|
96 | + ); |
|
97 | + return $template_fields; |
|
98 | + } |
|
99 | 99 | |
100 | 100 | } //end class EE_Newsletter_Shortcodes |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct() { |
24 | 24 | $this->name = 'newsletter'; |
25 | - $this->description = __( 'Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.', 'event_espresso' ); |
|
25 | + $this->description = __('Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.', 'event_espresso'); |
|
26 | 26 | $this->label = array( |
27 | - 'singular' => __( 'batch', 'event_espresso' ), |
|
28 | - 'plural' => __( 'batches', 'event_espresso' ) |
|
27 | + 'singular' => __('batch', 'event_espresso'), |
|
28 | + 'plural' => __('batches', 'event_espresso') |
|
29 | 29 | ); |
30 | 30 | $this->_master_templates = array( |
31 | 31 | 'email' => 'registration', |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
52 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) { |
|
53 | 53 | //newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects. |
54 | - return array( $registration ); |
|
54 | + return array($registration); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | |
65 | 65 | protected function _set_contexts() { |
66 | 66 | $this->_context_label = array( |
67 | - 'label' => __( 'recipient', 'event_espresso' ), |
|
68 | - 'plural' => __( 'recipients', 'event_espresso' ), |
|
69 | - 'description' => __( 'Recipient\'s are who will receive the message.', 'event_espresso' ) |
|
67 | + 'label' => __('recipient', 'event_espresso'), |
|
68 | + 'plural' => __('recipients', 'event_espresso'), |
|
69 | + 'description' => __('Recipient\'s are who will receive the message.', 'event_espresso') |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $this->_contexts = array( |
73 | 73 | 'attendee' => array( |
74 | - 'label' => __( 'Registrant', 'event_espresso' ), |
|
75 | - 'description' => __( 'This template goes to selected registrants.', 'event_espresso' ) |
|
74 | + 'label' => __('Registrant', 'event_espresso'), |
|
75 | + 'description' => __('This template goes to selected registrants.', 'event_espresso') |
|
76 | 76 | ) |
77 | 77 | ); |
78 | 78 | } |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | 'newsletter', |
99 | 99 | ); |
100 | 100 | |
101 | - foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
102 | - foreach ( $shortcodes as $key => $shortcode ) { |
|
103 | - if ( ! in_array( $shortcode, $included_shortcodes ) ) { |
|
104 | - unset( $this->_valid_shortcodes[ $context ][ $key ] ); |
|
101 | + foreach ($this->_valid_shortcodes as $context => $shortcodes) { |
|
102 | + foreach ($shortcodes as $key => $shortcode) { |
|
103 | + if ( ! in_array($shortcode, $included_shortcodes)) { |
|
104 | + unset($this->_valid_shortcodes[$context][$key]); |
|
105 | 105 | } |
106 | 106 | } |
107 | - $this->_valid_shortcodes[ $context ][] = 'newsletter'; |
|
107 | + $this->_valid_shortcodes[$context][] = 'newsletter'; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | } |
@@ -118,44 +118,44 @@ discard block |
||
118 | 118 | $addressee = array(); |
119 | 119 | |
120 | 120 | //looping through registrations |
121 | - foreach ( $this->_data->registrations as $reg_id => $details ) { |
|
121 | + foreach ($this->_data->registrations as $reg_id => $details) { |
|
122 | 122 | //set $attendee array to blank on each loop |
123 | 123 | $aee = array(); |
124 | 124 | |
125 | 125 | //need to get the attendee from this registration. |
126 | - $attendee = isset( $details['att_obj'] ) && $details['att_obj'] instanceof EE_Attendee |
|
126 | + $attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee |
|
127 | 127 | ? $details['att_obj'] |
128 | 128 | : null; |
129 | 129 | |
130 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
130 | + if ( ! $attendee instanceof EE_Attendee) { |
|
131 | 131 | continue; |
132 | 132 | } |
133 | 133 | |
134 | 134 | //set $aee from attendee object |
135 | 135 | $aee['att_obj'] = $attendee; |
136 | - $aee['reg_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['reg_objs'] ) |
|
137 | - ? $this->_data->attendees[ $attendee->ID() ]['reg_objs'] |
|
136 | + $aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs']) |
|
137 | + ? $this->_data->attendees[$attendee->ID()]['reg_objs'] |
|
138 | 138 | : array(); |
139 | 139 | $aee['attendee_email'] = $attendee->email(); |
140 | - $aee['tkt_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] ) |
|
141 | - ? $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] |
|
140 | + $aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs']) |
|
141 | + ? $this->_data->attendees[$attendee->ID()]['tkt_objs'] |
|
142 | 142 | : array(); |
143 | 143 | |
144 | - if ( isset( $this->_data->attendees[ $attendee->ID() ]['evt_objs'] ) ) { |
|
145 | - $aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
146 | - $aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
144 | + if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) { |
|
145 | + $aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs']; |
|
146 | + $aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs']; |
|
147 | 147 | } else { |
148 | 148 | $aee['evt_objs'] = $aee['events'] = array(); |
149 | 149 | } |
150 | 150 | |
151 | - $aee['reg_obj'] = isset( $details['reg_obj'] ) |
|
151 | + $aee['reg_obj'] = isset($details['reg_obj']) |
|
152 | 152 | ? $details['reg_obj'] |
153 | 153 | : null; |
154 | 154 | $aee['attendees'] = $this->_data->attendees; |
155 | 155 | |
156 | 156 | //merge in the primary attendee data |
157 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
158 | - $addressee[] = new EE_Messages_Addressee( $aee ); |
|
157 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
158 | + $addressee[] = new EE_Messages_Addressee($aee); |
|
159 | 159 | } |
160 | 160 | return $addressee; |
161 | 161 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | - {exit('NO direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
2 | + {exit('NO direct script access allowed'); } |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | /** |
75 | 75 | * @param bool $routing |
76 | 76 | */ |
77 | - public function __construct( $routing = true ) { |
|
77 | + public function __construct($routing = true) { |
|
78 | 78 | //make sure messages autoloader is running |
79 | 79 | EED_Messages::set_autoloaders(); |
80 | - parent::__construct( $routing ); |
|
80 | + parent::__construct($routing); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array(); |
93 | 93 | |
94 | - $this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : null; |
|
94 | + $this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : null; |
|
95 | 95 | $this->_load_message_resource_manager(); |
96 | 96 | } |
97 | 97 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @throws EE_Error |
106 | 106 | */ |
107 | 107 | protected function _load_message_resource_manager() { |
108 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
108 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -116,21 +116,21 @@ discard block |
||
116 | 116 | public function get_messengers_for_list_table() { |
117 | 117 | EE_Error::doing_it_wrong( |
118 | 118 | __METHOD__, |
119 | - __( 'This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
119 | + __('This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
120 | 120 | values for use in creating a messenger filter dropdown which is now generated differently via |
121 | - Messages_Admin_Page::get_messengers_select_input', 'event_espresso' ), |
|
121 | + Messages_Admin_Page::get_messengers_select_input', 'event_espresso'), |
|
122 | 122 | '4.9.9.rc.014' |
123 | 123 | ); |
124 | 124 | |
125 | 125 | $m_values = array(); |
126 | - $active_messengers = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) ); |
|
126 | + $active_messengers = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger')); |
|
127 | 127 | //setup messengers for selects |
128 | 128 | $i = 1; |
129 | - foreach ( $active_messengers as $active_messenger ) { |
|
130 | - if ( $active_messenger instanceof EE_Message ) { |
|
131 | - $m_values[ $i ]['id'] = $active_messenger->messenger(); |
|
132 | - $m_values[ $i ]['text'] = ucwords( $active_messenger->messenger_label() ); |
|
133 | - $i ++; |
|
129 | + foreach ($active_messengers as $active_messenger) { |
|
130 | + if ($active_messenger instanceof EE_Message) { |
|
131 | + $m_values[$i]['id'] = $active_messenger->messenger(); |
|
132 | + $m_values[$i]['text'] = ucwords($active_messenger->messenger_label()); |
|
133 | + $i++; |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | return $m_values; |
@@ -144,20 +144,20 @@ discard block |
||
144 | 144 | public function get_message_types_for_list_table() { |
145 | 145 | EE_Error::doing_it_wrong( |
146 | 146 | __METHOD__, |
147 | - __( 'This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
147 | + __('This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
148 | 148 | values for use in creating a message type filter dropdown which is now generated differently via |
149 | - Messages_Admin_Page::get_message_types_select_input', 'event_espresso' ), |
|
149 | + Messages_Admin_Page::get_message_types_select_input', 'event_espresso'), |
|
150 | 150 | '4.9.9.rc.014' |
151 | 151 | ); |
152 | 152 | |
153 | 153 | $mt_values = array(); |
154 | - $active_messages = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) ); |
|
154 | + $active_messages = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type')); |
|
155 | 155 | $i = 1; |
156 | - foreach ( $active_messages as $active_message ) { |
|
157 | - if ( $active_message instanceof EE_Message ) { |
|
158 | - $mt_values[ $i ]['id'] = $active_message->message_type(); |
|
159 | - $mt_values[ $i ]['text'] = ucwords( $active_message->message_type_label() ); |
|
160 | - $i ++; |
|
156 | + foreach ($active_messages as $active_message) { |
|
157 | + if ($active_message instanceof EE_Message) { |
|
158 | + $mt_values[$i]['id'] = $active_message->message_type(); |
|
159 | + $mt_values[$i]['text'] = ucwords($active_message->message_type_label()); |
|
160 | + $i++; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | return $mt_values; |
@@ -171,21 +171,21 @@ discard block |
||
171 | 171 | public function get_contexts_for_message_types_for_list_table() { |
172 | 172 | EE_Error::doing_it_wrong( |
173 | 173 | __METHOD__, |
174 | - __( 'This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
174 | + __('This method is no longer in use. There is no replacement for it. The method was used to generate a set of |
|
175 | 175 | values for use in creating a message type context filter dropdown which is now generated differently via |
176 | - Messages_Admin_Page::get_contexts_for_message_types_select_input', 'event_espresso' ), |
|
176 | + Messages_Admin_Page::get_contexts_for_message_types_select_input', 'event_espresso'), |
|
177 | 177 | '4.9.9.rc.014' |
178 | 178 | ); |
179 | 179 | |
180 | 180 | $contexts = array(); |
181 | - $active_message_contexts = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) ); |
|
182 | - foreach ( $active_message_contexts as $active_message ) { |
|
183 | - if ( $active_message instanceof EE_Message ) { |
|
181 | + $active_message_contexts = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context')); |
|
182 | + foreach ($active_message_contexts as $active_message) { |
|
183 | + if ($active_message instanceof EE_Message) { |
|
184 | 184 | $message_type = $active_message->message_type_object(); |
185 | - if ( $message_type instanceof EE_message_type ) { |
|
185 | + if ($message_type instanceof EE_message_type) { |
|
186 | 186 | $message_type_contexts = $message_type->get_contexts(); |
187 | - foreach ( $message_type_contexts as $context => $context_details ) { |
|
188 | - $contexts[ $context ] = $context_details['label']; |
|
187 | + foreach ($message_type_contexts as $context => $context_details) { |
|
188 | + $contexts[$context] = $context_details['label']; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
@@ -201,17 +201,17 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return string |
203 | 203 | */ |
204 | - public function get_messengers_select_input( $messenger_options ) { |
|
204 | + public function get_messengers_select_input($messenger_options) { |
|
205 | 205 | //if empty or just one value then just return an empty string |
206 | - if ( empty( $messenger_options ) |
|
207 | - || ! is_array( $messenger_options ) |
|
208 | - || count( $messenger_options ) === 1 |
|
206 | + if (empty($messenger_options) |
|
207 | + || ! is_array($messenger_options) |
|
208 | + || count($messenger_options) === 1 |
|
209 | 209 | ) { |
210 | 210 | return ''; |
211 | 211 | } |
212 | 212 | //merge in default |
213 | 213 | $messenger_options = array_merge( |
214 | - array( 'none_selected' => __( 'Show All Messengers', 'event_espresso' ) ), |
|
214 | + array('none_selected' => __('Show All Messengers', 'event_espresso')), |
|
215 | 215 | $messenger_options |
216 | 216 | ); |
217 | 217 | $input = new EE_Select_Input( |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | 'html_name' => 'ee_messenger_filter_by', |
221 | 221 | 'html_id' => 'ee_messenger_filter_by', |
222 | 222 | 'html_class' => 'wide', |
223 | - 'default' => isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
224 | - ? sanitize_title( $this->_req_data['ee_messenger_filter_by'] ) |
|
223 | + 'default' => isset($this->_req_data['ee_messenger_filter_by']) |
|
224 | + ? sanitize_title($this->_req_data['ee_messenger_filter_by']) |
|
225 | 225 | : 'none_selected' |
226 | 226 | ) |
227 | 227 | ); |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return string |
239 | 239 | */ |
240 | - public function get_message_types_select_input( $message_type_options ) { |
|
240 | + public function get_message_types_select_input($message_type_options) { |
|
241 | 241 | //if empty or count of options is 1 then just return an empty string |
242 | - if ( empty( $message_type_options ) |
|
243 | - || ! is_array( $message_type_options ) |
|
244 | - || count( $message_type_options ) === 1 |
|
242 | + if (empty($message_type_options) |
|
243 | + || ! is_array($message_type_options) |
|
244 | + || count($message_type_options) === 1 |
|
245 | 245 | ) { |
246 | 246 | return ''; |
247 | 247 | } |
248 | 248 | //merge in default |
249 | 249 | $message_type_options = array_merge( |
250 | - array( 'none_selected' => __( 'Show All Message Types', 'event_espresso' ) ), |
|
250 | + array('none_selected' => __('Show All Message Types', 'event_espresso')), |
|
251 | 251 | $message_type_options |
252 | 252 | ); |
253 | 253 | $input = new EE_Select_Input( |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | 'html_name' => 'ee_message_type_filter_by', |
257 | 257 | 'html_id' => 'ee_message_type_filter_by', |
258 | 258 | 'html_class' => 'wide', |
259 | - 'default' => isset( $this->_req_data['ee_message_type_filter_by'] ) |
|
260 | - ? sanitize_title( $this->_req_data['ee_message_type_filter_by'] ) |
|
259 | + 'default' => isset($this->_req_data['ee_message_type_filter_by']) |
|
260 | + ? sanitize_title($this->_req_data['ee_message_type_filter_by']) |
|
261 | 261 | : 'none_selected', |
262 | 262 | ) |
263 | 263 | ); |
@@ -273,17 +273,17 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return string |
275 | 275 | */ |
276 | - public function get_contexts_for_message_types_select_input( $context_options ) { |
|
276 | + public function get_contexts_for_message_types_select_input($context_options) { |
|
277 | 277 | //if empty or count of options is one then just return empty string |
278 | - if ( empty( $context_options ) |
|
279 | - || ! is_array( $context_options ) |
|
280 | - || count( $context_options ) === 1 |
|
278 | + if (empty($context_options) |
|
279 | + || ! is_array($context_options) |
|
280 | + || count($context_options) === 1 |
|
281 | 281 | ) { |
282 | 282 | return ''; |
283 | 283 | } |
284 | 284 | //merge in default |
285 | 285 | $context_options = array_merge( |
286 | - array( 'none_selected' => __( 'Show all Contexts', 'event_espresso' ) ), |
|
286 | + array('none_selected' => __('Show all Contexts', 'event_espresso')), |
|
287 | 287 | $context_options |
288 | 288 | ); |
289 | 289 | $input = new EE_Select_Input( |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | 'html_name' => 'ee_context_filter_by', |
293 | 293 | 'html_id' => 'ee_context_filter_by', |
294 | 294 | 'html_class' => 'wide', |
295 | - 'default' => isset( $this->_req_data['ee_context_filter_by'] ) |
|
296 | - ? sanitize_title( $this->_req_data['ee_context_filter_by'] ) |
|
295 | + 'default' => isset($this->_req_data['ee_context_filter_by']) |
|
296 | + ? sanitize_title($this->_req_data['ee_context_filter_by']) |
|
297 | 297 | : 'none_selected', |
298 | 298 | ) |
299 | 299 | ); |
@@ -303,11 +303,11 @@ discard block |
||
303 | 303 | |
304 | 304 | |
305 | 305 | protected function _ajax_hooks() { |
306 | - add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) ); |
|
307 | - add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') ); |
|
308 | - add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') ); |
|
309 | - add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) ); |
|
310 | - add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) ); |
|
306 | + add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle')); |
|
307 | + add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle')); |
|
308 | + add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings')); |
|
309 | + add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form')); |
|
310 | + add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack')); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | * @return void |
340 | 340 | */ |
341 | 341 | protected function _set_page_routes() { |
342 | - $grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) |
|
342 | + $grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) |
|
343 | 343 | ? $this->_req_data['GRP_ID'] |
344 | 344 | : 0; |
345 | - $grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) |
|
345 | + $grp_id = empty($grp_id) && ! empty($this->_req_data['id']) |
|
346 | 346 | ? $this->_req_data['id'] |
347 | 347 | : $grp_id; |
348 | - $msg_id = ! empty( $this->_req_data['MSG_ID'] ) && ! is_array( $this->_req_data['MSG_ID'] ) |
|
348 | + $msg_id = ! empty($this->_req_data['MSG_ID']) && ! is_array($this->_req_data['MSG_ID']) |
|
349 | 349 | ? $this->_req_data['MSG_ID'] |
350 | 350 | : 0; |
351 | 351 | |
@@ -387,35 +387,35 @@ discard block |
||
387 | 387 | 'insert_message_template' => array( |
388 | 388 | 'func' => '_insert_or_update_message_template', |
389 | 389 | 'capability' => 'ee_edit_messages', |
390 | - 'args' => array( 'new_template' => true ), |
|
390 | + 'args' => array('new_template' => true), |
|
391 | 391 | 'noheader' => true |
392 | 392 | ), |
393 | 393 | 'update_message_template' => array( |
394 | 394 | 'func' => '_insert_or_update_message_template', |
395 | 395 | 'capability' => 'ee_edit_message', |
396 | 396 | 'obj_id' => $grp_id, |
397 | - 'args' => array( 'new_template' => false ), |
|
397 | + 'args' => array('new_template' => false), |
|
398 | 398 | 'noheader' => true |
399 | 399 | ), |
400 | 400 | 'trash_message_template' => array( |
401 | 401 | 'func' => '_trash_or_restore_message_template', |
402 | 402 | 'capability' => 'ee_delete_message', |
403 | 403 | 'obj_id' => $grp_id, |
404 | - 'args' => array( 'trash' => true, 'all' => true ), |
|
404 | + 'args' => array('trash' => true, 'all' => true), |
|
405 | 405 | 'noheader' => true |
406 | 406 | ), |
407 | 407 | 'trash_message_template_context' => array( |
408 | 408 | 'func' => '_trash_or_restore_message_template', |
409 | 409 | 'capability' => 'ee_delete_message', |
410 | 410 | 'obj_id' => $grp_id, |
411 | - 'args' => array( 'trash' => true ), |
|
411 | + 'args' => array('trash' => true), |
|
412 | 412 | 'noheader' => true |
413 | 413 | ), |
414 | 414 | 'restore_message_template' => array( |
415 | 415 | 'func' => '_trash_or_restore_message_template', |
416 | 416 | 'capability' => 'ee_delete_message', |
417 | 417 | 'obj_id' => $grp_id, |
418 | - 'args' => array( 'trash' => false, 'all' => true ), |
|
418 | + 'args' => array('trash' => false, 'all' => true), |
|
419 | 419 | 'noheader' => true |
420 | 420 | ), |
421 | 421 | 'restore_message_template_context' => array( |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | 'filename' => 'messages_overview_other', |
535 | 535 | ), |
536 | 536 | ), |
537 | - 'help_tour' => array( 'Messages_Overview_Help_Tour' ), |
|
537 | + 'help_tour' => array('Messages_Overview_Help_Tour'), |
|
538 | 538 | 'require_nonce' => false |
539 | 539 | ), |
540 | 540 | 'custom_mtps' => array( |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | ), |
570 | 570 | 'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'), |
571 | 571 | 'has_metaboxes' => true, |
572 | - 'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ), |
|
572 | + 'help_tour' => array('Message_Templates_Edit_Help_Tour'), |
|
573 | 573 | 'help_tabs' => array( |
574 | 574 | 'edit_message_template' => array( |
575 | 575 | 'title' => __('Message Template Editor', 'event_espresso'), |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | 'filename' => 'messages_settings_messengers' |
626 | 626 | ), |
627 | 627 | ), |
628 | - 'help_tour' => array( 'Messages_Settings_Help_Tour' ), |
|
628 | + 'help_tour' => array('Messages_Settings_Help_Tour'), |
|
629 | 629 | 'require_nonce' => false |
630 | 630 | ) |
631 | 631 | ); |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | |
659 | 659 | |
660 | 660 | protected function _add_screen_options_default() { |
661 | - $this->_admin_page_title = __( 'Message Activity', 'event_espresso' ); |
|
661 | + $this->_admin_page_title = __('Message Activity', 'event_espresso'); |
|
662 | 662 | $this->_per_page_screen_option(); |
663 | 663 | } |
664 | 664 | |
@@ -680,37 +680,37 @@ discard block |
||
680 | 680 | |
681 | 681 | |
682 | 682 | public function messages_help_tab() { |
683 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php' ); |
|
683 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php'); |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | |
687 | 687 | public function messengers_help_tab() { |
688 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php' ); |
|
688 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php'); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | |
692 | 692 | public function message_types_help_tab() { |
693 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php' ); |
|
693 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php'); |
|
694 | 694 | } |
695 | 695 | |
696 | 696 | |
697 | 697 | public function messages_overview_help_tab() { |
698 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php' ); |
|
698 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php'); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | |
702 | 702 | public function message_templates_help_tab() { |
703 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php' ); |
|
703 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php'); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | |
707 | 707 | public function edit_message_template_help_tab() { |
708 | - $args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />'; |
|
709 | - $args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />'; |
|
710 | - $args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />'; |
|
711 | - $args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />'; |
|
712 | - $args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />'; |
|
713 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php', $args); |
|
708 | + $args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />'; |
|
709 | + $args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />'; |
|
710 | + $args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />'; |
|
711 | + $args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />'; |
|
712 | + $args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />'; |
|
713 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php', $args); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | |
@@ -718,22 +718,22 @@ discard block |
||
718 | 718 | public function message_template_shortcodes_help_tab() { |
719 | 719 | $this->_set_shortcodes(); |
720 | 720 | $args['shortcodes'] = $this->_shortcodes; |
721 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php', $args ); |
|
721 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php', $args); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
725 | 725 | |
726 | 726 | public function preview_message_help_tab() { |
727 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php' ); |
|
727 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php'); |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | |
731 | 731 | public function settings_help_tab() { |
732 | - $args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'; |
|
733 | - $args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'; |
|
732 | + $args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />'; |
|
733 | + $args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />'; |
|
734 | 734 | $args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>'; |
735 | 735 | $args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>'; |
736 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php', $args); |
|
736 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php', $args); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | |
@@ -741,31 +741,31 @@ discard block |
||
741 | 741 | |
742 | 742 | |
743 | 743 | public function load_scripts_styles() { |
744 | - wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION ); |
|
744 | + wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION); |
|
745 | 745 | wp_enqueue_style('espresso_ee_msg'); |
746 | 746 | |
747 | - wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true ); |
|
748 | - wp_register_script( 'ee-msg-list-table-js', EE_MSG_ASSETS_URL. 'ee_message_admin_list_table.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION ); |
|
747 | + wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true); |
|
748 | + wp_register_script('ee-msg-list-table-js', EE_MSG_ASSETS_URL.'ee_message_admin_list_table.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION); |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | |
752 | 752 | |
753 | 753 | public function load_scripts_styles_default() { |
754 | - wp_enqueue_script( 'ee-msg-list-table-js' ); |
|
754 | + wp_enqueue_script('ee-msg-list-table-js'); |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | |
758 | 758 | |
759 | 759 | |
760 | 760 | |
761 | - public function wp_editor_css( $mce_css ) { |
|
761 | + public function wp_editor_css($mce_css) { |
|
762 | 762 | //if we're on the edit_message_template route |
763 | - if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger ) { |
|
763 | + if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) { |
|
764 | 764 | $message_type_name = $this->_active_message_type_name; |
765 | 765 | |
766 | 766 | //we're going to REPLACE the existing mce css |
767 | 767 | //we need to get the css file location from the active messenger |
768 | - $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation ); |
|
768 | + $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | return $mce_css; |
@@ -783,15 +783,15 @@ discard block |
||
783 | 783 | $this->_message_template_group->messenger_obj()->label['singular'], |
784 | 784 | $this->_message_template_group->message_type_obj()->label['singular'] |
785 | 785 | ); |
786 | - EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded. Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' ); |
|
786 | + EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded. Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso'); |
|
787 | 787 | |
788 | - wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION ); |
|
788 | + wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION); |
|
789 | 789 | |
790 | 790 | wp_enqueue_script('ee_admin_js'); |
791 | 791 | wp_enqueue_script('ee_msgs_edit_js'); |
792 | 792 | |
793 | 793 | //add in special css for tiny_mce |
794 | - add_filter( 'mce_css', array( $this, 'wp_editor_css' ) ); |
|
794 | + add_filter('mce_css', array($this, 'wp_editor_css')); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | |
@@ -800,22 +800,22 @@ discard block |
||
800 | 800 | |
801 | 801 | $this->_set_message_template_group(); |
802 | 802 | |
803 | - if ( isset( $this->_req_data['messenger'] ) ) { |
|
804 | - $this->_active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
803 | + if (isset($this->_req_data['messenger'])) { |
|
804 | + $this->_active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
805 | 805 | } |
806 | 806 | |
807 | - $message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : ''; |
|
807 | + $message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : ''; |
|
808 | 808 | |
809 | 809 | |
810 | - wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, true, 'preview', $this->_variation ) ); |
|
810 | + wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'preview', $this->_variation)); |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | |
814 | 814 | |
815 | 815 | public function load_scripts_styles_settings() { |
816 | - wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION ); |
|
817 | - wp_enqueue_style( 'ee-text-links' ); |
|
818 | - wp_enqueue_style( 'ee-message-settings' ); |
|
816 | + wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION); |
|
817 | + wp_enqueue_style('ee-text-links'); |
|
818 | + wp_enqueue_style('ee-message-settings'); |
|
819 | 819 | |
820 | 820 | wp_enqueue_script('ee-messages-settings'); |
821 | 821 | } |
@@ -845,40 +845,40 @@ discard block |
||
845 | 845 | * set views array for message queue list table |
846 | 846 | */ |
847 | 847 | public function _set_list_table_views_default() { |
848 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
848 | + EE_Registry::instance()->load_helper('Template'); |
|
849 | 849 | |
850 | - $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' ) |
|
850 | + $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'message_list_table_bulk_actions') |
|
851 | 851 | ? array( |
852 | - 'generate_now' => __( 'Generate Now', 'event_espresso' ), |
|
853 | - 'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ), |
|
854 | - 'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ), |
|
855 | - 'send_now' => __( 'Send Now', 'event_espresso' ) |
|
852 | + 'generate_now' => __('Generate Now', 'event_espresso'), |
|
853 | + 'generate_and_send_now' => __('Generate and Send Now', 'event_espresso'), |
|
854 | + 'queue_for_resending' => __('Queue for Resending', 'event_espresso'), |
|
855 | + 'send_now' => __('Send Now', 'event_espresso') |
|
856 | 856 | ) |
857 | 857 | : array(); |
858 | 858 | |
859 | - $delete_bulk_action = EE_Registry::instance()->CAP->current_user_can( 'ee_delete_messages', 'message_list_table_bulk_actions' ) |
|
860 | - ? array( 'delete_ee_messages' => __( 'Delete Messages', 'event_espresso' ) ) |
|
859 | + $delete_bulk_action = EE_Registry::instance()->CAP->current_user_can('ee_delete_messages', 'message_list_table_bulk_actions') |
|
860 | + ? array('delete_ee_messages' => __('Delete Messages', 'event_espresso')) |
|
861 | 861 | : array(); |
862 | 862 | |
863 | 863 | |
864 | 864 | $this->_views = array( |
865 | 865 | 'all' => array( |
866 | 866 | 'slug' => 'all', |
867 | - 'label' => __( 'All', 'event_espresso' ), |
|
867 | + 'label' => __('All', 'event_espresso'), |
|
868 | 868 | 'count' => 0, |
869 | - 'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action ) |
|
869 | + 'bulk_action' => array_merge($common_bulk_actions, $delete_bulk_action) |
|
870 | 870 | ) |
871 | 871 | ); |
872 | 872 | |
873 | 873 | |
874 | - foreach ( EEM_Message::instance()->all_statuses() as $status ) { |
|
875 | - if ( $status === EEM_Message::status_debug_only && ! EEM_Message::debug() ) { |
|
874 | + foreach (EEM_Message::instance()->all_statuses() as $status) { |
|
875 | + if ($status === EEM_Message::status_debug_only && ! EEM_Message::debug()) { |
|
876 | 876 | continue; |
877 | 877 | } |
878 | 878 | $status_bulk_actions = $common_bulk_actions; |
879 | 879 | //unset bulk actions not applying to status |
880 | - if ( ! empty( $status_bulk_actions ) ) { |
|
881 | - switch ( $status ) { |
|
880 | + if ( ! empty($status_bulk_actions)) { |
|
881 | + switch ($status) { |
|
882 | 882 | case EEM_Message::status_idle : |
883 | 883 | case EEM_Message::status_resend : |
884 | 884 | $status_bulk_actions['send_now'] = $common_bulk_actions['send_now']; |
@@ -890,21 +890,21 @@ discard block |
||
890 | 890 | break; |
891 | 891 | |
892 | 892 | case EEM_Message::status_incomplete : |
893 | - unset( $status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now'] ); |
|
893 | + unset($status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now']); |
|
894 | 894 | break; |
895 | 895 | |
896 | 896 | case EEM_Message::status_retry : |
897 | 897 | case EEM_Message::status_sent : |
898 | - unset( $status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now'] ); |
|
898 | + unset($status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now']); |
|
899 | 899 | break; |
900 | 900 | } |
901 | 901 | } |
902 | 902 | |
903 | - $this->_views[ strtolower( $status ) ] = array( |
|
904 | - 'slug' => strtolower( $status ), |
|
905 | - 'label' => EEH_Template::pretty_status( $status, false, 'sentence' ), |
|
903 | + $this->_views[strtolower($status)] = array( |
|
904 | + 'slug' => strtolower($status), |
|
905 | + 'label' => EEH_Template::pretty_status($status, false, 'sentence'), |
|
906 | 906 | 'count' => 0, |
907 | - 'bulk_action' => array_merge( $status_bulk_actions, $delete_bulk_action ) |
|
907 | + 'bulk_action' => array_merge($status_bulk_actions, $delete_bulk_action) |
|
908 | 908 | ); |
909 | 909 | } |
910 | 910 | } |
@@ -923,8 +923,8 @@ discard block |
||
923 | 923 | protected function _message_queue_list_table() { |
924 | 924 | $this->_search_btn_label = __('Message Activity', 'event_espresso'); |
925 | 925 | $this->_template_args['per_column'] = 6; |
926 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_message_legend_items() ); |
|
927 | - $this->_template_args['before_list_table'] = '<h3>' . EEM_Message::instance()->get_pretty_label_for_results() . '</h3>'; |
|
926 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_message_legend_items()); |
|
927 | + $this->_template_args['before_list_table'] = '<h3>'.EEM_Message::instance()->get_pretty_label_for_results().'</h3>'; |
|
928 | 928 | $this->display_admin_list_table_page_with_no_sidebar(); |
929 | 929 | } |
930 | 930 | |
@@ -937,8 +937,8 @@ discard block |
||
937 | 937 | $action_css_classes = EEH_MSG_Template::get_message_action_icons(); |
938 | 938 | $action_items = array(); |
939 | 939 | |
940 | - foreach( $action_css_classes as $action_item => $action_details ) { |
|
941 | - if ( $action_item === 'see_notifications_for' ) { |
|
940 | + foreach ($action_css_classes as $action_item => $action_details) { |
|
941 | + if ($action_item === 'see_notifications_for') { |
|
942 | 942 | continue; |
943 | 943 | } |
944 | 944 | $action_items[$action_item] = array( |
@@ -950,37 +950,37 @@ discard block |
||
950 | 950 | /** @type array $status_items status legend setup*/ |
951 | 951 | $status_items = array( |
952 | 952 | 'sent_status' => array( |
953 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_sent, |
|
954 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_sent, false, 'sentence' ) |
|
953 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_sent, |
|
954 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_sent, false, 'sentence') |
|
955 | 955 | ), |
956 | 956 | 'idle_status' => array( |
957 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_idle, |
|
958 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_idle, false, 'sentence' ) |
|
957 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_idle, |
|
958 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_idle, false, 'sentence') |
|
959 | 959 | ), |
960 | 960 | 'failed_status' => array( |
961 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_failed, |
|
962 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_failed, false, 'sentence' ) |
|
961 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_failed, |
|
962 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_failed, false, 'sentence') |
|
963 | 963 | ), |
964 | 964 | 'resend_status' => array( |
965 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_resend, |
|
966 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_resend, false, 'sentence' ) |
|
965 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_resend, |
|
966 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_resend, false, 'sentence') |
|
967 | 967 | ), |
968 | 968 | 'incomplete_status' => array( |
969 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_incomplete, |
|
970 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_incomplete, false, 'sentence' ) |
|
969 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_incomplete, |
|
970 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_incomplete, false, 'sentence') |
|
971 | 971 | ), |
972 | 972 | 'retry_status' => array( |
973 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_retry, |
|
974 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_retry, false, 'sentence' ) |
|
973 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_retry, |
|
974 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_retry, false, 'sentence') |
|
975 | 975 | ) |
976 | 976 | ); |
977 | - if ( EEM_Message::debug() ) { |
|
977 | + if (EEM_Message::debug()) { |
|
978 | 978 | $status_items['debug_only_status'] = array( |
979 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_debug_only, |
|
980 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_debug_only, false, 'sentence' ) |
|
979 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_debug_only, |
|
980 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_debug_only, false, 'sentence') |
|
981 | 981 | ); |
982 | 982 | } |
983 | - return array_merge( $action_items, $status_items ); |
|
983 | + return array_merge($action_items, $status_items); |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | |
@@ -990,9 +990,9 @@ discard block |
||
990 | 990 | |
991 | 991 | protected function _custom_mtps_preview() { |
992 | 992 | $this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso'); |
993 | - $this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />'; |
|
993 | + $this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />'; |
|
994 | 994 | $this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso. With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>'; |
995 | - $this->display_admin_caf_preview_page( 'custom_message_types', false ); |
|
995 | + $this->display_admin_caf_preview_page('custom_message_types', false); |
|
996 | 996 | } |
997 | 997 | |
998 | 998 | |
@@ -1016,31 +1016,31 @@ discard block |
||
1016 | 1016 | * |
1017 | 1017 | * @return array |
1018 | 1018 | */ |
1019 | - public function get_message_templates( $perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true ) { |
|
1019 | + public function get_message_templates($perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true) { |
|
1020 | 1020 | |
1021 | 1021 | $MTP = EEM_Message_Template_Group::instance(); |
1022 | 1022 | |
1023 | 1023 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby']; |
1024 | 1024 | $orderby = $this->_req_data['orderby']; |
1025 | 1025 | |
1026 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC'; |
|
1026 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
1027 | 1027 | |
1028 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1029 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage; |
|
1028 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1029 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage; |
|
1030 | 1030 | |
1031 | - $offset = ($current_page-1)*$per_page; |
|
1032 | - $limit = $all ? null : array( $offset, $per_page ); |
|
1031 | + $offset = ($current_page - 1) * $per_page; |
|
1032 | + $limit = $all ? null : array($offset, $per_page); |
|
1033 | 1033 | |
1034 | 1034 | |
1035 | 1035 | //options will match what is in the _views array property |
1036 | - switch( $type ) { |
|
1036 | + switch ($type) { |
|
1037 | 1037 | |
1038 | 1038 | case 'in_use': |
1039 | - $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true ); |
|
1039 | + $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true); |
|
1040 | 1040 | break; |
1041 | 1041 | |
1042 | 1042 | default: |
1043 | - $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global ); |
|
1043 | + $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global); |
|
1044 | 1044 | |
1045 | 1045 | } |
1046 | 1046 | |
@@ -1059,8 +1059,8 @@ discard block |
||
1059 | 1059 | $installed_message_types = $this->_message_resource_manager->installed_message_types(); |
1060 | 1060 | $installed = array(); |
1061 | 1061 | |
1062 | - foreach ( $installed_message_types as $message_type ) { |
|
1063 | - $installed[ $message_type->name ] = $message_type; |
|
1062 | + foreach ($installed_message_types as $message_type) { |
|
1063 | + $installed[$message_type->name] = $message_type; |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | return $installed; |
@@ -1079,24 +1079,24 @@ discard block |
||
1079 | 1079 | * |
1080 | 1080 | * @throws EE_error |
1081 | 1081 | */ |
1082 | - protected function _add_message_template( $message_type = '', $messenger='', $GRP_ID = '' ) { |
|
1082 | + protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') { |
|
1083 | 1083 | //set values override any request data |
1084 | - $message_type = !empty( $message_type ) ? $message_type : ''; |
|
1085 | - $message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type; |
|
1084 | + $message_type = ! empty($message_type) ? $message_type : ''; |
|
1085 | + $message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type; |
|
1086 | 1086 | |
1087 | - $messenger = !empty( $messenger ) ? $messenger : ''; |
|
1088 | - $messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger; |
|
1087 | + $messenger = ! empty($messenger) ? $messenger : ''; |
|
1088 | + $messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger; |
|
1089 | 1089 | |
1090 | - $GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : ''; |
|
1091 | - $GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
1090 | + $GRP_ID = ! empty($GRP_ID) ? $GRP_ID : ''; |
|
1091 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
1092 | 1092 | |
1093 | 1093 | //we need messenger and message type. They should be coming from the event editor. If not here then return error |
1094 | - if ( empty( $message_type ) || empty( $messenger ) ) |
|
1095 | - {throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));} |
|
1094 | + if (empty($message_type) || empty($messenger)) |
|
1095 | + {throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); } |
|
1096 | 1096 | |
1097 | 1097 | //we need the GRP_ID for the template being used as the base for the new template |
1098 | - if ( empty( $GRP_ID ) ) |
|
1099 | - {throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );} |
|
1098 | + if (empty($GRP_ID)) |
|
1099 | + {throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso')); } |
|
1100 | 1100 | |
1101 | 1101 | //let's just make sure the template gets generated! |
1102 | 1102 | |
@@ -1117,8 +1117,8 @@ discard block |
||
1117 | 1117 | * @param int $GRP_ID GRP_ID for the related message template group this new template will be based |
1118 | 1118 | * off of. |
1119 | 1119 | */ |
1120 | - public function add_message_template( $message_type, $messenger, $GRP_ID ) { |
|
1121 | - $this->_add_message_template( $message_type, $messenger, $GRP_ID ); |
|
1120 | + public function add_message_template($message_type, $messenger, $GRP_ID) { |
|
1121 | + $this->_add_message_template($message_type, $messenger, $GRP_ID); |
|
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 | |
@@ -1129,14 +1129,14 @@ discard block |
||
1129 | 1129 | * @return void |
1130 | 1130 | */ |
1131 | 1131 | protected function _edit_message_template() { |
1132 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1132 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1133 | 1133 | $template_fields = ''; |
1134 | 1134 | $sidebar_fields = ''; |
1135 | 1135 | //we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates. |
1136 | - add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 ); |
|
1136 | + add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2); |
|
1137 | 1137 | |
1138 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) |
|
1139 | - ? absint( $this->_req_data['id'] ) |
|
1138 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) |
|
1139 | + ? absint($this->_req_data['id']) |
|
1140 | 1140 | : false; |
1141 | 1141 | |
1142 | 1142 | $this->_set_shortcodes(); //this also sets the _message_template property. |
@@ -1144,20 +1144,20 @@ discard block |
||
1144 | 1144 | $c_label = $message_template_group->context_label(); |
1145 | 1145 | $c_config = $message_template_group->contexts_config(); |
1146 | 1146 | |
1147 | - reset( $c_config ); |
|
1148 | - $context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) |
|
1147 | + reset($c_config); |
|
1148 | + $context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) |
|
1149 | 1149 | ? strtolower($this->_req_data['context']) |
1150 | 1150 | : key($c_config); |
1151 | 1151 | |
1152 | 1152 | |
1153 | - if ( empty($GRP_ID) ) { |
|
1153 | + if (empty($GRP_ID)) { |
|
1154 | 1154 | $action = 'insert_message_template'; |
1155 | 1155 | //$button_both = false; |
1156 | 1156 | //$button_text = array( __( 'Save','event_espresso') ); |
1157 | 1157 | //$button_actions = array('something_different'); |
1158 | 1158 | //$referrer = false; |
1159 | 1159 | $edit_message_template_form_url = add_query_arg( |
1160 | - array( 'action' => $action, 'noheader' => true ), |
|
1160 | + array('action' => $action, 'noheader' => true), |
|
1161 | 1161 | EE_MSG_ADMIN_URL |
1162 | 1162 | ); |
1163 | 1163 | } else { |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | //$button_actions = array(); |
1168 | 1168 | //$referrer = $this->_admin_base_url; |
1169 | 1169 | $edit_message_template_form_url = add_query_arg( |
1170 | - array( 'action' => $action, 'noheader' => true ), |
|
1170 | + array('action' => $action, 'noheader' => true), |
|
1171 | 1171 | EE_MSG_ADMIN_URL |
1172 | 1172 | ); |
1173 | 1173 | } |
@@ -1181,14 +1181,14 @@ discard block |
||
1181 | 1181 | |
1182 | 1182 | //Do we have any validation errors? |
1183 | 1183 | $validators = $this->_get_transient(); |
1184 | - $v_fields = !empty($validators) ? array_keys($validators) : array(); |
|
1184 | + $v_fields = ! empty($validators) ? array_keys($validators) : array(); |
|
1185 | 1185 | |
1186 | 1186 | |
1187 | 1187 | //we need to assemble the title from Various details |
1188 | 1188 | $context_label = sprintf( |
1189 | 1189 | __('(%s %s)', 'event_espresso'), |
1190 | 1190 | $c_config[$context]['label'], |
1191 | - ucwords($c_label['label'] ) |
|
1191 | + ucwords($c_label['label']) |
|
1192 | 1192 | ); |
1193 | 1193 | |
1194 | 1194 | $title = sprintf( |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | $message_template_group->message_type() |
1210 | 1210 | ); |
1211 | 1211 | |
1212 | - if ( !$template_field_structure ) { |
|
1212 | + if ( ! $template_field_structure) { |
|
1213 | 1213 | $template_field_structure = false; |
1214 | 1214 | $template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso'); |
1215 | 1215 | } |
@@ -1219,51 +1219,51 @@ discard block |
||
1219 | 1219 | |
1220 | 1220 | |
1221 | 1221 | //if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array. |
1222 | - if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) { |
|
1223 | - foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) { |
|
1224 | - unset( $template_field_structure[$context][$reference_field] ); |
|
1222 | + if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) { |
|
1223 | + foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) { |
|
1224 | + unset($template_field_structure[$context][$reference_field]); |
|
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | |
1228 | 1228 | //let's loop through the template_field_structure and actually assemble the input fields! |
1229 | - if ( !empty($template_field_structure) ) { |
|
1230 | - foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) { |
|
1229 | + if ( ! empty($template_field_structure)) { |
|
1230 | + foreach ($template_field_structure[$context] as $template_field => $field_setup_array) { |
|
1231 | 1231 | //if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them. |
1232 | - if ( $template_field == 'extra' ) { |
|
1232 | + if ($template_field == 'extra') { |
|
1233 | 1233 | $this->_template_args['is_extra_fields'] = true; |
1234 | - foreach ( $field_setup_array as $reference_field => $new_fields_array ) { |
|
1235 | - $message_template = $message_templates[ $context ][ $reference_field ]; |
|
1234 | + foreach ($field_setup_array as $reference_field => $new_fields_array) { |
|
1235 | + $message_template = $message_templates[$context][$reference_field]; |
|
1236 | 1236 | $content = $message_template instanceof EE_Message_Template |
1237 | - ? $message_template->get( 'MTP_content' ) |
|
1237 | + ? $message_template->get('MTP_content') |
|
1238 | 1238 | : ''; |
1239 | - foreach ( $new_fields_array as $extra_field => $extra_array ) { |
|
1239 | + foreach ($new_fields_array as $extra_field => $extra_array) { |
|
1240 | 1240 | //let's verify if we need this extra field via the shortcodes parameter. |
1241 | 1241 | $continue = false; |
1242 | - if ( isset( $extra_array['shortcodes_required'] ) ) { |
|
1243 | - foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) { |
|
1244 | - if ( !array_key_exists( $shortcode, $this->_shortcodes ) ) |
|
1245 | - {$continue = true;} |
|
1242 | + if (isset($extra_array['shortcodes_required'])) { |
|
1243 | + foreach ((array) $extra_array['shortcodes_required'] as $shortcode) { |
|
1244 | + if ( ! array_key_exists($shortcode, $this->_shortcodes)) |
|
1245 | + {$continue = true; } |
|
1246 | 1246 | } |
1247 | - if ( $continue ) {continue;} |
|
1247 | + if ($continue) {continue; } |
|
1248 | 1248 | } |
1249 | 1249 | |
1250 | - $field_id = $reference_field . '-' . $extra_field . '-content'; |
|
1250 | + $field_id = $reference_field.'-'.$extra_field.'-content'; |
|
1251 | 1251 | $template_form_fields[$field_id] = $extra_array; |
1252 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']'; |
|
1253 | - $css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : ''; |
|
1252 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']'; |
|
1253 | + $css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : ''; |
|
1254 | 1254 | |
1255 | - $template_form_fields[$field_id]['css_class'] = ! empty( $v_fields ) |
|
1255 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) |
|
1256 | 1256 | && in_array($extra_field, $v_fields) |
1257 | 1257 | && |
1258 | 1258 | ( |
1259 | - is_array($validators[$extra_field] ) |
|
1260 | - && isset( $validators[$extra_field]['msg'] ) |
|
1259 | + is_array($validators[$extra_field]) |
|
1260 | + && isset($validators[$extra_field]['msg']) |
|
1261 | 1261 | ) |
1262 | - ? 'validate-error ' . $css_class |
|
1262 | + ? 'validate-error '.$css_class |
|
1263 | 1263 | : $css_class; |
1264 | 1264 | |
1265 | - $template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) |
|
1266 | - ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) |
|
1265 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) |
|
1266 | + ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) |
|
1267 | 1267 | : ''; |
1268 | 1268 | |
1269 | 1269 | //do we have a validation error? if we do then let's use that value instead |
@@ -1279,32 +1279,32 @@ discard block |
||
1279 | 1279 | $field_id |
1280 | 1280 | ); |
1281 | 1281 | |
1282 | - if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) { |
|
1282 | + if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') { |
|
1283 | 1283 | //we want to decode the entities |
1284 | 1284 | $template_form_fields[$field_id]['value'] = stripslashes( |
1285 | - html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") |
|
1285 | + html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") |
|
1286 | 1286 | ); |
1287 | 1287 | |
1288 | 1288 | }/**/ |
1289 | 1289 | } |
1290 | - $templatefield_MTP_id = $reference_field . '-MTP_ID'; |
|
1291 | - $templatefield_templatename_id = $reference_field . '-name'; |
|
1290 | + $templatefield_MTP_id = $reference_field.'-MTP_ID'; |
|
1291 | + $templatefield_templatename_id = $reference_field.'-name'; |
|
1292 | 1292 | |
1293 | 1293 | $template_form_fields[$templatefield_MTP_id] = array( |
1294 | - 'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]', |
|
1294 | + 'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]', |
|
1295 | 1295 | 'label' => null, |
1296 | 1296 | 'input' => 'hidden', |
1297 | 1297 | 'type' => 'int', |
1298 | 1298 | 'required' => false, |
1299 | 1299 | 'validation' => false, |
1300 | - 'value' => !empty($message_templates) ? $message_template->ID() : '', |
|
1300 | + 'value' => ! empty($message_templates) ? $message_template->ID() : '', |
|
1301 | 1301 | 'css_class' => '', |
1302 | 1302 | 'format' => '%d', |
1303 | 1303 | 'db-col' => 'MTP_ID' |
1304 | 1304 | ); |
1305 | 1305 | |
1306 | 1306 | $template_form_fields[$templatefield_templatename_id] = array( |
1307 | - 'name' => 'MTP_template_fields[' . $reference_field . '][name]', |
|
1307 | + 'name' => 'MTP_template_fields['.$reference_field.'][name]', |
|
1308 | 1308 | 'label' => null, |
1309 | 1309 | 'input' => 'hidden', |
1310 | 1310 | 'type' => 'string', |
@@ -1318,14 +1318,14 @@ discard block |
||
1318 | 1318 | } |
1319 | 1319 | continue; //skip the next stuff, we got the necessary fields here for this dataset. |
1320 | 1320 | } else { |
1321 | - $field_id = $template_field . '-content'; |
|
1321 | + $field_id = $template_field.'-content'; |
|
1322 | 1322 | $template_form_fields[$field_id] = $field_setup_array; |
1323 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]'; |
|
1324 | - $message_template = isset( $message_templates[ $context ][ $template_field ] ) |
|
1325 | - ? $message_templates[ $context ][ $template_field ] |
|
1323 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]'; |
|
1324 | + $message_template = isset($message_templates[$context][$template_field]) |
|
1325 | + ? $message_templates[$context][$template_field] |
|
1326 | 1326 | : null; |
1327 | - $template_form_fields[$field_id]['value'] = ! empty( $message_templates ) |
|
1328 | - && is_array( $message_templates[$context] ) |
|
1327 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) |
|
1328 | + && is_array($message_templates[$context]) |
|
1329 | 1329 | && $message_template instanceof EE_Message_Template |
1330 | 1330 | ? $message_template->get('MTP_content') |
1331 | 1331 | : ''; |
@@ -1338,10 +1338,10 @@ discard block |
||
1338 | 1338 | |
1339 | 1339 | $template_form_fields[$field_id]['db-col'] = 'MTP_content'; |
1340 | 1340 | $css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : ''; |
1341 | - $template_form_fields[$field_id]['css_class'] = ! empty( $v_fields ) |
|
1342 | - && in_array( $template_field, $v_fields ) |
|
1343 | - && isset( $validators[$template_field]['msg'] ) |
|
1344 | - ? 'validate-error ' . $css_class |
|
1341 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) |
|
1342 | + && in_array($template_field, $v_fields) |
|
1343 | + && isset($validators[$template_field]['msg']) |
|
1344 | + ? 'validate-error '.$css_class |
|
1345 | 1345 | : $css_class; |
1346 | 1346 | |
1347 | 1347 | //shortcode selector |
@@ -1352,12 +1352,12 @@ discard block |
||
1352 | 1352 | |
1353 | 1353 | //k took care of content field(s) now let's take care of others. |
1354 | 1354 | |
1355 | - $templatefield_MTP_id = $template_field . '-MTP_ID'; |
|
1356 | - $templatefield_field_templatename_id = $template_field . '-name'; |
|
1355 | + $templatefield_MTP_id = $template_field.'-MTP_ID'; |
|
1356 | + $templatefield_field_templatename_id = $template_field.'-name'; |
|
1357 | 1357 | |
1358 | 1358 | //foreach template field there are actually two form fields created |
1359 | 1359 | $template_form_fields[$templatefield_MTP_id] = array( |
1360 | - 'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]', |
|
1360 | + 'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]', |
|
1361 | 1361 | 'label' => null, |
1362 | 1362 | 'input' => 'hidden', |
1363 | 1363 | 'type' => 'int', |
@@ -1370,7 +1370,7 @@ discard block |
||
1370 | 1370 | ); |
1371 | 1371 | |
1372 | 1372 | $template_form_fields[$templatefield_field_templatename_id] = array( |
1373 | - 'name' => 'MTP_template_fields[' . $template_field . '][name]', |
|
1373 | + 'name' => 'MTP_template_fields['.$template_field.'][name]', |
|
1374 | 1374 | 'label' => null, |
1375 | 1375 | 'input' => 'hidden', |
1376 | 1376 | 'type' => 'string', |
@@ -1514,13 +1514,13 @@ discard block |
||
1514 | 1514 | 'value' => $GRP_ID |
1515 | 1515 | ); |
1516 | 1516 | $sidebar_form_fields['ee-msg-evt-nonce'] = array( |
1517 | - 'name' => $action . '_nonce', |
|
1517 | + 'name' => $action.'_nonce', |
|
1518 | 1518 | 'input' => 'hidden', |
1519 | 1519 | 'type' => 'string', |
1520 | - 'value' => wp_create_nonce( $action . '_nonce') |
|
1520 | + 'value' => wp_create_nonce($action.'_nonce') |
|
1521 | 1521 | ); |
1522 | 1522 | |
1523 | - if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) { |
|
1523 | + if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) { |
|
1524 | 1524 | $sidebar_form_fields['ee-msg-template-switch'] = array( |
1525 | 1525 | 'name' => 'template_switch', |
1526 | 1526 | 'input' => 'hidden', |
@@ -1530,8 +1530,8 @@ discard block |
||
1530 | 1530 | } |
1531 | 1531 | |
1532 | 1532 | |
1533 | - $template_fields = $this->_generate_admin_form_fields( $template_form_fields ); |
|
1534 | - $sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields ); |
|
1533 | + $template_fields = $this->_generate_admin_form_fields($template_form_fields); |
|
1534 | + $sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields); |
|
1535 | 1535 | |
1536 | 1536 | |
1537 | 1537 | } //end if ( !empty($template_field_structure) ) |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | $GRP_ID, |
1544 | 1544 | false, |
1545 | 1545 | add_query_arg( |
1546 | - array( 'action' => 'global_mtps' ), |
|
1546 | + array('action' => 'global_mtps'), |
|
1547 | 1547 | $this->_admin_base_url |
1548 | 1548 | ) |
1549 | 1549 | ); |
@@ -1559,7 +1559,7 @@ discard block |
||
1559 | 1559 | ), |
1560 | 1560 | $this->_admin_base_url |
1561 | 1561 | ); |
1562 | - $preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>'; |
|
1562 | + $preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>'; |
|
1563 | 1563 | |
1564 | 1564 | |
1565 | 1565 | //setup context switcher |
@@ -1587,17 +1587,17 @@ discard block |
||
1587 | 1587 | $this->_template_args['after_admin_page_content'] = $this->_add_form_element_after(); |
1588 | 1588 | |
1589 | 1589 | $this->_template_path = $this->_template_args['GRP_ID'] |
1590 | - ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' |
|
1591 | - : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php'; |
|
1590 | + ? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php' |
|
1591 | + : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php'; |
|
1592 | 1592 | |
1593 | 1593 | //send along EE_Message_Template_Group object for further template use. |
1594 | 1594 | $this->_template_args['MTP'] = $message_template_group; |
1595 | 1595 | |
1596 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, true ); |
|
1596 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, true); |
|
1597 | 1597 | |
1598 | 1598 | |
1599 | 1599 | //finally, let's set the admin_page title |
1600 | - $this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title ); |
|
1600 | + $this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title); |
|
1601 | 1601 | |
1602 | 1602 | |
1603 | 1603 | //we need to take care of setting the shortcodes property for use elsewhere. |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | } |
1611 | 1611 | |
1612 | 1612 | |
1613 | - public function filter_tinymce_init( $mceInit, $editor_id ) { |
|
1613 | + public function filter_tinymce_init($mceInit, $editor_id) { |
|
1614 | 1614 | return $mceInit; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | } |
1622 | 1622 | |
1623 | 1623 | public function _add_form_element_before() { |
1624 | - return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">'; |
|
1624 | + return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">'; |
|
1625 | 1625 | } |
1626 | 1626 | |
1627 | 1627 | public function _add_form_element_after() { |
@@ -1638,25 +1638,25 @@ discard block |
||
1638 | 1638 | * |
1639 | 1639 | */ |
1640 | 1640 | public function switch_template_pack() { |
1641 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1642 | - $template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : ''; |
|
1641 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1642 | + $template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : ''; |
|
1643 | 1643 | |
1644 | 1644 | //verify we have needed values. |
1645 | - if ( empty( $GRP_ID ) || empty( $template_pack ) ) { |
|
1645 | + if (empty($GRP_ID) || empty($template_pack)) { |
|
1646 | 1646 | $this->_template_args['error'] = true; |
1647 | - EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1647 | + EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1648 | 1648 | } else { |
1649 | 1649 | //get template, set the new template_pack and then reset to default |
1650 | 1650 | /** @type EE_Message_Template_Group $message_template_group */ |
1651 | - $message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
1651 | + $message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
1652 | 1652 | |
1653 | - $message_template_group->set_template_pack_name( $template_pack ); |
|
1653 | + $message_template_group->set_template_pack_name($template_pack); |
|
1654 | 1654 | $this->_req_data['msgr'] = $message_template_group->messenger(); |
1655 | 1655 | $this->_req_data['mt'] = $message_template_group->message_type(); |
1656 | 1656 | |
1657 | 1657 | $query_args = $this->_reset_to_default_template(); |
1658 | 1658 | |
1659 | - if ( empty( $query_args['id'] ) ) { |
|
1659 | + if (empty($query_args['id'])) { |
|
1660 | 1660 | EE_Error::add_error( |
1661 | 1661 | __( |
1662 | 1662 | 'Something went wrong with switching the template pack. Please try again or contact EE support', |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | ); |
1667 | 1667 | $this->_template_args['error'] = true; |
1668 | 1668 | } else { |
1669 | - $template_label =$message_template_group->get_template_pack()->label; |
|
1669 | + $template_label = $message_template_group->get_template_pack()->label; |
|
1670 | 1670 | $template_pack_labels = $message_template_group->messenger_obj()->get_supports_labels(); |
1671 | 1671 | EE_Error::add_success( |
1672 | 1672 | sprintf( |
@@ -1679,7 +1679,7 @@ discard block |
||
1679 | 1679 | ) |
1680 | 1680 | ); |
1681 | 1681 | //generate the redirect url for js. |
1682 | - $url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1682 | + $url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1683 | 1683 | $this->_template_args['data']['redirect_url'] = $url; |
1684 | 1684 | $this->_template_args['success'] = true; |
1685 | 1685 | } |
@@ -1701,9 +1701,9 @@ discard block |
||
1701 | 1701 | protected function _reset_to_default_template() { |
1702 | 1702 | |
1703 | 1703 | $templates = array(); |
1704 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1704 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1705 | 1705 | //we need to make sure we've got the info we need. |
1706 | - if ( ! isset( $this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'] ) ) { |
|
1706 | + if ( ! isset($this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'])) { |
|
1707 | 1707 | EE_Error::add_error( |
1708 | 1708 | __( |
1709 | 1709 | 'In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset. At least one of these is missing.', |
@@ -1715,9 +1715,9 @@ discard block |
||
1715 | 1715 | |
1716 | 1716 | // all templates will be reset to whatever the defaults are |
1717 | 1717 | // for the global template matching the messenger and message type. |
1718 | - $success = !empty( $GRP_ID ) ? true : false; |
|
1718 | + $success = ! empty($GRP_ID) ? true : false; |
|
1719 | 1719 | |
1720 | - if ( $success ) { |
|
1720 | + if ($success) { |
|
1721 | 1721 | |
1722 | 1722 | //let's first determine if the incoming template is a global template, |
1723 | 1723 | // if it isn't then we need to get the global template matching messenger and message type. |
@@ -1725,9 +1725,9 @@ discard block |
||
1725 | 1725 | |
1726 | 1726 | |
1727 | 1727 | //note this is ONLY deleting the template fields (Message Template rows) NOT the message template group. |
1728 | - $success = $this->_delete_mtp_permanently( $GRP_ID, false ); |
|
1728 | + $success = $this->_delete_mtp_permanently($GRP_ID, false); |
|
1729 | 1729 | |
1730 | - if ( $success ) { |
|
1730 | + if ($success) { |
|
1731 | 1731 | // if successfully deleted, lets generate the new ones. |
1732 | 1732 | // Note. We set GLOBAL to true, because resets on ANY template |
1733 | 1733 | // will use the related global template defaults for regeneration. |
@@ -1745,32 +1745,32 @@ discard block |
||
1745 | 1745 | } |
1746 | 1746 | |
1747 | 1747 | //any error messages? |
1748 | - if ( !$success ) { |
|
1748 | + if ( ! $success) { |
|
1749 | 1749 | EE_Error::add_error( |
1750 | - __( 'Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso' ), |
|
1750 | + __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), |
|
1751 | 1751 | __FILE__, __FUNCTION__, __LINE__ |
1752 | 1752 | ); |
1753 | 1753 | } |
1754 | 1754 | |
1755 | 1755 | //all good, let's add a success message! |
1756 | - if ( $success && ! empty( $templates ) ) { |
|
1756 | + if ($success && ! empty($templates)) { |
|
1757 | 1757 | $templates = $templates[0]; //the info for the template we generated is the first element in the returned array. |
1758 | 1758 | EE_Error::overwrite_success(); |
1759 | - EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') ); |
|
1759 | + EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso')); |
|
1760 | 1760 | } |
1761 | 1761 | |
1762 | 1762 | |
1763 | 1763 | $query_args = array( |
1764 | - 'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : null, |
|
1765 | - 'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : null, |
|
1766 | - 'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'global_mtps' |
|
1764 | + 'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : null, |
|
1765 | + 'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : null, |
|
1766 | + 'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'global_mtps' |
|
1767 | 1767 | ); |
1768 | 1768 | |
1769 | 1769 | //if called via ajax then we return query args otherwise redirect |
1770 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
1770 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
1771 | 1771 | return $query_args; |
1772 | 1772 | } else { |
1773 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
1773 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
1774 | 1774 | return null; |
1775 | 1775 | } |
1776 | 1776 | } |
@@ -1783,7 +1783,7 @@ discard block |
||
1783 | 1783 | * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview. |
1784 | 1784 | * @return string |
1785 | 1785 | */ |
1786 | - public function _preview_message( $send = false ) { |
|
1786 | + public function _preview_message($send = false) { |
|
1787 | 1787 | //first make sure we've got the necessary parameters |
1788 | 1788 | if ( |
1789 | 1789 | ! isset( |
@@ -1799,13 +1799,13 @@ discard block |
||
1799 | 1799 | ); |
1800 | 1800 | } |
1801 | 1801 | |
1802 | - EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] ); |
|
1802 | + EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']); |
|
1803 | 1803 | |
1804 | 1804 | |
1805 | 1805 | //get the preview! |
1806 | - $preview = EED_Messages::preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send ); |
|
1806 | + $preview = EED_Messages::preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send); |
|
1807 | 1807 | |
1808 | - if ( $send ) { |
|
1808 | + if ($send) { |
|
1809 | 1809 | return $preview; |
1810 | 1810 | } |
1811 | 1811 | |
@@ -1815,22 +1815,22 @@ discard block |
||
1815 | 1815 | 'context' => $this->_req_data['context'], |
1816 | 1816 | 'action' => 'edit_message_template' |
1817 | 1817 | ); |
1818 | - $go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1819 | - $preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>'; |
|
1818 | + $go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1819 | + $preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>'; |
|
1820 | 1820 | $message_types = $this->get_installed_message_types(); |
1821 | - $active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
1821 | + $active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
1822 | 1822 | $active_messenger_label = $active_messenger instanceof EE_messenger |
1823 | - ? ucwords( $active_messenger->label['singular'] ) |
|
1824 | - : esc_html__( 'Unknown Messenger', 'event_espresso' ); |
|
1823 | + ? ucwords($active_messenger->label['singular']) |
|
1824 | + : esc_html__('Unknown Messenger', 'event_espresso'); |
|
1825 | 1825 | //let's provide a helpful title for context |
1826 | 1826 | $preview_title = sprintf( |
1827 | - __( 'Viewing Preview for %s %s Message Template', 'event_espresso' ), |
|
1827 | + __('Viewing Preview for %s %s Message Template', 'event_espresso'), |
|
1828 | 1828 | $active_messenger_label, |
1829 | - ucwords( $message_types[ $this->_req_data[ 'message_type' ] ]->label[ 'singular' ] ) |
|
1829 | + ucwords($message_types[$this->_req_data['message_type']]->label['singular']) |
|
1830 | 1830 | ); |
1831 | 1831 | //setup display of preview. |
1832 | 1832 | $this->_admin_page_title = $preview_title; |
1833 | - $this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview); |
|
1833 | + $this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview); |
|
1834 | 1834 | $this->_template_args['data']['force_json'] = true; |
1835 | 1835 | return ''; |
1836 | 1836 | } |
@@ -1860,9 +1860,9 @@ discard block |
||
1860 | 1860 | * @return void |
1861 | 1861 | */ |
1862 | 1862 | protected function _register_edit_meta_boxes() { |
1863 | - add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' ); |
|
1864 | - add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1865 | - add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1863 | + add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default'); |
|
1864 | + add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1865 | + add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1866 | 1866 | } |
1867 | 1867 | |
1868 | 1868 | |
@@ -1881,14 +1881,14 @@ discard block |
||
1881 | 1881 | |
1882 | 1882 | $tp_select_values = array(); |
1883 | 1883 | |
1884 | - foreach ( $tp_collection as $tp ) { |
|
1884 | + foreach ($tp_collection as $tp) { |
|
1885 | 1885 | //only include template packs that support this messenger and message type! |
1886 | 1886 | $supports = $tp->get_supports(); |
1887 | 1887 | if ( |
1888 | - ! isset( $supports[ $this->_message_template_group->messenger() ] ) |
|
1888 | + ! isset($supports[$this->_message_template_group->messenger()]) |
|
1889 | 1889 | || ! in_array( |
1890 | 1890 | $this->_message_template_group->message_type(), |
1891 | - $supports[ $this->_message_template_group->messenger() ] |
|
1891 | + $supports[$this->_message_template_group->messenger()] |
|
1892 | 1892 | ) |
1893 | 1893 | ) { |
1894 | 1894 | //not supported |
@@ -1902,7 +1902,7 @@ discard block |
||
1902 | 1902 | } |
1903 | 1903 | |
1904 | 1904 | //if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack. This still allows for the odd template pack to override. |
1905 | - if ( empty( $tp_select_values ) ) { |
|
1905 | + if (empty($tp_select_values)) { |
|
1906 | 1906 | $tp_select_values[] = array( |
1907 | 1907 | 'text' => __('Default', 'event_espresso'), |
1908 | 1908 | 'id' => 'default' |
@@ -1915,14 +1915,14 @@ discard block |
||
1915 | 1915 | $this->_message_template_group->message_type() |
1916 | 1916 | ); |
1917 | 1917 | $variations_select_values = array(); |
1918 | - foreach ( $variations as $variation => $label ) { |
|
1918 | + foreach ($variations as $variation => $label) { |
|
1919 | 1919 | $variations_select_values[] = array( |
1920 | 1920 | 'text' => $label, |
1921 | 1921 | 'id' => $variation |
1922 | 1922 | ); |
1923 | 1923 | } |
1924 | 1924 | |
1925 | - $template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1925 | + $template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1926 | 1926 | |
1927 | 1927 | $template_args['template_packs_selector'] = EEH_Form_Fields::select_input( |
1928 | 1928 | 'MTP_template_pack', |
@@ -1939,9 +1939,9 @@ discard block |
||
1939 | 1939 | $template_args['template_pack_description'] = $template_pack_labels->template_pack_description; |
1940 | 1940 | $template_args['template_variation_description'] = $template_pack_labels->template_variation_description; |
1941 | 1941 | |
1942 | - $template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php'; |
|
1942 | + $template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php'; |
|
1943 | 1943 | |
1944 | - EEH_Template::display_template( $template, $template_args ); |
|
1944 | + EEH_Template::display_template($template, $template_args); |
|
1945 | 1945 | } |
1946 | 1946 | |
1947 | 1947 | |
@@ -1965,46 +1965,46 @@ discard block |
||
1965 | 1965 | //first we need to see if there are any fields |
1966 | 1966 | $fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields(); |
1967 | 1967 | |
1968 | - if ( !empty( $fields ) ) { |
|
1968 | + if ( ! empty($fields)) { |
|
1969 | 1969 | //yup there be fields |
1970 | - foreach ( $fields as $field => $config ) { |
|
1971 | - $field_id = $this->_message_template_group->messenger() . '_' . $field; |
|
1970 | + foreach ($fields as $field => $config) { |
|
1971 | + $field_id = $this->_message_template_group->messenger().'_'.$field; |
|
1972 | 1972 | $existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings(); |
1973 | - $default = isset( $config['default'] ) ? $config['default'] : ''; |
|
1974 | - $default = isset( $config['value'] ) ? $config['value'] : $default; |
|
1973 | + $default = isset($config['default']) ? $config['default'] : ''; |
|
1974 | + $default = isset($config['value']) ? $config['value'] : $default; |
|
1975 | 1975 | |
1976 | 1976 | // if type is hidden and the value is empty |
1977 | 1977 | // something may have gone wrong so let's correct with the defaults |
1978 | 1978 | $fix = $config['input'] === 'hidden' && isset($existing[$field]) && empty($existing[$field]) |
1979 | 1979 | ? $default |
1980 | 1980 | : ''; |
1981 | - $existing[$field] = isset( $existing[$field] ) && empty( $fix ) |
|
1981 | + $existing[$field] = isset($existing[$field]) && empty($fix) |
|
1982 | 1982 | ? $existing[$field] |
1983 | 1983 | : $fix; |
1984 | 1984 | |
1985 | 1985 | $template_form_fields[$field_id] = array( |
1986 | - 'name' => 'test_settings_fld[' . $field . ']', |
|
1986 | + 'name' => 'test_settings_fld['.$field.']', |
|
1987 | 1987 | 'label' => $config['label'], |
1988 | 1988 | 'input' => $config['input'], |
1989 | 1989 | 'type' => $config['type'], |
1990 | 1990 | 'required' => $config['required'], |
1991 | 1991 | 'validation' => $config['validation'], |
1992 | - 'value' => isset( $existing[ $field ] ) ? $existing[ $field ] : $default, |
|
1992 | + 'value' => isset($existing[$field]) ? $existing[$field] : $default, |
|
1993 | 1993 | 'css_class' => $config['css_class'], |
1994 | - 'options' => isset( $config['options'] ) ? $config['options'] : array(), |
|
1994 | + 'options' => isset($config['options']) ? $config['options'] : array(), |
|
1995 | 1995 | 'default' => $default, |
1996 | 1996 | 'format' => $config['format'] |
1997 | 1997 | ); |
1998 | 1998 | } |
1999 | 1999 | } |
2000 | 2000 | |
2001 | - $test_settings_fields = !empty( $template_form_fields) |
|
2002 | - ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) |
|
2001 | + $test_settings_fields = ! empty($template_form_fields) |
|
2002 | + ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') |
|
2003 | 2003 | : ''; |
2004 | 2004 | |
2005 | 2005 | $test_settings_html = ''; |
2006 | 2006 | //print out $test_settings_fields |
2007 | - if ( !empty( $test_settings_fields ) ) { |
|
2007 | + if ( ! empty($test_settings_fields)) { |
|
2008 | 2008 | echo $test_settings_fields; |
2009 | 2009 | $test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" '; |
2010 | 2010 | $test_settings_html .= 'name="test_button" value="'; |
@@ -2013,7 +2013,7 @@ discard block |
||
2013 | 2013 | } |
2014 | 2014 | |
2015 | 2015 | //and button |
2016 | - $test_settings_html .= '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>'; |
|
2016 | + $test_settings_html .= '<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'; |
|
2017 | 2017 | $test_settings_html .= '<div class="publishing-action alignright resetbutton">'; |
2018 | 2018 | $test_settings_html .= $this->get_action_link_or_button( |
2019 | 2019 | 'reset_to_default', |
@@ -2037,13 +2037,13 @@ discard block |
||
2037 | 2037 | * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
2038 | 2038 | * @return string |
2039 | 2039 | */ |
2040 | - protected function _get_shortcode_selector( $field, $linked_input_id ) { |
|
2040 | + protected function _get_shortcode_selector($field, $linked_input_id) { |
|
2041 | 2041 | $template_args = array( |
2042 | - 'shortcodes' => $this->_get_shortcodes( array( $field ), true ), |
|
2042 | + 'shortcodes' => $this->_get_shortcodes(array($field), true), |
|
2043 | 2043 | 'fieldname' => $field, |
2044 | 2044 | 'linked_input_id' => $linked_input_id |
2045 | 2045 | ); |
2046 | - return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true ); |
|
2046 | + return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true); |
|
2047 | 2047 | } |
2048 | 2048 | |
2049 | 2049 | |
@@ -2058,13 +2058,13 @@ discard block |
||
2058 | 2058 | $shortcodes = $this->_get_shortcodes(array(), false); //just make sure shortcodes property is set |
2059 | 2059 | //$messenger = $this->_message_template_group->messenger_obj(); |
2060 | 2060 | //now let's set the content depending on the status of the shortcodes array |
2061 | - if ( empty( $shortcodes ) ) { |
|
2062 | - $content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>'; |
|
2061 | + if (empty($shortcodes)) { |
|
2062 | + $content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>'; |
|
2063 | 2063 | echo $content; |
2064 | 2064 | } else { |
2065 | 2065 | //$alt = 0; |
2066 | 2066 | ?> |
2067 | - <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p> |
|
2067 | + <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p> |
|
2068 | 2068 | <?php |
2069 | 2069 | } |
2070 | 2070 | |
@@ -2081,7 +2081,7 @@ discard block |
||
2081 | 2081 | protected function _set_shortcodes() { |
2082 | 2082 | |
2083 | 2083 | //no need to run this if the property is already set |
2084 | - if ( !empty($this->_shortcodes ) ) {return;} |
|
2084 | + if ( ! empty($this->_shortcodes)) {return; } |
|
2085 | 2085 | |
2086 | 2086 | $this->_shortcodes = $this->_get_shortcodes(); |
2087 | 2087 | } |
@@ -2103,14 +2103,14 @@ discard block |
||
2103 | 2103 | * @return array Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true |
2104 | 2104 | * just an array of shortcode/label pairs. |
2105 | 2105 | */ |
2106 | - protected function _get_shortcodes( $fields = array(), $merged = true ) { |
|
2106 | + protected function _get_shortcodes($fields = array(), $merged = true) { |
|
2107 | 2107 | $this->_set_message_template_group(); |
2108 | 2108 | |
2109 | 2109 | //we need the messenger and message template to retrieve the valid shortcodes array. |
2110 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : false; |
|
2111 | - $context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() ); |
|
2110 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : false; |
|
2111 | + $context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config()); |
|
2112 | 2112 | |
2113 | - return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array(); |
|
2113 | + return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array(); |
|
2114 | 2114 | } |
2115 | 2115 | |
2116 | 2116 | |
@@ -2123,19 +2123,19 @@ discard block |
||
2123 | 2123 | */ |
2124 | 2124 | protected function _set_message_template_group() { |
2125 | 2125 | |
2126 | - if ( !empty( $this->_message_template_group ) ) |
|
2127 | - {return;} //get out if this is already set. |
|
2126 | + if ( ! empty($this->_message_template_group)) |
|
2127 | + {return; } //get out if this is already set. |
|
2128 | 2128 | |
2129 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : false; |
|
2130 | - $GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID; |
|
2129 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : false; |
|
2130 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID; |
|
2131 | 2131 | |
2132 | 2132 | //let's get the message templates |
2133 | 2133 | $MTP = EEM_Message_Template_Group::instance(); |
2134 | 2134 | |
2135 | - if ( empty($GRP_ID) ) |
|
2136 | - {$this->_message_template_group = $MTP->create_default_object();} |
|
2135 | + if (empty($GRP_ID)) |
|
2136 | + {$this->_message_template_group = $MTP->create_default_object(); } |
|
2137 | 2137 | else |
2138 | - {$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );} |
|
2138 | + {$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID); } |
|
2139 | 2139 | |
2140 | 2140 | $this->_template_pack = $this->_message_template_group->get_template_pack(); |
2141 | 2141 | $this->_variation = $this->_message_template_group->get_template_pack_variation(); |
@@ -2154,7 +2154,7 @@ discard block |
||
2154 | 2154 | * @param array $args various things the context switcher needs. |
2155 | 2155 | * |
2156 | 2156 | */ |
2157 | - protected function _set_context_switcher( EE_Message_Template_Group $template_group_object, $args) { |
|
2157 | + protected function _set_context_switcher(EE_Message_Template_Group $template_group_object, $args) { |
|
2158 | 2158 | $context_details = $template_group_object->contexts_config(); |
2159 | 2159 | $context_label = $template_group_object->context_label(); |
2160 | 2160 | ob_start(); |
@@ -2162,20 +2162,20 @@ discard block |
||
2162 | 2162 | <div class="ee-msg-switcher-container"> |
2163 | 2163 | <form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm"> |
2164 | 2164 | <?php |
2165 | - foreach ( $args as $name => $value ) { |
|
2166 | - if ( $name == 'context' || empty($value) || $name == 'extra' ) {continue;} |
|
2165 | + foreach ($args as $name => $value) { |
|
2166 | + if ($name == 'context' || empty($value) || $name == 'extra') {continue; } |
|
2167 | 2167 | ?> |
2168 | 2168 | <input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" /> |
2169 | 2169 | <?php |
2170 | 2170 | } |
2171 | 2171 | //setup nonce_url |
2172 | - wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false); |
|
2172 | + wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false); |
|
2173 | 2173 | ?> |
2174 | 2174 | <select name="context"> |
2175 | 2175 | <?php |
2176 | 2176 | $context_templates = $template_group_object->context_templates(); |
2177 | - if ( is_array($context_templates) ) : |
|
2178 | - foreach ( $context_templates as $context => $template_fields ) : |
|
2177 | + if (is_array($context_templates)) : |
|
2178 | + foreach ($context_templates as $context => $template_fields) : |
|
2179 | 2179 | $checked = ($context == $args['context']) ? 'selected="selected"' : ''; |
2180 | 2180 | ?> |
2181 | 2181 | <option value="<?php echo $context; ?>" <?php echo $checked; ?>> |
@@ -2183,7 +2183,7 @@ discard block |
||
2183 | 2183 | </option> |
2184 | 2184 | <?php endforeach; endif; ?> |
2185 | 2185 | </select> |
2186 | - <?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?> |
|
2186 | + <?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?> |
|
2187 | 2187 | <input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>"> |
2188 | 2188 | </form> |
2189 | 2189 | <?php echo $args['extra']; ?> |
@@ -2210,8 +2210,8 @@ discard block |
||
2210 | 2210 | * @return array |
2211 | 2211 | */ |
2212 | 2212 | protected function _set_message_template_column_values($index) { |
2213 | - if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) { |
|
2214 | - foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) { |
|
2213 | + if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) { |
|
2214 | + foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) { |
|
2215 | 2215 | $this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value; |
2216 | 2216 | } |
2217 | 2217 | } /*else { |
@@ -2220,22 +2220,22 @@ discard block |
||
2220 | 2220 | |
2221 | 2221 | |
2222 | 2222 | $set_column_values = array( |
2223 | - 'MTP_ID' => absint( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'MTP_ID' ] ), |
|
2224 | - 'GRP_ID' => absint( $this->_req_data[ 'GRP_ID' ] ), |
|
2225 | - 'MTP_user_id' => absint( $this->_req_data[ 'MTP_user_id' ] ), |
|
2226 | - 'MTP_messenger' => strtolower( $this->_req_data[ 'MTP_messenger' ] ), |
|
2227 | - 'MTP_message_type' => strtolower( $this->_req_data[ 'MTP_message_type' ] ), |
|
2228 | - 'MTP_template_field' => strtolower( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'name' ] ), |
|
2229 | - 'MTP_context' => strtolower( $this->_req_data[ 'MTP_context' ] ), |
|
2230 | - 'MTP_content' => $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'content' ], |
|
2231 | - 'MTP_is_global' => isset( $this->_req_data[ 'MTP_is_global' ] ) |
|
2232 | - ? absint( $this->_req_data[ 'MTP_is_global' ] ) |
|
2223 | + 'MTP_ID' => absint($this->_req_data['MTP_template_fields'][$index]['MTP_ID']), |
|
2224 | + 'GRP_ID' => absint($this->_req_data['GRP_ID']), |
|
2225 | + 'MTP_user_id' => absint($this->_req_data['MTP_user_id']), |
|
2226 | + 'MTP_messenger' => strtolower($this->_req_data['MTP_messenger']), |
|
2227 | + 'MTP_message_type' => strtolower($this->_req_data['MTP_message_type']), |
|
2228 | + 'MTP_template_field' => strtolower($this->_req_data['MTP_template_fields'][$index]['name']), |
|
2229 | + 'MTP_context' => strtolower($this->_req_data['MTP_context']), |
|
2230 | + 'MTP_content' => $this->_req_data['MTP_template_fields'][$index]['content'], |
|
2231 | + 'MTP_is_global' => isset($this->_req_data['MTP_is_global']) |
|
2232 | + ? absint($this->_req_data['MTP_is_global']) |
|
2233 | 2233 | : 0, |
2234 | - 'MTP_is_override' => isset( $this->_req_data[ 'MTP_is_override' ] ) |
|
2235 | - ? absint( $this->_req_data[ 'MTP_is_override' ] ) |
|
2234 | + 'MTP_is_override' => isset($this->_req_data['MTP_is_override']) |
|
2235 | + ? absint($this->_req_data['MTP_is_override']) |
|
2236 | 2236 | : 0, |
2237 | - 'MTP_deleted' => absint( $this->_req_data[ 'MTP_deleted' ] ), |
|
2238 | - 'MTP_is_active' => absint( $this->_req_data[ 'MTP_is_active' ] ) |
|
2237 | + 'MTP_deleted' => absint($this->_req_data['MTP_deleted']), |
|
2238 | + 'MTP_is_active' => absint($this->_req_data['MTP_is_active']) |
|
2239 | 2239 | ); |
2240 | 2240 | |
2241 | 2241 | |
@@ -2247,42 +2247,42 @@ discard block |
||
2247 | 2247 | |
2248 | 2248 | |
2249 | 2249 | |
2250 | - protected function _insert_or_update_message_template($new = false ) { |
|
2250 | + protected function _insert_or_update_message_template($new = false) { |
|
2251 | 2251 | |
2252 | - do_action ( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2252 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2253 | 2253 | $success = 0; |
2254 | 2254 | $override = false; |
2255 | 2255 | |
2256 | 2256 | //setup notices description |
2257 | - $messenger_slug = ! empty( $this->_req_data['MTP_messenger'] ) ? $this->_req_data['MTP_messenger'] : ''; |
|
2257 | + $messenger_slug = ! empty($this->_req_data['MTP_messenger']) ? $this->_req_data['MTP_messenger'] : ''; |
|
2258 | 2258 | |
2259 | 2259 | //need the message type and messenger objects to be able to use the labels for the notices |
2260 | - $messenger_object = $this->_message_resource_manager->get_messenger( $messenger_slug ); |
|
2261 | - $messenger_label = $messenger_object instanceof EE_messenger ? ucwords( $messenger_object->label['singular'] ) : ''; |
|
2260 | + $messenger_object = $this->_message_resource_manager->get_messenger($messenger_slug); |
|
2261 | + $messenger_label = $messenger_object instanceof EE_messenger ? ucwords($messenger_object->label['singular']) : ''; |
|
2262 | 2262 | |
2263 | - $message_type_slug = ! empty( $this->_req_data['MTP_message_type'] ) ? $this->_req_data['MTP_message_type'] : ''; |
|
2264 | - $message_type_object = $this->_message_resource_manager->get_message_type( $message_type_slug ); |
|
2263 | + $message_type_slug = ! empty($this->_req_data['MTP_message_type']) ? $this->_req_data['MTP_message_type'] : ''; |
|
2264 | + $message_type_object = $this->_message_resource_manager->get_message_type($message_type_slug); |
|
2265 | 2265 | |
2266 | 2266 | $message_type_label = $message_type_object instanceof EE_message_type |
2267 | - ? ucwords( $message_type_object->label['singular'] ) |
|
2267 | + ? ucwords($message_type_object->label['singular']) |
|
2268 | 2268 | : ''; |
2269 | 2269 | |
2270 | - $context_slug = ! empty( $this->_req_data['MTP_context'] ) |
|
2270 | + $context_slug = ! empty($this->_req_data['MTP_context']) |
|
2271 | 2271 | ? $this->_req_data['MTP_context'] |
2272 | 2272 | : ''; |
2273 | - $context = ucwords( str_replace( '_', ' ', $context_slug ) ); |
|
2273 | + $context = ucwords(str_replace('_', ' ', $context_slug)); |
|
2274 | 2274 | |
2275 | - $item_desc = $messenger_label && $message_type_label ? $messenger_label. ' ' . $message_type_label . ' ' . $context . ' ' : ''; |
|
2275 | + $item_desc = $messenger_label && $message_type_label ? $messenger_label.' '.$message_type_label.' '.$context.' ' : ''; |
|
2276 | 2276 | $item_desc .= 'Message Template'; |
2277 | 2277 | $query_args = array(); |
2278 | 2278 | $edit_array = array(); |
2279 | 2279 | $action_desc = ''; |
2280 | 2280 | |
2281 | 2281 | //if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit. |
2282 | - if ( $new ) { |
|
2283 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
2284 | - if ( $edit_array = $this->_generate_new_templates($messenger_slug, $message_type_slug, $GRP_ID ) ) { |
|
2285 | - if ( empty($edit_array) ) { |
|
2282 | + if ($new) { |
|
2283 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
2284 | + if ($edit_array = $this->_generate_new_templates($messenger_slug, $message_type_slug, $GRP_ID)) { |
|
2285 | + if (empty($edit_array)) { |
|
2286 | 2286 | $success = 0; |
2287 | 2287 | } else { |
2288 | 2288 | $success = 1; |
@@ -2301,7 +2301,7 @@ discard block |
||
2301 | 2301 | |
2302 | 2302 | |
2303 | 2303 | //run update for each template field in displayed context |
2304 | - if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) { |
|
2304 | + if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) { |
|
2305 | 2305 | EE_Error::add_error( |
2306 | 2306 | __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), |
2307 | 2307 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2310,25 +2310,25 @@ discard block |
||
2310 | 2310 | |
2311 | 2311 | } else { |
2312 | 2312 | //first validate all fields! |
2313 | - $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $context_slug, $messenger_slug, $message_type_slug); |
|
2313 | + $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $context_slug, $messenger_slug, $message_type_slug); |
|
2314 | 2314 | |
2315 | 2315 | //if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array. WE need to make sure there is no actual error messages in validates. |
2316 | - if ( is_array($validates) && !empty($validates) ) { |
|
2316 | + if (is_array($validates) && ! empty($validates)) { |
|
2317 | 2317 | //add the transient so when the form loads we know which fields to highlight |
2318 | - $this->_add_transient( 'edit_message_template', $validates ); |
|
2318 | + $this->_add_transient('edit_message_template', $validates); |
|
2319 | 2319 | |
2320 | 2320 | $success = 0; |
2321 | 2321 | |
2322 | 2322 | //setup notices |
2323 | - foreach ( $validates as $field => $error ) { |
|
2324 | - if ( isset($error['msg'] ) ) { |
|
2325 | - EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ ); |
|
2323 | + foreach ($validates as $field => $error) { |
|
2324 | + if (isset($error['msg'])) { |
|
2325 | + EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__); |
|
2326 | 2326 | } |
2327 | 2327 | } |
2328 | 2328 | |
2329 | 2329 | } else { |
2330 | 2330 | $set_column_values = array(); |
2331 | - foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) { |
|
2331 | + foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) { |
|
2332 | 2332 | $set_column_values = $this->_set_message_template_column_values($template_field); |
2333 | 2333 | |
2334 | 2334 | $where_cols_n_values = array( |
@@ -2341,11 +2341,11 @@ discard block |
||
2341 | 2341 | 'MTP_context' => $set_column_values['MTP_context'], |
2342 | 2342 | 'MTP_content' => $set_column_values['MTP_content'] |
2343 | 2343 | ); |
2344 | - if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) { |
|
2345 | - if ( $updated === false ) { |
|
2344 | + if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) { |
|
2345 | + if ($updated === false) { |
|
2346 | 2346 | EE_Error::add_error( |
2347 | 2347 | sprintf( |
2348 | - __( '%s field was NOT updated for some reason', 'event_espresso' ), |
|
2348 | + __('%s field was NOT updated for some reason', 'event_espresso'), |
|
2349 | 2349 | $template_field |
2350 | 2350 | ), |
2351 | 2351 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2359,46 +2359,46 @@ discard block |
||
2359 | 2359 | |
2360 | 2360 | //we can use the last set_column_values for the MTPG update (because its the same for all of these specific MTPs) |
2361 | 2361 | $mtpg_fields = array( |
2362 | - 'MTP_user_id' => $set_column_values[ 'MTP_user_id' ], |
|
2363 | - 'MTP_messenger' => $set_column_values[ 'MTP_messenger' ], |
|
2364 | - 'MTP_message_type' => $set_column_values[ 'MTP_message_type' ], |
|
2365 | - 'MTP_is_global' => $set_column_values[ 'MTP_is_global' ], |
|
2366 | - 'MTP_is_override' => $set_column_values[ 'MTP_is_override' ], |
|
2367 | - 'MTP_deleted' => $set_column_values[ 'MTP_deleted' ], |
|
2368 | - 'MTP_is_active' => $set_column_values[ 'MTP_is_active' ], |
|
2369 | - 'MTP_name' => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] ) |
|
2370 | - ? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] |
|
2362 | + 'MTP_user_id' => $set_column_values['MTP_user_id'], |
|
2363 | + 'MTP_messenger' => $set_column_values['MTP_messenger'], |
|
2364 | + 'MTP_message_type' => $set_column_values['MTP_message_type'], |
|
2365 | + 'MTP_is_global' => $set_column_values['MTP_is_global'], |
|
2366 | + 'MTP_is_override' => $set_column_values['MTP_is_override'], |
|
2367 | + 'MTP_deleted' => $set_column_values['MTP_deleted'], |
|
2368 | + 'MTP_is_active' => $set_column_values['MTP_is_active'], |
|
2369 | + 'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) |
|
2370 | + ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] |
|
2371 | 2371 | : '', |
2372 | - 'MTP_description' => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] ) |
|
2373 | - ? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] |
|
2372 | + 'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) |
|
2373 | + ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] |
|
2374 | 2374 | : '' |
2375 | 2375 | ); |
2376 | 2376 | |
2377 | - $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] ); |
|
2378 | - $updated = $MTPG->update( $mtpg_fields, array($mtpg_where) ); |
|
2377 | + $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']); |
|
2378 | + $updated = $MTPG->update($mtpg_fields, array($mtpg_where)); |
|
2379 | 2379 | |
2380 | - if ( $updated === false ) { |
|
2380 | + if ($updated === false) { |
|
2381 | 2381 | EE_Error::add_error( |
2382 | 2382 | sprintf( |
2383 | - __( 'The Message Template Group (%d) was NOT updated for some reason', 'event_espresso' ), |
|
2384 | - $set_column_values[ 'GRP_ID' ] |
|
2383 | + __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), |
|
2384 | + $set_column_values['GRP_ID'] |
|
2385 | 2385 | ), |
2386 | 2386 | __FILE__, __FUNCTION__, __LINE__ |
2387 | 2387 | ); |
2388 | 2388 | } else { |
2389 | 2389 | //k now we need to ensure the template_pack and template_variation fields are set. |
2390 | - $template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) |
|
2390 | + $template_pack = ! empty($this->_req_data['MTP_template_pack']) |
|
2391 | 2391 | ? $this->_req_data['MTP_template_pack'] |
2392 | 2392 | : 'default'; |
2393 | 2393 | |
2394 | - $template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) |
|
2394 | + $template_variation = ! empty($this->_req_data['MTP_template_variation']) |
|
2395 | 2395 | ? $this->_req_data['MTP_template_variation'] |
2396 | 2396 | : 'default'; |
2397 | 2397 | |
2398 | - $mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] ); |
|
2399 | - if ( $mtpg_obj instanceof EE_Message_Template_Group ) { |
|
2400 | - $mtpg_obj->set_template_pack_name( $template_pack ); |
|
2401 | - $mtpg_obj->set_template_pack_variation( $template_variation ); |
|
2398 | + $mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']); |
|
2399 | + if ($mtpg_obj instanceof EE_Message_Template_Group) { |
|
2400 | + $mtpg_obj->set_template_pack_name($template_pack); |
|
2401 | + $mtpg_obj->set_template_pack_variation($template_variation); |
|
2402 | 2402 | } |
2403 | 2403 | $success = 1; |
2404 | 2404 | } |
@@ -2408,7 +2408,7 @@ discard block |
||
2408 | 2408 | } |
2409 | 2409 | |
2410 | 2410 | //we return things differently if doing ajax |
2411 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
2411 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2412 | 2412 | $this->_template_args['success'] = $success; |
2413 | 2413 | $this->_template_args['error'] = ! $success ? true : false; |
2414 | 2414 | $this->_template_args['content'] = ''; |
@@ -2416,9 +2416,9 @@ discard block |
||
2416 | 2416 | 'grpID' => $edit_array['GRP_ID'], |
2417 | 2417 | 'templateName' => $edit_array['template_name'] |
2418 | 2418 | ); |
2419 | - if ( $success ) { |
|
2419 | + if ($success) { |
|
2420 | 2420 | EE_Error::overwrite_success(); |
2421 | - EE_Error::add_success( __('The new template has been created and automatically selected for this event. You can edit the new template by clicking the edit button. Note before this template is assigned to this event, the event must be saved.', 'event_espresso') ); |
|
2421 | + EE_Error::add_success(__('The new template has been created and automatically selected for this event. You can edit the new template by clicking the edit button. Note before this template is assigned to this event, the event must be saved.', 'event_espresso')); |
|
2422 | 2422 | } |
2423 | 2423 | |
2424 | 2424 | $this->_return_json(); |
@@ -2426,13 +2426,13 @@ discard block |
||
2426 | 2426 | |
2427 | 2427 | |
2428 | 2428 | //was a test send triggered? |
2429 | - if ( isset( $this->_req_data['test_button'] ) ) { |
|
2429 | + if (isset($this->_req_data['test_button'])) { |
|
2430 | 2430 | EE_Error::overwrite_success(); |
2431 | - $this->_do_test_send( $context, $messenger_slug, $message_type_slug ); |
|
2431 | + $this->_do_test_send($context, $messenger_slug, $message_type_slug); |
|
2432 | 2432 | $override = true; |
2433 | 2433 | } |
2434 | 2434 | |
2435 | - if ( empty( $query_args ) ) { |
|
2435 | + if (empty($query_args)) { |
|
2436 | 2436 | $query_args = array( |
2437 | 2437 | 'id' => $this->_req_data['GRP_ID'], |
2438 | 2438 | 'context' => $context_slug, |
@@ -2440,7 +2440,7 @@ discard block |
||
2440 | 2440 | ); |
2441 | 2441 | } |
2442 | 2442 | |
2443 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override ); |
|
2443 | + $this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override); |
|
2444 | 2444 | } |
2445 | 2445 | |
2446 | 2446 | |
@@ -2454,28 +2454,28 @@ discard block |
||
2454 | 2454 | * @param string $message_type message type being tested |
2455 | 2455 | * |
2456 | 2456 | */ |
2457 | - protected function _do_test_send( $context, $messenger, $message_type ) { |
|
2457 | + protected function _do_test_send($context, $messenger, $message_type) { |
|
2458 | 2458 | //set things up for preview |
2459 | 2459 | $this->_req_data['messenger'] = $messenger; |
2460 | 2460 | $this->_req_data['message_type'] = $message_type; |
2461 | 2461 | $this->_req_data['context'] = $context; |
2462 | - $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : ''; |
|
2463 | - $active_messenger = $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
2462 | + $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : ''; |
|
2463 | + $active_messenger = $this->_message_resource_manager->get_active_messenger($messenger); |
|
2464 | 2464 | |
2465 | 2465 | //let's save any existing fields that might be required by the messenger |
2466 | 2466 | if ( |
2467 | - isset( $this->_req_data['test_settings_fld'] ) |
|
2467 | + isset($this->_req_data['test_settings_fld']) |
|
2468 | 2468 | && $active_messenger instanceof EE_messenger |
2469 | 2469 | ) { |
2470 | - $active_messenger->set_existing_test_settings( $this->_req_data['test_settings_fld'] ); |
|
2470 | + $active_messenger->set_existing_test_settings($this->_req_data['test_settings_fld']); |
|
2471 | 2471 | } |
2472 | 2472 | |
2473 | 2473 | $success = $this->_preview_message(true); |
2474 | 2474 | |
2475 | - if ( $success ) { |
|
2476 | - EE_Error::add_success( __('Test message sent', 'event_espresso') ); |
|
2475 | + if ($success) { |
|
2476 | + EE_Error::add_success(__('Test message sent', 'event_espresso')); |
|
2477 | 2477 | } else { |
2478 | - EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
2478 | + EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2479 | 2479 | } |
2480 | 2480 | } |
2481 | 2481 | |
@@ -2501,11 +2501,11 @@ discard block |
||
2501 | 2501 | protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = false) { |
2502 | 2502 | |
2503 | 2503 | //if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates. |
2504 | - if ( empty( $message_types ) ) { |
|
2504 | + if (empty($message_types)) { |
|
2505 | 2505 | return true; |
2506 | 2506 | } |
2507 | 2507 | |
2508 | - return EEH_MSG_Template::generate_new_templates( $messenger, $message_types, $GRP_ID, $global ); |
|
2508 | + return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global); |
|
2509 | 2509 | } |
2510 | 2510 | |
2511 | 2511 | |
@@ -2521,33 +2521,33 @@ discard block |
||
2521 | 2521 | * |
2522 | 2522 | * @return void |
2523 | 2523 | */ |
2524 | - protected function _trash_or_restore_message_template($trash = true, $all = false ) { |
|
2525 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2524 | + protected function _trash_or_restore_message_template($trash = true, $all = false) { |
|
2525 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2526 | 2526 | $MTP = EEM_Message_Template_Group::instance(); |
2527 | 2527 | |
2528 | 2528 | $success = 1; |
2529 | 2529 | |
2530 | 2530 | //incoming GRP_IDs |
2531 | - if ( $all ) { |
|
2531 | + if ($all) { |
|
2532 | 2532 | //Checkboxes |
2533 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) { |
|
2533 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2534 | 2534 | //if array has more than one element then success message should be plural. |
2535 | 2535 | //todo: what about nonce? |
2536 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2536 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2537 | 2537 | |
2538 | 2538 | //cycle through checkboxes |
2539 | - while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) { |
|
2540 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2541 | - if ( ! $trashed_or_restored ) { |
|
2539 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2540 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2541 | + if ( ! $trashed_or_restored) { |
|
2542 | 2542 | $success = 0; |
2543 | 2543 | } |
2544 | 2544 | } |
2545 | 2545 | } else { |
2546 | 2546 | //grab single GRP_ID and handle |
2547 | - $GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
2548 | - if ( ! empty( $GRP_ID ) ) { |
|
2549 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2550 | - if ( ! $trashed_or_restored ) { |
|
2547 | + $GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
2548 | + if ( ! empty($GRP_ID)) { |
|
2549 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2550 | + if ( ! $trashed_or_restored) { |
|
2551 | 2551 | $success = 0; |
2552 | 2552 | } |
2553 | 2553 | } else { |
@@ -2559,13 +2559,13 @@ discard block |
||
2559 | 2559 | |
2560 | 2560 | $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
2561 | 2561 | |
2562 | - $action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc; |
|
2562 | + $action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc; |
|
2563 | 2563 | |
2564 | 2564 | $item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso'); |
2565 | 2565 | |
2566 | - $item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2566 | + $item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2567 | 2567 | |
2568 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, array() ); |
|
2568 | + $this->_redirect_after_action($success, $item_desc, $action_desc, array()); |
|
2569 | 2569 | |
2570 | 2570 | } |
2571 | 2571 | |
@@ -2581,24 +2581,24 @@ discard block |
||
2581 | 2581 | * @return void |
2582 | 2582 | */ |
2583 | 2583 | protected function _delete_message_template() { |
2584 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2584 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2585 | 2585 | |
2586 | 2586 | //checkboxes |
2587 | - if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) { |
|
2587 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2588 | 2588 | //if array has more than one element then success message should be plural |
2589 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2589 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2590 | 2590 | |
2591 | 2591 | //cycle through bulk action checkboxes |
2592 | - while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) { |
|
2593 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2592 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2593 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2594 | 2594 | } |
2595 | 2595 | } else { |
2596 | 2596 | //grab single grp_id and delete |
2597 | - $GRP_ID = absint($this->_req_data['id'] ); |
|
2598 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2597 | + $GRP_ID = absint($this->_req_data['id']); |
|
2598 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2599 | 2599 | } |
2600 | 2600 | |
2601 | - $this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() ); |
|
2601 | + $this->_redirect_after_action($success, 'Message Templates', 'deleted', array()); |
|
2602 | 2602 | |
2603 | 2603 | } |
2604 | 2604 | |
@@ -2613,20 +2613,20 @@ discard block |
||
2613 | 2613 | * |
2614 | 2614 | * @return bool boolean to indicate the success of the deletes or not. |
2615 | 2615 | */ |
2616 | - private function _delete_mtp_permanently( $GRP_ID, $include_group = true ) { |
|
2616 | + private function _delete_mtp_permanently($GRP_ID, $include_group = true) { |
|
2617 | 2617 | $success = 1; |
2618 | 2618 | $MTPG = EEM_Message_Template_Group::instance(); |
2619 | 2619 | //first let's GET this group |
2620 | - $MTG = $MTPG->get_one_by_ID( $GRP_ID ); |
|
2620 | + $MTG = $MTPG->get_one_by_ID($GRP_ID); |
|
2621 | 2621 | //then delete permanently all the related Message Templates |
2622 | - $deleted = $MTG->delete_related_permanently( 'Message_Template' ); |
|
2622 | + $deleted = $MTG->delete_related_permanently('Message_Template'); |
|
2623 | 2623 | |
2624 | - if ( $deleted === 0 ) |
|
2625 | - {$success = 0;} |
|
2624 | + if ($deleted === 0) |
|
2625 | + {$success = 0; } |
|
2626 | 2626 | |
2627 | 2627 | //now delete permanently this particular group |
2628 | 2628 | |
2629 | - if ( $include_group && ! $MTG->delete_permanently() ) { |
|
2629 | + if ($include_group && ! $MTG->delete_permanently()) { |
|
2630 | 2630 | $success = 0; |
2631 | 2631 | } |
2632 | 2632 | return $success; |
@@ -2644,7 +2644,7 @@ discard block |
||
2644 | 2644 | * @return string |
2645 | 2645 | */ |
2646 | 2646 | protected function _learn_more_about_message_templates_link() { |
2647 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; |
|
2647 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>'; |
|
2648 | 2648 | } |
2649 | 2649 | |
2650 | 2650 | |
@@ -2662,10 +2662,10 @@ discard block |
||
2662 | 2662 | |
2663 | 2663 | $this->_set_m_mt_settings(); |
2664 | 2664 | |
2665 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2665 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2666 | 2666 | |
2667 | 2667 | //let's setup the messenger tabs |
2668 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger ); |
|
2668 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger); |
|
2669 | 2669 | $this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">'; |
2670 | 2670 | $this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->'; |
2671 | 2671 | |
@@ -2684,7 +2684,7 @@ discard block |
||
2684 | 2684 | */ |
2685 | 2685 | protected function _set_m_mt_settings() { |
2686 | 2686 | //first if this is already set then lets get out no need to regenerate data. |
2687 | - if ( !empty($this->_m_mt_settings) ) { |
|
2687 | + if ( ! empty($this->_m_mt_settings)) { |
|
2688 | 2688 | return; |
2689 | 2689 | } |
2690 | 2690 | |
@@ -2699,10 +2699,10 @@ discard block |
||
2699 | 2699 | |
2700 | 2700 | //assemble the array for the _tab_text_links helper |
2701 | 2701 | |
2702 | - foreach ( $messengers as $messenger ) { |
|
2702 | + foreach ($messengers as $messenger) { |
|
2703 | 2703 | $this->_m_mt_settings['messenger_tabs'][$messenger->name] = array( |
2704 | 2704 | 'label' => ucwords($messenger->label['singular']), |
2705 | - 'class' => $this->_message_resource_manager->is_messenger_active( $messenger->name ) ? 'messenger-active' : '', |
|
2705 | + 'class' => $this->_message_resource_manager->is_messenger_active($messenger->name) ? 'messenger-active' : '', |
|
2706 | 2706 | 'href' => $messenger->name, |
2707 | 2707 | 'title' => __('Modify this Messenger', 'event_espresso'), |
2708 | 2708 | 'slug' => $messenger->name, |
@@ -2712,26 +2712,26 @@ discard block |
||
2712 | 2712 | |
2713 | 2713 | $message_types_for_messenger = $messenger->get_valid_message_types(); |
2714 | 2714 | |
2715 | - foreach ( $message_types as $message_type ) { |
|
2715 | + foreach ($message_types as $message_type) { |
|
2716 | 2716 | //first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox. |
2717 | - if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) { |
|
2717 | + if ( ! in_array($message_type->name, $message_types_for_messenger)) { |
|
2718 | 2718 | continue; |
2719 | 2719 | } |
2720 | 2720 | |
2721 | - $a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger->name, $message_type->name ) ? 'active' : 'inactive'; |
|
2721 | + $a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger($messenger->name, $message_type->name) ? 'active' : 'inactive'; |
|
2722 | 2722 | |
2723 | 2723 | $this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array( |
2724 | - 'label' => ucwords( $message_type->label[ 'singular' ] ), |
|
2725 | - 'class' => 'message-type-' . $a_or_i, |
|
2726 | - 'slug_id' => $message_type->name . '-messagetype-' . $messenger->name, |
|
2727 | - 'mt_nonce' => wp_create_nonce( $message_type->name . '_nonce' ), |
|
2728 | - 'href' => 'espresso_' . $message_type->name . '_message_type_settings', |
|
2724 | + 'label' => ucwords($message_type->label['singular']), |
|
2725 | + 'class' => 'message-type-'.$a_or_i, |
|
2726 | + 'slug_id' => $message_type->name.'-messagetype-'.$messenger->name, |
|
2727 | + 'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'), |
|
2728 | + 'href' => 'espresso_'.$message_type->name.'_message_type_settings', |
|
2729 | 2729 | 'title' => $a_or_i == 'active' |
2730 | - ? __( 'Drag this message type to the Inactive window to deactivate', 'event_espresso' ) |
|
2731 | - : __( 'Drag this message type to the messenger to activate', 'event_espresso' ), |
|
2730 | + ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') |
|
2731 | + : __('Drag this message type to the messenger to activate', 'event_espresso'), |
|
2732 | 2732 | 'content' => $a_or_i == 'active' |
2733 | - ? $this->_message_type_settings_content( $message_type, $messenger, true ) |
|
2734 | - : $this->_message_type_settings_content( $message_type, $messenger ), |
|
2733 | + ? $this->_message_type_settings_content($message_type, $messenger, true) |
|
2734 | + : $this->_message_type_settings_content($message_type, $messenger), |
|
2735 | 2735 | 'slug' => $message_type->name, |
2736 | 2736 | 'active' => $a_or_i == 'active' ? true : false, |
2737 | 2737 | 'obj' => $message_type |
@@ -2750,34 +2750,34 @@ discard block |
||
2750 | 2750 | * |
2751 | 2751 | * @return string html output for the content |
2752 | 2752 | */ |
2753 | - protected function _message_type_settings_content( $message_type, $messenger, $active = false ) { |
|
2753 | + protected function _message_type_settings_content($message_type, $messenger, $active = false) { |
|
2754 | 2754 | //get message type fields |
2755 | 2755 | $fields = $message_type->get_admin_settings_fields(); |
2756 | - $settings_template_args['template_form_fields']= ''; |
|
2756 | + $settings_template_args['template_form_fields'] = ''; |
|
2757 | 2757 | |
2758 | - if ( !empty( $fields ) && $active ) { |
|
2758 | + if ( ! empty($fields) && $active) { |
|
2759 | 2759 | |
2760 | - $existing_settings = $message_type->get_existing_admin_settings( $messenger->name ); |
|
2760 | + $existing_settings = $message_type->get_existing_admin_settings($messenger->name); |
|
2761 | 2761 | |
2762 | - foreach( $fields as $fldname => $fldprops ) { |
|
2763 | - $field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname; |
|
2762 | + foreach ($fields as $fldname => $fldprops) { |
|
2763 | + $field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname; |
|
2764 | 2764 | $template_form_field[$field_id] = array( |
2765 | - 'name' => 'message_type_settings[' . $fldname . ']', |
|
2765 | + 'name' => 'message_type_settings['.$fldname.']', |
|
2766 | 2766 | 'label' => $fldprops['label'], |
2767 | 2767 | 'input' => $fldprops['field_type'], |
2768 | 2768 | 'type' => $fldprops['value_type'], |
2769 | 2769 | 'required' => $fldprops['required'], |
2770 | 2770 | 'validation' => $fldprops['validation'], |
2771 | - 'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2772 | - 'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(), |
|
2773 | - 'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2771 | + 'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2772 | + 'options' => isset($fldprops['options']) ? $fldprops['options'] : array(), |
|
2773 | + 'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2774 | 2774 | 'css_class' => 'no-drag', |
2775 | 2775 | 'format' => $fldprops['format'] |
2776 | 2776 | ); |
2777 | 2777 | } |
2778 | 2778 | |
2779 | 2779 | |
2780 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : ''; |
|
2780 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : ''; |
|
2781 | 2781 | } |
2782 | 2782 | |
2783 | 2783 | $settings_template_args['description'] = $message_type->description; |
@@ -2797,13 +2797,13 @@ discard block |
||
2797 | 2797 | ) |
2798 | 2798 | ); |
2799 | 2799 | |
2800 | - $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' ); |
|
2801 | - $settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : ''; |
|
2800 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array'); |
|
2801 | + $settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : ''; |
|
2802 | 2802 | |
2803 | 2803 | |
2804 | 2804 | |
2805 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php'; |
|
2806 | - $content = EEH_Template::display_template( $template, $settings_template_args, true ); |
|
2805 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php'; |
|
2806 | + $content = EEH_Template::display_template($template, $settings_template_args, true); |
|
2807 | 2807 | return $content; |
2808 | 2808 | } |
2809 | 2809 | |
@@ -2820,27 +2820,27 @@ discard block |
||
2820 | 2820 | $m_boxes = $mt_boxes = array(); |
2821 | 2821 | $m_template_args = $mt_template_args = array(); |
2822 | 2822 | |
2823 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2823 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2824 | 2824 | |
2825 | - if ( isset( $this->_m_mt_settings[ 'messenger_tabs' ] ) ) { |
|
2826 | - foreach ( $this->_m_mt_settings[ 'messenger_tabs' ] as $messenger => $tab_array ) { |
|
2827 | - $hide_on_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? '' : 'hidden'; |
|
2828 | - $hide_off_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? 'hidden' : ''; |
|
2825 | + if (isset($this->_m_mt_settings['messenger_tabs'])) { |
|
2826 | + foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) { |
|
2827 | + $hide_on_message = $this->_message_resource_manager->is_messenger_active($messenger) ? '' : 'hidden'; |
|
2828 | + $hide_off_message = $this->_message_resource_manager->is_messenger_active($messenger) ? 'hidden' : ''; |
|
2829 | 2829 | //messenger meta boxes |
2830 | 2830 | $active = $selected_messenger == $messenger ? true : false; |
2831 | - $active_mt_tabs = isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] ) |
|
2832 | - ? $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] |
|
2831 | + $active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) |
|
2832 | + ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] |
|
2833 | 2833 | : ''; |
2834 | - $m_boxes[ $messenger . '_a_box' ] = sprintf( |
|
2835 | - __( '%s Settings', 'event_espresso' ), |
|
2836 | - $tab_array[ 'label' ] |
|
2834 | + $m_boxes[$messenger.'_a_box'] = sprintf( |
|
2835 | + __('%s Settings', 'event_espresso'), |
|
2836 | + $tab_array['label'] |
|
2837 | 2837 | ); |
2838 | - $m_template_args[ $messenger . '_a_box' ] = array( |
|
2839 | - 'active_message_types' => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2840 | - 'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2841 | - ? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2838 | + $m_template_args[$messenger.'_a_box'] = array( |
|
2839 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2840 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2841 | + ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2842 | 2842 | : '', |
2843 | - 'content' => $this->_get_messenger_box_content( $tab_array[ 'obj' ] ), |
|
2843 | + 'content' => $this->_get_messenger_box_content($tab_array['obj']), |
|
2844 | 2844 | 'hidden' => $active ? '' : ' hidden', |
2845 | 2845 | 'hide_on_message' => $hide_on_message, |
2846 | 2846 | 'messenger' => $messenger, |
@@ -2849,11 +2849,11 @@ discard block |
||
2849 | 2849 | // message type meta boxes |
2850 | 2850 | // (which is really just the inactive container for each messenger |
2851 | 2851 | // showing inactive message types for that messenger) |
2852 | - $mt_boxes[ $messenger . '_i_box' ] = __( 'Inactive Message Types', 'event_espresso' ); |
|
2853 | - $mt_template_args[ $messenger . '_i_box' ] = array( |
|
2854 | - 'active_message_types' => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2855 | - 'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2856 | - ? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2852 | + $mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso'); |
|
2853 | + $mt_template_args[$messenger.'_i_box'] = array( |
|
2854 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2855 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2856 | + ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2857 | 2857 | : '', |
2858 | 2858 | 'hidden' => $active ? '' : ' hidden', |
2859 | 2859 | 'hide_on_message' => $hide_on_message, |
@@ -2866,15 +2866,15 @@ discard block |
||
2866 | 2866 | |
2867 | 2867 | |
2868 | 2868 | //register messenger metaboxes |
2869 | - $m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2870 | - foreach ( $m_boxes as $box => $label ) { |
|
2871 | - $callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] ); |
|
2872 | - $msgr = str_replace( '_a_box', '', $box ); |
|
2869 | + $m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2870 | + foreach ($m_boxes as $box => $label) { |
|
2871 | + $callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]); |
|
2872 | + $msgr = str_replace('_a_box', '', $box); |
|
2873 | 2873 | add_meta_box( |
2874 | - 'espresso_' . $msgr . '_settings', |
|
2874 | + 'espresso_'.$msgr.'_settings', |
|
2875 | 2875 | $label, |
2876 | - function( $post, $metabox ) { |
|
2877 | - echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE ); |
|
2876 | + function($post, $metabox) { |
|
2877 | + echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE); |
|
2878 | 2878 | }, |
2879 | 2879 | $this->_current_screen->id, |
2880 | 2880 | 'normal', |
@@ -2884,17 +2884,17 @@ discard block |
||
2884 | 2884 | } |
2885 | 2885 | |
2886 | 2886 | //register message type metaboxes |
2887 | - $mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php'; |
|
2888 | - foreach ( $mt_boxes as $box => $label ) { |
|
2887 | + $mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php'; |
|
2888 | + foreach ($mt_boxes as $box => $label) { |
|
2889 | 2889 | $callback_args = array( |
2890 | - 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[ $box ] |
|
2890 | + 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] |
|
2891 | 2891 | ); |
2892 | - $mt = str_replace( '_i_box', '', $box ); |
|
2892 | + $mt = str_replace('_i_box', '', $box); |
|
2893 | 2893 | add_meta_box( |
2894 | - 'espresso_' . $mt . '_inactive_mts', |
|
2894 | + 'espresso_'.$mt.'_inactive_mts', |
|
2895 | 2895 | $label, |
2896 | - function( $post, $metabox ) { |
|
2897 | - echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE ); |
|
2896 | + function($post, $metabox) { |
|
2897 | + echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE); |
|
2898 | 2898 | }, |
2899 | 2899 | $this->_current_screen->id, |
2900 | 2900 | 'side', |
@@ -2905,11 +2905,11 @@ discard block |
||
2905 | 2905 | |
2906 | 2906 | //register metabox for global messages settings but only when on the main site. On single site installs this will |
2907 | 2907 | //always result in the metabox showing, on multisite installs the metabox will only show on the main site. |
2908 | - if ( is_main_site() ) { |
|
2908 | + if (is_main_site()) { |
|
2909 | 2909 | add_meta_box( |
2910 | 2910 | 'espresso_global_message_settings', |
2911 | - __( 'Global Message Settings', 'event_espresso' ), |
|
2912 | - array( $this, 'global_messages_settings_metabox_content' ), |
|
2911 | + __('Global Message Settings', 'event_espresso'), |
|
2912 | + array($this, 'global_messages_settings_metabox_content'), |
|
2913 | 2913 | $this->_current_screen->id, |
2914 | 2914 | 'normal', |
2915 | 2915 | 'low', |
@@ -2929,7 +2929,7 @@ discard block |
||
2929 | 2929 | public function global_messages_settings_metabox_content() { |
2930 | 2930 | $form = $this->_generate_global_settings_form(); |
2931 | 2931 | echo $form->form_open( |
2932 | - $this->add_query_args_and_nonce( array( 'action' => 'update_global_settings' ), EE_MSG_ADMIN_URL ), |
|
2932 | + $this->add_query_args_and_nonce(array('action' => 'update_global_settings'), EE_MSG_ADMIN_URL), |
|
2933 | 2933 | 'POST' |
2934 | 2934 | ) |
2935 | 2935 | . $form->get_html() |
@@ -2942,7 +2942,7 @@ discard block |
||
2942 | 2942 | * @return EE_Form_Section_Proper |
2943 | 2943 | */ |
2944 | 2944 | protected function _generate_global_settings_form() { |
2945 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
2945 | + EE_Registry::instance()->load_helper('HTML'); |
|
2946 | 2946 | /** @var EE_Network_Core_Config $network_config */ |
2947 | 2947 | $network_config = EE_Registry::instance()->NET_CFG->core; |
2948 | 2948 | return new EE_Form_Section_Proper( |
@@ -2961,13 +2961,13 @@ discard block |
||
2961 | 2961 | ), |
2962 | 2962 | array( |
2963 | 2963 | 'default' => $network_config->do_messages_on_same_request, |
2964 | - 'html_label_text' => __( 'Generate and send all messages:', 'event_espresso' ), |
|
2965 | - 'html_help_text' => __( 'By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system. This makes things execute faster for people registering for your events. However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso' ), |
|
2964 | + 'html_label_text' => __('Generate and send all messages:', 'event_espresso'), |
|
2965 | + 'html_help_text' => __('By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system. This makes things execute faster for people registering for your events. However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso'), |
|
2966 | 2966 | ) |
2967 | 2967 | ), |
2968 | 2968 | 'update_settings' => new EE_Submit_Input( |
2969 | 2969 | array( |
2970 | - 'default' => __( 'Update', 'event_espresso' ), |
|
2970 | + 'default' => __('Update', 'event_espresso'), |
|
2971 | 2971 | 'html_label_text' => ' ' |
2972 | 2972 | ) |
2973 | 2973 | ) |
@@ -2986,28 +2986,28 @@ discard block |
||
2986 | 2986 | /** @var EE_Network_Core_Config $network_config */ |
2987 | 2987 | $network_config = EE_Registry::instance()->NET_CFG->core; |
2988 | 2988 | $form = $this->_generate_global_settings_form(); |
2989 | - if ( $form->was_submitted() ) { |
|
2989 | + if ($form->was_submitted()) { |
|
2990 | 2990 | $form->receive_form_submission(); |
2991 | - if ( $form->is_valid() ) { |
|
2991 | + if ($form->is_valid()) { |
|
2992 | 2992 | $valid_data = $form->valid_data(); |
2993 | - foreach( $valid_data as $property => $value ) { |
|
2994 | - $setter = 'set_' . $property; |
|
2995 | - if ( method_exists( $network_config, $setter ) ) { |
|
2996 | - $network_config->{$setter}( $value ); |
|
2993 | + foreach ($valid_data as $property => $value) { |
|
2994 | + $setter = 'set_'.$property; |
|
2995 | + if (method_exists($network_config, $setter)) { |
|
2996 | + $network_config->{$setter}($value); |
|
2997 | 2997 | } else if ( |
2998 | - property_exists( $network_config, $property ) |
|
2998 | + property_exists($network_config, $property) |
|
2999 | 2999 | && $network_config->{$property} !== $value |
3000 | 3000 | ) { |
3001 | 3001 | $network_config->{$property} = $value; |
3002 | 3002 | } |
3003 | 3003 | } |
3004 | 3004 | //only update if the form submission was valid! |
3005 | - EE_Registry::instance()->NET_CFG->update_config( true, false ); |
|
3005 | + EE_Registry::instance()->NET_CFG->update_config(true, false); |
|
3006 | 3006 | EE_Error::overwrite_success(); |
3007 | - EE_Error::add_success( __( 'Global message settings were updated', 'event_espresso' ) ); |
|
3007 | + EE_Error::add_success(__('Global message settings were updated', 'event_espresso')); |
|
3008 | 3008 | } |
3009 | 3009 | } |
3010 | - $this->_redirect_after_action( 0, '', '', array( 'action' => 'settings' ), true ); |
|
3010 | + $this->_redirect_after_action(0, '', '', array('action' => 'settings'), true); |
|
3011 | 3011 | } |
3012 | 3012 | |
3013 | 3013 | |
@@ -3018,13 +3018,13 @@ discard block |
||
3018 | 3018 | * |
3019 | 3019 | * @return string html formatted tabs |
3020 | 3020 | */ |
3021 | - protected function _get_mt_tabs( $tab_array ) { |
|
3021 | + protected function _get_mt_tabs($tab_array) { |
|
3022 | 3022 | $tab_array = (array) $tab_array; |
3023 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php'; |
|
3023 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php'; |
|
3024 | 3024 | $tabs = ''; |
3025 | 3025 | |
3026 | - foreach ( $tab_array as $tab ) { |
|
3027 | - $tabs .= EEH_Template::display_template( $template, $tab, true ); |
|
3026 | + foreach ($tab_array as $tab) { |
|
3027 | + $tabs .= EEH_Template::display_template($template, $tab, true); |
|
3028 | 3028 | } |
3029 | 3029 | |
3030 | 3030 | return $tabs; |
@@ -3040,29 +3040,29 @@ discard block |
||
3040 | 3040 | * |
3041 | 3041 | * @return string html formatted content |
3042 | 3042 | */ |
3043 | - protected function _get_messenger_box_content( EE_messenger $messenger ) { |
|
3043 | + protected function _get_messenger_box_content(EE_messenger $messenger) { |
|
3044 | 3044 | |
3045 | 3045 | $fields = $messenger->get_admin_settings_fields(); |
3046 | 3046 | $settings_template_args['template_form_fields'] = ''; |
3047 | 3047 | |
3048 | 3048 | //is $messenger active? |
3049 | - $settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active( $messenger->name ); |
|
3049 | + $settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active($messenger->name); |
|
3050 | 3050 | |
3051 | 3051 | |
3052 | - if ( ! empty( $fields ) ) { |
|
3052 | + if ( ! empty($fields)) { |
|
3053 | 3053 | |
3054 | 3054 | $existing_settings = $messenger->get_existing_admin_settings(); |
3055 | 3055 | |
3056 | - foreach( $fields as $fldname => $fldprops ) { |
|
3057 | - $field_id = $messenger->name . '-' . $fldname; |
|
3056 | + foreach ($fields as $fldname => $fldprops) { |
|
3057 | + $field_id = $messenger->name.'-'.$fldname; |
|
3058 | 3058 | $template_form_field[$field_id] = array( |
3059 | - 'name' => 'messenger_settings[' . $field_id . ']', |
|
3059 | + 'name' => 'messenger_settings['.$field_id.']', |
|
3060 | 3060 | 'label' => $fldprops['label'], |
3061 | 3061 | 'input' => $fldprops['field_type'], |
3062 | 3062 | 'type' => $fldprops['value_type'], |
3063 | 3063 | 'required' => $fldprops['required'], |
3064 | 3064 | 'validation' => $fldprops['validation'], |
3065 | - 'value' => isset( $existing_settings[$field_id]) |
|
3065 | + 'value' => isset($existing_settings[$field_id]) |
|
3066 | 3066 | ? $existing_settings[$field_id] |
3067 | 3067 | : $fldprops['default'], |
3068 | 3068 | 'css_class' => '', |
@@ -3071,8 +3071,8 @@ discard block |
||
3071 | 3071 | } |
3072 | 3072 | |
3073 | 3073 | |
3074 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) |
|
3075 | - ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) |
|
3074 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) |
|
3075 | + ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') |
|
3076 | 3076 | : ''; |
3077 | 3077 | } |
3078 | 3078 | |
@@ -3089,39 +3089,39 @@ discard block |
||
3089 | 3089 | ); |
3090 | 3090 | |
3091 | 3091 | //make sure any active message types that are existing are included in the hidden fields |
3092 | - if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) { |
|
3093 | - foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) { |
|
3092 | + if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) { |
|
3093 | + foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) { |
|
3094 | 3094 | $settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array( |
3095 | 3095 | 'type' => 'hidden', |
3096 | 3096 | 'value' => $mt |
3097 | 3097 | ); |
3098 | 3098 | } |
3099 | 3099 | } |
3100 | - $settings_template_args[ 'hidden_fields' ] = $this->_generate_admin_form_fields( |
|
3101 | - $settings_template_args[ 'hidden_fields' ], |
|
3100 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( |
|
3101 | + $settings_template_args['hidden_fields'], |
|
3102 | 3102 | 'array' |
3103 | 3103 | ); |
3104 | - $active = $this->_message_resource_manager->is_messenger_active( $messenger->name ); |
|
3104 | + $active = $this->_message_resource_manager->is_messenger_active($messenger->name); |
|
3105 | 3105 | |
3106 | 3106 | $settings_template_args['messenger'] = $messenger->name; |
3107 | 3107 | $settings_template_args['description'] = $messenger->description; |
3108 | 3108 | $settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden'; |
3109 | 3109 | |
3110 | 3110 | |
3111 | - $settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active( $messenger->name ) |
|
3111 | + $settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active($messenger->name) |
|
3112 | 3112 | ? $settings_template_args['show_hide_edit_form'] |
3113 | 3113 | : ' hidden'; |
3114 | 3114 | |
3115 | - $settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) |
|
3115 | + $settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) |
|
3116 | 3116 | ? ' hidden' |
3117 | 3117 | : $settings_template_args['show_hide_edit_form']; |
3118 | 3118 | |
3119 | 3119 | |
3120 | 3120 | $settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on'; |
3121 | - $settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce'); |
|
3121 | + $settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce'); |
|
3122 | 3122 | $settings_template_args['on_off_status'] = $active ? true : false; |
3123 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php'; |
|
3124 | - $content = EEH_Template::display_template( $template, $settings_template_args, true); |
|
3123 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php'; |
|
3124 | + $content = EEH_Template::display_template($template, $settings_template_args, true); |
|
3125 | 3125 | return $content; |
3126 | 3126 | } |
3127 | 3127 | |
@@ -3135,9 +3135,9 @@ discard block |
||
3135 | 3135 | $success = true; |
3136 | 3136 | $this->_prep_default_response_for_messenger_or_message_type_toggle(); |
3137 | 3137 | //let's check that we have required data |
3138 | - if ( !isset( $this->_req_data[ 'messenger' ] ) ) { |
|
3138 | + if ( ! isset($this->_req_data['messenger'])) { |
|
3139 | 3139 | EE_Error::add_error( |
3140 | - __( 'Messenger name needed to toggle activation. None given', 'event_espresso' ), |
|
3140 | + __('Messenger name needed to toggle activation. None given', 'event_espresso'), |
|
3141 | 3141 | __FILE__, |
3142 | 3142 | __FUNCTION__, |
3143 | 3143 | __LINE__ |
@@ -3146,14 +3146,14 @@ discard block |
||
3146 | 3146 | } |
3147 | 3147 | |
3148 | 3148 | //do a nonce check here since we're not arriving via a normal route |
3149 | - $nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : ''; |
|
3150 | - $nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce'; |
|
3149 | + $nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : ''; |
|
3150 | + $nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce'; |
|
3151 | 3151 | |
3152 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
3152 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
3153 | 3153 | |
3154 | 3154 | |
3155 | 3155 | |
3156 | - if ( !isset( $this->_req_data[ 'status' ])) { |
|
3156 | + if ( ! isset($this->_req_data['status'])) { |
|
3157 | 3157 | EE_Error::add_error( |
3158 | 3158 | __( |
3159 | 3159 | 'Messenger status needed to know whether activation or deactivation is happening. No status is given', |
@@ -3169,11 +3169,11 @@ discard block |
||
3169 | 3169 | //do check to verify we have a valid status. |
3170 | 3170 | $status = $this->_req_data['status']; |
3171 | 3171 | |
3172 | - if ( $status != 'off' && $status != 'on' ) { |
|
3172 | + if ($status != 'off' && $status != 'on') { |
|
3173 | 3173 | EE_Error::add_error( |
3174 | 3174 | sprintf( |
3175 | - __( 'The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso' ), |
|
3176 | - $this->_req_data[ 'status' ] |
|
3175 | + __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), |
|
3176 | + $this->_req_data['status'] |
|
3177 | 3177 | ), |
3178 | 3178 | __FILE__, |
3179 | 3179 | __FUNCTION__, |
@@ -3182,11 +3182,11 @@ discard block |
||
3182 | 3182 | $success = false; |
3183 | 3183 | } |
3184 | 3184 | |
3185 | - if ( $success ) { |
|
3185 | + if ($success) { |
|
3186 | 3186 | //made it here? Stop dawdling then!! |
3187 | 3187 | $success = $status == 'off' |
3188 | - ? $this->_deactivate_messenger( $this->_req_data['messenger'] ) |
|
3189 | - : $this->_activate_messenger( $this->_req_data['messenger'] ); |
|
3188 | + ? $this->_deactivate_messenger($this->_req_data['messenger']) |
|
3189 | + : $this->_activate_messenger($this->_req_data['messenger']); |
|
3190 | 3190 | } |
3191 | 3191 | |
3192 | 3192 | $this->_template_args['success'] = $success; |
@@ -3209,7 +3209,7 @@ discard block |
||
3209 | 3209 | $this->_prep_default_response_for_messenger_or_message_type_toggle(); |
3210 | 3210 | |
3211 | 3211 | //let's make sure we have the necessary data |
3212 | - if ( ! isset( $this->_req_data[ 'message_type' ] ) ) { |
|
3212 | + if ( ! isset($this->_req_data['message_type'])) { |
|
3213 | 3213 | EE_Error::add_error( |
3214 | 3214 | __('Message Type name needed to toggle activation. None given', 'event_espresso'), |
3215 | 3215 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3217,7 +3217,7 @@ discard block |
||
3217 | 3217 | $success = false; |
3218 | 3218 | } |
3219 | 3219 | |
3220 | - if ( ! isset( $this->_req_data[ 'messenger' ] ) ) { |
|
3220 | + if ( ! isset($this->_req_data['messenger'])) { |
|
3221 | 3221 | EE_Error::add_error( |
3222 | 3222 | __('Messenger name needed to toggle activation. None given', 'event_espresso'), |
3223 | 3223 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3225,7 +3225,7 @@ discard block |
||
3225 | 3225 | $success = false; |
3226 | 3226 | } |
3227 | 3227 | |
3228 | - if ( ! isset( $this->_req_data[ 'status' ])) { |
|
3228 | + if ( ! isset($this->_req_data['status'])) { |
|
3229 | 3229 | EE_Error::add_error( |
3230 | 3230 | __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), |
3231 | 3231 | __FILE__, __FUNCTION__, __LINE__ |
@@ -3237,7 +3237,7 @@ discard block |
||
3237 | 3237 | //do check to verify we have a valid status. |
3238 | 3238 | $status = $this->_req_data['status']; |
3239 | 3239 | |
3240 | - if ( $status != 'activate' && $status != 'deactivate' ) { |
|
3240 | + if ($status != 'activate' && $status != 'deactivate') { |
|
3241 | 3241 | EE_Error::add_error( |
3242 | 3242 | sprintf( |
3243 | 3243 | __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), |
@@ -3250,16 +3250,16 @@ discard block |
||
3250 | 3250 | |
3251 | 3251 | |
3252 | 3252 | //do a nonce check here since we're not arriving via a normal route |
3253 | - $nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : ''; |
|
3254 | - $nonce_ref = $this->_req_data['message_type'] . '_nonce'; |
|
3253 | + $nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : ''; |
|
3254 | + $nonce_ref = $this->_req_data['message_type'].'_nonce'; |
|
3255 | 3255 | |
3256 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
3256 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
3257 | 3257 | |
3258 | - if ( $success ) { |
|
3258 | + if ($success) { |
|
3259 | 3259 | //made it here? um, what are you waiting for then? |
3260 | 3260 | $success = $status == 'deactivate' |
3261 | - ? $this->_deactivate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] ) |
|
3262 | - : $this->_activate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] ); |
|
3261 | + ? $this->_deactivate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']) |
|
3262 | + : $this->_activate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']); |
|
3263 | 3263 | } |
3264 | 3264 | |
3265 | 3265 | $this->_template_args['success'] = $success; |
@@ -3273,30 +3273,30 @@ discard block |
||
3273 | 3273 | * @param string $messenger_name The name of the messenger being activated |
3274 | 3274 | * @return bool |
3275 | 3275 | */ |
3276 | - protected function _activate_messenger( $messenger_name ) { |
|
3276 | + protected function _activate_messenger($messenger_name) { |
|
3277 | 3277 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3278 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3278 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3279 | 3279 | $message_types_to_activate = $active_messenger instanceof EE_Messenger ? $active_messenger->get_default_message_types() : array(); |
3280 | 3280 | |
3281 | 3281 | //ensure is active |
3282 | - $this->_message_resource_manager->activate_messenger( $messenger_name, $message_types_to_activate ); |
|
3282 | + $this->_message_resource_manager->activate_messenger($messenger_name, $message_types_to_activate); |
|
3283 | 3283 | |
3284 | 3284 | //set response_data for reload |
3285 | - foreach( $message_types_to_activate as $message_type_name ) { |
|
3285 | + foreach ($message_types_to_activate as $message_type_name) { |
|
3286 | 3286 | /** @var EE_message_type $message_type */ |
3287 | - $message_type = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3288 | - if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) |
|
3287 | + $message_type = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3288 | + if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name) |
|
3289 | 3289 | && $message_type instanceof EE_message_type |
3290 | 3290 | ) { |
3291 | 3291 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3292 | - if ( $message_type->get_admin_settings_fields() ) { |
|
3292 | + if ($message_type->get_admin_settings_fields()) { |
|
3293 | 3293 | $this->_template_args['data']['mt_reload'][] = $message_type_name; |
3294 | 3294 | } |
3295 | 3295 | } |
3296 | 3296 | } |
3297 | 3297 | |
3298 | 3298 | //add success message for activating messenger |
3299 | - return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger ); |
|
3299 | + return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger); |
|
3300 | 3300 | |
3301 | 3301 | } |
3302 | 3302 | |
@@ -3307,11 +3307,11 @@ discard block |
||
3307 | 3307 | * @param string $messenger_name The name of the messenger being activated |
3308 | 3308 | * @return bool |
3309 | 3309 | */ |
3310 | - protected function _deactivate_messenger( $messenger_name ) { |
|
3310 | + protected function _deactivate_messenger($messenger_name) { |
|
3311 | 3311 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3312 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3313 | - $this->_message_resource_manager->deactivate_messenger( $messenger_name ); |
|
3314 | - return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger ); |
|
3312 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3313 | + $this->_message_resource_manager->deactivate_messenger($messenger_name); |
|
3314 | + return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger); |
|
3315 | 3315 | } |
3316 | 3316 | |
3317 | 3317 | |
@@ -3322,23 +3322,23 @@ discard block |
||
3322 | 3322 | * @param string $message_type_name The name of the message type being activated for the messenger |
3323 | 3323 | * @return bool |
3324 | 3324 | */ |
3325 | - protected function _activate_message_type_for_messenger( $messenger_name, $message_type_name ) { |
|
3325 | + protected function _activate_message_type_for_messenger($messenger_name, $message_type_name) { |
|
3326 | 3326 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3327 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3327 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3328 | 3328 | /** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/ |
3329 | - $message_type_to_activate = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3329 | + $message_type_to_activate = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3330 | 3330 | |
3331 | 3331 | //ensure is active |
3332 | - $this->_message_resource_manager->activate_messenger( $messenger_name, $message_type_name ); |
|
3332 | + $this->_message_resource_manager->activate_messenger($messenger_name, $message_type_name); |
|
3333 | 3333 | |
3334 | 3334 | //set response for load |
3335 | - if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) { |
|
3335 | + if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name)) { |
|
3336 | 3336 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3337 | - if ( $message_type_to_activate->get_admin_settings_fields() ) { |
|
3337 | + if ($message_type_to_activate->get_admin_settings_fields()) { |
|
3338 | 3338 | $this->_template_args['data']['mt_reload'][] = $message_type_name; |
3339 | 3339 | } |
3340 | 3340 | } |
3341 | - return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger, $message_type_to_activate ); |
|
3341 | + return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger, $message_type_to_activate); |
|
3342 | 3342 | } |
3343 | 3343 | |
3344 | 3344 | |
@@ -3350,13 +3350,13 @@ discard block |
||
3350 | 3350 | * @param string $message_type_name The name of the message type being deactivated for the messenger |
3351 | 3351 | * @return bool |
3352 | 3352 | */ |
3353 | - protected function _deactivate_message_type_for_messenger( $messenger_name, $message_type_name ) { |
|
3353 | + protected function _deactivate_message_type_for_messenger($messenger_name, $message_type_name) { |
|
3354 | 3354 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3355 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3355 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3356 | 3356 | /** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/ |
3357 | - $message_type_to_deactivate = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3358 | - $this->_message_resource_manager->deactivate_message_type_for_messenger( $message_type_name, $messenger_name ); |
|
3359 | - return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger, $message_type_to_deactivate ); |
|
3357 | + $message_type_to_deactivate = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3358 | + $this->_message_resource_manager->deactivate_message_type_for_messenger($message_type_name, $messenger_name); |
|
3359 | + return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger, $message_type_to_deactivate); |
|
3360 | 3360 | } |
3361 | 3361 | |
3362 | 3362 | |
@@ -3387,9 +3387,9 @@ discard block |
||
3387 | 3387 | EE_Message_Type $message_type = null |
3388 | 3388 | ) { |
3389 | 3389 | //if $messenger isn't a valid messenger object then get out. |
3390 | - if ( ! $messenger instanceof EE_Messenger ) { |
|
3390 | + if ( ! $messenger instanceof EE_Messenger) { |
|
3391 | 3391 | EE_Error::add_error( |
3392 | - __( 'The messenger being activated is not a valid messenger', 'event_espresso' ), |
|
3392 | + __('The messenger being activated is not a valid messenger', 'event_espresso'), |
|
3393 | 3393 | __FILE__, |
3394 | 3394 | __FUNCTION__, |
3395 | 3395 | __LINE__ |
@@ -3397,32 +3397,32 @@ discard block |
||
3397 | 3397 | return false; |
3398 | 3398 | } |
3399 | 3399 | //activated |
3400 | - if ( $this->_template_args['data']['active_mts'] ) { |
|
3400 | + if ($this->_template_args['data']['active_mts']) { |
|
3401 | 3401 | EE_Error::overwrite_success(); |
3402 | 3402 | //activated a message type with the messenger |
3403 | - if ( $message_type instanceof EE_message_type ) { |
|
3403 | + if ($message_type instanceof EE_message_type) { |
|
3404 | 3404 | EE_Error::add_success( |
3405 | 3405 | sprintf( |
3406 | 3406 | __('%s message type has been successfully activated with the %s messenger', 'event_espresso'), |
3407 | - ucwords( $message_type->label['singular'] ), |
|
3408 | - ucwords( $messenger->label['singular'] ) |
|
3407 | + ucwords($message_type->label['singular']), |
|
3408 | + ucwords($messenger->label['singular']) |
|
3409 | 3409 | ) |
3410 | 3410 | ); |
3411 | 3411 | |
3412 | 3412 | //if message type was invoice then let's make sure we activate the invoice payment method. |
3413 | - if ( $message_type->name == 'invoice' ) { |
|
3414 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
3415 | - $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
3416 | - if ( $pm instanceof EE_Payment_Method ) { |
|
3417 | - EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method. If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) ); |
|
3413 | + if ($message_type->name == 'invoice') { |
|
3414 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
3415 | + $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
3416 | + if ($pm instanceof EE_Payment_Method) { |
|
3417 | + EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method. If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso')); |
|
3418 | 3418 | } |
3419 | 3419 | } |
3420 | 3420 | //just toggles the entire messenger |
3421 | 3421 | } else { |
3422 | 3422 | EE_Error::add_success( |
3423 | 3423 | sprintf( |
3424 | - __( '%s messenger has been successfully activated', 'event_espresso' ), |
|
3425 | - ucwords( $messenger->label[ 'singular' ] ) |
|
3424 | + __('%s messenger has been successfully activated', 'event_espresso'), |
|
3425 | + ucwords($messenger->label['singular']) |
|
3426 | 3426 | ) |
3427 | 3427 | ); |
3428 | 3428 | } |
@@ -3432,12 +3432,12 @@ discard block |
||
3432 | 3432 | //message types after the activation process. However its possible some messengers don't HAVE any default_message_types |
3433 | 3433 | //in which case we just give a success message for the messenger being successfully activated. |
3434 | 3434 | } else { |
3435 | - if ( ! $messenger->get_default_message_types() ) { |
|
3435 | + if ( ! $messenger->get_default_message_types()) { |
|
3436 | 3436 | //messenger doesn't have any default message types so still a success. |
3437 | 3437 | EE_Error::add_success( |
3438 | 3438 | sprintf( |
3439 | - __('%s messenger was successfully activated.', 'event_espresso' ), |
|
3440 | - ucwords( $messenger->label['singular'] ) |
|
3439 | + __('%s messenger was successfully activated.', 'event_espresso'), |
|
3440 | + ucwords($messenger->label['singular']) |
|
3441 | 3441 | ) |
3442 | 3442 | ); |
3443 | 3443 | return true; |
@@ -3445,13 +3445,13 @@ discard block |
||
3445 | 3445 | EE_Error::add_error( |
3446 | 3446 | $message_type instanceof EE_message_type |
3447 | 3447 | ? sprintf( |
3448 | - __( '%s message type was not successfully activated with the %s messenger', 'event_espresso' ), |
|
3449 | - ucwords( $message_type->label['singular'] ), |
|
3450 | - ucwords( $messenger->label['singular'] ) |
|
3448 | + __('%s message type was not successfully activated with the %s messenger', 'event_espresso'), |
|
3449 | + ucwords($message_type->label['singular']), |
|
3450 | + ucwords($messenger->label['singular']) |
|
3451 | 3451 | ) |
3452 | 3452 | : sprintf( |
3453 | - __( '%s messenger was not successfully activated', 'event_espresso' ), |
|
3454 | - ucwords( $messenger->label['singular'] ) |
|
3453 | + __('%s messenger was not successfully activated', 'event_espresso'), |
|
3454 | + ucwords($messenger->label['singular']) |
|
3455 | 3455 | ), |
3456 | 3456 | __FILE__, |
3457 | 3457 | __FUNCTION__, |
@@ -3479,9 +3479,9 @@ discard block |
||
3479 | 3479 | EE_Error::overwrite_success(); |
3480 | 3480 | |
3481 | 3481 | //if $messenger isn't a valid messenger object then get out. |
3482 | - if ( ! $messenger instanceof EE_Messenger ) { |
|
3482 | + if ( ! $messenger instanceof EE_Messenger) { |
|
3483 | 3483 | EE_Error::add_error( |
3484 | - __( 'The messenger being deactivated is not a valid messenger', 'event_espresso' ), |
|
3484 | + __('The messenger being deactivated is not a valid messenger', 'event_espresso'), |
|
3485 | 3485 | __FILE__, |
3486 | 3486 | __FUNCTION__, |
3487 | 3487 | __LINE__ |
@@ -3489,13 +3489,13 @@ discard block |
||
3489 | 3489 | return false; |
3490 | 3490 | } |
3491 | 3491 | |
3492 | - if ( $message_type instanceof EE_message_type ) { |
|
3492 | + if ($message_type instanceof EE_message_type) { |
|
3493 | 3493 | $message_type_name = $message_type->name; |
3494 | 3494 | EE_Error::add_success( |
3495 | 3495 | sprintf( |
3496 | 3496 | __('%s message type has been successfully deactivated for the %s messenger.', 'event_espresso'), |
3497 | - ucwords( $message_type->label['singular'] ), |
|
3498 | - ucwords ( $messenger->label['singular'] ) |
|
3497 | + ucwords($message_type->label['singular']), |
|
3498 | + ucwords($messenger->label['singular']) |
|
3499 | 3499 | ) |
3500 | 3500 | ); |
3501 | 3501 | } else { |
@@ -3503,20 +3503,20 @@ discard block |
||
3503 | 3503 | EE_Error::add_success( |
3504 | 3504 | sprintf( |
3505 | 3505 | __('%s messenger has been successfully deactivated.', 'event_espresso'), |
3506 | - ucwords( $messenger->label['singular'] ) |
|
3506 | + ucwords($messenger->label['singular']) |
|
3507 | 3507 | ) |
3508 | 3508 | ); |
3509 | 3509 | } |
3510 | 3510 | |
3511 | 3511 | //if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method. |
3512 | - if ( $messenger->name == 'html' || $message_type_name == 'invoice') { |
|
3513 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
3514 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' ); |
|
3515 | - if ( $count_updated > 0 ) { |
|
3512 | + if ($messenger->name == 'html' || $message_type_name == 'invoice') { |
|
3513 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
3514 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice'); |
|
3515 | + if ($count_updated > 0) { |
|
3516 | 3516 | $msg = $message_type_name == 'invoice' |
3517 | - ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) |
|
3518 | - : __('Deactivating the html messenger also automatically deactivates the invoice payment method. In order for invoices to be generated the html messenger must be be active. If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ); |
|
3519 | - EE_Error::add_attention( $msg ); |
|
3517 | + ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') |
|
3518 | + : __('Deactivating the html messenger also automatically deactivates the invoice payment method. In order for invoices to be generated the html messenger must be be active. If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso'); |
|
3519 | + EE_Error::add_attention($msg); |
|
3520 | 3520 | } |
3521 | 3521 | } |
3522 | 3522 | return true; |
@@ -3527,17 +3527,17 @@ discard block |
||
3527 | 3527 | * handles updating a message type form on messenger activation IF the message type has settings fields. (via ajax) |
3528 | 3528 | */ |
3529 | 3529 | public function update_mt_form() { |
3530 | - if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) { |
|
3531 | - EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3530 | + if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) { |
|
3531 | + EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__); |
|
3532 | 3532 | $this->_return_json(); |
3533 | 3533 | } |
3534 | 3534 | |
3535 | 3535 | $message_types = $this->get_installed_message_types(); |
3536 | 3536 | |
3537 | - $message_type = $message_types[ $this->_req_data['message_type'] ]; |
|
3538 | - $messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
3537 | + $message_type = $message_types[$this->_req_data['message_type']]; |
|
3538 | + $messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
3539 | 3539 | |
3540 | - $content = $this->_message_type_settings_content ( $message_type, $messenger, true ); |
|
3540 | + $content = $this->_message_type_settings_content($message_type, $messenger, true); |
|
3541 | 3541 | $this->_template_args['success'] = true; |
3542 | 3542 | $this->_template_args['content'] = $content; |
3543 | 3543 | $this->_return_json(); |
@@ -3551,45 +3551,45 @@ discard block |
||
3551 | 3551 | * |
3552 | 3552 | */ |
3553 | 3553 | public function save_settings() { |
3554 | - if ( !isset( $this->_req_data['type'] ) ) { |
|
3555 | - EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3554 | + if ( ! isset($this->_req_data['type'])) { |
|
3555 | + EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
3556 | 3556 | $this->_template_args['error'] = true; |
3557 | 3557 | $this->_return_json(); |
3558 | 3558 | } |
3559 | 3559 | |
3560 | 3560 | |
3561 | - if ( $this->_req_data['type'] == 'messenger' ) { |
|
3561 | + if ($this->_req_data['type'] == 'messenger') { |
|
3562 | 3562 | $settings = $this->_req_data['messenger_settings']; //this should be an array. |
3563 | 3563 | $messenger = $settings['messenger']; |
3564 | 3564 | //let's setup the settings data |
3565 | - foreach ( $settings as $key => $value ) { |
|
3566 | - switch ( $key ) { |
|
3565 | + foreach ($settings as $key => $value) { |
|
3566 | + switch ($key) { |
|
3567 | 3567 | case 'messenger' : |
3568 | - unset( $settings['messenger'] ); |
|
3568 | + unset($settings['messenger']); |
|
3569 | 3569 | break; |
3570 | 3570 | case 'message_types' : |
3571 | - unset( $settings['message_types'] ); |
|
3571 | + unset($settings['message_types']); |
|
3572 | 3572 | break; |
3573 | 3573 | default : |
3574 | 3574 | $settings[$key] = $value; |
3575 | 3575 | break; |
3576 | 3576 | } |
3577 | 3577 | } |
3578 | - $this->_message_resource_manager->add_settings_for_messenger( $messenger, $settings ); |
|
3578 | + $this->_message_resource_manager->add_settings_for_messenger($messenger, $settings); |
|
3579 | 3579 | } |
3580 | 3580 | |
3581 | - else if ( $this->_req_data['type'] == 'message_type' ) { |
|
3581 | + else if ($this->_req_data['type'] == 'message_type') { |
|
3582 | 3582 | $settings = $this->_req_data['message_type_settings']; |
3583 | 3583 | $messenger = $settings['messenger']; |
3584 | 3584 | $message_type = $settings['message_type']; |
3585 | 3585 | |
3586 | - foreach ( $settings as $key => $value ) { |
|
3587 | - switch ( $key ) { |
|
3586 | + foreach ($settings as $key => $value) { |
|
3587 | + switch ($key) { |
|
3588 | 3588 | case 'messenger' : |
3589 | - unset( $settings['messenger'] ); |
|
3589 | + unset($settings['messenger']); |
|
3590 | 3590 | break; |
3591 | 3591 | case 'message_type' : |
3592 | - unset( $settings['message_type'] ); |
|
3592 | + unset($settings['message_type']); |
|
3593 | 3593 | break; |
3594 | 3594 | default : |
3595 | 3595 | $settings[$key] = $value; |
@@ -3597,16 +3597,16 @@ discard block |
||
3597 | 3597 | } |
3598 | 3598 | } |
3599 | 3599 | |
3600 | - $this->_message_resource_manager->add_settings_for_message_type( $messenger, $message_type, $settings ); |
|
3600 | + $this->_message_resource_manager->add_settings_for_message_type($messenger, $message_type, $settings); |
|
3601 | 3601 | } |
3602 | 3602 | |
3603 | 3603 | //okay we should have the data all setup. Now we just update! |
3604 | 3604 | $success = $this->_message_resource_manager->update_active_messengers_option(); |
3605 | 3605 | |
3606 | - if ( $success ) { |
|
3607 | - EE_Error::add_success( __('Settings updated', 'event_espresso') ); |
|
3606 | + if ($success) { |
|
3607 | + EE_Error::add_success(__('Settings updated', 'event_espresso')); |
|
3608 | 3608 | } else { |
3609 | - EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3609 | + EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
3610 | 3610 | } |
3611 | 3611 | |
3612 | 3612 | $this->_template_args['success'] = $success; |
@@ -3628,8 +3628,8 @@ discard block |
||
3628 | 3628 | */ |
3629 | 3629 | protected function _generate_now() { |
3630 | 3630 | $msg_ids = $this->_get_msg_ids_from_request(); |
3631 | - EED_Messages::generate_now( $msg_ids ); |
|
3632 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3631 | + EED_Messages::generate_now($msg_ids); |
|
3632 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3633 | 3633 | } |
3634 | 3634 | |
3635 | 3635 | |
@@ -3644,7 +3644,7 @@ discard block |
||
3644 | 3644 | protected function _generate_and_send_now() { |
3645 | 3645 | $this->_generate_now(); |
3646 | 3646 | $this->_send_now(); |
3647 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3647 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3648 | 3648 | } |
3649 | 3649 | |
3650 | 3650 | |
@@ -3658,8 +3658,8 @@ discard block |
||
3658 | 3658 | */ |
3659 | 3659 | protected function _queue_for_resending() { |
3660 | 3660 | $msg_ids = $this->_get_msg_ids_from_request(); |
3661 | - EED_Messages::queue_for_resending( $msg_ids ); |
|
3662 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3661 | + EED_Messages::queue_for_resending($msg_ids); |
|
3662 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3663 | 3663 | } |
3664 | 3664 | |
3665 | 3665 | |
@@ -3672,8 +3672,8 @@ discard block |
||
3672 | 3672 | */ |
3673 | 3673 | protected function _send_now() { |
3674 | 3674 | $msg_ids = $this->_get_msg_ids_from_request(); |
3675 | - EED_Messages::send_now( $msg_ids ); |
|
3676 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3675 | + EED_Messages::send_now($msg_ids); |
|
3676 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3677 | 3677 | } |
3678 | 3678 | |
3679 | 3679 | |
@@ -3687,23 +3687,23 @@ discard block |
||
3687 | 3687 | protected function _delete_ee_messages() { |
3688 | 3688 | $msg_ids = $this->_get_msg_ids_from_request(); |
3689 | 3689 | $deleted_count = 0; |
3690 | - foreach ( $msg_ids as $msg_id ) { |
|
3691 | - if ( EEM_Message::instance()->delete_by_ID( $msg_id ) ) { |
|
3690 | + foreach ($msg_ids as $msg_id) { |
|
3691 | + if (EEM_Message::instance()->delete_by_ID($msg_id)) { |
|
3692 | 3692 | $deleted_count++; |
3693 | 3693 | } |
3694 | 3694 | } |
3695 | - if ( $deleted_count ) { |
|
3695 | + if ($deleted_count) { |
|
3696 | 3696 | $this->_redirect_after_action( |
3697 | 3697 | true, |
3698 | - _n( 'message', 'messages', $deleted_count, 'event_espresso' ), |
|
3698 | + _n('message', 'messages', $deleted_count, 'event_espresso'), |
|
3699 | 3699 | __('deleted', 'event_espresso') |
3700 | 3700 | ); |
3701 | 3701 | } else { |
3702 | 3702 | EE_Error::add_error( |
3703 | - _n( 'The message was not deleted.', 'The messages were not deleted', count( $msg_ids ), 'event_espresso' ), |
|
3703 | + _n('The message was not deleted.', 'The messages were not deleted', count($msg_ids), 'event_espresso'), |
|
3704 | 3704 | __FILE__, __FUNCTION__, __LINE__ |
3705 | 3705 | ); |
3706 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3706 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3707 | 3707 | } |
3708 | 3708 | } |
3709 | 3709 | |
@@ -3716,10 +3716,10 @@ discard block |
||
3716 | 3716 | * @return array |
3717 | 3717 | */ |
3718 | 3718 | protected function _get_msg_ids_from_request() { |
3719 | - if ( ! isset( $this->_req_data['MSG_ID'] ) ) { |
|
3719 | + if ( ! isset($this->_req_data['MSG_ID'])) { |
|
3720 | 3720 | return array(); |
3721 | 3721 | } |
3722 | - return is_array( $this->_req_data['MSG_ID'] ) ? array_keys( $this->_req_data['MSG_ID'] ) : array( $this->_req_data['MSG_ID'] ); |
|
3722 | + return is_array($this->_req_data['MSG_ID']) ? array_keys($this->_req_data['MSG_ID']) : array($this->_req_data['MSG_ID']); |
|
3723 | 3723 | } |
3724 | 3724 | |
3725 | 3725 |