@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -18,28 +18,28 @@ discard block |
||
18 | 18 | class EE_Boolean_Normalization extends EE_Normalization_Strategy_Base |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @param string | int | bool $value_to_normalize |
|
23 | - * @return boolean |
|
24 | - */ |
|
25 | - public function normalize($value_to_normalize) |
|
26 | - { |
|
27 | - return filter_var($value_to_normalize, FILTER_VALIDATE_BOOLEAN); |
|
28 | - } |
|
21 | + /** |
|
22 | + * @param string | int | bool $value_to_normalize |
|
23 | + * @return boolean |
|
24 | + */ |
|
25 | + public function normalize($value_to_normalize) |
|
26 | + { |
|
27 | + return filter_var($value_to_normalize, FILTER_VALIDATE_BOOLEAN); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @param boolean $normalized_value |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function unnormalize($normalized_value) |
|
37 | - { |
|
38 | - if ($normalized_value) { |
|
39 | - return '1'; |
|
40 | - } else { |
|
41 | - return '0'; |
|
42 | - } |
|
43 | - } |
|
32 | + /** |
|
33 | + * @param boolean $normalized_value |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function unnormalize($normalized_value) |
|
37 | + { |
|
38 | + if ($normalized_value) { |
|
39 | + return '1'; |
|
40 | + } else { |
|
41 | + return '0'; |
|
42 | + } |
|
43 | + } |
|
44 | 44 | } |
45 | 45 | // End of file EE_Boolean_Normalization.strategy.php |
@@ -1,4 +1,4 @@ |
||
1 | -<?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | 4 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <div id="admin-primary-mbox-dv" class="admin-primary-mbox-dv"> |
2 | 2 | |
3 | 3 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
4 | - <span class="dashicons dashicons-cart"></span><?php _e( 'Transaction Items', 'event_espresso' );?> |
|
4 | + <span class="dashicons dashicons-cart"></span><?php _e('Transaction Items', 'event_espresso'); ?> |
|
5 | 5 | </h3> |
6 | 6 | |
7 | 7 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -10,27 +10,27 @@ discard block |
||
10 | 10 | </div> |
11 | 11 | |
12 | 12 | <a id="display-additional-transaction-session-info" class="display-the-hidden smaller-text" rel="additional-transaction-session-info"> |
13 | - <span class="dashicons dashicons-plus-alt"></span><?php _e( 'view additional transaction session details', 'event_espresso' );?> |
|
13 | + <span class="dashicons dashicons-plus-alt"></span><?php _e('view additional transaction session details', 'event_espresso'); ?> |
|
14 | 14 | </a> |
15 | 15 | |
16 | 16 | <div id="additional-transaction-session-info-dv" class="hidden"> |
17 | 17 | |
18 | 18 | <a id="hide-additional-transaction-session-info" class="hide-the-displayed hidden smaller-text" rel="additional-transaction-session-info"> |
19 | - <span class="dashicons dashicons-dismiss"></span><?php _e( 'hide additional transaction session details', 'event_espresso' );?> |
|
19 | + <span class="dashicons dashicons-dismiss"></span><?php _e('hide additional transaction session details', 'event_espresso'); ?> |
|
20 | 20 | </a> |
21 | 21 | <br class="clear"/> |
22 | 22 | |
23 | - <h3 class="admin-primary-mbox-h4"><?php _e( 'Transaction Session Details', 'event_espresso' );?></h3> |
|
23 | + <h3 class="admin-primary-mbox-h4"><?php _e('Transaction Session Details', 'event_espresso'); ?></h3> |
|
24 | 24 | |
25 | 25 | <table id="admin-primary-mbox-txn-extra-session-info-tbl" class="form-table skinny-rows"> |
26 | 26 | <tbody> |
27 | - <?php foreach ( $txn_details as $key => $txn_detail ) : ?> |
|
27 | + <?php foreach ($txn_details as $key => $txn_detail) : ?> |
|
28 | 28 | <tr> |
29 | 29 | <th> |
30 | - <label for="<?php echo $key;?>"><?php echo $txn_detail['label'];?></label> |
|
30 | + <label for="<?php echo $key; ?>"><?php echo $txn_detail['label']; ?></label> |
|
31 | 31 | </th> |
32 | 32 | <td> |
33 | - <?php echo $txn_detail['value'];?> |
|
33 | + <?php echo $txn_detail['value']; ?> |
|
34 | 34 | </td> |
35 | 35 | </tr> |
36 | 36 | <?php endforeach; // $txn_details?> |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | <br class="clear"/> |
41 | 41 | |
42 | 42 | |
43 | - <?php if ( $attendee instanceof EE_Attendee && ( $grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty( $payments ) ) ) : ?> |
|
43 | + <?php if ($attendee instanceof EE_Attendee && ($grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty($payments))) : ?> |
|
44 | 44 | |
45 | 45 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
46 | - <span class="ee-icon ee-icon-cash"></span><?php _e( 'Payment Details', 'event_espresso' );?> |
|
46 | + <span class="ee-icon ee-icon-cash"></span><?php _e('Payment Details', 'event_espresso'); ?> |
|
47 | 47 | </h3> |
48 | 48 | |
49 | 49 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -52,79 +52,79 @@ discard block |
||
52 | 52 | <tr> |
53 | 53 | <th></th> |
54 | 54 | <th class="jst-cntr"></th> |
55 | - <th class="jst-cntr"><?php _e( 'ID', 'event_espresso' );?></th> |
|
56 | - <th class="jst-left"><?php _e( 'Date', 'event_espresso' );?></th> |
|
57 | - <th class="jst-cntr"><?php _e( 'Source', 'event_espresso' );?></th> |
|
58 | - <th class="jst-left"><?php _e( 'Method', 'event_espresso' );?></th> |
|
59 | - <th class="jst-left"><?php _e( 'Gateway Response', 'event_espresso' );?></th> |
|
60 | - <th class="jst-left"><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></th> |
|
61 | - <th class="jst-left"><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></th> |
|
62 | - <th class="jst-left"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></th> |
|
63 | - <!--<th class="jst-left"><?php _e( 'Details', 'event_espresso' );?></th>--> |
|
64 | - <th class="jst-cntr"><?php _e( 'Amount', 'event_espresso' );?></th> |
|
55 | + <th class="jst-cntr"><?php _e('ID', 'event_espresso'); ?></th> |
|
56 | + <th class="jst-left"><?php _e('Date', 'event_espresso'); ?></th> |
|
57 | + <th class="jst-cntr"><?php _e('Source', 'event_espresso'); ?></th> |
|
58 | + <th class="jst-left"><?php _e('Method', 'event_espresso'); ?></th> |
|
59 | + <th class="jst-left"><?php _e('Gateway Response', 'event_espresso'); ?></th> |
|
60 | + <th class="jst-left"><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></th> |
|
61 | + <th class="jst-left"><?php _e('P.O. / S.O. #', 'event_espresso'); ?></th> |
|
62 | + <th class="jst-left"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></th> |
|
63 | + <!--<th class="jst-left"><?php _e('Details', 'event_espresso'); ?></th>--> |
|
64 | + <th class="jst-cntr"><?php _e('Amount', 'event_espresso'); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if ( $payments ) : ?> |
|
68 | + <?php if ($payments) : ?> |
|
69 | 69 | <?php $payment_total = 0; ?> |
70 | - <?php foreach ( $payments as $PAY_ID => $payment ) : |
|
71 | - $existing_reg_payment_json = isset( $existing_reg_payments[ $PAY_ID ] ) |
|
72 | - ? wp_json_encode( $existing_reg_payments[ $PAY_ID ] ) |
|
70 | + <?php foreach ($payments as $PAY_ID => $payment) : |
|
71 | + $existing_reg_payment_json = isset($existing_reg_payments[$PAY_ID]) |
|
72 | + ? wp_json_encode($existing_reg_payments[$PAY_ID]) |
|
73 | 73 | : '{}'; |
74 | 74 | ?> |
75 | - <tr id="txn-admin-payment-tr-<?php echo $PAY_ID;?>"> |
|
75 | + <tr id="txn-admin-payment-tr-<?php echo $PAY_ID; ?>"> |
|
76 | 76 | <td> |
77 | 77 | <span id="payment-status-<?php echo $PAY_ID; ?>" class="ee-status-strip-td ee-status-strip pymt-status-<?php echo $payment->STS_ID(); ?>"></span> |
78 | - <div id="payment-STS_ID-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->STS_ID();?></div> |
|
79 | - <div id="reg-payments-<?php echo $PAY_ID;?>" class="hidden"><?php echo $existing_reg_payment_json; ?></div> |
|
78 | + <div id="payment-STS_ID-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->STS_ID(); ?></div> |
|
79 | + <div id="reg-payments-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $existing_reg_payment_json; ?></div> |
|
80 | 80 | </td> |
81 | 81 | <td class=" jst-cntr"> |
82 | 82 | <ul class="txn-overview-actions-ul"> |
83 | 83 | <li> |
84 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
84 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
85 | 85 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
86 | 86 | </a> |
87 | 87 | </li> |
88 | 88 | <li> |
89 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
89 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
90 | 90 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
91 | 91 | </a> |
92 | 92 | </li> |
93 | 93 | </ul> |
94 | 94 | </td> |
95 | 95 | <td class=" jst-rght"> |
96 | - <div id="payment-id-<?php echo $PAY_ID;?>"><?php echo $PAY_ID;?></div> |
|
96 | + <div id="payment-id-<?php echo $PAY_ID; ?>"><?php echo $PAY_ID; ?></div> |
|
97 | 97 | </td> |
98 | 98 | <td class=" jst-left"> |
99 | - <div id="payment-date-<?php echo $PAY_ID;?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a');?></div> |
|
99 | + <div id="payment-date-<?php echo $PAY_ID; ?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a'); ?></div> |
|
100 | 100 | </td> |
101 | 101 | <td class=" jst-cntr"> |
102 | - <div id="payment-method-<?php echo $PAY_ID;?>"> |
|
103 | - <?php echo $payment->source();?> |
|
102 | + <div id="payment-method-<?php echo $PAY_ID; ?>"> |
|
103 | + <?php echo $payment->source(); ?> |
|
104 | 104 | </div> |
105 | 105 | </td> |
106 | 106 | <td class=" jst-left"> |
107 | - <div id="payment-gateway-<?php echo $PAY_ID;?>"> |
|
108 | - <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso');?> |
|
107 | + <div id="payment-gateway-<?php echo $PAY_ID; ?>"> |
|
108 | + <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'); ?> |
|
109 | 109 | </div> |
110 | - <div id="payment-gateway-id-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0;?></div> |
|
110 | + <div id="payment-gateway-id-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0; ?></div> |
|
111 | 111 | </td> |
112 | 112 | <td class=" jst-left"> |
113 | - <div id="payment-response-<?php echo $PAY_ID;?>"><?php echo $payment->gateway_response();?></div> |
|
113 | + <div id="payment-response-<?php echo $PAY_ID; ?>"><?php echo $payment->gateway_response(); ?></div> |
|
114 | 114 | </td> |
115 | 115 | <td class=" jst-left"> |
116 | - <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->txn_id_chq_nmbr();?></div> |
|
116 | + <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->txn_id_chq_nmbr(); ?></div> |
|
117 | 117 | </td> |
118 | 118 | <td class=" jst-left"> |
119 | - <div id="payment-po-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->po_number();?></div> |
|
119 | + <div id="payment-po-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->po_number(); ?></div> |
|
120 | 120 | </td> |
121 | 121 | <td class=" jst-left"> |
122 | - <div id="payment-accntng-<?php echo $PAY_ID;?>"><?php echo $payment->extra_accntng();?></div> |
|
122 | + <div id="payment-accntng-<?php echo $PAY_ID; ?>"><?php echo $payment->extra_accntng(); ?></div> |
|
123 | 123 | </td> |
124 | 124 | <td class=" jst-rght"> |
125 | - <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-' . $payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
126 | - <span class="<?php echo $payment_class;?>"> |
|
127 | - <div id="payment-amount-<?php echo $PAY_ID;?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE ); ?></div> |
|
125 | + <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-'.$payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
126 | + <span class="<?php echo $payment_class; ?>"> |
|
127 | + <div id="payment-amount-<?php echo $PAY_ID; ?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE); ?></div> |
|
128 | 128 | </span> |
129 | 129 | </td> |
130 | 130 | </tr> |
@@ -134,25 +134,25 @@ discard block |
||
134 | 134 | <?php endforeach; // $payment?> |
135 | 135 | <?php |
136 | 136 | $pay_totals_class = $payment_total > $grand_raw_total ? ' important-notice' : ''; |
137 | - $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">' . __( 'This transaction has been overpaid ! ', 'event_espresso' ) . '</span>' : ''; |
|
137 | + $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">'.__('This transaction has been overpaid ! ', 'event_espresso').'</span>' : ''; |
|
138 | 138 | ?> |
139 | 139 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden"> |
140 | 140 | <td class=" jst-rght" colspan="11"> |
141 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
141 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
142 | 142 | </td> |
143 | 143 | </tr> |
144 | - <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class;?>"> |
|
145 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid . sprintf( __( 'Payments Total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );?></span></th> |
|
146 | - <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE);?></span></th> |
|
144 | + <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class; ?>"> |
|
145 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid.sprintf(__('Payments Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); ?></span></th> |
|
146 | + <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE); ?></span></th> |
|
147 | 147 | </tr> |
148 | 148 | <?php else : ?> |
149 | 149 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr"> |
150 | 150 | <td class=" jst-rght" colspan="11"> |
151 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
151 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
152 | 152 | </td> |
153 | 153 | </tr> |
154 | 154 | <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr hidden"> |
155 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __( 'Payments Total', 'event_espresso' );?></span></th> |
|
155 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __('Payments Total', 'event_espresso'); ?></span></th> |
|
156 | 156 | <th class=" jst-rght"><span id="txn-admin-payment-total"></span></th> |
157 | 157 | </tr> |
158 | 158 | <?php endif; // $payments?> |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | <td class=" jst-cntr"> |
166 | 166 | <ul class="txn-overview-actions-ul"> |
167 | 167 | <li> |
168 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
168 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
169 | 169 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
170 | 170 | </a> |
171 | 171 | </li> |
172 | 172 | <li> |
173 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
173 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
174 | 174 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
175 | 175 | </a> |
176 | 176 | </li> |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | <ul id="txn-admin-payment-options-ul"> |
218 | 218 | <li> |
219 | 219 | <a id="display-txn-admin-apply-payment" class="button-primary no-icon no-hide" rel="txn-admin-apply-payment" > <!--display-the-hidden --> |
220 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
220 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
221 | 221 | </a> |
222 | 222 | </li> |
223 | 223 | <li> |
224 | 224 | <a id="display-txn-admin-apply-refund" class="button-secondary no-icon no-hide" rel="txn-admin-apply-refund" > <!--display-the-hidden --> |
225 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
225 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
226 | 226 | </a> |
227 | 227 | </li> |
228 | 228 | </ul> |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | |
233 | 233 | <h2 id="admin-modal-dialog-apply-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
234 | 234 | <div class="ee-icon ee-icon-cash-add float-left"></div> |
235 | - <?php echo __( 'Apply a Payment to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
235 | + <?php echo __('Apply a Payment to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
236 | 236 | </h2> |
237 | 237 | |
238 | 238 | <h2 id="admin-modal-dialog-edit-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
239 | 239 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
240 | 240 | <?php |
241 | 241 | echo sprintf( |
242 | - __( 'Edit Payment #%s for Transaction #%s', 'event_espresso' ), |
|
242 | + __('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
243 | 243 | '<span></span>', |
244 | 244 | $txn_nmbr['value'] |
245 | 245 | ); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
251 | 251 | <?php |
252 | 252 | echo sprintf( |
253 | - __( 'Edit Refund #%s for Transaction #%s', 'event_espresso' ), |
|
253 | + __('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
254 | 254 | '<span></span>', |
255 | 255 | $txn_nmbr['value'] |
256 | 256 | ); |
@@ -259,14 +259,14 @@ discard block |
||
259 | 259 | |
260 | 260 | <h2 id="admin-modal-dialog-apply-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
261 | 261 | <div class="ee-icon ee-icon-cash-remove float-left"></div> |
262 | - <?php echo __( 'Apply a Refund to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
262 | + <?php echo __('Apply a Refund to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
263 | 263 | </h2> |
264 | 264 | |
265 | 265 | <form name="txn-admin-apply-payment-frm" id="txn-admin-apply-payment-frm" action="<?php echo $apply_payment_form_url; ?>"> |
266 | 266 | <div class="admin-modal-dialog-wrap"> |
267 | 267 | <div class="admin-modal-dialog-inner"> |
268 | 268 | |
269 | - <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_apply_payment_nonce' );?>"/> |
|
269 | + <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce('espresso_apply_payment_nonce'); ?>"/> |
|
270 | 270 | <input type="hidden" name="espresso_ajax" id="espresso-ajax" value="0"/> |
271 | 271 | <input type="hidden" name="noheader" id="txn-admin-noheader-inp" value="0"/> |
272 | 272 | <input type="hidden" name="txn_admin_payment[PAY_ID]" id="txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
@@ -274,108 +274,108 @@ discard block |
||
274 | 274 | <input type="hidden" name="txn_admin_payment[type]" id="txn-admin-payment-type-inp" value="1"/> |
275 | 275 | <input type="hidden" name="txn_admin_payment[details]" id="txn-admin-payment-details-inp" value=""/> |
276 | 276 | <input type="hidden" name="txn_admin_delete_payment_form_url" id="txn-admin-delete-payment-form-url-inp" value="<?php echo $delete_payment_form_url; ?>"/> |
277 | - <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date( 'Y-m-d h:i a', current_time( 'timestamp' )); ?>"/> |
|
277 | + <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date('Y-m-d h:i a', current_time('timestamp')); ?>"/> |
|
278 | 278 | |
279 | 279 | <div class="txn-admin-apply-payment-date-dv admin-modal-dialog-row"> |
280 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
281 | - <label for="txn-admin-payment-date-inp" class=""><?php _e( 'Payment Date', 'event_espresso' );?></label> |
|
282 | - <input name="txn_admin_payment[date]" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date( 'Y-m-d g:i a', current_time( 'timestamp' )); ?>"/> |
|
283 | - <p class="description"><?php _e( 'The date the payment was actually made on', 'event_espresso' );?></p> |
|
280 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
281 | + <label for="txn-admin-payment-date-inp" class=""><?php _e('Payment Date', 'event_espresso'); ?></label> |
|
282 | + <input name="txn_admin_payment[date]" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date('Y-m-d g:i a', current_time('timestamp')); ?>"/> |
|
283 | + <p class="description"><?php _e('The date the payment was actually made on', 'event_espresso'); ?></p> |
|
284 | 284 | </div> |
285 | 285 | |
286 | 286 | <div class="txn-admin-apply-payment-amount-dv admin-modal-dialog-row"> |
287 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
288 | - <label for="txn-admin-payment-amount-inp" class=""><?php _e( 'Amount', 'event_espresso' );?></label> |
|
287 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
288 | + <label for="txn-admin-payment-amount-inp" class=""><?php _e('Amount', 'event_espresso'); ?></label> |
|
289 | 289 | <input name="txn_admin_payment[amount]" id="txn-admin-payment-amount-inp" class="txn-admin-apply-payment-inp required" type="text" value=""/> |
290 | - <p class="description"><?php _e( 'The amount of the payment', 'event_espresso' );?></p> |
|
290 | + <p class="description"><?php _e('The amount of the payment', 'event_espresso'); ?></p> |
|
291 | 291 | </div> |
292 | 292 | |
293 | 293 | <div class="txn-admin-apply-payment-method-dv admin-modal-dialog-row"> |
294 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
295 | - <label for="txn-admin-payment-method-inp" class=""><?php _e( 'Method of Payment', 'event_espresso' );?></label> |
|
294 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
295 | + <label for="txn-admin-payment-method-inp" class=""><?php _e('Method of Payment', 'event_espresso'); ?></label> |
|
296 | 296 | <select name="txn_admin_payment[PMD_ID]" id="txn-admin-payment-method-slct" class="txn-admin-apply-payment-slct required" type="text" > |
297 | - <?php foreach ( $payment_methods as $method ) : ?> |
|
297 | + <?php foreach ($payment_methods as $method) : ?> |
|
298 | 298 | <?php $selected = $method->slug() == 'cash' ? ' selected="selected"' : ''; ?> |
299 | - <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key( $method->admin_desc() ) ? substr( $method->admin_desc(), 0, 128) : $method->admin_name() ; ?> </option> |
|
299 | + <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key($method->admin_desc()) ? substr($method->admin_desc(), 0, 128) : $method->admin_name(); ?> </option> |
|
300 | 300 | <?php endforeach; ?> |
301 | 301 | </select> |
302 | - <p class="description"><?php _e( 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso' );?></p> |
|
302 | + <p class="description"><?php _e('Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso'); ?></p> |
|
303 | 303 | </div> |
304 | 304 | |
305 | 305 | <div class="mop-PP mop-CC mop-CHQ mop"> |
306 | 306 | <div class="txn-admin-apply-payment-gw-txn-id-dv admin-modal-dialog-row"> |
307 | - <label for="txn-admin-payment-txn-id-inp" class=""><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></label> |
|
307 | + <label for="txn-admin-payment-txn-id-inp" class=""><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></label> |
|
308 | 308 | <input name="txn_admin_payment[txn_id_chq_nmbr]" id="txn-admin-payment-txn-id-chq-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
309 | - <p class="description"><?php _e( 'The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso' );?></p> |
|
309 | + <p class="description"><?php _e('The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso'); ?></p> |
|
310 | 310 | </div> |
311 | 311 | </div> |
312 | 312 | |
313 | 313 | <div class="mop-CC mop" style="display:none"> |
314 | 314 | <div class="txn-admin-apply-payment-response-dv admin-modal-dialog-row"> |
315 | - <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e( 'Gateway Response', 'event_espresso' );?></label> |
|
315 | + <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e('Gateway Response', 'event_espresso'); ?></label> |
|
316 | 316 | <input name="txn_admin_payment[gateway_response]" id="txn-admin-payment-gateway-response-inp" class="txn-admin-apply-payment-inp" type="text"/> |
317 | - <p class="description"><?php _e( 'The gateway response string (optional)', 'event_espresso' );?></p> |
|
317 | + <p class="description"><?php _e('The gateway response string (optional)', 'event_espresso'); ?></p> |
|
318 | 318 | </div> |
319 | 319 | </div> |
320 | 320 | |
321 | 321 | <div class="mop-PP mop-CC mop"> |
322 | 322 | <div class="txn-admin-apply-payment-status-dv admin-modal-dialog-row"> |
323 | - <label for="txn-admin-payment-status-inp" class=""><?php _e( 'Payment Status', 'event_espresso' );?></label> |
|
323 | + <label for="txn-admin-payment-status-inp" class=""><?php _e('Payment Status', 'event_espresso'); ?></label> |
|
324 | 324 | <select name="txn_admin_payment[status]" id="txn-admin-payment-status-slct" class="txn-admin-apply-payment-slct" type="text" > |
325 | - <?php foreach ( $payment_status as $STS_ID => $STS_code ) : ?> |
|
325 | + <?php foreach ($payment_status as $STS_ID => $STS_code) : ?> |
|
326 | 326 | <?php $selected = $STS_ID == 'PAP' ? ' selected="selected"' : ''; ?> |
327 | 327 | <option id="payment-status-opt-<?php echo $STS_ID; ?>" value="<?php echo $STS_ID; ?>"<?php echo $selected; ?>><?php echo $STS_code; ?> </option> |
328 | 328 | <?php endforeach; ?> |
329 | 329 | </select> |
330 | - <p class="description"><?php _e( 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso' );?></p> |
|
330 | + <p class="description"><?php _e('Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso'); ?></p> |
|
331 | 331 | </div> |
332 | 332 | </div> |
333 | 333 | |
334 | 334 | <div class="txn-admin-apply-payment-po-nmbr-dv admin-modal-dialog-row"> |
335 | - <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></label> |
|
335 | + <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e('P.O. / S.O. #', 'event_espresso'); ?></label> |
|
336 | 336 | <input name="txn_admin_payment[po_number]" id="txn-admin-payment-po-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
337 | - <p class="description"><?php _e( 'The Purchase or Sales Order Number if any (optional)', 'event_espresso' );?></p> |
|
337 | + <p class="description"><?php _e('The Purchase or Sales Order Number if any (optional)', 'event_espresso'); ?></p> |
|
338 | 338 | </div> |
339 | 339 | |
340 | 340 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
341 | - <label for="txn-admin-payment-accounting-inp" class="last"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></label> |
|
341 | + <label for="txn-admin-payment-accounting-inp" class="last"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></label> |
|
342 | 342 | <input name="txn_admin_payment[accounting]" id="txn-admin-payment-accounting-inp" class="txn-admin-apply-payment-inp" type="text" value="<?php echo $REG_code; ?>" maxlength="100"/> <input type="hidden" id="txn-admin-reg-code-inp" value="<?php echo $REG_code; ?>"/> |
343 | - <p class="description"><?php _e( 'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso' );?></p> |
|
343 | + <p class="description"><?php _e('An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso'); ?></p> |
|
344 | 344 | </div> |
345 | 345 | |
346 | 346 | <div class="txn-admin-apply-payment-registrations-dv admin-modal-dialog-row"> |
347 | - <label for="txn-admin-payment-registrations-inp" class="last"><?php _e( 'Registrations to Apply Payment to:', 'event_espresso' ); ?></label> |
|
347 | + <label for="txn-admin-payment-registrations-inp" class="last"><?php _e('Registrations to Apply Payment to:', 'event_espresso'); ?></label> |
|
348 | 348 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
349 | 349 | <input type="radio" value="1" id="txn-admin-apply-payment-to-all-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" checked="checked"/> |
350 | - <?php _e( 'ALL Registrations', 'event_espresso' ); ?> |
|
350 | + <?php _e('ALL Registrations', 'event_espresso'); ?> |
|
351 | 351 | </label> |
352 | 352 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
353 | 353 | <input type="radio" value="0" id="txn-admin-apply-payment-to-some-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" /> |
354 | - <?php _e( 'Just the following Registrations', 'event_espresso' ); ?> |
|
354 | + <?php _e('Just the following Registrations', 'event_espresso'); ?> |
|
355 | 355 | </label> |
356 | 356 | <?php echo $registrations_to_apply_payment_to; ?> |
357 | 357 | </div> |
358 | 358 | |
359 | 359 | <div class="txn-admin-payment-reg-status-dv admin-modal-dialog-row"> |
360 | - <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
360 | + <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
361 | 361 | <?php echo $status_change_select; ?> |
362 | - <p class="description"><?php _e( 'If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso' ); ?></p> |
|
362 | + <p class="description"><?php _e('If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso'); ?></p> |
|
363 | 363 | <br/> |
364 | 364 | </div> |
365 | 365 | |
366 | 366 | <div class="txn-admin-apply-payment-send-notifications-dv admin-modal-dialog-row"> |
367 | 367 | |
368 | - <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
368 | + <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
369 | 369 | <label class="txn-admin-payment-send-notifications-lbl"> |
370 | 370 | <input type="checkbox" value="1" name="txn_payments[send_notifications]" checked="checked" aria-checked="true" style="vertical-align: middle;"> |
371 | - <?php _e( 'Payment Messages?', 'event_espresso' ); ?> |
|
371 | + <?php _e('Payment Messages?', 'event_espresso'); ?> |
|
372 | 372 | </label> |
373 | 373 | <label class="txn-admin-payment-send-notifications-lbl"> |
374 | 374 | <input type="checkbox" value="1" name="txn_reg_status_change[send_notifications]" style="vertical-align: middle;"> |
375 | - <?php _e( 'Registration Messages?', 'event_espresso' ); ?> |
|
375 | + <?php _e('Registration Messages?', 'event_espresso'); ?> |
|
376 | 376 | </label> |
377 | 377 | <br class="clear-float"/> |
378 | - <p class="description"><?php printf( __('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />' ); ?></p> |
|
378 | + <p class="description"><?php printf(__('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />'); ?></p> |
|
379 | 379 | <label></label> |
380 | 380 | </div> |
381 | 381 | <div class="clear"></div> |
@@ -386,27 +386,27 @@ discard block |
||
386 | 386 | <ul id="admin-modal-dialog-options-ul"> |
387 | 387 | <li> |
388 | 388 | <a id="txn-admin-modal-dialog-apply-payment-lnk" class="button-primary no-icon" style="display:none;" > |
389 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
389 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
390 | 390 | </a> |
391 | 391 | </li> |
392 | 392 | <li> |
393 | 393 | <a id="txn-admin-modal-dialog-edit-payment-lnk" class="button-primary no-icon" style="display:none;" > |
394 | - <?php _e( 'Save Payment Details', 'event_espresso' );?> |
|
394 | + <?php _e('Save Payment Details', 'event_espresso'); ?> |
|
395 | 395 | </a> |
396 | 396 | </li> |
397 | 397 | <li> |
398 | 398 | <a id="txn-admin-modal-dialog-edit-refund-lnk" class="button-primary no-icon" style="display:none;" > |
399 | - <?php _e( 'Save Refund Details', 'event_espresso' );?> |
|
399 | + <?php _e('Save Refund Details', 'event_espresso'); ?> |
|
400 | 400 | </a> |
401 | 401 | </li> |
402 | 402 | <li> |
403 | 403 | <a id="txn-admin-modal-dialog-apply-refund-lnk" class="button-primary no-icon" style="display:none;" > |
404 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
404 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
405 | 405 | </a> |
406 | 406 | </li> |
407 | 407 | <li> |
408 | 408 | <a id="txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
409 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
409 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
410 | 410 | </a> |
411 | 411 | </li> |
412 | 412 | <li> |
@@ -423,29 +423,29 @@ discard block |
||
423 | 423 | |
424 | 424 | <h2 id="admin-modal-dialog-delete-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
425 | 425 | <span class="ee-icon ee-icon-cash-add"></span> |
426 | - <?php echo __( 'Delete Payment/Refund for Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
426 | + <?php echo __('Delete Payment/Refund for Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
427 | 427 | </h2> |
428 | 428 | |
429 | 429 | <form name="txn-admin-delete-payment-frm" id="txn-admin-delete-payment-frm" action="<?php echo $delete_payment_url; ?>"> |
430 | 430 | <div class="admin-modal-dialog-wrap"> |
431 | 431 | <div class="admin-modal-dialog-inner"> |
432 | 432 | |
433 | - <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_delete_payment_nonce' );?>"/> |
|
433 | + <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce('espresso_delete_payment_nonce'); ?>"/> |
|
434 | 434 | <input type="hidden" name="delete_espresso_ajax" id="delete-espresso-ajax" value="0"/> |
435 | 435 | <input type="hidden" name="delete_noheader" id="delete-txn-admin-noheader-inp" value="0"/> |
436 | 436 | <input type="hidden" name="delete_txn_admin_payment[PAY_ID]" id="delete-txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
437 | 437 | <input type="hidden" name="delete_txn_admin_payment[TXN_ID]" id="delete-txn-admin-payment-txn-id-inp" value="<?php echo $txn_nmbr['value']; ?>"/> |
438 | 438 | |
439 | 439 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
440 | - <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
440 | + <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
441 | 441 | <?php echo $delete_status_change_select; ?> |
442 | - <p class="description"><?php printf( __('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>' ); ?></p> |
|
442 | + <p class="description"><?php printf(__('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
443 | 443 | </div> |
444 | 444 | |
445 | 445 | <div class="ee-attention txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
446 | - <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
446 | + <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
447 | 447 | <input type="checkbox" value="1" name="delete_txn_reg_status_change[send_notifications]"> |
448 | - <p class="description"><?php _e( 'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso' );?></p> |
|
448 | + <p class="description"><?php _e('If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso'); ?></p> |
|
449 | 449 | </div> |
450 | 450 | <div class="clear"></div> |
451 | 451 | |
@@ -455,12 +455,12 @@ discard block |
||
455 | 455 | <ul id="del-admin-modal-dialog-options-ul"> |
456 | 456 | <li> |
457 | 457 | <a id="txn-admin-modal-dialog-delete-lnk" class="button-primary no-icon" style="display:none;" > |
458 | - <?php _e( 'Delete', 'event_espresso' );?> |
|
458 | + <?php _e('Delete', 'event_espresso'); ?> |
|
459 | 459 | </a> |
460 | 460 | </li> |
461 | 461 | <li> |
462 | 462 | <a id="del-txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
463 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
463 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
464 | 464 | </a> |
465 | 465 | </li> |
466 | 466 | <li> |
@@ -476,30 +476,30 @@ discard block |
||
476 | 476 | <?php endif; // $grand_raw_total > 0?> |
477 | 477 | |
478 | 478 | <?php |
479 | - if ( WP_DEBUG ) { |
|
480 | - $delivered_messages = get_option( 'EED_Messages__payment', array() ); |
|
481 | - if ( isset( $delivered_messages[ $TXN_ID ] )) { |
|
479 | + if (WP_DEBUG) { |
|
480 | + $delivered_messages = get_option('EED_Messages__payment', array()); |
|
481 | + if (isset($delivered_messages[$TXN_ID])) { |
|
482 | 482 | ?> |
483 | - <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e( 'Messages Sent to Primary Registrant', 'event_espresso' );?></h4> |
|
483 | + <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e('Messages Sent to Primary Registrant', 'event_espresso'); ?></h4> |
|
484 | 484 | |
485 | 485 | <div class="admin-primary-mbox-tbl-wrap"> |
486 | 486 | <table class="admin-primary-mbox-tbl"> |
487 | 487 | <thead> |
488 | 488 | <tr> |
489 | - <th class="jst-left"><?php _e( 'Date & Time', 'event_espresso' );?></th> |
|
490 | - <th class="jst-left"><?php _e( 'Message Type', 'event_espresso' );?></th> |
|
491 | - <th class="jst-left"><?php _e( 'Payment Status Upon Sending', 'event_espresso' );?></th> |
|
492 | - <th class="jst-left"><?php _e( 'TXN Status Upon Sending', 'event_espresso' );?></th> |
|
489 | + <th class="jst-left"><?php _e('Date & Time', 'event_espresso'); ?></th> |
|
490 | + <th class="jst-left"><?php _e('Message Type', 'event_espresso'); ?></th> |
|
491 | + <th class="jst-left"><?php _e('Payment Status Upon Sending', 'event_espresso'); ?></th> |
|
492 | + <th class="jst-left"><?php _e('TXN Status Upon Sending', 'event_espresso'); ?></th> |
|
493 | 493 | </tr> |
494 | 494 | </thead> |
495 | 495 | <tbody> |
496 | - <?php foreach ( $delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message ) : |
|
496 | + <?php foreach ($delivered_messages[$TXN_ID] as $timestamp => $delivered_message) : |
|
497 | 497 | ?> |
498 | 498 | <tr> |
499 | - <td class="jst-left"><?php echo date( get_option('date_format') . ' ' . get_option('time_format'), ( $timestamp + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );?></td> |
|
500 | - <td class="jst-left"><?php echo isset( $delivered_message['message_type'] ) ? $delivered_message['message_type'] : '';?></td> |
|
501 | - <td class="jst-left"><?php echo isset( $delivered_message['pay_status'] ) ? $delivered_message['pay_status'] : '';?></td> |
|
502 | - <td class="jst-left"><?php echo isset( $delivered_message['txn_status'] ) ? $delivered_message['txn_status'] : '';?></td> |
|
499 | + <td class="jst-left"><?php echo date(get_option('date_format').' '.get_option('time_format'), ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))); ?></td> |
|
500 | + <td class="jst-left"><?php echo isset($delivered_message['message_type']) ? $delivered_message['message_type'] : ''; ?></td> |
|
501 | + <td class="jst-left"><?php echo isset($delivered_message['pay_status']) ? $delivered_message['pay_status'] : ''; ?></td> |
|
502 | + <td class="jst-left"><?php echo isset($delivered_message['txn_status']) ? $delivered_message['txn_status'] : ''; ?></td> |
|
503 | 503 | </tr> |
504 | 504 | <?php endforeach; // $delivered_messages?> |
505 | 505 | </tbody> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -15,39 +15,39 @@ discard block |
||
15 | 15 | class EE_Text_Normalization extends EE_Normalization_Strategy_Base |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @param string $value_to_normalize |
|
20 | - * @return array|mixed|string |
|
21 | - */ |
|
22 | - public function normalize($value_to_normalize) |
|
23 | - { |
|
24 | - if (is_array($value_to_normalize)) { |
|
25 | - return (string)array_shift($value_to_normalize); |
|
26 | - } |
|
27 | - // consider `"null"` values to be equivalent to null. |
|
28 | - if ($value_to_normalize === '' || $value_to_normalize === null) { |
|
29 | - return null; |
|
30 | - } |
|
31 | - return (string)$value_to_normalize; |
|
32 | - } |
|
18 | + /** |
|
19 | + * @param string $value_to_normalize |
|
20 | + * @return array|mixed|string |
|
21 | + */ |
|
22 | + public function normalize($value_to_normalize) |
|
23 | + { |
|
24 | + if (is_array($value_to_normalize)) { |
|
25 | + return (string)array_shift($value_to_normalize); |
|
26 | + } |
|
27 | + // consider `"null"` values to be equivalent to null. |
|
28 | + if ($value_to_normalize === '' || $value_to_normalize === null) { |
|
29 | + return null; |
|
30 | + } |
|
31 | + return (string)$value_to_normalize; |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * IF its a string in PHP, it will be a string in the HTML form. easy |
|
38 | - * |
|
39 | - * @param string $normalized_value |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function unnormalize($normalized_value) |
|
43 | - { |
|
44 | - //account for default "select here" option values |
|
45 | - if ($normalized_value === null) { |
|
46 | - return ''; |
|
47 | - } |
|
48 | - //double-check it's a string. It's possible this value was a question option that happened to be a numeric |
|
49 | - //string, in which case PHP has automatically converted it to an integer! |
|
50 | - return (string)$normalized_value; |
|
51 | - } |
|
36 | + /** |
|
37 | + * IF its a string in PHP, it will be a string in the HTML form. easy |
|
38 | + * |
|
39 | + * @param string $normalized_value |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function unnormalize($normalized_value) |
|
43 | + { |
|
44 | + //account for default "select here" option values |
|
45 | + if ($normalized_value === null) { |
|
46 | + return ''; |
|
47 | + } |
|
48 | + //double-check it's a string. It's possible this value was a question option that happened to be a numeric |
|
49 | + //string, in which case PHP has automatically converted it to an integer! |
|
50 | + return (string)$normalized_value; |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | // End of file EE_Text_Normalization.strategy.php |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | 4 | |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | public function normalize($value_to_normalize) |
23 | 23 | { |
24 | 24 | if (is_array($value_to_normalize)) { |
25 | - return (string)array_shift($value_to_normalize); |
|
25 | + return (string) array_shift($value_to_normalize); |
|
26 | 26 | } |
27 | 27 | // consider `"null"` values to be equivalent to null. |
28 | 28 | if ($value_to_normalize === '' || $value_to_normalize === null) { |
29 | 29 | return null; |
30 | 30 | } |
31 | - return (string)$value_to_normalize; |
|
31 | + return (string) $value_to_normalize; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | //double-check it's a string. It's possible this value was a question option that happened to be a numeric |
49 | 49 | //string, in which case PHP has automatically converted it to an integer! |
50 | - return (string)$normalized_value; |
|
50 | + return (string) $normalized_value; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | // End of file EE_Text_Normalization.strategy.php |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -14,60 +14,60 @@ discard block |
||
14 | 14 | abstract class EE_Normalization_Strategy_Base extends EE_Form_Input_Strategy_Base |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Takes the sanitized value for the input and casts it into the correct PHP type. |
|
19 | - * Eg, turns it into an int, float, string, boolean, datetime, etc. The validation |
|
20 | - * strategy should be able to depend on the normalized value being of the correct type. |
|
21 | - * If the normalized value passes validation, the normalized value is what other code |
|
22 | - * will operate on. If the sanitized value cannot be normalized, this method should either |
|
23 | - * add a validation error onto the input, or wrangle the input into a format that can be normalized |
|
24 | - * (eg, for a date input, if the user enters "2014/100/100", you can either add an error stating |
|
25 | - * "hey! 2014/100/100 is not a valid date!", or simply convert it into a valid date like "2014/12/31". |
|
26 | - * For this case, I'd prefer the former. But there may be cases where you'd just rather correct it for them) |
|
27 | - * |
|
28 | - * @param string $value_to_normalize it should always be a string. If the input receives an array, then the |
|
29 | - * validation strategy should be called on array elements, not on the entire array |
|
30 | - * @return mixed the normalized value |
|
31 | - */ |
|
32 | - abstract public function normalize($value_to_normalize); |
|
17 | + /** |
|
18 | + * Takes the sanitized value for the input and casts it into the correct PHP type. |
|
19 | + * Eg, turns it into an int, float, string, boolean, datetime, etc. The validation |
|
20 | + * strategy should be able to depend on the normalized value being of the correct type. |
|
21 | + * If the normalized value passes validation, the normalized value is what other code |
|
22 | + * will operate on. If the sanitized value cannot be normalized, this method should either |
|
23 | + * add a validation error onto the input, or wrangle the input into a format that can be normalized |
|
24 | + * (eg, for a date input, if the user enters "2014/100/100", you can either add an error stating |
|
25 | + * "hey! 2014/100/100 is not a valid date!", or simply convert it into a valid date like "2014/12/31". |
|
26 | + * For this case, I'd prefer the former. But there may be cases where you'd just rather correct it for them) |
|
27 | + * |
|
28 | + * @param string $value_to_normalize it should always be a string. If the input receives an array, then the |
|
29 | + * validation strategy should be called on array elements, not on the entire array |
|
30 | + * @return mixed the normalized value |
|
31 | + */ |
|
32 | + abstract public function normalize($value_to_normalize); |
|
33 | 33 | |
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * Identical to normalize, except normalize_one() CANNOT be passed an array and |
|
38 | - * never returns an array. Useful if the normalization strategy converts between arrays |
|
39 | - * |
|
40 | - * @param string $individual_item_to_normalize |
|
41 | - * @return mixed |
|
42 | - */ |
|
43 | - public function normalize_one($individual_item_to_normalize) |
|
44 | - { |
|
45 | - return $this->normalize($individual_item_to_normalize); |
|
46 | - } |
|
36 | + /** |
|
37 | + * Identical to normalize, except normalize_one() CANNOT be passed an array and |
|
38 | + * never returns an array. Useful if the normalization strategy converts between arrays |
|
39 | + * |
|
40 | + * @param string $individual_item_to_normalize |
|
41 | + * @return mixed |
|
42 | + */ |
|
43 | + public function normalize_one($individual_item_to_normalize) |
|
44 | + { |
|
45 | + return $this->normalize($individual_item_to_normalize); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * Takes the normalized value (for an Yes_No_Input this could be TRUE or FALSE), and converts it into |
|
52 | - * the value you would use in the html form (for a Yes_No_Input this could be '1' or '0'). |
|
53 | - * |
|
54 | - * @param $normalized_value |
|
55 | - * @return array|string the 'raw' value as used in the form, usually a string or array of strings. |
|
56 | - */ |
|
57 | - abstract public function unnormalize($normalized_value); |
|
50 | + /** |
|
51 | + * Takes the normalized value (for an Yes_No_Input this could be TRUE or FALSE), and converts it into |
|
52 | + * the value you would use in the html form (for a Yes_No_Input this could be '1' or '0'). |
|
53 | + * |
|
54 | + * @param $normalized_value |
|
55 | + * @return array|string the 'raw' value as used in the form, usually a string or array of strings. |
|
56 | + */ |
|
57 | + abstract public function unnormalize($normalized_value); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | |
61 | - /** |
|
62 | - * Normally the same as unnormalize, except it CANNOT be passed an array and |
|
63 | - * ALWAYS returns a string |
|
64 | - * |
|
65 | - * @param mixed $individual_item_to_unnormalize NOT an array |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - public function unnormalize_one($individual_item_to_unnormalize) |
|
69 | - { |
|
70 | - return $this->unnormalize($individual_item_to_unnormalize); |
|
71 | - } |
|
61 | + /** |
|
62 | + * Normally the same as unnormalize, except it CANNOT be passed an array and |
|
63 | + * ALWAYS returns a string |
|
64 | + * |
|
65 | + * @param mixed $individual_item_to_unnormalize NOT an array |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + public function unnormalize_one($individual_item_to_unnormalize) |
|
69 | + { |
|
70 | + return $this->unnormalize($individual_item_to_unnormalize); |
|
71 | + } |
|
72 | 72 | } |
73 | 73 | // End of file EE_Normalization_Strategy_Base.strategy.php |
@@ -1,4 +1,4 @@ |
||
1 | -<?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | 4 |
@@ -7,133 +7,133 @@ |
||
7 | 7 | */ |
8 | 8 | class EE_Post_Content_Field extends EE_Text_Field_Base |
9 | 9 | { |
10 | - static protected $_added_the_content_basic_filters = false; |
|
10 | + static protected $_added_the_content_basic_filters = false; |
|
11 | 11 | |
12 | - /** |
|
13 | - * @param string $table_column |
|
14 | - * @param string $nicename |
|
15 | - * @param bool $nullable |
|
16 | - * @param null $default_value |
|
17 | - */ |
|
18 | - public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
19 | - { |
|
20 | - parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
21 | - $this->setSchemaType('object'); |
|
22 | - } |
|
12 | + /** |
|
13 | + * @param string $table_column |
|
14 | + * @param string $nicename |
|
15 | + * @param bool $nullable |
|
16 | + * @param null $default_value |
|
17 | + */ |
|
18 | + public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
19 | + { |
|
20 | + parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
21 | + $this->setSchemaType('object'); |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * removes all tags which a WP Post wouldn't allow in its content normally |
|
27 | - * |
|
28 | - * @param string $value |
|
29 | - * @return string |
|
30 | - */ |
|
31 | - function prepare_for_set($value) |
|
32 | - { |
|
33 | - if (! current_user_can('unfiltered_html')) { |
|
34 | - $value = wp_kses("$value", wp_kses_allowed_html('post')); |
|
35 | - } |
|
36 | - return parent::prepare_for_set($value); |
|
37 | - } |
|
25 | + /** |
|
26 | + * removes all tags which a WP Post wouldn't allow in its content normally |
|
27 | + * |
|
28 | + * @param string $value |
|
29 | + * @return string |
|
30 | + */ |
|
31 | + function prepare_for_set($value) |
|
32 | + { |
|
33 | + if (! current_user_can('unfiltered_html')) { |
|
34 | + $value = wp_kses("$value", wp_kses_allowed_html('post')); |
|
35 | + } |
|
36 | + return parent::prepare_for_set($value); |
|
37 | + } |
|
38 | 38 | |
39 | - function prepare_for_set_from_db($value_found_in_db_for_model_object) |
|
40 | - { |
|
41 | - return $value_found_in_db_for_model_object; |
|
42 | - } |
|
39 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) |
|
40 | + { |
|
41 | + return $value_found_in_db_for_model_object; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * Runs the content through `the_content`, or if prepares the content for placing in a form input |
|
48 | - * @param string $value_on_field_to_be_outputted |
|
49 | - * @param string $schema possible values: 'form_input' or null (if null, will run through 'the_content') |
|
50 | - * @return string |
|
51 | - * @throws EE_Error when WP_DEBUG is on and recursive calling is detected |
|
52 | - */ |
|
53 | - public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
|
54 | - { |
|
55 | - switch($schema){ |
|
56 | - case 'form_input': |
|
57 | - return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
|
58 | - case 'the_content': |
|
46 | + /** |
|
47 | + * Runs the content through `the_content`, or if prepares the content for placing in a form input |
|
48 | + * @param string $value_on_field_to_be_outputted |
|
49 | + * @param string $schema possible values: 'form_input' or null (if null, will run through 'the_content') |
|
50 | + * @return string |
|
51 | + * @throws EE_Error when WP_DEBUG is on and recursive calling is detected |
|
52 | + */ |
|
53 | + public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
|
54 | + { |
|
55 | + switch($schema){ |
|
56 | + case 'form_input': |
|
57 | + return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
|
58 | + case 'the_content': |
|
59 | 59 | |
60 | - if(doing_filter( 'the_content')){ |
|
61 | - if( defined('WP_DEBUG') && WP_DEBUG){ |
|
62 | - throw new EE_Error( |
|
63 | - sprintf( |
|
64 | - esc_html__('You have recursively called "%1$s" with %2$s set to %3$s which uses "%2$s" filter. You should use it with %2$s "%3$s" instead here.', 'event_espresso'), |
|
65 | - 'EE_Post_Content_Field::prepare_for_pretty_echoing', |
|
66 | - '$schema', |
|
67 | - 'the_content', |
|
68 | - 'the_content_wp_core_only' |
|
69 | - ) |
|
70 | - ); |
|
71 | - } else { |
|
72 | - return $this->prepare_for_pretty_echoing($value_on_field_to_be_outputted, 'the_content_wp_core_only'); |
|
73 | - } |
|
74 | - } |
|
75 | - return apply_filters( |
|
76 | - 'the_content', |
|
77 | - parent::prepare_for_pretty_echoing( |
|
78 | - $value_on_field_to_be_outputted, |
|
79 | - $schema |
|
80 | - ) |
|
81 | - ); |
|
82 | - case 'the_content_wp_core_only': |
|
83 | - default: |
|
84 | - self::_ensure_filters_setup(); |
|
85 | - return apply_filters( |
|
86 | - 'the_content_wp_core_only', |
|
87 | - parent::prepare_for_pretty_echoing( |
|
88 | - $value_on_field_to_be_outputted, |
|
89 | - $schema |
|
90 | - ) |
|
91 | - ); |
|
92 | - } |
|
93 | - } |
|
60 | + if(doing_filter( 'the_content')){ |
|
61 | + if( defined('WP_DEBUG') && WP_DEBUG){ |
|
62 | + throw new EE_Error( |
|
63 | + sprintf( |
|
64 | + esc_html__('You have recursively called "%1$s" with %2$s set to %3$s which uses "%2$s" filter. You should use it with %2$s "%3$s" instead here.', 'event_espresso'), |
|
65 | + 'EE_Post_Content_Field::prepare_for_pretty_echoing', |
|
66 | + '$schema', |
|
67 | + 'the_content', |
|
68 | + 'the_content_wp_core_only' |
|
69 | + ) |
|
70 | + ); |
|
71 | + } else { |
|
72 | + return $this->prepare_for_pretty_echoing($value_on_field_to_be_outputted, 'the_content_wp_core_only'); |
|
73 | + } |
|
74 | + } |
|
75 | + return apply_filters( |
|
76 | + 'the_content', |
|
77 | + parent::prepare_for_pretty_echoing( |
|
78 | + $value_on_field_to_be_outputted, |
|
79 | + $schema |
|
80 | + ) |
|
81 | + ); |
|
82 | + case 'the_content_wp_core_only': |
|
83 | + default: |
|
84 | + self::_ensure_filters_setup(); |
|
85 | + return apply_filters( |
|
86 | + 'the_content_wp_core_only', |
|
87 | + parent::prepare_for_pretty_echoing( |
|
88 | + $value_on_field_to_be_outputted, |
|
89 | + $schema |
|
90 | + ) |
|
91 | + ); |
|
92 | + } |
|
93 | + } |
|
94 | 94 | |
95 | 95 | |
96 | 96 | |
97 | - /** |
|
98 | - * Verifies we've setup the standard WP core filters on 'the_content_wp_core_only' filter |
|
99 | - */ |
|
100 | - protected static function _ensure_filters_setup() |
|
101 | - { |
|
102 | - if( !self::$_added_the_content_basic_filters){ |
|
103 | - add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8); |
|
104 | - add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8); |
|
105 | - add_filter('the_content_wp_core_only', 'wptexturize', 10); |
|
106 | - add_filter('the_content_wp_core_only', 'wpautop', 10); |
|
107 | - add_filter('the_content_wp_core_only', 'shortcode_unautop', 10); |
|
108 | - add_filter('the_content_wp_core_only', 'prepend_attachment', 10); |
|
109 | - if(function_exists('wp_make_content_images_responsive')) { |
|
110 | - add_filter('the_content_wp_core_only', 'wp_make_content_images_responsive', 10); |
|
111 | - } |
|
112 | - add_filter('the_content_wp_core_only', 'do_shortcode', 11); |
|
113 | - add_filter('the_content_wp_core_only', 'convert_smilies', 20); |
|
114 | - self::$_added_the_content_basic_filters = true; |
|
115 | - } |
|
116 | - } |
|
97 | + /** |
|
98 | + * Verifies we've setup the standard WP core filters on 'the_content_wp_core_only' filter |
|
99 | + */ |
|
100 | + protected static function _ensure_filters_setup() |
|
101 | + { |
|
102 | + if( !self::$_added_the_content_basic_filters){ |
|
103 | + add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8); |
|
104 | + add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8); |
|
105 | + add_filter('the_content_wp_core_only', 'wptexturize', 10); |
|
106 | + add_filter('the_content_wp_core_only', 'wpautop', 10); |
|
107 | + add_filter('the_content_wp_core_only', 'shortcode_unautop', 10); |
|
108 | + add_filter('the_content_wp_core_only', 'prepend_attachment', 10); |
|
109 | + if(function_exists('wp_make_content_images_responsive')) { |
|
110 | + add_filter('the_content_wp_core_only', 'wp_make_content_images_responsive', 10); |
|
111 | + } |
|
112 | + add_filter('the_content_wp_core_only', 'do_shortcode', 11); |
|
113 | + add_filter('the_content_wp_core_only', 'convert_smilies', 20); |
|
114 | + self::$_added_the_content_basic_filters = true; |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | |
119 | 119 | |
120 | - public function getSchemaProperties() |
|
121 | - { |
|
122 | - return array( |
|
123 | - 'raw' => array( |
|
124 | - 'description' => sprintf( |
|
125 | - __('%s - the content as it exists in the database.', 'event_espresso'), |
|
126 | - $this->get_nicename() |
|
127 | - ), |
|
128 | - 'type' => 'string' |
|
129 | - ), |
|
130 | - 'rendered' => array( |
|
131 | - 'description' => sprintf( |
|
132 | - __('%s - the content rendered for display.', 'event_espresso'), |
|
133 | - $this->get_nicename() |
|
134 | - ), |
|
135 | - 'type' => 'string' |
|
136 | - ) |
|
137 | - ); |
|
138 | - } |
|
120 | + public function getSchemaProperties() |
|
121 | + { |
|
122 | + return array( |
|
123 | + 'raw' => array( |
|
124 | + 'description' => sprintf( |
|
125 | + __('%s - the content as it exists in the database.', 'event_espresso'), |
|
126 | + $this->get_nicename() |
|
127 | + ), |
|
128 | + 'type' => 'string' |
|
129 | + ), |
|
130 | + 'rendered' => array( |
|
131 | + 'description' => sprintf( |
|
132 | + __('%s - the content rendered for display.', 'event_espresso'), |
|
133 | + $this->get_nicename() |
|
134 | + ), |
|
135 | + 'type' => 'string' |
|
136 | + ) |
|
137 | + ); |
|
138 | + } |
|
139 | 139 | } |
140 | 140 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function prepare_for_set($value) |
32 | 32 | { |
33 | - if (! current_user_can('unfiltered_html')) { |
|
33 | + if ( ! current_user_can('unfiltered_html')) { |
|
34 | 34 | $value = wp_kses("$value", wp_kses_allowed_html('post')); |
35 | 35 | } |
36 | 36 | return parent::prepare_for_set($value); |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
54 | 54 | { |
55 | - switch($schema){ |
|
55 | + switch ($schema) { |
|
56 | 56 | case 'form_input': |
57 | 57 | return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
58 | 58 | case 'the_content': |
59 | 59 | |
60 | - if(doing_filter( 'the_content')){ |
|
61 | - if( defined('WP_DEBUG') && WP_DEBUG){ |
|
60 | + if (doing_filter('the_content')) { |
|
61 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
62 | 62 | throw new EE_Error( |
63 | 63 | sprintf( |
64 | 64 | esc_html__('You have recursively called "%1$s" with %2$s set to %3$s which uses "%2$s" filter. You should use it with %2$s "%3$s" instead here.', 'event_espresso'), |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | */ |
100 | 100 | protected static function _ensure_filters_setup() |
101 | 101 | { |
102 | - if( !self::$_added_the_content_basic_filters){ |
|
103 | - add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8); |
|
104 | - add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8); |
|
102 | + if ( ! self::$_added_the_content_basic_filters) { |
|
103 | + add_filter('the_content_wp_core_only', array($GLOBALS['wp_embed'], 'run_shortcode'), 8); |
|
104 | + add_filter('the_content_wp_core_only', array($GLOBALS['wp_embed'], 'autoembed'), 8); |
|
105 | 105 | add_filter('the_content_wp_core_only', 'wptexturize', 10); |
106 | 106 | add_filter('the_content_wp_core_only', 'wpautop', 10); |
107 | 107 | add_filter('the_content_wp_core_only', 'shortcode_unautop', 10); |
108 | 108 | add_filter('the_content_wp_core_only', 'prepend_attachment', 10); |
109 | - if(function_exists('wp_make_content_images_responsive')) { |
|
109 | + if (function_exists('wp_make_content_images_responsive')) { |
|
110 | 110 | add_filter('the_content_wp_core_only', 'wp_make_content_images_responsive', 10); |
111 | 111 | } |
112 | 112 | add_filter('the_content_wp_core_only', 'do_shortcode', 11); |
@@ -108,10 +108,10 @@ |
||
108 | 108 | } |
109 | 109 | } |
110 | 110 | $csv_data[] = apply_filters( |
111 | - 'FHEE___EventEspresso_core_libraries_batch_JobHandlers_AttendeesReport__get_csv_data__row', |
|
112 | - $csv_row, |
|
113 | - $attendee_row |
|
114 | - ); |
|
111 | + 'FHEE___EventEspresso_core_libraries_batch_JobHandlers_AttendeesReport__get_csv_data__row', |
|
112 | + $csv_row, |
|
113 | + $attendee_row |
|
114 | + ); |
|
115 | 115 | } |
116 | 116 | return $csv_data; |
117 | 117 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use EventEspressoBatchRequest\Helpers\JobParameters; |
19 | 19 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
20 | 20 | |
21 | -if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
21 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
22 | 22 | exit('No direct script access allowed'); |
23 | 23 | } |
24 | 24 | |
@@ -27,84 +27,84 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | public function create_job(JobParameters $job_parameters) { |
30 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_contacts', 'generating_report' ) ) { |
|
30 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_contacts', 'generating_report')) { |
|
31 | 31 | throw new BatchRequestException( |
32 | - __( 'You do not have permission to view contacts', 'event_espresso') |
|
32 | + __('You do not have permission to view contacts', 'event_espresso') |
|
33 | 33 | ); |
34 | 34 | } |
35 | 35 | $filepath = $this->create_file_from_job_with_name( |
36 | 36 | $job_parameters->job_id(), |
37 | 37 | __('contact-list-report.csv', 'event_espresso') |
38 | 38 | ); |
39 | - $job_parameters->add_extra_data( 'filepath', $filepath ); |
|
40 | - $job_parameters->set_job_size( $this->count_units_to_process() ); |
|
39 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
40 | + $job_parameters->set_job_size($this->count_units_to_process()); |
|
41 | 41 | //we should also set the header columns |
42 | - $csv_data_for_row = $this->get_csv_data( 0, 1 ); |
|
43 | - \EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true ); |
|
42 | + $csv_data_for_row = $this->get_csv_data(0, 1); |
|
43 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
44 | 44 | //if we actually processed a row there, record it |
45 | - if( $job_parameters->job_size() ) { |
|
46 | - $job_parameters->mark_processed( 1 ); |
|
45 | + if ($job_parameters->job_size()) { |
|
46 | + $job_parameters->mark_processed(1); |
|
47 | 47 | } |
48 | 48 | return new JobStepResponse( |
49 | 49 | $job_parameters, |
50 | - __( 'Contacts report started successfully...', 'event_espresso' ) |
|
50 | + __('Contacts report started successfully...', 'event_espresso') |
|
51 | 51 | ); |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
56 | - $csv_data = $this->get_csv_data( $job_parameters->units_processed(), $batch_size ); |
|
57 | - \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
58 | - $units_processed = count( $csv_data ); |
|
59 | - $job_parameters->mark_processed( $units_processed ); |
|
56 | + $csv_data = $this->get_csv_data($job_parameters->units_processed(), $batch_size); |
|
57 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
58 | + $units_processed = count($csv_data); |
|
59 | + $job_parameters->mark_processed($units_processed); |
|
60 | 60 | $extra_response_data = array( |
61 | 61 | 'file_url' => '' |
62 | 62 | ); |
63 | - if( $units_processed < $batch_size ) { |
|
64 | - $job_parameters->set_status( JobParameters::status_complete ); |
|
65 | - $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
63 | + if ($units_processed < $batch_size) { |
|
64 | + $job_parameters->set_status(JobParameters::status_complete); |
|
65 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
66 | 66 | } |
67 | 67 | return new JobStepResponse( |
68 | 68 | $job_parameters, |
69 | 69 | sprintf( |
70 | - __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
71 | - count( $csv_data ) ), |
|
70 | + __('Wrote %1$s rows to report CSV file...', 'event_espresso'), |
|
71 | + count($csv_data) ), |
|
72 | 72 | $extra_response_data ); |
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | public function cleanup_job(JobParameters $job_parameters) { |
77 | 77 | $this->_file_helper->delete( |
78 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
78 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
79 | 79 | true, |
80 | 80 | 'd' |
81 | 81 | ); |
82 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
82 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function count_units_to_process() { |
86 | - return \EEM_Attendee::instance()->count( array( 'caps' => \EEM_Base::caps_read_admin )); |
|
86 | + return \EEM_Attendee::instance()->count(array('caps' => \EEM_Base::caps_read_admin)); |
|
87 | 87 | } |
88 | - public function get_csv_data( $offset, $limit ) { |
|
88 | + public function get_csv_data($offset, $limit) { |
|
89 | 89 | $attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( |
90 | 90 | array( |
91 | - 'limit' => array( $offset, $limit ), |
|
92 | - 'force_join' => array( 'State', 'Country' ), |
|
91 | + 'limit' => array($offset, $limit), |
|
92 | + 'force_join' => array('State', 'Country'), |
|
93 | 93 | 'caps' => \EEM_Base::caps_read_admin |
94 | 94 | ) |
95 | 95 | ); |
96 | 96 | $csv_data = array(); |
97 | - foreach( $attendee_rows as $attendee_row ){ |
|
97 | + foreach ($attendee_rows as $attendee_row) { |
|
98 | 98 | $csv_row = array(); |
99 | - foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){ |
|
100 | - if( $field_name == 'STA_ID' ){ |
|
101 | - $state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' ); |
|
102 | - $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
|
103 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
104 | - $country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
|
105 | - $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
|
106 | - }else{ |
|
107 | - $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
|
99 | + foreach (\EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) { |
|
100 | + if ($field_name == 'STA_ID') { |
|
101 | + $state_name_field = \EEM_State::instance()->field_settings_for('STA_name'); |
|
102 | + $csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()]; |
|
103 | + }elseif ($field_name == 'CNT_ISO') { |
|
104 | + $country_name_field = \EEM_Country::instance()->field_settings_for('CNT_name'); |
|
105 | + $csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()]; |
|
106 | + } else { |
|
107 | + $csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()]; |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | $csv_data[] = apply_filters( |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
18 | 18 | |
19 | 19 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
20 | - exit('No direct script access allowed'); |
|
20 | + exit('No direct script access allowed'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -25,443 +25,442 @@ discard block |
||
25 | 25 | class RegistrationsReport extends JobHandlerFile |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * Performs any necessary setup for starting the job. This is also a good |
|
30 | - * place to setup the $job_arguments which will be used for subsequent HTTP requests |
|
31 | - * when continue_job will be called |
|
32 | - * |
|
33 | - * @param JobParameters $job_parameters |
|
34 | - * @throws BatchRequestException |
|
35 | - * @return JobStepResponse |
|
36 | - */ |
|
37 | - public function create_job(JobParameters $job_parameters) |
|
38 | - { |
|
39 | - $event_id = intval($job_parameters->request_datum('EVT_ID', '0')); |
|
40 | - if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) { |
|
41 | - throw new BatchRequestException(__('You do not have permission to view registrations', 'event_espresso')); |
|
42 | - } |
|
43 | - $filepath = $this->create_file_from_job_with_name($job_parameters->job_id(), |
|
44 | - $this->get_filename($event_id)); |
|
45 | - $job_parameters->add_extra_data('filepath', $filepath); |
|
46 | - if ($job_parameters->request_datum('use_filters', false)) { |
|
47 | - $query_params = maybe_unserialize(stripslashes($job_parameters->request_datum('filters', array()))); |
|
48 | - } else { |
|
49 | - $query_params = apply_filters('FHEE__EE_Export__report_registration_for_event', array( |
|
50 | - array( |
|
51 | - 'OR' => array( |
|
52 | - //don't include registrations from failed or abandoned transactions... |
|
53 | - 'Transaction.STS_ID' => array( |
|
54 | - 'NOT IN', |
|
55 | - array( |
|
56 | - \EEM_Transaction::failed_status_code, |
|
57 | - \EEM_Transaction::abandoned_status_code, |
|
58 | - ), |
|
59 | - ), |
|
60 | - //unless the registration is approved, in which case include it regardless of transaction status |
|
61 | - 'STS_ID' => \EEM_Registration::status_id_approved, |
|
62 | - ), |
|
63 | - 'Ticket.TKT_deleted' => array('IN', array(true, false)), |
|
64 | - ), |
|
65 | - 'order_by' => array('Transaction.TXN_ID' => 'asc', 'REG_count' => 'asc'), |
|
66 | - 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
67 | - 'caps' => \EEM_Base::caps_read_admin, |
|
68 | - ), $event_id); |
|
69 | - if ($event_id) { |
|
70 | - $query_params[0]['EVT_ID'] = $event_id; |
|
71 | - } else { |
|
72 | - $query_params['force_join'][] = 'Event'; |
|
73 | - } |
|
74 | - } |
|
75 | - if ( ! isset($query_params['force_join'])) { |
|
76 | - $query_params['force_join'] = array('Event', 'Transaction', 'Ticket', 'Attendee'); |
|
77 | - } |
|
78 | - $job_parameters->add_extra_data('query_params', $query_params); |
|
79 | - $question_labels = $this->_get_question_labels($query_params); |
|
80 | - $job_parameters->add_extra_data('question_labels', $question_labels); |
|
81 | - $job_parameters->set_job_size( |
|
82 | - \EEM_Registration::instance()->count( |
|
83 | - array_diff_key( |
|
84 | - $query_params, |
|
85 | - array_flip( |
|
86 | - array( 'limit' ) |
|
87 | - ) |
|
88 | - ) |
|
89 | - ) |
|
90 | - ); |
|
91 | - //we should also set the header columns |
|
92 | - $csv_data_for_row = $this->get_csv_data_for($event_id, 0, 1, $job_parameters->extra_datum('question_labels'), |
|
93 | - $job_parameters->extra_datum('query_params')); |
|
94 | - \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
95 | - //if we actually processed a row there, record it |
|
96 | - if ($job_parameters->job_size()) { |
|
97 | - $job_parameters->mark_processed(1); |
|
98 | - } |
|
99 | - return new JobStepResponse($job_parameters, |
|
100 | - __('Registrations report started successfully...', 'event_espresso')); |
|
101 | - } |
|
28 | + /** |
|
29 | + * Performs any necessary setup for starting the job. This is also a good |
|
30 | + * place to setup the $job_arguments which will be used for subsequent HTTP requests |
|
31 | + * when continue_job will be called |
|
32 | + * |
|
33 | + * @param JobParameters $job_parameters |
|
34 | + * @throws BatchRequestException |
|
35 | + * @return JobStepResponse |
|
36 | + */ |
|
37 | + public function create_job(JobParameters $job_parameters) |
|
38 | + { |
|
39 | + $event_id = intval($job_parameters->request_datum('EVT_ID', '0')); |
|
40 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) { |
|
41 | + throw new BatchRequestException(__('You do not have permission to view registrations', 'event_espresso')); |
|
42 | + } |
|
43 | + $filepath = $this->create_file_from_job_with_name($job_parameters->job_id(), |
|
44 | + $this->get_filename($event_id)); |
|
45 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
46 | + if ($job_parameters->request_datum('use_filters', false)) { |
|
47 | + $query_params = maybe_unserialize(stripslashes($job_parameters->request_datum('filters', array()))); |
|
48 | + } else { |
|
49 | + $query_params = apply_filters('FHEE__EE_Export__report_registration_for_event', array( |
|
50 | + array( |
|
51 | + 'OR' => array( |
|
52 | + //don't include registrations from failed or abandoned transactions... |
|
53 | + 'Transaction.STS_ID' => array( |
|
54 | + 'NOT IN', |
|
55 | + array( |
|
56 | + \EEM_Transaction::failed_status_code, |
|
57 | + \EEM_Transaction::abandoned_status_code, |
|
58 | + ), |
|
59 | + ), |
|
60 | + //unless the registration is approved, in which case include it regardless of transaction status |
|
61 | + 'STS_ID' => \EEM_Registration::status_id_approved, |
|
62 | + ), |
|
63 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)), |
|
64 | + ), |
|
65 | + 'order_by' => array('Transaction.TXN_ID' => 'asc', 'REG_count' => 'asc'), |
|
66 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
67 | + 'caps' => \EEM_Base::caps_read_admin, |
|
68 | + ), $event_id); |
|
69 | + if ($event_id) { |
|
70 | + $query_params[0]['EVT_ID'] = $event_id; |
|
71 | + } else { |
|
72 | + $query_params['force_join'][] = 'Event'; |
|
73 | + } |
|
74 | + } |
|
75 | + if ( ! isset($query_params['force_join'])) { |
|
76 | + $query_params['force_join'] = array('Event', 'Transaction', 'Ticket', 'Attendee'); |
|
77 | + } |
|
78 | + $job_parameters->add_extra_data('query_params', $query_params); |
|
79 | + $question_labels = $this->_get_question_labels($query_params); |
|
80 | + $job_parameters->add_extra_data('question_labels', $question_labels); |
|
81 | + $job_parameters->set_job_size( |
|
82 | + \EEM_Registration::instance()->count( |
|
83 | + array_diff_key( |
|
84 | + $query_params, |
|
85 | + array_flip( |
|
86 | + array( 'limit' ) |
|
87 | + ) |
|
88 | + ) |
|
89 | + ) |
|
90 | + ); |
|
91 | + //we should also set the header columns |
|
92 | + $csv_data_for_row = $this->get_csv_data_for($event_id, 0, 1, $job_parameters->extra_datum('question_labels'), |
|
93 | + $job_parameters->extra_datum('query_params')); |
|
94 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
95 | + //if we actually processed a row there, record it |
|
96 | + if ($job_parameters->job_size()) { |
|
97 | + $job_parameters->mark_processed(1); |
|
98 | + } |
|
99 | + return new JobStepResponse($job_parameters, |
|
100 | + __('Registrations report started successfully...', 'event_espresso')); |
|
101 | + } |
|
102 | 102 | |
103 | 103 | |
104 | 104 | |
105 | - /** |
|
106 | - * Gets the filename |
|
107 | - * @return string |
|
108 | - */ |
|
109 | - protected function get_filename() |
|
110 | - { |
|
111 | - return sprintf("event-espresso-registrations-%s.csv", str_replace(':', '-', current_time('mysql'))); |
|
112 | - } |
|
105 | + /** |
|
106 | + * Gets the filename |
|
107 | + * @return string |
|
108 | + */ |
|
109 | + protected function get_filename() |
|
110 | + { |
|
111 | + return sprintf("event-espresso-registrations-%s.csv", str_replace(':', '-', current_time('mysql'))); |
|
112 | + } |
|
113 | 113 | |
114 | 114 | |
115 | 115 | |
116 | - /** |
|
117 | - * Gets the questions which are to be used for this report, so they |
|
118 | - * can be remembered for later |
|
119 | - * |
|
120 | - * @param array $registration_query_params |
|
121 | - * @return array question admin labels to be used for this report |
|
122 | - */ |
|
123 | - protected function _get_question_labels($registration_query_params) |
|
124 | - { |
|
125 | - $where = isset($registration_query_params[0]) ? $registration_query_params[0] : null; |
|
126 | - $question_query_params = array(); |
|
127 | - if ($where !== null) { |
|
128 | - $question_query_params = array( |
|
129 | - $this->_change_registration_where_params_to_question_where_params($registration_query_params[0]), |
|
130 | - ); |
|
131 | - } |
|
132 | - $question_query_params[0]['QST_system'] = array('NOT_IN', array_keys(\EEM_Attendee::instance()->system_question_to_attendee_field_mapping())); |
|
133 | - if(apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) { |
|
134 | - $question_query_params[0]['Answer.ANS_ID'] = array('IS_NOT_NULL'); |
|
135 | - } |
|
136 | - $question_query_params['group_by'] = array( 'QST_ID' ); |
|
137 | - return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) ); |
|
138 | - } |
|
116 | + /** |
|
117 | + * Gets the questions which are to be used for this report, so they |
|
118 | + * can be remembered for later |
|
119 | + * |
|
120 | + * @param array $registration_query_params |
|
121 | + * @return array question admin labels to be used for this report |
|
122 | + */ |
|
123 | + protected function _get_question_labels($registration_query_params) |
|
124 | + { |
|
125 | + $where = isset($registration_query_params[0]) ? $registration_query_params[0] : null; |
|
126 | + $question_query_params = array(); |
|
127 | + if ($where !== null) { |
|
128 | + $question_query_params = array( |
|
129 | + $this->_change_registration_where_params_to_question_where_params($registration_query_params[0]), |
|
130 | + ); |
|
131 | + } |
|
132 | + $question_query_params[0]['QST_system'] = array('NOT_IN', array_keys(\EEM_Attendee::instance()->system_question_to_attendee_field_mapping())); |
|
133 | + if(apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) { |
|
134 | + $question_query_params[0]['Answer.ANS_ID'] = array('IS_NOT_NULL'); |
|
135 | + } |
|
136 | + $question_query_params['group_by'] = array( 'QST_ID' ); |
|
137 | + return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) ); |
|
138 | + } |
|
139 | 139 | |
140 | 140 | |
141 | 141 | |
142 | - /** |
|
143 | - * Takes where params meant for registrations and changes them to work for questions |
|
144 | - * |
|
145 | - * @param array $reg_where_params |
|
146 | - * @return array |
|
147 | - */ |
|
148 | - protected function _change_registration_where_params_to_question_where_params($reg_where_params) |
|
149 | - { |
|
150 | - $question_where_params = array(); |
|
151 | - foreach ($reg_where_params as $key => $val) { |
|
152 | - if (\EEM_Registration::instance()->is_logic_query_param_key($key)) { |
|
153 | - $question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val); |
|
154 | - } else { |
|
155 | - //it's a normal where condition |
|
156 | - $question_where_params['Question_Group.Event.Registration.' . $key] = $val; |
|
157 | - } |
|
158 | - } |
|
159 | - return $question_where_params; |
|
160 | - } |
|
142 | + /** |
|
143 | + * Takes where params meant for registrations and changes them to work for questions |
|
144 | + * |
|
145 | + * @param array $reg_where_params |
|
146 | + * @return array |
|
147 | + */ |
|
148 | + protected function _change_registration_where_params_to_question_where_params($reg_where_params) |
|
149 | + { |
|
150 | + $question_where_params = array(); |
|
151 | + foreach ($reg_where_params as $key => $val) { |
|
152 | + if (\EEM_Registration::instance()->is_logic_query_param_key($key)) { |
|
153 | + $question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val); |
|
154 | + } else { |
|
155 | + //it's a normal where condition |
|
156 | + $question_where_params['Question_Group.Event.Registration.' . $key] = $val; |
|
157 | + } |
|
158 | + } |
|
159 | + return $question_where_params; |
|
160 | + } |
|
161 | 161 | |
162 | 162 | |
163 | 163 | |
164 | - /** |
|
165 | - * Performs another step of the job |
|
166 | - * |
|
167 | - * @param JobParameters $job_parameters |
|
168 | - * @param int $batch_size |
|
169 | - * @return JobStepResponse |
|
170 | - * @throws \EE_Error |
|
171 | - */ |
|
172 | - public function continue_job(JobParameters $job_parameters, $batch_size = 50) |
|
173 | - { |
|
174 | - if( $job_parameters->units_processed() < $job_parameters->job_size() ) { |
|
175 | - $csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'), |
|
176 | - $job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'), |
|
177 | - $job_parameters->extra_datum('query_params')); |
|
178 | - \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
179 | - $units_processed = count($csv_data); |
|
180 | - }else{ |
|
181 | - $units_processed = 0; |
|
182 | - } |
|
183 | - $job_parameters->mark_processed($units_processed); |
|
184 | - $extra_response_data = array( |
|
185 | - 'file_url' => '', |
|
186 | - ); |
|
187 | - if ($units_processed < $batch_size) { |
|
188 | - $job_parameters->set_status(JobParameters::status_complete); |
|
189 | - $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
190 | - } |
|
164 | + /** |
|
165 | + * Performs another step of the job |
|
166 | + * |
|
167 | + * @param JobParameters $job_parameters |
|
168 | + * @param int $batch_size |
|
169 | + * @return JobStepResponse |
|
170 | + * @throws \EE_Error |
|
171 | + */ |
|
172 | + public function continue_job(JobParameters $job_parameters, $batch_size = 50) |
|
173 | + { |
|
174 | + if( $job_parameters->units_processed() < $job_parameters->job_size() ) { |
|
175 | + $csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'), |
|
176 | + $job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'), |
|
177 | + $job_parameters->extra_datum('query_params')); |
|
178 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
179 | + $units_processed = count($csv_data); |
|
180 | + }else{ |
|
181 | + $units_processed = 0; |
|
182 | + } |
|
183 | + $job_parameters->mark_processed($units_processed); |
|
184 | + $extra_response_data = array( |
|
185 | + 'file_url' => '', |
|
186 | + ); |
|
187 | + if ($units_processed < $batch_size) { |
|
188 | + $job_parameters->set_status(JobParameters::status_complete); |
|
189 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
190 | + } |
|
191 | 191 | |
192 | - return new JobStepResponse($job_parameters, |
|
193 | - sprintf(__('Wrote %1$s rows to report CSV file...', 'event_espresso'), count($csv_data)), |
|
194 | - $extra_response_data); |
|
195 | - } |
|
192 | + return new JobStepResponse($job_parameters, |
|
193 | + sprintf(__('Wrote %1$s rows to report CSV file...', 'event_espresso'), count($csv_data)), |
|
194 | + $extra_response_data); |
|
195 | + } |
|
196 | 196 | |
197 | 197 | |
198 | 198 | |
199 | - /** |
|
200 | - * Gets the csv data for a batch of registrations |
|
201 | - |
|
202 | - * |
|
199 | + /** |
|
200 | + * Gets the csv data for a batch of registrations |
|
201 | + * |
|
203 | 202 | *@param int|null $event_id |
204 | - * @param int $offset |
|
205 | - * @param int $limit |
|
206 | - * @param array $question_labels the IDs for all the questions which were answered by someone in this selection |
|
207 | - * @param array $query_params for using where querying the model |
|
208 | - * @return array top-level keys are numeric, next-level keys are column headers |
|
209 | - */ |
|
210 | - function get_csv_data_for($event_id, $offset, $limit, $question_labels, $query_params) |
|
211 | - { |
|
212 | - $reg_fields_to_include = array( |
|
213 | - 'TXN_ID', |
|
214 | - 'ATT_ID', |
|
215 | - 'REG_ID', |
|
216 | - 'REG_date', |
|
217 | - 'REG_code', |
|
218 | - 'REG_count', |
|
219 | - 'REG_final_price', |
|
220 | - ); |
|
221 | - $att_fields_to_include = array( |
|
222 | - 'ATT_fname', |
|
223 | - 'ATT_lname', |
|
224 | - 'ATT_email', |
|
225 | - 'ATT_address', |
|
226 | - 'ATT_address2', |
|
227 | - 'ATT_city', |
|
228 | - 'STA_ID', |
|
229 | - 'CNT_ISO', |
|
230 | - 'ATT_zip', |
|
231 | - 'ATT_phone', |
|
232 | - ); |
|
233 | - $registrations_csv_ready_array = array(); |
|
234 | - $reg_model = \EE_Registry::instance()->load_model('Registration'); |
|
235 | - $query_params['limit'] = array($offset, $limit); |
|
236 | - $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
237 | - $registration_ids = array(); |
|
238 | - foreach ($registration_rows as $reg_row) { |
|
239 | - $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
240 | - } |
|
241 | - foreach ($registration_rows as $reg_row) { |
|
242 | - if (is_array($reg_row)) { |
|
243 | - $reg_csv_array = array(); |
|
244 | - if ( ! $event_id) { |
|
245 | - //get the event's name and Id |
|
246 | - $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), |
|
247 | - \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', |
|
248 | - $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']); |
|
249 | - } |
|
250 | - $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
251 | - /*@var $reg_row EE_Registration */ |
|
252 | - foreach ($reg_fields_to_include as $field_name) { |
|
253 | - $field = $reg_model->field_settings_for($field_name); |
|
254 | - if ($field_name == 'REG_final_price') { |
|
255 | - $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
256 | - $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
257 | - } elseif ($field_name == 'REG_count') { |
|
258 | - $value = sprintf(__('%s of %s', 'event_espresso'), |
|
259 | - \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', |
|
260 | - $reg_row['Registration.REG_count']), |
|
261 | - \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', |
|
262 | - $reg_row['Registration.REG_group_size'])); |
|
263 | - } elseif ($field_name == 'REG_date') { |
|
264 | - $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
265 | - $reg_row['Registration.REG_date'], 'no_html'); |
|
266 | - } else { |
|
267 | - $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
268 | - $reg_row[$field->get_qualified_column()]); |
|
269 | - } |
|
270 | - $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
|
271 | - if ($field_name == 'REG_final_price') { |
|
272 | - //add a column named Currency after the final price |
|
273 | - $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code; |
|
274 | - } |
|
275 | - } |
|
276 | - //get pretty status |
|
277 | - $stati = \EEM_Status::instance()->localized_status(array( |
|
278 | - $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
279 | - $reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso'), |
|
280 | - ), false, 'sentence'); |
|
281 | - $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
282 | - //get pretty transaction status |
|
283 | - $reg_csv_array[__("Transaction Status", |
|
284 | - 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']]; |
|
285 | - $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg |
|
286 | - ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', |
|
287 | - $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00'; |
|
288 | - $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg |
|
289 | - ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', |
|
290 | - $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00'; |
|
291 | - $payment_methods = array(); |
|
292 | - $gateway_txn_ids_etc = array(); |
|
293 | - $payment_times = array(); |
|
294 | - if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) { |
|
295 | - $payments_info = \EEM_Payment::instance()->get_all_wpdb_results(array( |
|
296 | - array( |
|
297 | - 'TXN_ID' => $reg_row['TransactionTable.TXN_ID'], |
|
298 | - 'STS_ID' => \EEM_Payment::status_id_approved, |
|
299 | - ), |
|
300 | - 'force_join' => array('Payment_Method'), |
|
301 | - ), ARRAY_A, |
|
302 | - 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time'); |
|
303 | - foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
304 | - $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) |
|
305 | - ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
306 | - $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) |
|
307 | - ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
308 | - $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) |
|
309 | - ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
310 | - } |
|
311 | - } |
|
312 | - $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
313 | - $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
314 | - $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
315 | - //get whether or not the user has checked in |
|
316 | - $reg_csv_array[__("Check-Ins", |
|
317 | - "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
318 | - //get ticket of registration and its price |
|
319 | - $ticket_model = \EE_Registry::instance()->load_model('Ticket'); |
|
320 | - if ($reg_row['Ticket.TKT_ID']) { |
|
321 | - $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', |
|
322 | - $reg_row['Ticket.TKT_name']); |
|
323 | - $datetimes_strings = array(); |
|
324 | - foreach ( |
|
325 | - \EEM_Datetime::instance()->get_all_wpdb_results(array( |
|
326 | - array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), |
|
327 | - 'order_by' => array('DTT_EVT_start' => 'ASC'), |
|
328 | - 'default_where_conditions' => 'none', |
|
329 | - )) as $datetime |
|
330 | - ) { |
|
331 | - $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), |
|
332 | - 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
333 | - } |
|
334 | - } else { |
|
335 | - $ticket_name = __('Unknown', 'event_espresso'); |
|
336 | - $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
337 | - } |
|
338 | - $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
|
339 | - $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
|
340 | - //get datetime(s) of registration |
|
341 | - //add attendee columns |
|
342 | - foreach ($att_fields_to_include as $att_field_name) { |
|
343 | - $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name); |
|
344 | - if ($reg_row['Attendee_CPT.ID']) { |
|
345 | - if ($att_field_name == 'STA_ID') { |
|
346 | - $value = \EEM_State::instance() |
|
347 | - ->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), |
|
348 | - 'STA_name'); |
|
349 | - } elseif ($att_field_name == 'CNT_ISO') { |
|
350 | - $value = \EEM_Country::instance() |
|
351 | - ->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), |
|
352 | - 'CNT_name'); |
|
353 | - } else { |
|
354 | - $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), |
|
355 | - $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
356 | - } |
|
357 | - } else { |
|
358 | - $value = ''; |
|
359 | - } |
|
360 | - $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value; |
|
361 | - } |
|
362 | - //make sure each registration has the same questions in the same order |
|
363 | - foreach ($question_labels as $question_label) { |
|
364 | - if ( ! isset($reg_csv_array[$question_label])) { |
|
365 | - $reg_csv_array[$question_label] = null; |
|
366 | - } |
|
367 | - } |
|
368 | - $answers = \EEM_Answer::instance()->get_all_wpdb_results(array( |
|
369 | - array('REG_ID' => $reg_row['Registration.REG_ID']), |
|
370 | - 'force_join' => array('Question'), |
|
371 | - )); |
|
372 | - //now fill out the questions THEY answered |
|
373 | - foreach ($answers as $answer_row) { |
|
374 | - if ($answer_row['Question.QST_ID']) { |
|
375 | - $question_label = \EEH_Export::prepare_value_from_db_for_display(\EEM_Question::instance(), |
|
376 | - 'QST_admin_label', $answer_row['Question.QST_admin_label']); |
|
377 | - } else { |
|
378 | - $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
379 | - } |
|
380 | - if (isset($answer_row['Question.QST_type']) |
|
381 | - && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state |
|
382 | - ) { |
|
383 | - $reg_csv_array[$question_label] = \EEM_State::instance() |
|
384 | - ->get_state_name_by_ID($answer_row['Answer.ANS_value']); |
|
385 | - } else { |
|
386 | - //this isn't for html, so don't show html entities |
|
387 | - $reg_csv_array[$question_label] = html_entity_decode(\EEH_Export::prepare_value_from_db_for_display(\EEM_Answer::instance(), |
|
388 | - 'ANS_value', $answer_row['Answer.ANS_value'])); |
|
389 | - } |
|
390 | - } |
|
391 | - /** |
|
392 | - * Filter to change the contents of each row of the registrations report CSV file. |
|
393 | - * |
|
394 | - * This can be used to add or remote columns from the CSV file, or change their values. * |
|
395 | - * Note: it has this name because originally that's where this filter resided, |
|
396 | - * and we've left its name as-is for backward compatibility. |
|
397 | - * Note when using: all rows in the CSV should have the same columns. |
|
398 | - * |
|
399 | - * @param array $reg_csv_array keys are column-header names, and values are that columns' value |
|
400 | - * in this row |
|
401 | - * @param array $reg_row is the row from the database's wp_esp_registration table |
|
402 | - * |
|
403 | - */ |
|
404 | - $registrations_csv_ready_array[] = apply_filters( |
|
405 | - 'FHEE__EE_Export__report_registrations__reg_csv_array', |
|
406 | - $reg_csv_array, |
|
407 | - $reg_row |
|
408 | - ); |
|
409 | - } |
|
410 | - } |
|
411 | - //if we couldn't export anything, we want to at least show the column headers |
|
412 | - if (empty($registrations_csv_ready_array)) { |
|
413 | - $reg_csv_array = array(); |
|
414 | - $model_and_fields_to_include = array( |
|
415 | - 'Registration' => $reg_fields_to_include, |
|
416 | - 'Attendee' => $att_fields_to_include, |
|
417 | - ); |
|
418 | - foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
419 | - $model = \EE_Registry::instance()->load_model($model_name); |
|
420 | - foreach ($field_list as $field_name) { |
|
421 | - $field = $model->field_settings_for($field_name); |
|
422 | - $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null; |
|
423 | - } |
|
424 | - } |
|
425 | - $registrations_csv_ready_array[] = $reg_csv_array; |
|
426 | - } |
|
427 | - return $registrations_csv_ready_array; |
|
428 | - } |
|
203 | + * @param int $offset |
|
204 | + * @param int $limit |
|
205 | + * @param array $question_labels the IDs for all the questions which were answered by someone in this selection |
|
206 | + * @param array $query_params for using where querying the model |
|
207 | + * @return array top-level keys are numeric, next-level keys are column headers |
|
208 | + */ |
|
209 | + function get_csv_data_for($event_id, $offset, $limit, $question_labels, $query_params) |
|
210 | + { |
|
211 | + $reg_fields_to_include = array( |
|
212 | + 'TXN_ID', |
|
213 | + 'ATT_ID', |
|
214 | + 'REG_ID', |
|
215 | + 'REG_date', |
|
216 | + 'REG_code', |
|
217 | + 'REG_count', |
|
218 | + 'REG_final_price', |
|
219 | + ); |
|
220 | + $att_fields_to_include = array( |
|
221 | + 'ATT_fname', |
|
222 | + 'ATT_lname', |
|
223 | + 'ATT_email', |
|
224 | + 'ATT_address', |
|
225 | + 'ATT_address2', |
|
226 | + 'ATT_city', |
|
227 | + 'STA_ID', |
|
228 | + 'CNT_ISO', |
|
229 | + 'ATT_zip', |
|
230 | + 'ATT_phone', |
|
231 | + ); |
|
232 | + $registrations_csv_ready_array = array(); |
|
233 | + $reg_model = \EE_Registry::instance()->load_model('Registration'); |
|
234 | + $query_params['limit'] = array($offset, $limit); |
|
235 | + $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
236 | + $registration_ids = array(); |
|
237 | + foreach ($registration_rows as $reg_row) { |
|
238 | + $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
239 | + } |
|
240 | + foreach ($registration_rows as $reg_row) { |
|
241 | + if (is_array($reg_row)) { |
|
242 | + $reg_csv_array = array(); |
|
243 | + if ( ! $event_id) { |
|
244 | + //get the event's name and Id |
|
245 | + $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), |
|
246 | + \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', |
|
247 | + $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']); |
|
248 | + } |
|
249 | + $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
250 | + /*@var $reg_row EE_Registration */ |
|
251 | + foreach ($reg_fields_to_include as $field_name) { |
|
252 | + $field = $reg_model->field_settings_for($field_name); |
|
253 | + if ($field_name == 'REG_final_price') { |
|
254 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
255 | + $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
256 | + } elseif ($field_name == 'REG_count') { |
|
257 | + $value = sprintf(__('%s of %s', 'event_espresso'), |
|
258 | + \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', |
|
259 | + $reg_row['Registration.REG_count']), |
|
260 | + \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', |
|
261 | + $reg_row['Registration.REG_group_size'])); |
|
262 | + } elseif ($field_name == 'REG_date') { |
|
263 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
264 | + $reg_row['Registration.REG_date'], 'no_html'); |
|
265 | + } else { |
|
266 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, |
|
267 | + $reg_row[$field->get_qualified_column()]); |
|
268 | + } |
|
269 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
|
270 | + if ($field_name == 'REG_final_price') { |
|
271 | + //add a column named Currency after the final price |
|
272 | + $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code; |
|
273 | + } |
|
274 | + } |
|
275 | + //get pretty status |
|
276 | + $stati = \EEM_Status::instance()->localized_status(array( |
|
277 | + $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
278 | + $reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso'), |
|
279 | + ), false, 'sentence'); |
|
280 | + $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
281 | + //get pretty transaction status |
|
282 | + $reg_csv_array[__("Transaction Status", |
|
283 | + 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']]; |
|
284 | + $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg |
|
285 | + ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', |
|
286 | + $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00'; |
|
287 | + $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg |
|
288 | + ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', |
|
289 | + $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00'; |
|
290 | + $payment_methods = array(); |
|
291 | + $gateway_txn_ids_etc = array(); |
|
292 | + $payment_times = array(); |
|
293 | + if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) { |
|
294 | + $payments_info = \EEM_Payment::instance()->get_all_wpdb_results(array( |
|
295 | + array( |
|
296 | + 'TXN_ID' => $reg_row['TransactionTable.TXN_ID'], |
|
297 | + 'STS_ID' => \EEM_Payment::status_id_approved, |
|
298 | + ), |
|
299 | + 'force_join' => array('Payment_Method'), |
|
300 | + ), ARRAY_A, |
|
301 | + 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time'); |
|
302 | + foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
303 | + $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) |
|
304 | + ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
305 | + $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) |
|
306 | + ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
307 | + $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) |
|
308 | + ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
309 | + } |
|
310 | + } |
|
311 | + $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
312 | + $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
313 | + $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
314 | + //get whether or not the user has checked in |
|
315 | + $reg_csv_array[__("Check-Ins", |
|
316 | + "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
317 | + //get ticket of registration and its price |
|
318 | + $ticket_model = \EE_Registry::instance()->load_model('Ticket'); |
|
319 | + if ($reg_row['Ticket.TKT_ID']) { |
|
320 | + $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', |
|
321 | + $reg_row['Ticket.TKT_name']); |
|
322 | + $datetimes_strings = array(); |
|
323 | + foreach ( |
|
324 | + \EEM_Datetime::instance()->get_all_wpdb_results(array( |
|
325 | + array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), |
|
326 | + 'order_by' => array('DTT_EVT_start' => 'ASC'), |
|
327 | + 'default_where_conditions' => 'none', |
|
328 | + )) as $datetime |
|
329 | + ) { |
|
330 | + $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), |
|
331 | + 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
332 | + } |
|
333 | + } else { |
|
334 | + $ticket_name = __('Unknown', 'event_espresso'); |
|
335 | + $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
336 | + } |
|
337 | + $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
|
338 | + $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
|
339 | + //get datetime(s) of registration |
|
340 | + //add attendee columns |
|
341 | + foreach ($att_fields_to_include as $att_field_name) { |
|
342 | + $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name); |
|
343 | + if ($reg_row['Attendee_CPT.ID']) { |
|
344 | + if ($att_field_name == 'STA_ID') { |
|
345 | + $value = \EEM_State::instance() |
|
346 | + ->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), |
|
347 | + 'STA_name'); |
|
348 | + } elseif ($att_field_name == 'CNT_ISO') { |
|
349 | + $value = \EEM_Country::instance() |
|
350 | + ->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), |
|
351 | + 'CNT_name'); |
|
352 | + } else { |
|
353 | + $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), |
|
354 | + $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
355 | + } |
|
356 | + } else { |
|
357 | + $value = ''; |
|
358 | + } |
|
359 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value; |
|
360 | + } |
|
361 | + //make sure each registration has the same questions in the same order |
|
362 | + foreach ($question_labels as $question_label) { |
|
363 | + if ( ! isset($reg_csv_array[$question_label])) { |
|
364 | + $reg_csv_array[$question_label] = null; |
|
365 | + } |
|
366 | + } |
|
367 | + $answers = \EEM_Answer::instance()->get_all_wpdb_results(array( |
|
368 | + array('REG_ID' => $reg_row['Registration.REG_ID']), |
|
369 | + 'force_join' => array('Question'), |
|
370 | + )); |
|
371 | + //now fill out the questions THEY answered |
|
372 | + foreach ($answers as $answer_row) { |
|
373 | + if ($answer_row['Question.QST_ID']) { |
|
374 | + $question_label = \EEH_Export::prepare_value_from_db_for_display(\EEM_Question::instance(), |
|
375 | + 'QST_admin_label', $answer_row['Question.QST_admin_label']); |
|
376 | + } else { |
|
377 | + $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
378 | + } |
|
379 | + if (isset($answer_row['Question.QST_type']) |
|
380 | + && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state |
|
381 | + ) { |
|
382 | + $reg_csv_array[$question_label] = \EEM_State::instance() |
|
383 | + ->get_state_name_by_ID($answer_row['Answer.ANS_value']); |
|
384 | + } else { |
|
385 | + //this isn't for html, so don't show html entities |
|
386 | + $reg_csv_array[$question_label] = html_entity_decode(\EEH_Export::prepare_value_from_db_for_display(\EEM_Answer::instance(), |
|
387 | + 'ANS_value', $answer_row['Answer.ANS_value'])); |
|
388 | + } |
|
389 | + } |
|
390 | + /** |
|
391 | + * Filter to change the contents of each row of the registrations report CSV file. |
|
392 | + * |
|
393 | + * This can be used to add or remote columns from the CSV file, or change their values. * |
|
394 | + * Note: it has this name because originally that's where this filter resided, |
|
395 | + * and we've left its name as-is for backward compatibility. |
|
396 | + * Note when using: all rows in the CSV should have the same columns. |
|
397 | + * |
|
398 | + * @param array $reg_csv_array keys are column-header names, and values are that columns' value |
|
399 | + * in this row |
|
400 | + * @param array $reg_row is the row from the database's wp_esp_registration table |
|
401 | + * |
|
402 | + */ |
|
403 | + $registrations_csv_ready_array[] = apply_filters( |
|
404 | + 'FHEE__EE_Export__report_registrations__reg_csv_array', |
|
405 | + $reg_csv_array, |
|
406 | + $reg_row |
|
407 | + ); |
|
408 | + } |
|
409 | + } |
|
410 | + //if we couldn't export anything, we want to at least show the column headers |
|
411 | + if (empty($registrations_csv_ready_array)) { |
|
412 | + $reg_csv_array = array(); |
|
413 | + $model_and_fields_to_include = array( |
|
414 | + 'Registration' => $reg_fields_to_include, |
|
415 | + 'Attendee' => $att_fields_to_include, |
|
416 | + ); |
|
417 | + foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
418 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
419 | + foreach ($field_list as $field_name) { |
|
420 | + $field = $model->field_settings_for($field_name); |
|
421 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null; |
|
422 | + } |
|
423 | + } |
|
424 | + $registrations_csv_ready_array[] = $reg_csv_array; |
|
425 | + } |
|
426 | + return $registrations_csv_ready_array; |
|
427 | + } |
|
429 | 428 | |
430 | 429 | |
431 | 430 | |
432 | - /** |
|
433 | - * Counts total unit to process |
|
434 | - * |
|
435 | - * @deprecated since 4.9.19 |
|
436 | - * @param int|array $event_id |
|
437 | - * @return int |
|
438 | - */ |
|
439 | - public function count_units_to_process($event_id) |
|
440 | - { |
|
441 | - //use the legacy filter |
|
442 | - if ($event_id) { |
|
443 | - $query_params[0]['EVT_ID'] = $event_id; |
|
444 | - } else { |
|
445 | - $query_params['force_join'][] = 'Event'; |
|
446 | - } |
|
447 | - return \EEM_Registration::instance()->count($query_params); |
|
448 | - } |
|
431 | + /** |
|
432 | + * Counts total unit to process |
|
433 | + * |
|
434 | + * @deprecated since 4.9.19 |
|
435 | + * @param int|array $event_id |
|
436 | + * @return int |
|
437 | + */ |
|
438 | + public function count_units_to_process($event_id) |
|
439 | + { |
|
440 | + //use the legacy filter |
|
441 | + if ($event_id) { |
|
442 | + $query_params[0]['EVT_ID'] = $event_id; |
|
443 | + } else { |
|
444 | + $query_params['force_join'][] = 'Event'; |
|
445 | + } |
|
446 | + return \EEM_Registration::instance()->count($query_params); |
|
447 | + } |
|
449 | 448 | |
450 | 449 | |
451 | 450 | |
452 | - /** |
|
453 | - * Performs any clean-up logic when we know the job is completed. |
|
454 | - * In this case, we delete the temporary file |
|
455 | - * |
|
456 | - * @param JobParameters $job_parameters |
|
457 | - * @return boolean |
|
458 | - */ |
|
459 | - public function cleanup_job(JobParameters $job_parameters) |
|
460 | - { |
|
461 | - $this->_file_helper->delete(\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
462 | - true, 'd'); |
|
463 | - return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
464 | - } |
|
451 | + /** |
|
452 | + * Performs any clean-up logic when we know the job is completed. |
|
453 | + * In this case, we delete the temporary file |
|
454 | + * |
|
455 | + * @param JobParameters $job_parameters |
|
456 | + * @return boolean |
|
457 | + */ |
|
458 | + public function cleanup_job(JobParameters $job_parameters) |
|
459 | + { |
|
460 | + $this->_file_helper->delete(\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
461 | + true, 'd'); |
|
462 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
463 | + } |
|
465 | 464 | } |
466 | 465 | |
467 | 466 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
3 | - exit('NO direct script access allowed'); |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -21,62 +21,62 @@ discard block |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | |
24 | - public function __construct($routing = true) |
|
25 | - { |
|
26 | - parent::__construct($routing); |
|
27 | - define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/'); |
|
28 | - } |
|
24 | + public function __construct($routing = true) |
|
25 | + { |
|
26 | + parent::__construct($routing); |
|
27 | + define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/'); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | - protected function _extend_page_config() |
|
32 | - { |
|
31 | + protected function _extend_page_config() |
|
32 | + { |
|
33 | 33 | |
34 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
34 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
35 | 35 | |
36 | - //filters and action hooks here |
|
37 | - add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
38 | - add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
39 | - array($this, 'update_debug_logging_options'), 10, 1); |
|
36 | + //filters and action hooks here |
|
37 | + add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
38 | + add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
39 | + array($this, 'update_debug_logging_options'), 10, 1); |
|
40 | 40 | |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - /************* Logging Settings *************/ |
|
45 | + /************* Logging Settings *************/ |
|
46 | 46 | |
47 | - /** |
|
48 | - * debug_logging_options |
|
49 | - * |
|
50 | - * @param array $template_args |
|
51 | - * |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - public function debug_logging_options($template_args = array()) |
|
55 | - { |
|
56 | - $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
|
57 | - $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false; |
|
58 | - $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
|
59 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
60 | - EEH_Template::display_template($template, $template_args); |
|
61 | - } |
|
47 | + /** |
|
48 | + * debug_logging_options |
|
49 | + * |
|
50 | + * @param array $template_args |
|
51 | + * |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + public function debug_logging_options($template_args = array()) |
|
55 | + { |
|
56 | + $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
|
57 | + $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false; |
|
58 | + $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
|
59 | + $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
60 | + EEH_Template::display_template($template, $template_args); |
|
61 | + } |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * update_debug_logging_options |
|
66 | - * |
|
67 | - * @param array $admin_options |
|
68 | - * |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - public function update_debug_logging_options($admin_options = array()) |
|
72 | - { |
|
73 | - $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
74 | - $admin_options->use_full_logging = $use_full_logging; |
|
75 | - $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
|
76 | - $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; |
|
64 | + /** |
|
65 | + * update_debug_logging_options |
|
66 | + * |
|
67 | + * @param array $admin_options |
|
68 | + * |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + public function update_debug_logging_options($admin_options = array()) |
|
72 | + { |
|
73 | + $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
74 | + $admin_options->use_full_logging = $use_full_logging; |
|
75 | + $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
|
76 | + $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; |
|
77 | 77 | |
78 | - return $admin_options; |
|
79 | - } |
|
78 | + return $admin_options; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | |
82 | 82 | } |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | public function __construct($routing = true) |
25 | 25 | { |
26 | 26 | parent::__construct($routing); |
27 | - define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/'); |
|
27 | + define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function _extend_page_config() |
32 | 32 | { |
33 | 33 | |
34 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
34 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings'; |
|
35 | 35 | |
36 | 36 | //filters and action hooks here |
37 | 37 | add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
57 | 57 | $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false; |
58 | 58 | $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
59 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
59 | + $template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php'; |
|
60 | 60 | EEH_Template::display_template($template, $template_args); |
61 | 61 | } |
62 | 62 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function update_debug_logging_options($admin_options = array()) |
72 | 72 | { |
73 | - $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
73 | + $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
74 | 74 | $admin_options->use_full_logging = $use_full_logging; |
75 | 75 | $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
76 | 76 | $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
4 | 4 | use EventEspresso\core\services\loaders\LoaderInterface; |
5 | 5 | |
6 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | 7 | exit('No direct script access allowed'); |
8 | 8 | } |
9 | 9 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public static function instance(EE_Request $request = null, EE_Response $response = null) |
117 | 117 | { |
118 | 118 | // check if class object is instantiated, and instantiated properly |
119 | - if (! self::$_instance instanceof EE_Dependency_Map) { |
|
119 | + if ( ! self::$_instance instanceof EE_Dependency_Map) { |
|
120 | 120 | self::$_instance = new EE_Dependency_Map($request, $response); |
121 | 121 | } |
122 | 122 | return self::$_instance; |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public static function register_dependencies($class, $dependencies) |
143 | 143 | { |
144 | - if (! isset(self::$_instance->_dependency_map[$class])) { |
|
144 | + if ( ! isset(self::$_instance->_dependency_map[$class])) { |
|
145 | 145 | // we need to make sure that any aliases used when registering a dependency |
146 | 146 | // get resolved to the correct class name |
147 | - foreach ((array)$dependencies as $dependency => $load_source) { |
|
147 | + foreach ((array) $dependencies as $dependency => $load_source) { |
|
148 | 148 | $alias = self::$_instance->get_alias($dependency); |
149 | 149 | unset($dependencies[$dependency]); |
150 | 150 | $dependencies[$alias] = $load_source; |
151 | 151 | } |
152 | - self::$_instance->_dependency_map[$class] = (array)$dependencies; |
|
152 | + self::$_instance->_dependency_map[$class] = (array) $dependencies; |
|
153 | 153 | return true; |
154 | 154 | } |
155 | 155 | return false; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | ); |
182 | 182 | } |
183 | 183 | $class_name = self::$_instance->get_alias($class_name); |
184 | - if (! isset(self::$_instance->_class_loaders[$class_name])) { |
|
184 | + if ( ! isset(self::$_instance->_class_loaders[$class_name])) { |
|
185 | 185 | self::$_instance->_class_loaders[$class_name] = $loader; |
186 | 186 | return true; |
187 | 187 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | public function add_alias($class_name, $alias, $for_class = '') |
280 | 280 | { |
281 | 281 | if ($for_class !== '') { |
282 | - if (! isset($this->_aliases[$for_class])) { |
|
282 | + if ( ! isset($this->_aliases[$for_class])) { |
|
283 | 283 | $this->_aliases[$for_class] = array(); |
284 | 284 | } |
285 | 285 | $this->_aliases[$for_class][$class_name] = $alias; |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function get_alias($class_name = '', $for_class = '') |
326 | 326 | { |
327 | - if (! $this->has_alias($class_name, $for_class)) { |
|
327 | + if ( ! $this->has_alias($class_name, $for_class)) { |
|
328 | 328 | return $class_name; |
329 | 329 | } |
330 | 330 | if ($for_class !== '') { |
@@ -526,10 +526,10 @@ discard block |
||
526 | 526 | 'EE_Front_Controller' => 'load_core', |
527 | 527 | 'EE_Module_Request_Router' => 'load_core', |
528 | 528 | 'EE_Registry' => 'load_core', |
529 | - 'EE_Request' => function () use (&$request) { |
|
529 | + 'EE_Request' => function() use (&$request) { |
|
530 | 530 | return $request; |
531 | 531 | }, |
532 | - 'EE_Response' => function () use (&$response) { |
|
532 | + 'EE_Response' => function() use (&$response) { |
|
533 | 533 | return $response; |
534 | 534 | }, |
535 | 535 | 'EE_Request_Handler' => 'load_core', |
@@ -546,10 +546,10 @@ discard block |
||
546 | 546 | 'EE_Messages_Queue' => 'load_lib', |
547 | 547 | 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
548 | 548 | 'EE_Message_Template_Group_Collection' => 'load_lib', |
549 | - 'EE_Messages_Generator' => function () { |
|
549 | + 'EE_Messages_Generator' => function() { |
|
550 | 550 | return EE_Registry::instance()->load_lib('Messages_Generator', array(), false, false); |
551 | 551 | }, |
552 | - 'EE_Messages_Template_Defaults' => function ($arguments = array()) { |
|
552 | + 'EE_Messages_Template_Defaults' => function($arguments = array()) { |
|
553 | 553 | return EE_Registry::instance()->load_lib('Messages_Template_Defaults', $arguments, false, false); |
554 | 554 | }, |
555 | 555 | //load_model |
@@ -557,13 +557,13 @@ discard block |
||
557 | 557 | 'EEM_Message_Template_Group' => 'load_model', |
558 | 558 | 'EEM_Message_Template' => 'load_model', |
559 | 559 | //load_helper |
560 | - 'EEH_Parse_Shortcodes' => function () { |
|
560 | + 'EEH_Parse_Shortcodes' => function() { |
|
561 | 561 | if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
562 | 562 | return new EEH_Parse_Shortcodes(); |
563 | 563 | } |
564 | 564 | return null; |
565 | 565 | }, |
566 | - 'EventEspresso\core\services\loaders\Loader' => function () use (&$loader) { |
|
566 | + 'EventEspresso\core\services\loaders\Loader' => function() use (&$loader) { |
|
567 | 567 | return $loader; |
568 | 568 | }, |
569 | 569 | ); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use EventEspresso\core\services\loaders\LoaderInterface; |
5 | 5 | |
6 | 6 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
7 | - exit('No direct script access allowed'); |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -22,629 +22,629 @@ discard block |
||
22 | 22 | { |
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * This means that the requested class dependency is not present in the dependency map |
|
27 | - */ |
|
28 | - const not_registered = 0; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
33 | - */ |
|
34 | - const load_new_object = 1; |
|
35 | - |
|
36 | - /** |
|
37 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
38 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
39 | - */ |
|
40 | - const load_from_cache = 2; |
|
41 | - |
|
42 | - /** |
|
43 | - * @type EE_Dependency_Map $_instance |
|
44 | - */ |
|
45 | - protected static $_instance; |
|
46 | - |
|
47 | - /** |
|
48 | - * @type EE_Request $request |
|
49 | - */ |
|
50 | - protected $_request; |
|
51 | - |
|
52 | - /** |
|
53 | - * @type EE_Response $response |
|
54 | - */ |
|
55 | - protected $_response; |
|
56 | - |
|
57 | - /** |
|
58 | - * @type LoaderInterface $loader |
|
59 | - */ |
|
60 | - protected $loader; |
|
61 | - |
|
62 | - /** |
|
63 | - * @type array $_dependency_map |
|
64 | - */ |
|
65 | - protected $_dependency_map = array(); |
|
66 | - |
|
67 | - /** |
|
68 | - * @type array $_class_loaders |
|
69 | - */ |
|
70 | - protected $_class_loaders = array(); |
|
71 | - |
|
72 | - /** |
|
73 | - * @type array $_aliases |
|
74 | - */ |
|
75 | - protected $_aliases = array(); |
|
76 | - |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * EE_Dependency_Map constructor. |
|
81 | - * |
|
82 | - * @param EE_Request $request |
|
83 | - * @param EE_Response $response |
|
84 | - */ |
|
85 | - protected function __construct(EE_Request $request, EE_Response $response) |
|
86 | - { |
|
87 | - $this->_request = $request; |
|
88 | - $this->_response = $response; |
|
89 | - add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
90 | - do_action('EE_Dependency_Map____construct'); |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - |
|
95 | - /** |
|
96 | - * @throws InvalidDataTypeException |
|
97 | - * @throws InvalidInterfaceException |
|
98 | - * @throws InvalidArgumentException |
|
99 | - */ |
|
100 | - public function initialize() |
|
101 | - { |
|
102 | - $this->_register_core_dependencies(); |
|
103 | - $this->_register_core_class_loaders(); |
|
104 | - $this->_register_core_aliases(); |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @singleton method used to instantiate class object |
|
111 | - * @access public |
|
112 | - * @param EE_Request $request |
|
113 | - * @param EE_Response $response |
|
114 | - * @return EE_Dependency_Map |
|
115 | - */ |
|
116 | - public static function instance(EE_Request $request = null, EE_Response $response = null) |
|
117 | - { |
|
118 | - // check if class object is instantiated, and instantiated properly |
|
119 | - if (! self::$_instance instanceof EE_Dependency_Map) { |
|
120 | - self::$_instance = new EE_Dependency_Map($request, $response); |
|
121 | - } |
|
122 | - return self::$_instance; |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - |
|
127 | - /** |
|
128 | - * @param LoaderInterface $loader |
|
129 | - */ |
|
130 | - public function setLoader(LoaderInterface $loader) |
|
131 | - { |
|
132 | - $this->loader = $loader; |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * @param string $class |
|
139 | - * @param array $dependencies |
|
140 | - * @return boolean |
|
141 | - */ |
|
142 | - public static function register_dependencies($class, $dependencies) |
|
143 | - { |
|
144 | - if (! isset(self::$_instance->_dependency_map[$class])) { |
|
145 | - // we need to make sure that any aliases used when registering a dependency |
|
146 | - // get resolved to the correct class name |
|
147 | - foreach ((array)$dependencies as $dependency => $load_source) { |
|
148 | - $alias = self::$_instance->get_alias($dependency); |
|
149 | - unset($dependencies[$dependency]); |
|
150 | - $dependencies[$alias] = $load_source; |
|
151 | - } |
|
152 | - self::$_instance->_dependency_map[$class] = (array)$dependencies; |
|
153 | - return true; |
|
154 | - } |
|
155 | - return false; |
|
156 | - } |
|
157 | - |
|
158 | - |
|
159 | - |
|
160 | - /** |
|
161 | - * @param string $class_name |
|
162 | - * @param string $loader |
|
163 | - * @return bool |
|
164 | - * @throws EE_Error |
|
165 | - */ |
|
166 | - public static function register_class_loader($class_name, $loader = 'load_core') |
|
167 | - { |
|
168 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
169 | - if ( |
|
170 | - ! is_callable($loader) |
|
171 | - && ( |
|
172 | - strpos($loader, 'load_') !== 0 |
|
173 | - || ! method_exists('EE_Registry', $loader) |
|
174 | - ) |
|
175 | - ) { |
|
176 | - throw new EE_Error( |
|
177 | - sprintf( |
|
178 | - esc_html__('"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso'), |
|
179 | - $loader |
|
180 | - ) |
|
181 | - ); |
|
182 | - } |
|
183 | - $class_name = self::$_instance->get_alias($class_name); |
|
184 | - if (! isset(self::$_instance->_class_loaders[$class_name])) { |
|
185 | - self::$_instance->_class_loaders[$class_name] = $loader; |
|
186 | - return true; |
|
187 | - } |
|
188 | - return false; |
|
189 | - } |
|
190 | - |
|
191 | - |
|
192 | - |
|
193 | - /** |
|
194 | - * @return array |
|
195 | - */ |
|
196 | - public function dependency_map() |
|
197 | - { |
|
198 | - return $this->_dependency_map; |
|
199 | - } |
|
200 | - |
|
201 | - |
|
202 | - |
|
203 | - /** |
|
204 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
205 | - * |
|
206 | - * @param string $class_name |
|
207 | - * @return boolean |
|
208 | - */ |
|
209 | - public function has($class_name = '') |
|
210 | - { |
|
211 | - return isset($this->_dependency_map[$class_name]) ? true : false; |
|
212 | - } |
|
213 | - |
|
214 | - |
|
215 | - |
|
216 | - /** |
|
217 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
218 | - * |
|
219 | - * @param string $class_name |
|
220 | - * @param string $dependency |
|
221 | - * @return bool |
|
222 | - */ |
|
223 | - public function has_dependency_for_class($class_name = '', $dependency = '') |
|
224 | - { |
|
225 | - $dependency = $this->get_alias($dependency); |
|
226 | - return isset($this->_dependency_map[$class_name], $this->_dependency_map[$class_name][$dependency]) |
|
227 | - ? true |
|
228 | - : false; |
|
229 | - } |
|
230 | - |
|
231 | - |
|
232 | - |
|
233 | - /** |
|
234 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
235 | - * |
|
236 | - * @param string $class_name |
|
237 | - * @param string $dependency |
|
238 | - * @return int |
|
239 | - */ |
|
240 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
241 | - { |
|
242 | - $dependency = $this->get_alias($dependency); |
|
243 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
244 | - ? $this->_dependency_map[$class_name][$dependency] |
|
245 | - : EE_Dependency_Map::not_registered; |
|
246 | - } |
|
247 | - |
|
248 | - |
|
249 | - |
|
250 | - /** |
|
251 | - * @param string $class_name |
|
252 | - * @return string | Closure |
|
253 | - */ |
|
254 | - public function class_loader($class_name) |
|
255 | - { |
|
256 | - $class_name = $this->get_alias($class_name); |
|
257 | - return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
258 | - } |
|
259 | - |
|
260 | - |
|
261 | - |
|
262 | - /** |
|
263 | - * @return array |
|
264 | - */ |
|
265 | - public function class_loaders() |
|
266 | - { |
|
267 | - return $this->_class_loaders; |
|
268 | - } |
|
269 | - |
|
270 | - |
|
271 | - |
|
272 | - /** |
|
273 | - * adds an alias for a classname |
|
274 | - * |
|
275 | - * @param string $class_name the class name that should be used (concrete class to replace interface) |
|
276 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
277 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
278 | - */ |
|
279 | - public function add_alias($class_name, $alias, $for_class = '') |
|
280 | - { |
|
281 | - if ($for_class !== '') { |
|
282 | - if (! isset($this->_aliases[$for_class])) { |
|
283 | - $this->_aliases[$for_class] = array(); |
|
284 | - } |
|
285 | - $this->_aliases[$for_class][$class_name] = $alias; |
|
286 | - } |
|
287 | - $this->_aliases[$class_name] = $alias; |
|
288 | - } |
|
289 | - |
|
290 | - |
|
291 | - |
|
292 | - /** |
|
293 | - * returns TRUE if the provided class name has an alias |
|
294 | - * |
|
295 | - * @param string $class_name |
|
296 | - * @param string $for_class |
|
297 | - * @return bool |
|
298 | - */ |
|
299 | - public function has_alias($class_name = '', $for_class = '') |
|
300 | - { |
|
301 | - return isset($this->_aliases[$for_class], $this->_aliases[$for_class][$class_name]) |
|
302 | - || ( |
|
303 | - isset($this->_aliases[$class_name]) |
|
304 | - && ! is_array($this->_aliases[$class_name]) |
|
305 | - ); |
|
306 | - } |
|
307 | - |
|
308 | - |
|
309 | - |
|
310 | - /** |
|
311 | - * returns alias for class name if one exists, otherwise returns the original classname |
|
312 | - * functions recursively, so that multiple aliases can be used to drill down to a classname |
|
313 | - * for example: |
|
314 | - * if the following two entries were added to the _aliases array: |
|
315 | - * array( |
|
316 | - * 'interface_alias' => 'some\namespace\interface' |
|
317 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
318 | - * ) |
|
319 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
320 | - * to load an instance of 'some\namespace\classname' |
|
321 | - * |
|
322 | - * @param string $class_name |
|
323 | - * @param string $for_class |
|
324 | - * @return string |
|
325 | - */ |
|
326 | - public function get_alias($class_name = '', $for_class = '') |
|
327 | - { |
|
328 | - if (! $this->has_alias($class_name, $for_class)) { |
|
329 | - return $class_name; |
|
330 | - } |
|
331 | - if ($for_class !== '') { |
|
332 | - return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class); |
|
333 | - } |
|
334 | - return $this->get_alias($this->_aliases[$class_name]); |
|
335 | - } |
|
336 | - |
|
337 | - |
|
338 | - |
|
339 | - /** |
|
340 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
341 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
342 | - * This is done by using the following class constants: |
|
343 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
344 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
345 | - */ |
|
346 | - protected function _register_core_dependencies() |
|
347 | - { |
|
348 | - $this->_dependency_map = array( |
|
349 | - 'EE_Request_Handler' => array( |
|
350 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
351 | - ), |
|
352 | - 'EE_System' => array( |
|
353 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
354 | - ), |
|
355 | - 'EE_Session' => array( |
|
356 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
357 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
358 | - ), |
|
359 | - 'EE_Cart' => array( |
|
360 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
361 | - ), |
|
362 | - 'EE_Front_Controller' => array( |
|
363 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
364 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
365 | - 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
366 | - ), |
|
367 | - 'EE_Messenger_Collection_Loader' => array( |
|
368 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
369 | - ), |
|
370 | - 'EE_Message_Type_Collection_Loader' => array( |
|
371 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
372 | - ), |
|
373 | - 'EE_Message_Resource_Manager' => array( |
|
374 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
375 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
376 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
377 | - ), |
|
378 | - 'EE_Message_Factory' => array( |
|
379 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
380 | - ), |
|
381 | - 'EE_messages' => array( |
|
382 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
383 | - ), |
|
384 | - 'EE_Messages_Generator' => array( |
|
385 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
386 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
387 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
388 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
389 | - ), |
|
390 | - 'EE_Messages_Processor' => array( |
|
391 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
392 | - ), |
|
393 | - 'EE_Messages_Queue' => array( |
|
394 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
395 | - ), |
|
396 | - 'EE_Messages_Template_Defaults' => array( |
|
397 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
398 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
399 | - ), |
|
400 | - 'EE_Message_To_Generate_From_Request' => array( |
|
401 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
402 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
403 | - ), |
|
404 | - 'EventEspresso\core\services\commands\CommandBus' => array( |
|
405 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
406 | - ), |
|
407 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
408 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
409 | - ), |
|
410 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
411 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
412 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
413 | - ), |
|
414 | - 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
415 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
416 | - ), |
|
417 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
418 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
419 | - ), |
|
420 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
421 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
422 | - ), |
|
423 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
424 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
425 | - ), |
|
426 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
427 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
428 | - ), |
|
429 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
430 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
431 | - ), |
|
432 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
433 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
434 | - ), |
|
435 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
436 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
437 | - ), |
|
438 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
439 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
440 | - ), |
|
441 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
442 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
443 | - ), |
|
444 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
445 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
446 | - ), |
|
447 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
448 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
449 | - ), |
|
450 | - 'EventEspresso\core\services\database\TableManager' => array( |
|
451 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
452 | - ), |
|
453 | - 'EE_Data_Migration_Class_Base' => array( |
|
454 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
455 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
456 | - ), |
|
457 | - 'EE_DMS_Core_4_1_0' => array( |
|
458 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
459 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
460 | - ), |
|
461 | - 'EE_DMS_Core_4_2_0' => array( |
|
462 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
463 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
464 | - ), |
|
465 | - 'EE_DMS_Core_4_3_0' => array( |
|
466 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
467 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
468 | - ), |
|
469 | - 'EE_DMS_Core_4_4_0' => array( |
|
470 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
471 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
472 | - ), |
|
473 | - 'EE_DMS_Core_4_5_0' => array( |
|
474 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
475 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
476 | - ), |
|
477 | - 'EE_DMS_Core_4_6_0' => array( |
|
478 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
479 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
480 | - ), |
|
481 | - 'EE_DMS_Core_4_7_0' => array( |
|
482 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
483 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
484 | - ), |
|
485 | - 'EE_DMS_Core_4_8_0' => array( |
|
486 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
487 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
488 | - ), |
|
489 | - 'EE_DMS_Core_4_9_0' => array( |
|
490 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
491 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
492 | - ), |
|
493 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
494 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
495 | - ), |
|
496 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
497 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
498 | - ), |
|
499 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
500 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
501 | - ), |
|
502 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
503 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
504 | - ), |
|
505 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
506 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
507 | - ), |
|
508 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
509 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
510 | - ), |
|
511 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
512 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
513 | - ), |
|
514 | - 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
515 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
516 | - ), |
|
517 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
518 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
519 | - ), |
|
520 | - ); |
|
521 | - } |
|
522 | - |
|
523 | - |
|
524 | - |
|
525 | - /** |
|
526 | - * Registers how core classes are loaded. |
|
527 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
528 | - * 'EE_Request_Handler' => 'load_core' |
|
529 | - * 'EE_Messages_Queue' => 'load_lib' |
|
530 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
531 | - * or, if greater control is required, by providing a custom closure. For example: |
|
532 | - * 'Some_Class' => function () { |
|
533 | - * return new Some_Class(); |
|
534 | - * }, |
|
535 | - * This is required for instantiating dependencies |
|
536 | - * where an interface has been type hinted in a class constructor. For example: |
|
537 | - * 'Required_Interface' => function () { |
|
538 | - * return new A_Class_That_Implements_Required_Interface(); |
|
539 | - * }, |
|
540 | - */ |
|
541 | - protected function _register_core_class_loaders() |
|
542 | - { |
|
543 | - //for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot |
|
544 | - //be used in a closure. |
|
545 | - $request = &$this->_request; |
|
546 | - $response = &$this->_response; |
|
547 | - $loader = &$this->loader; |
|
548 | - $this->_class_loaders = array( |
|
549 | - //load_core |
|
550 | - 'EE_Capabilities' => 'load_core', |
|
551 | - 'EE_Encryption' => 'load_core', |
|
552 | - 'EE_Front_Controller' => 'load_core', |
|
553 | - 'EE_Module_Request_Router' => 'load_core', |
|
554 | - 'EE_Registry' => 'load_core', |
|
555 | - 'EE_Request' => function () use (&$request) { |
|
556 | - return $request; |
|
557 | - }, |
|
558 | - 'EE_Response' => function () use (&$response) { |
|
559 | - return $response; |
|
560 | - }, |
|
561 | - 'EE_Request_Handler' => 'load_core', |
|
562 | - 'EE_Session' => 'load_core', |
|
563 | - 'EE_System' => 'load_core', |
|
564 | - //load_lib |
|
565 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
566 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
567 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
568 | - 'EE_Messenger_Collection' => 'load_lib', |
|
569 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
570 | - 'EE_Messages_Processor' => 'load_lib', |
|
571 | - 'EE_Message_Repository' => 'load_lib', |
|
572 | - 'EE_Messages_Queue' => 'load_lib', |
|
573 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
574 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
575 | - 'EE_Messages_Generator' => function () { |
|
576 | - return EE_Registry::instance()->load_lib('Messages_Generator', array(), false, false); |
|
577 | - }, |
|
578 | - 'EE_Messages_Template_Defaults' => function ($arguments = array()) { |
|
579 | - return EE_Registry::instance()->load_lib('Messages_Template_Defaults', $arguments, false, false); |
|
580 | - }, |
|
581 | - //load_model |
|
582 | - 'EEM_Message_Template_Group' => 'load_model', |
|
583 | - 'EEM_Message_Template' => 'load_model', |
|
584 | - //load_helper |
|
585 | - 'EEH_Parse_Shortcodes' => function () { |
|
586 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
587 | - return new EEH_Parse_Shortcodes(); |
|
588 | - } |
|
589 | - return null; |
|
590 | - }, |
|
591 | - 'EventEspresso\core\services\loaders\Loader' => function () use (&$loader) { |
|
592 | - return $loader; |
|
593 | - }, |
|
594 | - ); |
|
595 | - } |
|
596 | - |
|
597 | - |
|
598 | - |
|
599 | - /** |
|
600 | - * can be used for supplying alternate names for classes, |
|
601 | - * or for connecting interface names to instantiable classes |
|
602 | - */ |
|
603 | - protected function _register_core_aliases() |
|
604 | - { |
|
605 | - $this->_aliases = array( |
|
606 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
607 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
608 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
609 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
610 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
611 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
612 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
613 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
614 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
615 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
616 | - 'CreateRegCodeCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegCodeCommand', |
|
617 | - 'CreateRegUrlLinkCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegUrlLinkCommand', |
|
618 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
619 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
620 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
621 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
622 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
623 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
624 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
625 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
626 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
627 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
628 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
629 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
630 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
631 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
632 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
633 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
634 | - ); |
|
635 | - } |
|
636 | - |
|
637 | - |
|
638 | - |
|
639 | - /** |
|
640 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
641 | - * request Primarily used by unit tests. |
|
642 | - */ |
|
643 | - public function reset() |
|
644 | - { |
|
645 | - $this->_register_core_class_loaders(); |
|
646 | - $this->_register_core_dependencies(); |
|
647 | - } |
|
25 | + /** |
|
26 | + * This means that the requested class dependency is not present in the dependency map |
|
27 | + */ |
|
28 | + const not_registered = 0; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
33 | + */ |
|
34 | + const load_new_object = 1; |
|
35 | + |
|
36 | + /** |
|
37 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
38 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
39 | + */ |
|
40 | + const load_from_cache = 2; |
|
41 | + |
|
42 | + /** |
|
43 | + * @type EE_Dependency_Map $_instance |
|
44 | + */ |
|
45 | + protected static $_instance; |
|
46 | + |
|
47 | + /** |
|
48 | + * @type EE_Request $request |
|
49 | + */ |
|
50 | + protected $_request; |
|
51 | + |
|
52 | + /** |
|
53 | + * @type EE_Response $response |
|
54 | + */ |
|
55 | + protected $_response; |
|
56 | + |
|
57 | + /** |
|
58 | + * @type LoaderInterface $loader |
|
59 | + */ |
|
60 | + protected $loader; |
|
61 | + |
|
62 | + /** |
|
63 | + * @type array $_dependency_map |
|
64 | + */ |
|
65 | + protected $_dependency_map = array(); |
|
66 | + |
|
67 | + /** |
|
68 | + * @type array $_class_loaders |
|
69 | + */ |
|
70 | + protected $_class_loaders = array(); |
|
71 | + |
|
72 | + /** |
|
73 | + * @type array $_aliases |
|
74 | + */ |
|
75 | + protected $_aliases = array(); |
|
76 | + |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * EE_Dependency_Map constructor. |
|
81 | + * |
|
82 | + * @param EE_Request $request |
|
83 | + * @param EE_Response $response |
|
84 | + */ |
|
85 | + protected function __construct(EE_Request $request, EE_Response $response) |
|
86 | + { |
|
87 | + $this->_request = $request; |
|
88 | + $this->_response = $response; |
|
89 | + add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
90 | + do_action('EE_Dependency_Map____construct'); |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + |
|
95 | + /** |
|
96 | + * @throws InvalidDataTypeException |
|
97 | + * @throws InvalidInterfaceException |
|
98 | + * @throws InvalidArgumentException |
|
99 | + */ |
|
100 | + public function initialize() |
|
101 | + { |
|
102 | + $this->_register_core_dependencies(); |
|
103 | + $this->_register_core_class_loaders(); |
|
104 | + $this->_register_core_aliases(); |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @singleton method used to instantiate class object |
|
111 | + * @access public |
|
112 | + * @param EE_Request $request |
|
113 | + * @param EE_Response $response |
|
114 | + * @return EE_Dependency_Map |
|
115 | + */ |
|
116 | + public static function instance(EE_Request $request = null, EE_Response $response = null) |
|
117 | + { |
|
118 | + // check if class object is instantiated, and instantiated properly |
|
119 | + if (! self::$_instance instanceof EE_Dependency_Map) { |
|
120 | + self::$_instance = new EE_Dependency_Map($request, $response); |
|
121 | + } |
|
122 | + return self::$_instance; |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + |
|
127 | + /** |
|
128 | + * @param LoaderInterface $loader |
|
129 | + */ |
|
130 | + public function setLoader(LoaderInterface $loader) |
|
131 | + { |
|
132 | + $this->loader = $loader; |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * @param string $class |
|
139 | + * @param array $dependencies |
|
140 | + * @return boolean |
|
141 | + */ |
|
142 | + public static function register_dependencies($class, $dependencies) |
|
143 | + { |
|
144 | + if (! isset(self::$_instance->_dependency_map[$class])) { |
|
145 | + // we need to make sure that any aliases used when registering a dependency |
|
146 | + // get resolved to the correct class name |
|
147 | + foreach ((array)$dependencies as $dependency => $load_source) { |
|
148 | + $alias = self::$_instance->get_alias($dependency); |
|
149 | + unset($dependencies[$dependency]); |
|
150 | + $dependencies[$alias] = $load_source; |
|
151 | + } |
|
152 | + self::$_instance->_dependency_map[$class] = (array)$dependencies; |
|
153 | + return true; |
|
154 | + } |
|
155 | + return false; |
|
156 | + } |
|
157 | + |
|
158 | + |
|
159 | + |
|
160 | + /** |
|
161 | + * @param string $class_name |
|
162 | + * @param string $loader |
|
163 | + * @return bool |
|
164 | + * @throws EE_Error |
|
165 | + */ |
|
166 | + public static function register_class_loader($class_name, $loader = 'load_core') |
|
167 | + { |
|
168 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
169 | + if ( |
|
170 | + ! is_callable($loader) |
|
171 | + && ( |
|
172 | + strpos($loader, 'load_') !== 0 |
|
173 | + || ! method_exists('EE_Registry', $loader) |
|
174 | + ) |
|
175 | + ) { |
|
176 | + throw new EE_Error( |
|
177 | + sprintf( |
|
178 | + esc_html__('"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso'), |
|
179 | + $loader |
|
180 | + ) |
|
181 | + ); |
|
182 | + } |
|
183 | + $class_name = self::$_instance->get_alias($class_name); |
|
184 | + if (! isset(self::$_instance->_class_loaders[$class_name])) { |
|
185 | + self::$_instance->_class_loaders[$class_name] = $loader; |
|
186 | + return true; |
|
187 | + } |
|
188 | + return false; |
|
189 | + } |
|
190 | + |
|
191 | + |
|
192 | + |
|
193 | + /** |
|
194 | + * @return array |
|
195 | + */ |
|
196 | + public function dependency_map() |
|
197 | + { |
|
198 | + return $this->_dependency_map; |
|
199 | + } |
|
200 | + |
|
201 | + |
|
202 | + |
|
203 | + /** |
|
204 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
205 | + * |
|
206 | + * @param string $class_name |
|
207 | + * @return boolean |
|
208 | + */ |
|
209 | + public function has($class_name = '') |
|
210 | + { |
|
211 | + return isset($this->_dependency_map[$class_name]) ? true : false; |
|
212 | + } |
|
213 | + |
|
214 | + |
|
215 | + |
|
216 | + /** |
|
217 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
218 | + * |
|
219 | + * @param string $class_name |
|
220 | + * @param string $dependency |
|
221 | + * @return bool |
|
222 | + */ |
|
223 | + public function has_dependency_for_class($class_name = '', $dependency = '') |
|
224 | + { |
|
225 | + $dependency = $this->get_alias($dependency); |
|
226 | + return isset($this->_dependency_map[$class_name], $this->_dependency_map[$class_name][$dependency]) |
|
227 | + ? true |
|
228 | + : false; |
|
229 | + } |
|
230 | + |
|
231 | + |
|
232 | + |
|
233 | + /** |
|
234 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
235 | + * |
|
236 | + * @param string $class_name |
|
237 | + * @param string $dependency |
|
238 | + * @return int |
|
239 | + */ |
|
240 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
241 | + { |
|
242 | + $dependency = $this->get_alias($dependency); |
|
243 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
244 | + ? $this->_dependency_map[$class_name][$dependency] |
|
245 | + : EE_Dependency_Map::not_registered; |
|
246 | + } |
|
247 | + |
|
248 | + |
|
249 | + |
|
250 | + /** |
|
251 | + * @param string $class_name |
|
252 | + * @return string | Closure |
|
253 | + */ |
|
254 | + public function class_loader($class_name) |
|
255 | + { |
|
256 | + $class_name = $this->get_alias($class_name); |
|
257 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
258 | + } |
|
259 | + |
|
260 | + |
|
261 | + |
|
262 | + /** |
|
263 | + * @return array |
|
264 | + */ |
|
265 | + public function class_loaders() |
|
266 | + { |
|
267 | + return $this->_class_loaders; |
|
268 | + } |
|
269 | + |
|
270 | + |
|
271 | + |
|
272 | + /** |
|
273 | + * adds an alias for a classname |
|
274 | + * |
|
275 | + * @param string $class_name the class name that should be used (concrete class to replace interface) |
|
276 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
277 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
278 | + */ |
|
279 | + public function add_alias($class_name, $alias, $for_class = '') |
|
280 | + { |
|
281 | + if ($for_class !== '') { |
|
282 | + if (! isset($this->_aliases[$for_class])) { |
|
283 | + $this->_aliases[$for_class] = array(); |
|
284 | + } |
|
285 | + $this->_aliases[$for_class][$class_name] = $alias; |
|
286 | + } |
|
287 | + $this->_aliases[$class_name] = $alias; |
|
288 | + } |
|
289 | + |
|
290 | + |
|
291 | + |
|
292 | + /** |
|
293 | + * returns TRUE if the provided class name has an alias |
|
294 | + * |
|
295 | + * @param string $class_name |
|
296 | + * @param string $for_class |
|
297 | + * @return bool |
|
298 | + */ |
|
299 | + public function has_alias($class_name = '', $for_class = '') |
|
300 | + { |
|
301 | + return isset($this->_aliases[$for_class], $this->_aliases[$for_class][$class_name]) |
|
302 | + || ( |
|
303 | + isset($this->_aliases[$class_name]) |
|
304 | + && ! is_array($this->_aliases[$class_name]) |
|
305 | + ); |
|
306 | + } |
|
307 | + |
|
308 | + |
|
309 | + |
|
310 | + /** |
|
311 | + * returns alias for class name if one exists, otherwise returns the original classname |
|
312 | + * functions recursively, so that multiple aliases can be used to drill down to a classname |
|
313 | + * for example: |
|
314 | + * if the following two entries were added to the _aliases array: |
|
315 | + * array( |
|
316 | + * 'interface_alias' => 'some\namespace\interface' |
|
317 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
318 | + * ) |
|
319 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
320 | + * to load an instance of 'some\namespace\classname' |
|
321 | + * |
|
322 | + * @param string $class_name |
|
323 | + * @param string $for_class |
|
324 | + * @return string |
|
325 | + */ |
|
326 | + public function get_alias($class_name = '', $for_class = '') |
|
327 | + { |
|
328 | + if (! $this->has_alias($class_name, $for_class)) { |
|
329 | + return $class_name; |
|
330 | + } |
|
331 | + if ($for_class !== '') { |
|
332 | + return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class); |
|
333 | + } |
|
334 | + return $this->get_alias($this->_aliases[$class_name]); |
|
335 | + } |
|
336 | + |
|
337 | + |
|
338 | + |
|
339 | + /** |
|
340 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
341 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
342 | + * This is done by using the following class constants: |
|
343 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
344 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
345 | + */ |
|
346 | + protected function _register_core_dependencies() |
|
347 | + { |
|
348 | + $this->_dependency_map = array( |
|
349 | + 'EE_Request_Handler' => array( |
|
350 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
351 | + ), |
|
352 | + 'EE_System' => array( |
|
353 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
354 | + ), |
|
355 | + 'EE_Session' => array( |
|
356 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
357 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
358 | + ), |
|
359 | + 'EE_Cart' => array( |
|
360 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
361 | + ), |
|
362 | + 'EE_Front_Controller' => array( |
|
363 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
364 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
365 | + 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
366 | + ), |
|
367 | + 'EE_Messenger_Collection_Loader' => array( |
|
368 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
369 | + ), |
|
370 | + 'EE_Message_Type_Collection_Loader' => array( |
|
371 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
372 | + ), |
|
373 | + 'EE_Message_Resource_Manager' => array( |
|
374 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
375 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
376 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
377 | + ), |
|
378 | + 'EE_Message_Factory' => array( |
|
379 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
380 | + ), |
|
381 | + 'EE_messages' => array( |
|
382 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
383 | + ), |
|
384 | + 'EE_Messages_Generator' => array( |
|
385 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
386 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
387 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
388 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
389 | + ), |
|
390 | + 'EE_Messages_Processor' => array( |
|
391 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
392 | + ), |
|
393 | + 'EE_Messages_Queue' => array( |
|
394 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
395 | + ), |
|
396 | + 'EE_Messages_Template_Defaults' => array( |
|
397 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
398 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
399 | + ), |
|
400 | + 'EE_Message_To_Generate_From_Request' => array( |
|
401 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
402 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
403 | + ), |
|
404 | + 'EventEspresso\core\services\commands\CommandBus' => array( |
|
405 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
406 | + ), |
|
407 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
408 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
409 | + ), |
|
410 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
411 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
412 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
413 | + ), |
|
414 | + 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
415 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
416 | + ), |
|
417 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
418 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
419 | + ), |
|
420 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
421 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
422 | + ), |
|
423 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
424 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
425 | + ), |
|
426 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
427 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
428 | + ), |
|
429 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
430 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
431 | + ), |
|
432 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
433 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
434 | + ), |
|
435 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
436 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
437 | + ), |
|
438 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
439 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
440 | + ), |
|
441 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
442 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
443 | + ), |
|
444 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
445 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
446 | + ), |
|
447 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
448 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
449 | + ), |
|
450 | + 'EventEspresso\core\services\database\TableManager' => array( |
|
451 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
452 | + ), |
|
453 | + 'EE_Data_Migration_Class_Base' => array( |
|
454 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
455 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
456 | + ), |
|
457 | + 'EE_DMS_Core_4_1_0' => array( |
|
458 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
459 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
460 | + ), |
|
461 | + 'EE_DMS_Core_4_2_0' => array( |
|
462 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
463 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
464 | + ), |
|
465 | + 'EE_DMS_Core_4_3_0' => array( |
|
466 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
467 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
468 | + ), |
|
469 | + 'EE_DMS_Core_4_4_0' => array( |
|
470 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
471 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
472 | + ), |
|
473 | + 'EE_DMS_Core_4_5_0' => array( |
|
474 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
475 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
476 | + ), |
|
477 | + 'EE_DMS_Core_4_6_0' => array( |
|
478 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
479 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
480 | + ), |
|
481 | + 'EE_DMS_Core_4_7_0' => array( |
|
482 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
483 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
484 | + ), |
|
485 | + 'EE_DMS_Core_4_8_0' => array( |
|
486 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
487 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
488 | + ), |
|
489 | + 'EE_DMS_Core_4_9_0' => array( |
|
490 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
491 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
492 | + ), |
|
493 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
494 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
495 | + ), |
|
496 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
497 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
498 | + ), |
|
499 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
500 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
501 | + ), |
|
502 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
503 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
504 | + ), |
|
505 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
506 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
507 | + ), |
|
508 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
509 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
510 | + ), |
|
511 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
512 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
513 | + ), |
|
514 | + 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
515 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
516 | + ), |
|
517 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
518 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
519 | + ), |
|
520 | + ); |
|
521 | + } |
|
522 | + |
|
523 | + |
|
524 | + |
|
525 | + /** |
|
526 | + * Registers how core classes are loaded. |
|
527 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
528 | + * 'EE_Request_Handler' => 'load_core' |
|
529 | + * 'EE_Messages_Queue' => 'load_lib' |
|
530 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
531 | + * or, if greater control is required, by providing a custom closure. For example: |
|
532 | + * 'Some_Class' => function () { |
|
533 | + * return new Some_Class(); |
|
534 | + * }, |
|
535 | + * This is required for instantiating dependencies |
|
536 | + * where an interface has been type hinted in a class constructor. For example: |
|
537 | + * 'Required_Interface' => function () { |
|
538 | + * return new A_Class_That_Implements_Required_Interface(); |
|
539 | + * }, |
|
540 | + */ |
|
541 | + protected function _register_core_class_loaders() |
|
542 | + { |
|
543 | + //for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot |
|
544 | + //be used in a closure. |
|
545 | + $request = &$this->_request; |
|
546 | + $response = &$this->_response; |
|
547 | + $loader = &$this->loader; |
|
548 | + $this->_class_loaders = array( |
|
549 | + //load_core |
|
550 | + 'EE_Capabilities' => 'load_core', |
|
551 | + 'EE_Encryption' => 'load_core', |
|
552 | + 'EE_Front_Controller' => 'load_core', |
|
553 | + 'EE_Module_Request_Router' => 'load_core', |
|
554 | + 'EE_Registry' => 'load_core', |
|
555 | + 'EE_Request' => function () use (&$request) { |
|
556 | + return $request; |
|
557 | + }, |
|
558 | + 'EE_Response' => function () use (&$response) { |
|
559 | + return $response; |
|
560 | + }, |
|
561 | + 'EE_Request_Handler' => 'load_core', |
|
562 | + 'EE_Session' => 'load_core', |
|
563 | + 'EE_System' => 'load_core', |
|
564 | + //load_lib |
|
565 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
566 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
567 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
568 | + 'EE_Messenger_Collection' => 'load_lib', |
|
569 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
570 | + 'EE_Messages_Processor' => 'load_lib', |
|
571 | + 'EE_Message_Repository' => 'load_lib', |
|
572 | + 'EE_Messages_Queue' => 'load_lib', |
|
573 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
574 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
575 | + 'EE_Messages_Generator' => function () { |
|
576 | + return EE_Registry::instance()->load_lib('Messages_Generator', array(), false, false); |
|
577 | + }, |
|
578 | + 'EE_Messages_Template_Defaults' => function ($arguments = array()) { |
|
579 | + return EE_Registry::instance()->load_lib('Messages_Template_Defaults', $arguments, false, false); |
|
580 | + }, |
|
581 | + //load_model |
|
582 | + 'EEM_Message_Template_Group' => 'load_model', |
|
583 | + 'EEM_Message_Template' => 'load_model', |
|
584 | + //load_helper |
|
585 | + 'EEH_Parse_Shortcodes' => function () { |
|
586 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
587 | + return new EEH_Parse_Shortcodes(); |
|
588 | + } |
|
589 | + return null; |
|
590 | + }, |
|
591 | + 'EventEspresso\core\services\loaders\Loader' => function () use (&$loader) { |
|
592 | + return $loader; |
|
593 | + }, |
|
594 | + ); |
|
595 | + } |
|
596 | + |
|
597 | + |
|
598 | + |
|
599 | + /** |
|
600 | + * can be used for supplying alternate names for classes, |
|
601 | + * or for connecting interface names to instantiable classes |
|
602 | + */ |
|
603 | + protected function _register_core_aliases() |
|
604 | + { |
|
605 | + $this->_aliases = array( |
|
606 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
607 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
608 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
609 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
610 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
611 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
612 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
613 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
614 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
615 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
616 | + 'CreateRegCodeCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegCodeCommand', |
|
617 | + 'CreateRegUrlLinkCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegUrlLinkCommand', |
|
618 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
619 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
620 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
621 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
622 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
623 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
624 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
625 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
626 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
627 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
628 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
629 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
630 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
631 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
632 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
633 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
634 | + ); |
|
635 | + } |
|
636 | + |
|
637 | + |
|
638 | + |
|
639 | + /** |
|
640 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
641 | + * request Primarily used by unit tests. |
|
642 | + */ |
|
643 | + public function reset() |
|
644 | + { |
|
645 | + $this->_register_core_class_loaders(); |
|
646 | + $this->_register_core_dependencies(); |
|
647 | + } |
|
648 | 648 | |
649 | 649 | |
650 | 650 | } |