@@ -21,60 +21,60 @@ |
||
21 | 21 | class CreateTransactionCommand extends Command implements CommandRequiresCapCheckInterface |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var EE_Checkout $checkout |
|
26 | - */ |
|
27 | - protected $checkout; |
|
24 | + /** |
|
25 | + * @var EE_Checkout $checkout |
|
26 | + */ |
|
27 | + protected $checkout; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @var array $transaction_details |
|
31 | - */ |
|
32 | - protected $transaction_details; |
|
29 | + /** |
|
30 | + * @var array $transaction_details |
|
31 | + */ |
|
32 | + protected $transaction_details; |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * CreateTransactionCommand constructor. |
|
37 | - * |
|
38 | - * @param EE_Checkout $checkout |
|
39 | - * @param array $transaction_details |
|
40 | - */ |
|
41 | - public function __construct(EE_Checkout $checkout = null, array $transaction_details = array()) |
|
42 | - { |
|
43 | - $this->checkout = $checkout; |
|
44 | - $this->transaction_details = $transaction_details; |
|
45 | - } |
|
35 | + /** |
|
36 | + * CreateTransactionCommand constructor. |
|
37 | + * |
|
38 | + * @param EE_Checkout $checkout |
|
39 | + * @param array $transaction_details |
|
40 | + */ |
|
41 | + public function __construct(EE_Checkout $checkout = null, array $transaction_details = array()) |
|
42 | + { |
|
43 | + $this->checkout = $checkout; |
|
44 | + $this->transaction_details = $transaction_details; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @return CapCheckInterface |
|
50 | - * @throws InvalidDataTypeException |
|
51 | - */ |
|
52 | - public function getCapCheck() |
|
53 | - { |
|
54 | - // need cap for non-AJAX admin requests |
|
55 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
56 | - // there's no specific caps for editing/creating transactions, |
|
57 | - // so that's why we are using ee_edit_registrations |
|
58 | - return new CapCheck('ee_edit_registrations', 'create_new_transaction'); |
|
59 | - } |
|
60 | - return new PublicCapabilities('', 'create_new_transaction'); |
|
61 | - } |
|
48 | + /** |
|
49 | + * @return CapCheckInterface |
|
50 | + * @throws InvalidDataTypeException |
|
51 | + */ |
|
52 | + public function getCapCheck() |
|
53 | + { |
|
54 | + // need cap for non-AJAX admin requests |
|
55 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
56 | + // there's no specific caps for editing/creating transactions, |
|
57 | + // so that's why we are using ee_edit_registrations |
|
58 | + return new CapCheck('ee_edit_registrations', 'create_new_transaction'); |
|
59 | + } |
|
60 | + return new PublicCapabilities('', 'create_new_transaction'); |
|
61 | + } |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * @return EE_Checkout |
|
66 | - */ |
|
67 | - public function checkout() |
|
68 | - { |
|
69 | - return $this->checkout; |
|
70 | - } |
|
64 | + /** |
|
65 | + * @return EE_Checkout |
|
66 | + */ |
|
67 | + public function checkout() |
|
68 | + { |
|
69 | + return $this->checkout; |
|
70 | + } |
|
71 | 71 | |
72 | 72 | |
73 | - /** |
|
74 | - * @return array |
|
75 | - */ |
|
76 | - public function transactionDetails() |
|
77 | - { |
|
78 | - return $this->transaction_details; |
|
79 | - } |
|
73 | + /** |
|
74 | + * @return array |
|
75 | + */ |
|
76 | + public function transactionDetails() |
|
77 | + { |
|
78 | + return $this->transaction_details; |
|
79 | + } |
|
80 | 80 | } |
@@ -17,48 +17,48 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * @var \EE_Registration $target_registration |
|
22 | - */ |
|
23 | - private $target_registration; |
|
20 | + /** |
|
21 | + * @var \EE_Registration $target_registration |
|
22 | + */ |
|
23 | + private $target_registration; |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @var \EE_Registration $registration_to_copy |
|
28 | - */ |
|
29 | - private $registration_to_copy; |
|
26 | + /** |
|
27 | + * @var \EE_Registration $registration_to_copy |
|
28 | + */ |
|
29 | + private $registration_to_copy; |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * CopyRegistrationDetailsCommand constructor. |
|
34 | - * |
|
35 | - * @param \EE_Registration $target_registration |
|
36 | - * @param \EE_Registration $registration_to_copy |
|
37 | - * v |
|
38 | - */ |
|
39 | - public function __construct( |
|
40 | - \EE_Registration $target_registration, |
|
41 | - \EE_Registration $registration_to_copy |
|
42 | - ) { |
|
43 | - $this->target_registration = $target_registration; |
|
44 | - $this->registration_to_copy = $registration_to_copy; |
|
45 | - } |
|
32 | + /** |
|
33 | + * CopyRegistrationDetailsCommand constructor. |
|
34 | + * |
|
35 | + * @param \EE_Registration $target_registration |
|
36 | + * @param \EE_Registration $registration_to_copy |
|
37 | + * v |
|
38 | + */ |
|
39 | + public function __construct( |
|
40 | + \EE_Registration $target_registration, |
|
41 | + \EE_Registration $registration_to_copy |
|
42 | + ) { |
|
43 | + $this->target_registration = $target_registration; |
|
44 | + $this->registration_to_copy = $registration_to_copy; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @return \EE_Registration |
|
50 | - */ |
|
51 | - public function targetRegistration() |
|
52 | - { |
|
53 | - return $this->target_registration; |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return \EE_Registration |
|
50 | + */ |
|
51 | + public function targetRegistration() |
|
52 | + { |
|
53 | + return $this->target_registration; |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | - /** |
|
58 | - * @return \EE_Registration |
|
59 | - */ |
|
60 | - public function registrationToCopy() |
|
61 | - { |
|
62 | - return $this->registration_to_copy; |
|
63 | - } |
|
57 | + /** |
|
58 | + * @return \EE_Registration |
|
59 | + */ |
|
60 | + public function registrationToCopy() |
|
61 | + { |
|
62 | + return $this->registration_to_copy; |
|
63 | + } |
|
64 | 64 | } |
@@ -39,31 +39,31 @@ discard block |
||
39 | 39 | * @param string $action_or_filter |
40 | 40 | */ |
41 | 41 | function deprecated_espresso_action_or_filter_doing_it_wrong( |
42 | - $deprecated_filter, |
|
43 | - $replacement, |
|
44 | - $replacement_location, |
|
45 | - $version_deprecated, |
|
46 | - $version_applies, |
|
47 | - $action_or_filter = 'action' |
|
42 | + $deprecated_filter, |
|
43 | + $replacement, |
|
44 | + $replacement_location, |
|
45 | + $version_deprecated, |
|
46 | + $version_applies, |
|
47 | + $action_or_filter = 'action' |
|
48 | 48 | ) { |
49 | - $action_or_filter = $action_or_filter === 'action' |
|
50 | - ? esc_html__('action', 'event_espresso') |
|
51 | - : esc_html__('filter', 'event_espresso'); |
|
52 | - EE_Error::doing_it_wrong( |
|
53 | - $deprecated_filter, |
|
54 | - sprintf( |
|
55 | - esc_html__( |
|
56 | - 'This %1$s is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new %1$s: %4$s"%2$s" found in "%3$s"', |
|
57 | - 'event_espresso' |
|
58 | - ), |
|
59 | - $action_or_filter, |
|
60 | - $replacement, |
|
61 | - $replacement_location, |
|
62 | - '<br />' |
|
63 | - ), |
|
64 | - $version_deprecated, |
|
65 | - $version_applies |
|
66 | - ); |
|
49 | + $action_or_filter = $action_or_filter === 'action' |
|
50 | + ? esc_html__('action', 'event_espresso') |
|
51 | + : esc_html__('filter', 'event_espresso'); |
|
52 | + EE_Error::doing_it_wrong( |
|
53 | + $deprecated_filter, |
|
54 | + sprintf( |
|
55 | + esc_html__( |
|
56 | + 'This %1$s is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new %1$s: %4$s"%2$s" found in "%3$s"', |
|
57 | + 'event_espresso' |
|
58 | + ), |
|
59 | + $action_or_filter, |
|
60 | + $replacement, |
|
61 | + $replacement_location, |
|
62 | + '<br />' |
|
63 | + ), |
|
64 | + $version_deprecated, |
|
65 | + $version_applies |
|
66 | + ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -75,90 +75,90 @@ discard block |
||
75 | 75 | */ |
76 | 76 | function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout) |
77 | 77 | { |
78 | - // list of old filters |
|
79 | - $deprecated_filters = array( |
|
80 | - 'update_registration_details' => true, |
|
81 | - 'process_payment' => true, |
|
82 | - 'finalize_registration' => true, |
|
83 | - 'and_proceed_to_payment' => true, |
|
84 | - 'proceed_to' => true, |
|
85 | - ); |
|
86 | - // loop thru and call doing_it_wrong() or remove any that aren't being used |
|
87 | - foreach ($deprecated_filters as $deprecated_filter => $on) { |
|
88 | - // was this filter called ? |
|
89 | - if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter)) { |
|
90 | - // only display doing_it_wrong() notice to Event Admins during non-AJAX requests |
|
91 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
92 | - 'ee_read_ee', |
|
93 | - 'hide_doing_it_wrong_for_deprecated_SPCO_filter' |
|
94 | - ) && ! defined('DOING_AJAX')) { |
|
95 | - EE_Error::doing_it_wrong( |
|
96 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
97 | - sprintf( |
|
98 | - esc_html__( |
|
99 | - 'The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', |
|
100 | - 'event_espresso' |
|
101 | - ), |
|
102 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
103 | - '<br />', |
|
104 | - 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
|
105 | - '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php' |
|
106 | - ), |
|
107 | - '4.6.10' |
|
108 | - ); |
|
109 | - } |
|
110 | - } else { |
|
111 | - unset($deprecated_filters[ $deprecated_filter ]); |
|
112 | - } |
|
113 | - } |
|
114 | - if (! empty($deprecated_filters)) { |
|
115 | - |
|
116 | - if ($checkout->current_step->slug( |
|
117 | - ) == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) { |
|
118 | - $submit_button_text = apply_filters( |
|
119 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', |
|
120 | - $submit_button_text |
|
121 | - ); |
|
122 | - } elseif ($checkout->current_step->slug( |
|
123 | - ) == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) { |
|
124 | - $submit_button_text = apply_filters( |
|
125 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', |
|
126 | - $submit_button_text |
|
127 | - ); |
|
128 | - } elseif ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug( |
|
129 | - ) == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) { |
|
130 | - $submit_button_text = apply_filters( |
|
131 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', |
|
132 | - $submit_button_text |
|
133 | - ); |
|
134 | - } |
|
135 | - if ($checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
136 | - if ($checkout->payment_required() && $checkout->next_step->slug( |
|
137 | - ) == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) { |
|
138 | - $submit_button_text .= apply_filters( |
|
139 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', |
|
140 | - $submit_button_text |
|
141 | - ); |
|
142 | - } |
|
143 | - if ($checkout->next_step->slug( |
|
144 | - ) != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) { |
|
145 | - $submit_button_text = apply_filters( |
|
146 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', |
|
147 | - $submit_button_text |
|
148 | - ) . $checkout->next_step->name(); |
|
149 | - } |
|
150 | - } |
|
151 | - |
|
152 | - } |
|
153 | - return $submit_button_text; |
|
78 | + // list of old filters |
|
79 | + $deprecated_filters = array( |
|
80 | + 'update_registration_details' => true, |
|
81 | + 'process_payment' => true, |
|
82 | + 'finalize_registration' => true, |
|
83 | + 'and_proceed_to_payment' => true, |
|
84 | + 'proceed_to' => true, |
|
85 | + ); |
|
86 | + // loop thru and call doing_it_wrong() or remove any that aren't being used |
|
87 | + foreach ($deprecated_filters as $deprecated_filter => $on) { |
|
88 | + // was this filter called ? |
|
89 | + if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter)) { |
|
90 | + // only display doing_it_wrong() notice to Event Admins during non-AJAX requests |
|
91 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
92 | + 'ee_read_ee', |
|
93 | + 'hide_doing_it_wrong_for_deprecated_SPCO_filter' |
|
94 | + ) && ! defined('DOING_AJAX')) { |
|
95 | + EE_Error::doing_it_wrong( |
|
96 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
97 | + sprintf( |
|
98 | + esc_html__( |
|
99 | + 'The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', |
|
100 | + 'event_espresso' |
|
101 | + ), |
|
102 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
103 | + '<br />', |
|
104 | + 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
|
105 | + '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php' |
|
106 | + ), |
|
107 | + '4.6.10' |
|
108 | + ); |
|
109 | + } |
|
110 | + } else { |
|
111 | + unset($deprecated_filters[ $deprecated_filter ]); |
|
112 | + } |
|
113 | + } |
|
114 | + if (! empty($deprecated_filters)) { |
|
115 | + |
|
116 | + if ($checkout->current_step->slug( |
|
117 | + ) == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) { |
|
118 | + $submit_button_text = apply_filters( |
|
119 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', |
|
120 | + $submit_button_text |
|
121 | + ); |
|
122 | + } elseif ($checkout->current_step->slug( |
|
123 | + ) == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) { |
|
124 | + $submit_button_text = apply_filters( |
|
125 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', |
|
126 | + $submit_button_text |
|
127 | + ); |
|
128 | + } elseif ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug( |
|
129 | + ) == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) { |
|
130 | + $submit_button_text = apply_filters( |
|
131 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', |
|
132 | + $submit_button_text |
|
133 | + ); |
|
134 | + } |
|
135 | + if ($checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
136 | + if ($checkout->payment_required() && $checkout->next_step->slug( |
|
137 | + ) == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) { |
|
138 | + $submit_button_text .= apply_filters( |
|
139 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', |
|
140 | + $submit_button_text |
|
141 | + ); |
|
142 | + } |
|
143 | + if ($checkout->next_step->slug( |
|
144 | + ) != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) { |
|
145 | + $submit_button_text = apply_filters( |
|
146 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', |
|
147 | + $submit_button_text |
|
148 | + ) . $checkout->next_step->name(); |
|
149 | + } |
|
150 | + } |
|
151 | + |
|
152 | + } |
|
153 | + return $submit_button_text; |
|
154 | 154 | |
155 | 155 | } |
156 | 156 | |
157 | 157 | add_filter( |
158 | - 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
|
159 | - 'ee_deprecated__registration_checkout__button_text', |
|
160 | - 10, |
|
161 | - 2 |
|
158 | + 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
|
159 | + 'ee_deprecated__registration_checkout__button_text', |
|
160 | + 10, |
|
161 | + 2 |
|
162 | 162 | ); |
163 | 163 | |
164 | 164 | |
@@ -170,54 +170,54 @@ discard block |
||
170 | 170 | */ |
171 | 171 | function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates) |
172 | 172 | { |
173 | - $action_ref = null; |
|
174 | - $action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction') |
|
175 | - ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
176 | - $action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction') |
|
177 | - ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
178 | - if ($action_ref) { |
|
179 | - |
|
180 | - EE_Error::doing_it_wrong( |
|
181 | - $action_ref, |
|
182 | - sprintf( |
|
183 | - esc_html__( |
|
184 | - 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', |
|
185 | - 'event_espresso' |
|
186 | - ), |
|
187 | - '<br />', |
|
188 | - '/core/business/EE_Transaction_Processor.class.php', |
|
189 | - 'AHEE__EE_Transaction_Processor__finalize', |
|
190 | - 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', |
|
191 | - 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', |
|
192 | - 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing' |
|
193 | - ), |
|
194 | - '4.6.0' |
|
195 | - ); |
|
196 | - switch ($action_ref) { |
|
197 | - case 'AHEE__EE_Transaction__finalize__new_transaction' : |
|
198 | - do_action( |
|
199 | - 'AHEE__EE_Transaction__finalize__new_transaction', |
|
200 | - $checkout->transaction, |
|
201 | - $checkout->admin_request |
|
202 | - ); |
|
203 | - break; |
|
204 | - case 'AHEE__EE_Transaction__finalize__all_transaction' : |
|
205 | - do_action( |
|
206 | - 'AHEE__EE_Transaction__finalize__new_transaction', |
|
207 | - $checkout->transaction, |
|
208 | - array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates), |
|
209 | - $checkout->admin_request |
|
210 | - ); |
|
211 | - break; |
|
212 | - } |
|
213 | - } |
|
173 | + $action_ref = null; |
|
174 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction') |
|
175 | + ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
176 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction') |
|
177 | + ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
178 | + if ($action_ref) { |
|
179 | + |
|
180 | + EE_Error::doing_it_wrong( |
|
181 | + $action_ref, |
|
182 | + sprintf( |
|
183 | + esc_html__( |
|
184 | + 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', |
|
185 | + 'event_espresso' |
|
186 | + ), |
|
187 | + '<br />', |
|
188 | + '/core/business/EE_Transaction_Processor.class.php', |
|
189 | + 'AHEE__EE_Transaction_Processor__finalize', |
|
190 | + 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', |
|
191 | + 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', |
|
192 | + 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing' |
|
193 | + ), |
|
194 | + '4.6.0' |
|
195 | + ); |
|
196 | + switch ($action_ref) { |
|
197 | + case 'AHEE__EE_Transaction__finalize__new_transaction' : |
|
198 | + do_action( |
|
199 | + 'AHEE__EE_Transaction__finalize__new_transaction', |
|
200 | + $checkout->transaction, |
|
201 | + $checkout->admin_request |
|
202 | + ); |
|
203 | + break; |
|
204 | + case 'AHEE__EE_Transaction__finalize__all_transaction' : |
|
205 | + do_action( |
|
206 | + 'AHEE__EE_Transaction__finalize__new_transaction', |
|
207 | + $checkout->transaction, |
|
208 | + array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates), |
|
209 | + $checkout->admin_request |
|
210 | + ); |
|
211 | + break; |
|
212 | + } |
|
213 | + } |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | add_action( |
217 | - 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', |
|
218 | - 'ee_deprecated_finalize_transaction', |
|
219 | - 10, |
|
220 | - 2 |
|
217 | + 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', |
|
218 | + 'ee_deprecated_finalize_transaction', |
|
219 | + 10, |
|
220 | + 2 |
|
221 | 221 | ); |
222 | 222 | /** |
223 | 223 | * ee_deprecated_finalize_registration |
@@ -226,35 +226,35 @@ discard block |
||
226 | 226 | */ |
227 | 227 | function ee_deprecated_finalize_registration(EE_Registration $registration) |
228 | 228 | { |
229 | - $action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg') |
|
230 | - ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : null; |
|
231 | - if ($action_ref) { |
|
232 | - EE_Error::doing_it_wrong( |
|
233 | - $action_ref, |
|
234 | - sprintf( |
|
235 | - esc_html__( |
|
236 | - 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', |
|
237 | - 'event_espresso' |
|
238 | - ), |
|
239 | - '<br />', |
|
240 | - '/core/business/EE_Registration_Processor.class.php', |
|
241 | - 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications' |
|
242 | - ), |
|
243 | - '4.6.0' |
|
244 | - ); |
|
245 | - do_action( |
|
246 | - 'AHEE__EE_Registration__finalize__update_and_new_reg', |
|
247 | - $registration, |
|
248 | - (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)) |
|
249 | - ); |
|
250 | - } |
|
229 | + $action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg') |
|
230 | + ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : null; |
|
231 | + if ($action_ref) { |
|
232 | + EE_Error::doing_it_wrong( |
|
233 | + $action_ref, |
|
234 | + sprintf( |
|
235 | + esc_html__( |
|
236 | + 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', |
|
237 | + 'event_espresso' |
|
238 | + ), |
|
239 | + '<br />', |
|
240 | + '/core/business/EE_Registration_Processor.class.php', |
|
241 | + 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications' |
|
242 | + ), |
|
243 | + '4.6.0' |
|
244 | + ); |
|
245 | + do_action( |
|
246 | + 'AHEE__EE_Registration__finalize__update_and_new_reg', |
|
247 | + $registration, |
|
248 | + (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)) |
|
249 | + ); |
|
250 | + } |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | add_action( |
254 | - 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', |
|
255 | - 'ee_deprecated_finalize_registration', |
|
256 | - 10, |
|
257 | - 1 |
|
254 | + 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', |
|
255 | + 'ee_deprecated_finalize_registration', |
|
256 | + 10, |
|
257 | + 1 |
|
258 | 258 | ); |
259 | 259 | |
260 | 260 | |
@@ -264,44 +264,44 @@ discard block |
||
264 | 264 | */ |
265 | 265 | function ee_deprecated_hooks() |
266 | 266 | { |
267 | - /** |
|
268 | - * @var $hooks array where keys are hook names, and their values are array{ |
|
269 | - * @type string $version when deprecated |
|
270 | - * @type string $alternative saying what to use instead |
|
271 | - * @type boolean $still_works whether or not the hook still works |
|
272 | - * } |
|
273 | - */ |
|
274 | - $hooks = array( |
|
275 | - 'AHEE__EE_System___do_setup_validations' => array( |
|
276 | - 'version' => '4.6.0', |
|
277 | - 'alternative' => esc_html__( |
|
278 | - 'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', |
|
279 | - 'event_espresso' |
|
280 | - ), |
|
281 | - 'still_works' => false, |
|
282 | - ), |
|
283 | - ); |
|
284 | - foreach ($hooks as $name => $deprecation_info) { |
|
285 | - if (has_action($name)) { |
|
286 | - EE_Error::doing_it_wrong( |
|
287 | - $name, |
|
288 | - sprintf( |
|
289 | - esc_html__('This filter is deprecated. %1$s%2$s', 'event_espresso'), |
|
290 | - $deprecation_info['still_works'] ? esc_html__( |
|
291 | - 'It *may* work as an attempt to build in backwards compatibility.', |
|
292 | - 'event_espresso' |
|
293 | - ) : esc_html__('It has been completely removed.', 'event_espresso'), |
|
294 | - isset($deprecation_info['alternative']) |
|
295 | - ? $deprecation_info['alternative'] |
|
296 | - : esc_html__( |
|
297 | - 'Please read the current EE4 documentation further or contact Support.', |
|
298 | - 'event_espresso' |
|
299 | - ) |
|
300 | - ), |
|
301 | - isset($deprecation_info['version']) ? $deprecation_info['version'] : esc_html__('recently', 'event_espresso') |
|
302 | - ); |
|
303 | - } |
|
304 | - } |
|
267 | + /** |
|
268 | + * @var $hooks array where keys are hook names, and their values are array{ |
|
269 | + * @type string $version when deprecated |
|
270 | + * @type string $alternative saying what to use instead |
|
271 | + * @type boolean $still_works whether or not the hook still works |
|
272 | + * } |
|
273 | + */ |
|
274 | + $hooks = array( |
|
275 | + 'AHEE__EE_System___do_setup_validations' => array( |
|
276 | + 'version' => '4.6.0', |
|
277 | + 'alternative' => esc_html__( |
|
278 | + 'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', |
|
279 | + 'event_espresso' |
|
280 | + ), |
|
281 | + 'still_works' => false, |
|
282 | + ), |
|
283 | + ); |
|
284 | + foreach ($hooks as $name => $deprecation_info) { |
|
285 | + if (has_action($name)) { |
|
286 | + EE_Error::doing_it_wrong( |
|
287 | + $name, |
|
288 | + sprintf( |
|
289 | + esc_html__('This filter is deprecated. %1$s%2$s', 'event_espresso'), |
|
290 | + $deprecation_info['still_works'] ? esc_html__( |
|
291 | + 'It *may* work as an attempt to build in backwards compatibility.', |
|
292 | + 'event_espresso' |
|
293 | + ) : esc_html__('It has been completely removed.', 'event_espresso'), |
|
294 | + isset($deprecation_info['alternative']) |
|
295 | + ? $deprecation_info['alternative'] |
|
296 | + : esc_html__( |
|
297 | + 'Please read the current EE4 documentation further or contact Support.', |
|
298 | + 'event_espresso' |
|
299 | + ) |
|
300 | + ), |
|
301 | + isset($deprecation_info['version']) ? $deprecation_info['version'] : esc_html__('recently', 'event_espresso') |
|
302 | + ); |
|
303 | + } |
|
304 | + } |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks'); |
@@ -316,34 +316,34 @@ discard block |
||
316 | 316 | */ |
317 | 317 | function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
318 | 318 | { |
319 | - $in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns') |
|
320 | - || has_action( |
|
321 | - 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' |
|
322 | - ); |
|
323 | - if ($in_use) { |
|
324 | - $msg = esc_html__( |
|
325 | - 'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.' |
|
326 | - . 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,' |
|
327 | - . 'use FHEE__EE_Form_Section_Proper__receive_form_submission__req_data to customize the submission data, or AHEE__EE_Form_Section_Proper__receive_form_submission__end ' |
|
328 | - . 'to add other actions after a form submission has been received.', |
|
329 | - 'event_espresso' |
|
330 | - ); |
|
331 | - EE_Error::doing_it_wrong( |
|
332 | - __CLASS__ . '::' . __FUNCTION__, |
|
333 | - $msg, |
|
334 | - '4.8.32.rc.000' |
|
335 | - ); |
|
336 | - // it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed |
|
337 | - if (is_admin() && ! defined('DOING_AJAX')) { |
|
338 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
339 | - } |
|
340 | - } |
|
341 | - return $in_use; |
|
319 | + $in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns') |
|
320 | + || has_action( |
|
321 | + 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' |
|
322 | + ); |
|
323 | + if ($in_use) { |
|
324 | + $msg = esc_html__( |
|
325 | + 'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.' |
|
326 | + . 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,' |
|
327 | + . 'use FHEE__EE_Form_Section_Proper__receive_form_submission__req_data to customize the submission data, or AHEE__EE_Form_Section_Proper__receive_form_submission__end ' |
|
328 | + . 'to add other actions after a form submission has been received.', |
|
329 | + 'event_espresso' |
|
330 | + ); |
|
331 | + EE_Error::doing_it_wrong( |
|
332 | + __CLASS__ . '::' . __FUNCTION__, |
|
333 | + $msg, |
|
334 | + '4.8.32.rc.000' |
|
335 | + ); |
|
336 | + // it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed |
|
337 | + if (is_admin() && ! defined('DOING_AJAX')) { |
|
338 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
339 | + } |
|
340 | + } |
|
341 | + return $in_use; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | add_action( |
345 | - 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', |
|
346 | - 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' |
|
345 | + 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', |
|
346 | + 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' |
|
347 | 347 | ); |
348 | 348 | |
349 | 349 | /** |
@@ -355,77 +355,77 @@ discard block |
||
355 | 355 | */ |
356 | 356 | function ee_deprecated_update_attendee_registration_form_old($admin_page) |
357 | 357 | { |
358 | - // check if the old hooks are in use. If not, do the default |
|
359 | - if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
360 | - || ! $admin_page instanceof EE_Admin_Page) { |
|
361 | - return; |
|
362 | - } |
|
363 | - $req_data = $admin_page->get_request_data(); |
|
364 | - $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : false; |
|
365 | - $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : false; |
|
366 | - $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
367 | - if (! $REG_ID || ! $qstns) { |
|
368 | - EE_Error::add_error( |
|
369 | - esc_html__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), |
|
370 | - __FILE__, |
|
371 | - __FUNCTION__, |
|
372 | - __LINE__ |
|
373 | - ); |
|
374 | - } |
|
375 | - $success = true; |
|
376 | - |
|
377 | - // allow others to get in on this awesome fun :D |
|
378 | - do_action( |
|
379 | - 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', |
|
380 | - $REG_ID, |
|
381 | - $qstns |
|
382 | - ); |
|
383 | - // loop thru questions... FINALLY!!! |
|
384 | - |
|
385 | - foreach ($qstns as $QST_ID => $qstn) { |
|
386 | - // if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
|
387 | - if (! is_array($qstn)) { |
|
388 | - $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
389 | - continue; |
|
390 | - } |
|
391 | - |
|
392 | - |
|
393 | - foreach ($qstn as $ANS_ID => $ANS_value) { |
|
394 | - // get answer |
|
395 | - $query_params = array( |
|
396 | - 0 => array( |
|
397 | - 'ANS_ID' => $ANS_ID, |
|
398 | - 'REG_ID' => $REG_ID, |
|
399 | - 'QST_ID' => $QST_ID, |
|
400 | - ), |
|
401 | - ); |
|
402 | - $answer = EEM_Answer::instance()->get_one($query_params); |
|
403 | - // this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
|
404 | - if (! $answer instanceof EE_Answer) { |
|
405 | - $set_values = array( |
|
406 | - 'QST_ID' => $QST_ID, |
|
407 | - 'REG_ID' => $REG_ID, |
|
408 | - 'ANS_value' => $qstn, |
|
409 | - ); |
|
410 | - $success = EEM_Answer::instance()->insert($set_values); |
|
411 | - continue 2; |
|
412 | - } |
|
413 | - |
|
414 | - $answer->set('ANS_value', $ANS_value); |
|
415 | - $success = $answer->save(); |
|
416 | - } |
|
417 | - } |
|
418 | - $what = esc_html__('Registration Form', 'event_espresso'); |
|
419 | - $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
420 | - $admin_page->redirect_after_action($success, $what, esc_html__('updated', 'event_espresso'), $route); |
|
421 | - exit; |
|
358 | + // check if the old hooks are in use. If not, do the default |
|
359 | + if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
360 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
361 | + return; |
|
362 | + } |
|
363 | + $req_data = $admin_page->get_request_data(); |
|
364 | + $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : false; |
|
365 | + $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : false; |
|
366 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
367 | + if (! $REG_ID || ! $qstns) { |
|
368 | + EE_Error::add_error( |
|
369 | + esc_html__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), |
|
370 | + __FILE__, |
|
371 | + __FUNCTION__, |
|
372 | + __LINE__ |
|
373 | + ); |
|
374 | + } |
|
375 | + $success = true; |
|
376 | + |
|
377 | + // allow others to get in on this awesome fun :D |
|
378 | + do_action( |
|
379 | + 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', |
|
380 | + $REG_ID, |
|
381 | + $qstns |
|
382 | + ); |
|
383 | + // loop thru questions... FINALLY!!! |
|
384 | + |
|
385 | + foreach ($qstns as $QST_ID => $qstn) { |
|
386 | + // if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
|
387 | + if (! is_array($qstn)) { |
|
388 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
389 | + continue; |
|
390 | + } |
|
391 | + |
|
392 | + |
|
393 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
394 | + // get answer |
|
395 | + $query_params = array( |
|
396 | + 0 => array( |
|
397 | + 'ANS_ID' => $ANS_ID, |
|
398 | + 'REG_ID' => $REG_ID, |
|
399 | + 'QST_ID' => $QST_ID, |
|
400 | + ), |
|
401 | + ); |
|
402 | + $answer = EEM_Answer::instance()->get_one($query_params); |
|
403 | + // this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
|
404 | + if (! $answer instanceof EE_Answer) { |
|
405 | + $set_values = array( |
|
406 | + 'QST_ID' => $QST_ID, |
|
407 | + 'REG_ID' => $REG_ID, |
|
408 | + 'ANS_value' => $qstn, |
|
409 | + ); |
|
410 | + $success = EEM_Answer::instance()->insert($set_values); |
|
411 | + continue 2; |
|
412 | + } |
|
413 | + |
|
414 | + $answer->set('ANS_value', $ANS_value); |
|
415 | + $success = $answer->save(); |
|
416 | + } |
|
417 | + } |
|
418 | + $what = esc_html__('Registration Form', 'event_espresso'); |
|
419 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
420 | + $admin_page->redirect_after_action($success, $what, esc_html__('updated', 'event_espresso'), $route); |
|
421 | + exit; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | add_action( |
425 | - 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', |
|
426 | - 'ee_deprecated_update_attendee_registration_form_old', |
|
427 | - 10, |
|
428 | - 1 |
|
425 | + 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', |
|
426 | + 'ee_deprecated_update_attendee_registration_form_old', |
|
427 | + 10, |
|
428 | + 1 |
|
429 | 429 | ); |
430 | 430 | /** |
431 | 431 | * Render the registration admin page's custom questions area in the old fashion |
@@ -441,50 +441,50 @@ discard block |
||
441 | 441 | */ |
442 | 442 | function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration) |
443 | 443 | { |
444 | - // check if the old hooks are in use. If not, do the default |
|
445 | - if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
446 | - || ! $admin_page instanceof EE_Admin_Page) { |
|
447 | - return $do_default_action; |
|
448 | - } |
|
449 | - add_filter( |
|
450 | - 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', |
|
451 | - array($admin_page, 'form_before_question_group'), |
|
452 | - 10, |
|
453 | - 1 |
|
454 | - ); |
|
455 | - add_filter( |
|
456 | - 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', |
|
457 | - array($admin_page, 'form_after_question_group'), |
|
458 | - 10, |
|
459 | - 1 |
|
460 | - ); |
|
461 | - add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1); |
|
462 | - add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1); |
|
463 | - |
|
464 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( |
|
465 | - $registration, |
|
466 | - $registration->get( |
|
467 | - 'EVT_ID' |
|
468 | - ) |
|
469 | - ); |
|
470 | - |
|
471 | - EE_Registry::instance()->load_helper('Form_Fields'); |
|
472 | - $template_args = array( |
|
473 | - 'att_questions' => EEH_Form_Fields::generate_question_groups_html($question_groups), |
|
474 | - 'reg_questions_form_action' => 'edit_registration', |
|
475 | - 'REG_ID' => $registration->ID(), |
|
476 | - ); |
|
477 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
478 | - echo EEH_Template::display_template($template_path, $template_args, true); |
|
479 | - // indicate that we should not do the default admin page code |
|
480 | - return false; |
|
444 | + // check if the old hooks are in use. If not, do the default |
|
445 | + if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
446 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
447 | + return $do_default_action; |
|
448 | + } |
|
449 | + add_filter( |
|
450 | + 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', |
|
451 | + array($admin_page, 'form_before_question_group'), |
|
452 | + 10, |
|
453 | + 1 |
|
454 | + ); |
|
455 | + add_filter( |
|
456 | + 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', |
|
457 | + array($admin_page, 'form_after_question_group'), |
|
458 | + 10, |
|
459 | + 1 |
|
460 | + ); |
|
461 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1); |
|
462 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1); |
|
463 | + |
|
464 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( |
|
465 | + $registration, |
|
466 | + $registration->get( |
|
467 | + 'EVT_ID' |
|
468 | + ) |
|
469 | + ); |
|
470 | + |
|
471 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
472 | + $template_args = array( |
|
473 | + 'att_questions' => EEH_Form_Fields::generate_question_groups_html($question_groups), |
|
474 | + 'reg_questions_form_action' => 'edit_registration', |
|
475 | + 'REG_ID' => $registration->ID(), |
|
476 | + ); |
|
477 | + $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
478 | + echo EEH_Template::display_template($template_path, $template_args, true); |
|
479 | + // indicate that we should not do the default admin page code |
|
480 | + return false; |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | add_action( |
484 | - 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', |
|
485 | - 'ee_deprecated_reg_questions_meta_box_old', |
|
486 | - 10, |
|
487 | - 3 |
|
484 | + 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', |
|
485 | + 'ee_deprecated_reg_questions_meta_box_old', |
|
486 | + 10, |
|
487 | + 3 |
|
488 | 488 | ); |
489 | 489 | |
490 | 490 | |
@@ -501,42 +501,42 @@ discard block |
||
501 | 501 | class EE_Message_Template_Defaults extends EE_Base |
502 | 502 | { |
503 | 503 | |
504 | - /** |
|
505 | - * EE_Message_Template_Defaults constructor. |
|
506 | - * |
|
507 | - * @param EE_messages $messages |
|
508 | - * @param $messenger_name |
|
509 | - * @param $message_type_name |
|
510 | - * @param int $GRP_ID |
|
511 | - * @return EE_Messages_Template_Defaults |
|
512 | - */ |
|
513 | - public function __construct( |
|
514 | - EE_messages $messages, |
|
515 | - $messenger_name, |
|
516 | - $message_type_name, |
|
517 | - $GRP_ID = 0 |
|
518 | - ) { |
|
519 | - EE_Error::doing_it_wrong( |
|
520 | - __FUNCTION__, |
|
521 | - esc_html__( |
|
522 | - 'The class EE_Message_Template_Defaults has been deprecated and replaced by EE_Messages_Template_Defaults.', |
|
523 | - 'event_espresso' |
|
524 | - ), |
|
525 | - '4.9.0' |
|
526 | - ); |
|
527 | - /** @var EE_Message_Resource_Manager $message_resource_manager */ |
|
528 | - $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
529 | - $messenger = $message_resource_manager->get_messenger($messenger_name); |
|
530 | - $message_type = $message_resource_manager->get_message_type($message_type_name); |
|
531 | - return EE_Registry::instance()->load_lib( |
|
532 | - 'Messages_Template_Defaults', |
|
533 | - array( |
|
534 | - $GRP_ID, |
|
535 | - $messenger, |
|
536 | - $message_type, |
|
537 | - ) |
|
538 | - ); |
|
539 | - } |
|
504 | + /** |
|
505 | + * EE_Message_Template_Defaults constructor. |
|
506 | + * |
|
507 | + * @param EE_messages $messages |
|
508 | + * @param $messenger_name |
|
509 | + * @param $message_type_name |
|
510 | + * @param int $GRP_ID |
|
511 | + * @return EE_Messages_Template_Defaults |
|
512 | + */ |
|
513 | + public function __construct( |
|
514 | + EE_messages $messages, |
|
515 | + $messenger_name, |
|
516 | + $message_type_name, |
|
517 | + $GRP_ID = 0 |
|
518 | + ) { |
|
519 | + EE_Error::doing_it_wrong( |
|
520 | + __FUNCTION__, |
|
521 | + esc_html__( |
|
522 | + 'The class EE_Message_Template_Defaults has been deprecated and replaced by EE_Messages_Template_Defaults.', |
|
523 | + 'event_espresso' |
|
524 | + ), |
|
525 | + '4.9.0' |
|
526 | + ); |
|
527 | + /** @var EE_Message_Resource_Manager $message_resource_manager */ |
|
528 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
529 | + $messenger = $message_resource_manager->get_messenger($messenger_name); |
|
530 | + $message_type = $message_resource_manager->get_message_type($message_type_name); |
|
531 | + return EE_Registry::instance()->load_lib( |
|
532 | + 'Messages_Template_Defaults', |
|
533 | + array( |
|
534 | + $GRP_ID, |
|
535 | + $messenger, |
|
536 | + $message_type, |
|
537 | + ) |
|
538 | + ); |
|
539 | + } |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | |
@@ -554,525 +554,525 @@ discard block |
||
554 | 554 | class EE_messages |
555 | 555 | { |
556 | 556 | |
557 | - /** @type EE_messenger[] */ |
|
558 | - protected $_active_messengers = array(); |
|
559 | - |
|
560 | - /** @type array */ |
|
561 | - protected $_active_message_types = array(); |
|
562 | - |
|
563 | - /** @type EE_message_type[] */ |
|
564 | - protected $_installed_message_types = array(); |
|
565 | - |
|
566 | - /** @type EE_messenger */ |
|
567 | - protected $_messenger; |
|
568 | - |
|
569 | - /** @type EE_message_type */ |
|
570 | - protected $_message_type; |
|
571 | - |
|
572 | - /** @type array */ |
|
573 | - protected $_contexts = array(); |
|
574 | - |
|
575 | - /** @type EE_Message_Resource_Manager $_message_resource_manager */ |
|
576 | - protected $_message_resource_manager; |
|
577 | - |
|
578 | - |
|
579 | - /** |
|
580 | - * EE_messages constructor. |
|
581 | - * |
|
582 | - * @deprecated 4.9.0 |
|
583 | - */ |
|
584 | - public function __construct() |
|
585 | - { |
|
586 | - } |
|
587 | - |
|
588 | - |
|
589 | - /** |
|
590 | - * @param string $method |
|
591 | - */ |
|
592 | - public function _class_is_deprecated($method) |
|
593 | - { |
|
594 | - EE_Error::doing_it_wrong( |
|
595 | - 'EE_messages::' . $method, |
|
596 | - esc_html__('EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.'), |
|
597 | - '4.9.0', |
|
598 | - '4.10.0.p' |
|
599 | - ); |
|
600 | - // Please use EE_Message_Resource_Manager instead |
|
601 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
602 | - } |
|
603 | - |
|
604 | - |
|
605 | - /** |
|
606 | - * @deprecated 4.9.0 |
|
607 | - * @param string $messenger_name |
|
608 | - * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive |
|
609 | - */ |
|
610 | - public function ensure_messenger_is_active($messenger_name) |
|
611 | - { |
|
612 | - // EE_messages has been deprecated |
|
613 | - $this->_class_is_deprecated(__FUNCTION__); |
|
614 | - return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name); |
|
615 | - } |
|
616 | - |
|
617 | - |
|
618 | - /** |
|
619 | - * @deprecated 4.9.0 |
|
620 | - * @param string $message_type message type name |
|
621 | - * @param $messenger |
|
622 | - * @return bool true if it got activated (or was active) and false if not. |
|
623 | - * @throws \EE_Error |
|
624 | - */ |
|
625 | - public function ensure_message_type_is_active($message_type, $messenger) |
|
626 | - { |
|
627 | - // EE_messages has been deprecated |
|
628 | - $this->_class_is_deprecated(__FUNCTION__); |
|
629 | - return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger); |
|
630 | - } |
|
631 | - |
|
632 | - |
|
633 | - /** |
|
634 | - * @deprecated 4.9.0 |
|
635 | - * @param string $messenger_name |
|
636 | - * @param array $mts_to_activate (optional) An array of message types to activate with this messenger. |
|
637 | - * If included we do NOT setup the default message types (assuming they |
|
638 | - * are already setup.) |
|
639 | - * @return boolean an array of generated templates or false if nothing generated/activated. |
|
640 | - */ |
|
641 | - public function activate_messenger($messenger_name, $mts_to_activate = array()) |
|
642 | - { |
|
643 | - // EE_messages has been deprecated |
|
644 | - $this->_class_is_deprecated(__FUNCTION__); |
|
645 | - return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate); |
|
646 | - } |
|
647 | - |
|
648 | - |
|
649 | - /** |
|
650 | - * @deprecated 4.9.0 |
|
651 | - * @param EE_messenger $messenger messenger used in trigger |
|
652 | - * @param EE_message_type $message_type message type used in trigger |
|
653 | - * |
|
654 | - * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
|
655 | - */ |
|
656 | - public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) |
|
657 | - { |
|
658 | - // EE_messages has been deprecated |
|
659 | - $this->_class_is_deprecated(__FUNCTION__); |
|
660 | - return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type); |
|
661 | - } |
|
662 | - |
|
663 | - |
|
664 | - /** |
|
665 | - * @deprecated 4.9.0 |
|
666 | - * @param string $messenger |
|
667 | - * @return EE_messenger | null |
|
668 | - */ |
|
669 | - public function get_messenger_if_active($messenger) |
|
670 | - { |
|
671 | - // EE_messages has been deprecated |
|
672 | - $this->_class_is_deprecated(__FUNCTION__); |
|
673 | - return $this->_message_resource_manager->get_active_messenger($messenger); |
|
674 | - } |
|
675 | - |
|
676 | - |
|
677 | - /** |
|
678 | - * @deprecated 4.9.0 |
|
679 | - * @param EE_Message $message |
|
680 | - * @return array An array with 'messenger' and 'message_type' as the index and the corresponding valid object if |
|
681 | - * available. |
|
682 | - * Eg. Valid Messenger and Message Type: |
|
683 | - * array( |
|
684 | - * 'messenger' => new EE_Email_messenger(), |
|
685 | - * 'message_type' => new EE_Registration_Approved_message_type() |
|
686 | - * ) |
|
687 | - * Valid Messenger and Invalid Message Type: |
|
688 | - * array( |
|
689 | - * 'messenger' => new EE_Email_messenger(), |
|
690 | - * 'message_type' => null |
|
691 | - * ) |
|
692 | - */ |
|
693 | - public function validate_for_use(EE_Message $message) |
|
694 | - { |
|
695 | - // EE_messages has been deprecated |
|
696 | - $this->_class_is_deprecated(__FUNCTION__); |
|
697 | - return array( |
|
698 | - 'messenger' => $message->messenger_object(), |
|
699 | - 'message_type' => $message->message_type_object(), |
|
700 | - ); |
|
701 | - } |
|
702 | - |
|
703 | - |
|
704 | - /** |
|
705 | - * @deprecated 4.9.0 |
|
706 | - * @param string $type What type of message are we sending (corresponds to message types) |
|
707 | - * @param mixed $vars Data being sent for parsing in the message |
|
708 | - * @param string $sending_messenger if included then we ONLY use the specified messenger for delivery. |
|
709 | - * Otherwise we cycle through all active messengers. |
|
710 | - * @param string $generating_messenger if included then this messenger is used for generating the message |
|
711 | - * templates (but not for sending). |
|
712 | - * @param string $context If included then only a message type for a specific context will be |
|
713 | - * generated. |
|
714 | - * @param bool $send Default TRUE. If false, then this will just return the generated |
|
715 | - * EE_messages objects which might be used by the trigger to setup a batch |
|
716 | - * message (typically html messenger uses it). |
|
717 | - * @return bool |
|
718 | - */ |
|
719 | - public function send_message( |
|
720 | - $type, |
|
721 | - $vars, |
|
722 | - $sending_messenger = '', |
|
723 | - $generating_messenger = '', |
|
724 | - $context = '', |
|
725 | - $send = true |
|
726 | - ) { |
|
727 | - // EE_messages has been deprecated |
|
728 | - $this->_class_is_deprecated(__FUNCTION__); |
|
729 | - /** @type EE_Messages_Processor $processor */ |
|
730 | - $processor = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
731 | - $error = false; |
|
732 | - // try to intelligently determine what method we'll call based on the incoming data. |
|
733 | - // if generating and sending are different then generate and send immediately. |
|
734 | - if (! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
735 | - // in the legacy system, when generating and sending were different, that means all the |
|
736 | - // vars are already in the request object. So let's just use that. |
|
737 | - try { |
|
738 | - /** @type EE_Message_To_Generate_From_Request $mtg */ |
|
739 | - $mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
740 | - $processor->generate_and_send_now($mtg); |
|
741 | - } catch (EE_Error $e) { |
|
742 | - $error_msg = esc_html__( |
|
743 | - 'Please note that a system message failed to send due to a technical issue.', |
|
744 | - 'event_espresso' |
|
745 | - ); |
|
746 | - // add specific message for developers if WP_DEBUG in on |
|
747 | - $error_msg .= '||' . $e->getMessage(); |
|
748 | - EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
749 | - $error = true; |
|
750 | - } |
|
751 | - } else { |
|
752 | - $processor->generate_for_all_active_messengers($type, $vars, $send); |
|
753 | - // let's find out if there were any errors and how many successfully were queued. |
|
754 | - $count_errors = $processor->get_queue()->count_STS_in_queue( |
|
755 | - array(EEM_Message::status_failed, EEM_Message::status_debug_only) |
|
756 | - ); |
|
757 | - $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
758 | - $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry); |
|
759 | - $count_errors = $count_errors + $count_retry; |
|
760 | - if ($count_errors > 0) { |
|
761 | - $error = true; |
|
762 | - if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) { |
|
763 | - $message = sprintf( |
|
764 | - esc_html__( |
|
765 | - 'There were %d errors and %d messages successfully queued for generation and sending', |
|
766 | - 'event_espresso' |
|
767 | - ), |
|
768 | - $count_errors, |
|
769 | - $count_queued |
|
770 | - ); |
|
771 | - } elseif ($count_errors > 1 && $count_queued === 1) { |
|
772 | - $message = sprintf( |
|
773 | - esc_html__( |
|
774 | - 'There were %d errors and %d message successfully queued for generation.', |
|
775 | - 'event_espresso' |
|
776 | - ), |
|
777 | - $count_errors, |
|
778 | - $count_queued |
|
779 | - ); |
|
780 | - } elseif ($count_errors === 1 && $count_queued > 1) { |
|
781 | - $message = sprintf( |
|
782 | - esc_html__( |
|
783 | - 'There was %d error and %d messages successfully queued for generation.', |
|
784 | - 'event_espresso' |
|
785 | - ), |
|
786 | - $count_errors, |
|
787 | - $count_queued |
|
788 | - ); |
|
789 | - } else { |
|
790 | - $message = sprintf( |
|
791 | - esc_html__( |
|
792 | - 'There was %d message that failed to be queued for generation.', |
|
793 | - 'event_espresso' |
|
794 | - ), |
|
795 | - $count_errors |
|
796 | - ); |
|
797 | - } |
|
798 | - EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__); |
|
799 | - } else { |
|
800 | - if ($count_queued === 1) { |
|
801 | - $message = sprintf( |
|
802 | - esc_html__( |
|
803 | - '%d message successfully queued for generation.', |
|
804 | - 'event_espresso' |
|
805 | - ), |
|
806 | - $count_queued |
|
807 | - ); |
|
808 | - } else { |
|
809 | - $message = sprintf( |
|
810 | - esc_html__( |
|
811 | - '%d messages were successfully queued for generation.', |
|
812 | - 'event_espresso' |
|
813 | - ), |
|
814 | - $count_queued |
|
815 | - ); |
|
816 | - } |
|
817 | - EE_Error::add_success($message); |
|
818 | - } |
|
819 | - } |
|
820 | - // if no error then return the generated message(s). |
|
821 | - if (! $error && ! $send) { |
|
822 | - $generated_queue = $processor->generate_queue(false); |
|
823 | - // get message and return. |
|
824 | - $generated_queue->get_message_repository()->rewind(); |
|
825 | - $messages = array(); |
|
826 | - while ($generated_queue->get_message_repository()->valid()) { |
|
827 | - $message = $generated_queue->get_message_repository()->current(); |
|
828 | - if ($message instanceof EE_Message) { |
|
829 | - // set properties that might be expected by add-ons (backward compat) |
|
830 | - $message->content = $message->content(); |
|
831 | - $message->template_pack = $message->get_template_pack(); |
|
832 | - $message->template_variation = $message->get_template_pack_variation(); |
|
833 | - $messages[] = $message; |
|
834 | - } |
|
835 | - $generated_queue->get_message_repository()->next(); |
|
836 | - } |
|
837 | - return $messages; |
|
838 | - } |
|
839 | - return $error ? false |
|
840 | - : true; // yeah backwards eh? Really what we're returning is if there is a total success for all the messages or not. We'll modify this once we get message recording in place. |
|
841 | - } |
|
842 | - |
|
843 | - |
|
844 | - /** |
|
845 | - * @deprecated 4.9.0 |
|
846 | - * @param string $type This should correspond with a valid message type |
|
847 | - * @param string $context This should correspond with a valid context for the message type |
|
848 | - * @param string $messenger This should correspond with a valid messenger. |
|
849 | - * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular |
|
850 | - * preview |
|
851 | - * @return string The body of the message. |
|
852 | - */ |
|
853 | - public function preview_message($type, $context, $messenger, $send = false) |
|
854 | - { |
|
855 | - // EE_messages has been deprecated |
|
856 | - $this->_class_is_deprecated(__FUNCTION__); |
|
857 | - return EED_Messages::preview_message($type, $context, $messenger, $send); |
|
858 | - } |
|
859 | - |
|
860 | - |
|
861 | - /** |
|
862 | - * @since 4.5.0 |
|
863 | - * @deprecated 4.9.0 Moved to EED_Messages Module |
|
864 | - * @param string $messenger a string matching a valid active messenger in the system |
|
865 | - * @param string $message_type Although it seems contrary to the name of the method, a message type name is still |
|
866 | - * required to send along the message type to the messenger because this is used for |
|
867 | - * determining what specific variations might be loaded for the generated message. |
|
868 | - * @param stdClass $message a stdClass object in the format expected by the messenger. |
|
869 | - * |
|
870 | - * @return bool success or fail. |
|
871 | - */ |
|
872 | - public function send_message_with_messenger_only($messenger, $message_type, $message) |
|
873 | - { |
|
874 | - // EE_messages has been deprecated |
|
875 | - $this->_class_is_deprecated(__FUNCTION__); |
|
876 | - // setup for sending to new method. |
|
877 | - /** @type EE_Messages_Queue $queue */ |
|
878 | - $queue = EE_Registry::instance()->load_lib('Messages_Queue'); |
|
879 | - // make sure we have a proper message object |
|
880 | - if (! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
881 | - $msg = EE_Message_Factory::create( |
|
882 | - array( |
|
883 | - 'MSG_messenger' => $messenger, |
|
884 | - 'MSG_message_type' => $message_type, |
|
885 | - 'MSG_content' => $message->content, |
|
886 | - 'MSG_subject' => $message->subject, |
|
887 | - ) |
|
888 | - ); |
|
889 | - } else { |
|
890 | - $msg = $message; |
|
891 | - } |
|
892 | - if (! $msg instanceof EE_Message) { |
|
893 | - return false; |
|
894 | - } |
|
895 | - // make sure any content in a content property (if not empty) is set on the MSG_content. |
|
896 | - if (! empty($msg->content)) { |
|
897 | - $msg->set('MSG_content', $msg->content); |
|
898 | - } |
|
899 | - $queue->add($msg); |
|
900 | - return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue); |
|
901 | - } |
|
902 | - |
|
903 | - |
|
904 | - /** |
|
905 | - * @deprecated 4.9.0 |
|
906 | - * @param $messenger |
|
907 | - * @param string $message_type message type that the templates are being created for |
|
908 | - * @param int $GRP_ID |
|
909 | - * @param bool $is_global |
|
910 | - * @return array|object if creation is successful then we return an array of info, otherwise an error_object is |
|
911 | - * returned. |
|
912 | - * @throws \EE_Error |
|
913 | - */ |
|
914 | - public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) |
|
915 | - { |
|
916 | - // EE_messages has been deprecated |
|
917 | - $this->_class_is_deprecated(__FUNCTION__); |
|
918 | - EE_Registry::instance()->load_helper('MSG_Template'); |
|
919 | - return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global); |
|
920 | - } |
|
921 | - |
|
922 | - |
|
923 | - /** |
|
924 | - * @deprecated 4.9.0 |
|
925 | - * @param string $messenger_name name of EE_messenger |
|
926 | - * @param string $message_type_name name of EE_message_type |
|
927 | - * @return array |
|
928 | - */ |
|
929 | - public function get_fields($messenger_name, $message_type_name) |
|
930 | - { |
|
931 | - // EE_messages has been deprecated |
|
932 | - $this->_class_is_deprecated(__FUNCTION__); |
|
933 | - EE_Registry::instance()->load_helper('MSG_Template'); |
|
934 | - return EEH_MSG_Template::get_fields($messenger_name, $message_type_name); |
|
935 | - } |
|
936 | - |
|
937 | - |
|
938 | - /** |
|
939 | - * @deprecated 4.9.0 |
|
940 | - * @access public |
|
941 | - * @param string $type we can indicate just returning installed message types |
|
942 | - * or messengers (or both) via this parameter. |
|
943 | - * @param bool $skip_cache if true then we skip the cache and retrieve via files. |
|
944 | - * @return array multidimensional array of messenger and message_type objects |
|
945 | - * (messengers index, and message_type index); |
|
946 | - */ |
|
947 | - public function get_installed($type = 'all', $skip_cache = false) |
|
948 | - { |
|
949 | - // EE_messages has been deprecated |
|
950 | - $this->_class_is_deprecated(__FUNCTION__); |
|
951 | - if ($skip_cache) { |
|
952 | - $this->_message_resource_manager->reset_active_messengers_and_message_types(); |
|
953 | - } |
|
954 | - switch ($type) { |
|
955 | - case 'messengers' : |
|
956 | - return array( |
|
957 | - 'messenger' => $this->_message_resource_manager->installed_messengers(), |
|
958 | - ); |
|
959 | - break; |
|
960 | - case 'message_types' : |
|
961 | - return array( |
|
962 | - 'message_type' => $this->_message_resource_manager->installed_message_types(), |
|
963 | - ); |
|
964 | - break; |
|
965 | - case 'all' : |
|
966 | - default : |
|
967 | - return array( |
|
968 | - 'messenger' => $this->_message_resource_manager->installed_messengers(), |
|
969 | - 'message_type' => $this->_message_resource_manager->installed_message_types(), |
|
970 | - ); |
|
971 | - break; |
|
972 | - } |
|
973 | - } |
|
974 | - |
|
975 | - |
|
976 | - /** |
|
977 | - * @deprecated 4.9.0 |
|
978 | - * @return \EE_messenger[] |
|
979 | - */ |
|
980 | - public function get_active_messengers() |
|
981 | - { |
|
982 | - // EE_messages has been deprecated |
|
983 | - $this->_class_is_deprecated(__FUNCTION__); |
|
984 | - return $this->_message_resource_manager->active_messengers(); |
|
985 | - } |
|
986 | - |
|
987 | - |
|
988 | - /** |
|
989 | - * @deprecated 4.9.0 |
|
990 | - * @return array array of message_type references (string) |
|
991 | - */ |
|
992 | - public function get_active_message_types() |
|
993 | - { |
|
994 | - // EE_messages has been deprecated |
|
995 | - $this->_class_is_deprecated(__FUNCTION__); |
|
996 | - return $this->_message_resource_manager->list_of_active_message_types(); |
|
997 | - } |
|
998 | - |
|
999 | - |
|
1000 | - /** |
|
1001 | - * @deprecated 4.9.0 |
|
1002 | - * @return EE_message_type[] |
|
1003 | - */ |
|
1004 | - public function get_active_message_type_objects() |
|
1005 | - { |
|
1006 | - // EE_messages has been deprecated |
|
1007 | - $this->_class_is_deprecated(__FUNCTION__); |
|
1008 | - return $this->_message_resource_manager->get_active_message_type_objects(); |
|
1009 | - } |
|
1010 | - |
|
1011 | - |
|
1012 | - /** |
|
1013 | - * @deprecated 4.9.0 |
|
1014 | - * @since 4.5.0 |
|
1015 | - * @param string $messenger The messenger being checked |
|
1016 | - * @return EE_message_type[] (or empty array if none present) |
|
1017 | - */ |
|
1018 | - public function get_active_message_types_per_messenger($messenger) |
|
1019 | - { |
|
1020 | - // EE_messages has been deprecated |
|
1021 | - $this->_class_is_deprecated(__FUNCTION__); |
|
1022 | - return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger); |
|
1023 | - } |
|
1024 | - |
|
1025 | - |
|
1026 | - /** |
|
1027 | - * @deprecated 4.9.0 |
|
1028 | - * @param string $messenger The string should correspond to the messenger (message types are |
|
1029 | - * @param string $message_type The string should correspond to a message type. |
|
1030 | - * @return EE_message_type|null |
|
1031 | - */ |
|
1032 | - public function get_active_message_type($messenger, $message_type) |
|
1033 | - { |
|
1034 | - // EE_messages has been deprecated |
|
1035 | - $this->_class_is_deprecated(__FUNCTION__); |
|
1036 | - return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type); |
|
1037 | - } |
|
1038 | - |
|
1039 | - |
|
1040 | - /** |
|
1041 | - * @deprecated 4.9.0 |
|
1042 | - * @return array|\EE_message_type[] |
|
1043 | - */ |
|
1044 | - public function get_installed_message_types() |
|
1045 | - { |
|
1046 | - // EE_messages has been deprecated |
|
1047 | - $this->_class_is_deprecated(__FUNCTION__); |
|
1048 | - return $this->_message_resource_manager->installed_message_types(); |
|
1049 | - } |
|
1050 | - |
|
1051 | - |
|
1052 | - /** |
|
1053 | - * @deprecated 4.9.0 |
|
1054 | - * @return array |
|
1055 | - */ |
|
1056 | - public function get_installed_messengers() |
|
1057 | - { |
|
1058 | - // EE_messages has been deprecated |
|
1059 | - $this->_class_is_deprecated(__FUNCTION__); |
|
1060 | - return $this->_message_resource_manager->installed_messengers(); |
|
1061 | - } |
|
1062 | - |
|
1063 | - |
|
1064 | - /** |
|
1065 | - * @deprecated 4.9.0 |
|
1066 | - * @param bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by |
|
1067 | - * message type. |
|
1068 | - * @return array |
|
1069 | - */ |
|
1070 | - public function get_all_contexts($slugs_only = true) |
|
1071 | - { |
|
1072 | - // EE_messages has been deprecated |
|
1073 | - $this->_class_is_deprecated(__FUNCTION__); |
|
1074 | - return $this->_message_resource_manager->get_all_contexts($slugs_only); |
|
1075 | - } |
|
557 | + /** @type EE_messenger[] */ |
|
558 | + protected $_active_messengers = array(); |
|
559 | + |
|
560 | + /** @type array */ |
|
561 | + protected $_active_message_types = array(); |
|
562 | + |
|
563 | + /** @type EE_message_type[] */ |
|
564 | + protected $_installed_message_types = array(); |
|
565 | + |
|
566 | + /** @type EE_messenger */ |
|
567 | + protected $_messenger; |
|
568 | + |
|
569 | + /** @type EE_message_type */ |
|
570 | + protected $_message_type; |
|
571 | + |
|
572 | + /** @type array */ |
|
573 | + protected $_contexts = array(); |
|
574 | + |
|
575 | + /** @type EE_Message_Resource_Manager $_message_resource_manager */ |
|
576 | + protected $_message_resource_manager; |
|
577 | + |
|
578 | + |
|
579 | + /** |
|
580 | + * EE_messages constructor. |
|
581 | + * |
|
582 | + * @deprecated 4.9.0 |
|
583 | + */ |
|
584 | + public function __construct() |
|
585 | + { |
|
586 | + } |
|
587 | + |
|
588 | + |
|
589 | + /** |
|
590 | + * @param string $method |
|
591 | + */ |
|
592 | + public function _class_is_deprecated($method) |
|
593 | + { |
|
594 | + EE_Error::doing_it_wrong( |
|
595 | + 'EE_messages::' . $method, |
|
596 | + esc_html__('EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.'), |
|
597 | + '4.9.0', |
|
598 | + '4.10.0.p' |
|
599 | + ); |
|
600 | + // Please use EE_Message_Resource_Manager instead |
|
601 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
602 | + } |
|
603 | + |
|
604 | + |
|
605 | + /** |
|
606 | + * @deprecated 4.9.0 |
|
607 | + * @param string $messenger_name |
|
608 | + * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive |
|
609 | + */ |
|
610 | + public function ensure_messenger_is_active($messenger_name) |
|
611 | + { |
|
612 | + // EE_messages has been deprecated |
|
613 | + $this->_class_is_deprecated(__FUNCTION__); |
|
614 | + return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name); |
|
615 | + } |
|
616 | + |
|
617 | + |
|
618 | + /** |
|
619 | + * @deprecated 4.9.0 |
|
620 | + * @param string $message_type message type name |
|
621 | + * @param $messenger |
|
622 | + * @return bool true if it got activated (or was active) and false if not. |
|
623 | + * @throws \EE_Error |
|
624 | + */ |
|
625 | + public function ensure_message_type_is_active($message_type, $messenger) |
|
626 | + { |
|
627 | + // EE_messages has been deprecated |
|
628 | + $this->_class_is_deprecated(__FUNCTION__); |
|
629 | + return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger); |
|
630 | + } |
|
631 | + |
|
632 | + |
|
633 | + /** |
|
634 | + * @deprecated 4.9.0 |
|
635 | + * @param string $messenger_name |
|
636 | + * @param array $mts_to_activate (optional) An array of message types to activate with this messenger. |
|
637 | + * If included we do NOT setup the default message types (assuming they |
|
638 | + * are already setup.) |
|
639 | + * @return boolean an array of generated templates or false if nothing generated/activated. |
|
640 | + */ |
|
641 | + public function activate_messenger($messenger_name, $mts_to_activate = array()) |
|
642 | + { |
|
643 | + // EE_messages has been deprecated |
|
644 | + $this->_class_is_deprecated(__FUNCTION__); |
|
645 | + return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate); |
|
646 | + } |
|
647 | + |
|
648 | + |
|
649 | + /** |
|
650 | + * @deprecated 4.9.0 |
|
651 | + * @param EE_messenger $messenger messenger used in trigger |
|
652 | + * @param EE_message_type $message_type message type used in trigger |
|
653 | + * |
|
654 | + * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
|
655 | + */ |
|
656 | + public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) |
|
657 | + { |
|
658 | + // EE_messages has been deprecated |
|
659 | + $this->_class_is_deprecated(__FUNCTION__); |
|
660 | + return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type); |
|
661 | + } |
|
662 | + |
|
663 | + |
|
664 | + /** |
|
665 | + * @deprecated 4.9.0 |
|
666 | + * @param string $messenger |
|
667 | + * @return EE_messenger | null |
|
668 | + */ |
|
669 | + public function get_messenger_if_active($messenger) |
|
670 | + { |
|
671 | + // EE_messages has been deprecated |
|
672 | + $this->_class_is_deprecated(__FUNCTION__); |
|
673 | + return $this->_message_resource_manager->get_active_messenger($messenger); |
|
674 | + } |
|
675 | + |
|
676 | + |
|
677 | + /** |
|
678 | + * @deprecated 4.9.0 |
|
679 | + * @param EE_Message $message |
|
680 | + * @return array An array with 'messenger' and 'message_type' as the index and the corresponding valid object if |
|
681 | + * available. |
|
682 | + * Eg. Valid Messenger and Message Type: |
|
683 | + * array( |
|
684 | + * 'messenger' => new EE_Email_messenger(), |
|
685 | + * 'message_type' => new EE_Registration_Approved_message_type() |
|
686 | + * ) |
|
687 | + * Valid Messenger and Invalid Message Type: |
|
688 | + * array( |
|
689 | + * 'messenger' => new EE_Email_messenger(), |
|
690 | + * 'message_type' => null |
|
691 | + * ) |
|
692 | + */ |
|
693 | + public function validate_for_use(EE_Message $message) |
|
694 | + { |
|
695 | + // EE_messages has been deprecated |
|
696 | + $this->_class_is_deprecated(__FUNCTION__); |
|
697 | + return array( |
|
698 | + 'messenger' => $message->messenger_object(), |
|
699 | + 'message_type' => $message->message_type_object(), |
|
700 | + ); |
|
701 | + } |
|
702 | + |
|
703 | + |
|
704 | + /** |
|
705 | + * @deprecated 4.9.0 |
|
706 | + * @param string $type What type of message are we sending (corresponds to message types) |
|
707 | + * @param mixed $vars Data being sent for parsing in the message |
|
708 | + * @param string $sending_messenger if included then we ONLY use the specified messenger for delivery. |
|
709 | + * Otherwise we cycle through all active messengers. |
|
710 | + * @param string $generating_messenger if included then this messenger is used for generating the message |
|
711 | + * templates (but not for sending). |
|
712 | + * @param string $context If included then only a message type for a specific context will be |
|
713 | + * generated. |
|
714 | + * @param bool $send Default TRUE. If false, then this will just return the generated |
|
715 | + * EE_messages objects which might be used by the trigger to setup a batch |
|
716 | + * message (typically html messenger uses it). |
|
717 | + * @return bool |
|
718 | + */ |
|
719 | + public function send_message( |
|
720 | + $type, |
|
721 | + $vars, |
|
722 | + $sending_messenger = '', |
|
723 | + $generating_messenger = '', |
|
724 | + $context = '', |
|
725 | + $send = true |
|
726 | + ) { |
|
727 | + // EE_messages has been deprecated |
|
728 | + $this->_class_is_deprecated(__FUNCTION__); |
|
729 | + /** @type EE_Messages_Processor $processor */ |
|
730 | + $processor = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
731 | + $error = false; |
|
732 | + // try to intelligently determine what method we'll call based on the incoming data. |
|
733 | + // if generating and sending are different then generate and send immediately. |
|
734 | + if (! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
735 | + // in the legacy system, when generating and sending were different, that means all the |
|
736 | + // vars are already in the request object. So let's just use that. |
|
737 | + try { |
|
738 | + /** @type EE_Message_To_Generate_From_Request $mtg */ |
|
739 | + $mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
740 | + $processor->generate_and_send_now($mtg); |
|
741 | + } catch (EE_Error $e) { |
|
742 | + $error_msg = esc_html__( |
|
743 | + 'Please note that a system message failed to send due to a technical issue.', |
|
744 | + 'event_espresso' |
|
745 | + ); |
|
746 | + // add specific message for developers if WP_DEBUG in on |
|
747 | + $error_msg .= '||' . $e->getMessage(); |
|
748 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
749 | + $error = true; |
|
750 | + } |
|
751 | + } else { |
|
752 | + $processor->generate_for_all_active_messengers($type, $vars, $send); |
|
753 | + // let's find out if there were any errors and how many successfully were queued. |
|
754 | + $count_errors = $processor->get_queue()->count_STS_in_queue( |
|
755 | + array(EEM_Message::status_failed, EEM_Message::status_debug_only) |
|
756 | + ); |
|
757 | + $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
758 | + $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry); |
|
759 | + $count_errors = $count_errors + $count_retry; |
|
760 | + if ($count_errors > 0) { |
|
761 | + $error = true; |
|
762 | + if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) { |
|
763 | + $message = sprintf( |
|
764 | + esc_html__( |
|
765 | + 'There were %d errors and %d messages successfully queued for generation and sending', |
|
766 | + 'event_espresso' |
|
767 | + ), |
|
768 | + $count_errors, |
|
769 | + $count_queued |
|
770 | + ); |
|
771 | + } elseif ($count_errors > 1 && $count_queued === 1) { |
|
772 | + $message = sprintf( |
|
773 | + esc_html__( |
|
774 | + 'There were %d errors and %d message successfully queued for generation.', |
|
775 | + 'event_espresso' |
|
776 | + ), |
|
777 | + $count_errors, |
|
778 | + $count_queued |
|
779 | + ); |
|
780 | + } elseif ($count_errors === 1 && $count_queued > 1) { |
|
781 | + $message = sprintf( |
|
782 | + esc_html__( |
|
783 | + 'There was %d error and %d messages successfully queued for generation.', |
|
784 | + 'event_espresso' |
|
785 | + ), |
|
786 | + $count_errors, |
|
787 | + $count_queued |
|
788 | + ); |
|
789 | + } else { |
|
790 | + $message = sprintf( |
|
791 | + esc_html__( |
|
792 | + 'There was %d message that failed to be queued for generation.', |
|
793 | + 'event_espresso' |
|
794 | + ), |
|
795 | + $count_errors |
|
796 | + ); |
|
797 | + } |
|
798 | + EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__); |
|
799 | + } else { |
|
800 | + if ($count_queued === 1) { |
|
801 | + $message = sprintf( |
|
802 | + esc_html__( |
|
803 | + '%d message successfully queued for generation.', |
|
804 | + 'event_espresso' |
|
805 | + ), |
|
806 | + $count_queued |
|
807 | + ); |
|
808 | + } else { |
|
809 | + $message = sprintf( |
|
810 | + esc_html__( |
|
811 | + '%d messages were successfully queued for generation.', |
|
812 | + 'event_espresso' |
|
813 | + ), |
|
814 | + $count_queued |
|
815 | + ); |
|
816 | + } |
|
817 | + EE_Error::add_success($message); |
|
818 | + } |
|
819 | + } |
|
820 | + // if no error then return the generated message(s). |
|
821 | + if (! $error && ! $send) { |
|
822 | + $generated_queue = $processor->generate_queue(false); |
|
823 | + // get message and return. |
|
824 | + $generated_queue->get_message_repository()->rewind(); |
|
825 | + $messages = array(); |
|
826 | + while ($generated_queue->get_message_repository()->valid()) { |
|
827 | + $message = $generated_queue->get_message_repository()->current(); |
|
828 | + if ($message instanceof EE_Message) { |
|
829 | + // set properties that might be expected by add-ons (backward compat) |
|
830 | + $message->content = $message->content(); |
|
831 | + $message->template_pack = $message->get_template_pack(); |
|
832 | + $message->template_variation = $message->get_template_pack_variation(); |
|
833 | + $messages[] = $message; |
|
834 | + } |
|
835 | + $generated_queue->get_message_repository()->next(); |
|
836 | + } |
|
837 | + return $messages; |
|
838 | + } |
|
839 | + return $error ? false |
|
840 | + : true; // yeah backwards eh? Really what we're returning is if there is a total success for all the messages or not. We'll modify this once we get message recording in place. |
|
841 | + } |
|
842 | + |
|
843 | + |
|
844 | + /** |
|
845 | + * @deprecated 4.9.0 |
|
846 | + * @param string $type This should correspond with a valid message type |
|
847 | + * @param string $context This should correspond with a valid context for the message type |
|
848 | + * @param string $messenger This should correspond with a valid messenger. |
|
849 | + * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular |
|
850 | + * preview |
|
851 | + * @return string The body of the message. |
|
852 | + */ |
|
853 | + public function preview_message($type, $context, $messenger, $send = false) |
|
854 | + { |
|
855 | + // EE_messages has been deprecated |
|
856 | + $this->_class_is_deprecated(__FUNCTION__); |
|
857 | + return EED_Messages::preview_message($type, $context, $messenger, $send); |
|
858 | + } |
|
859 | + |
|
860 | + |
|
861 | + /** |
|
862 | + * @since 4.5.0 |
|
863 | + * @deprecated 4.9.0 Moved to EED_Messages Module |
|
864 | + * @param string $messenger a string matching a valid active messenger in the system |
|
865 | + * @param string $message_type Although it seems contrary to the name of the method, a message type name is still |
|
866 | + * required to send along the message type to the messenger because this is used for |
|
867 | + * determining what specific variations might be loaded for the generated message. |
|
868 | + * @param stdClass $message a stdClass object in the format expected by the messenger. |
|
869 | + * |
|
870 | + * @return bool success or fail. |
|
871 | + */ |
|
872 | + public function send_message_with_messenger_only($messenger, $message_type, $message) |
|
873 | + { |
|
874 | + // EE_messages has been deprecated |
|
875 | + $this->_class_is_deprecated(__FUNCTION__); |
|
876 | + // setup for sending to new method. |
|
877 | + /** @type EE_Messages_Queue $queue */ |
|
878 | + $queue = EE_Registry::instance()->load_lib('Messages_Queue'); |
|
879 | + // make sure we have a proper message object |
|
880 | + if (! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
881 | + $msg = EE_Message_Factory::create( |
|
882 | + array( |
|
883 | + 'MSG_messenger' => $messenger, |
|
884 | + 'MSG_message_type' => $message_type, |
|
885 | + 'MSG_content' => $message->content, |
|
886 | + 'MSG_subject' => $message->subject, |
|
887 | + ) |
|
888 | + ); |
|
889 | + } else { |
|
890 | + $msg = $message; |
|
891 | + } |
|
892 | + if (! $msg instanceof EE_Message) { |
|
893 | + return false; |
|
894 | + } |
|
895 | + // make sure any content in a content property (if not empty) is set on the MSG_content. |
|
896 | + if (! empty($msg->content)) { |
|
897 | + $msg->set('MSG_content', $msg->content); |
|
898 | + } |
|
899 | + $queue->add($msg); |
|
900 | + return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue); |
|
901 | + } |
|
902 | + |
|
903 | + |
|
904 | + /** |
|
905 | + * @deprecated 4.9.0 |
|
906 | + * @param $messenger |
|
907 | + * @param string $message_type message type that the templates are being created for |
|
908 | + * @param int $GRP_ID |
|
909 | + * @param bool $is_global |
|
910 | + * @return array|object if creation is successful then we return an array of info, otherwise an error_object is |
|
911 | + * returned. |
|
912 | + * @throws \EE_Error |
|
913 | + */ |
|
914 | + public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) |
|
915 | + { |
|
916 | + // EE_messages has been deprecated |
|
917 | + $this->_class_is_deprecated(__FUNCTION__); |
|
918 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
919 | + return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global); |
|
920 | + } |
|
921 | + |
|
922 | + |
|
923 | + /** |
|
924 | + * @deprecated 4.9.0 |
|
925 | + * @param string $messenger_name name of EE_messenger |
|
926 | + * @param string $message_type_name name of EE_message_type |
|
927 | + * @return array |
|
928 | + */ |
|
929 | + public function get_fields($messenger_name, $message_type_name) |
|
930 | + { |
|
931 | + // EE_messages has been deprecated |
|
932 | + $this->_class_is_deprecated(__FUNCTION__); |
|
933 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
934 | + return EEH_MSG_Template::get_fields($messenger_name, $message_type_name); |
|
935 | + } |
|
936 | + |
|
937 | + |
|
938 | + /** |
|
939 | + * @deprecated 4.9.0 |
|
940 | + * @access public |
|
941 | + * @param string $type we can indicate just returning installed message types |
|
942 | + * or messengers (or both) via this parameter. |
|
943 | + * @param bool $skip_cache if true then we skip the cache and retrieve via files. |
|
944 | + * @return array multidimensional array of messenger and message_type objects |
|
945 | + * (messengers index, and message_type index); |
|
946 | + */ |
|
947 | + public function get_installed($type = 'all', $skip_cache = false) |
|
948 | + { |
|
949 | + // EE_messages has been deprecated |
|
950 | + $this->_class_is_deprecated(__FUNCTION__); |
|
951 | + if ($skip_cache) { |
|
952 | + $this->_message_resource_manager->reset_active_messengers_and_message_types(); |
|
953 | + } |
|
954 | + switch ($type) { |
|
955 | + case 'messengers' : |
|
956 | + return array( |
|
957 | + 'messenger' => $this->_message_resource_manager->installed_messengers(), |
|
958 | + ); |
|
959 | + break; |
|
960 | + case 'message_types' : |
|
961 | + return array( |
|
962 | + 'message_type' => $this->_message_resource_manager->installed_message_types(), |
|
963 | + ); |
|
964 | + break; |
|
965 | + case 'all' : |
|
966 | + default : |
|
967 | + return array( |
|
968 | + 'messenger' => $this->_message_resource_manager->installed_messengers(), |
|
969 | + 'message_type' => $this->_message_resource_manager->installed_message_types(), |
|
970 | + ); |
|
971 | + break; |
|
972 | + } |
|
973 | + } |
|
974 | + |
|
975 | + |
|
976 | + /** |
|
977 | + * @deprecated 4.9.0 |
|
978 | + * @return \EE_messenger[] |
|
979 | + */ |
|
980 | + public function get_active_messengers() |
|
981 | + { |
|
982 | + // EE_messages has been deprecated |
|
983 | + $this->_class_is_deprecated(__FUNCTION__); |
|
984 | + return $this->_message_resource_manager->active_messengers(); |
|
985 | + } |
|
986 | + |
|
987 | + |
|
988 | + /** |
|
989 | + * @deprecated 4.9.0 |
|
990 | + * @return array array of message_type references (string) |
|
991 | + */ |
|
992 | + public function get_active_message_types() |
|
993 | + { |
|
994 | + // EE_messages has been deprecated |
|
995 | + $this->_class_is_deprecated(__FUNCTION__); |
|
996 | + return $this->_message_resource_manager->list_of_active_message_types(); |
|
997 | + } |
|
998 | + |
|
999 | + |
|
1000 | + /** |
|
1001 | + * @deprecated 4.9.0 |
|
1002 | + * @return EE_message_type[] |
|
1003 | + */ |
|
1004 | + public function get_active_message_type_objects() |
|
1005 | + { |
|
1006 | + // EE_messages has been deprecated |
|
1007 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1008 | + return $this->_message_resource_manager->get_active_message_type_objects(); |
|
1009 | + } |
|
1010 | + |
|
1011 | + |
|
1012 | + /** |
|
1013 | + * @deprecated 4.9.0 |
|
1014 | + * @since 4.5.0 |
|
1015 | + * @param string $messenger The messenger being checked |
|
1016 | + * @return EE_message_type[] (or empty array if none present) |
|
1017 | + */ |
|
1018 | + public function get_active_message_types_per_messenger($messenger) |
|
1019 | + { |
|
1020 | + // EE_messages has been deprecated |
|
1021 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1022 | + return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger); |
|
1023 | + } |
|
1024 | + |
|
1025 | + |
|
1026 | + /** |
|
1027 | + * @deprecated 4.9.0 |
|
1028 | + * @param string $messenger The string should correspond to the messenger (message types are |
|
1029 | + * @param string $message_type The string should correspond to a message type. |
|
1030 | + * @return EE_message_type|null |
|
1031 | + */ |
|
1032 | + public function get_active_message_type($messenger, $message_type) |
|
1033 | + { |
|
1034 | + // EE_messages has been deprecated |
|
1035 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1036 | + return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type); |
|
1037 | + } |
|
1038 | + |
|
1039 | + |
|
1040 | + /** |
|
1041 | + * @deprecated 4.9.0 |
|
1042 | + * @return array|\EE_message_type[] |
|
1043 | + */ |
|
1044 | + public function get_installed_message_types() |
|
1045 | + { |
|
1046 | + // EE_messages has been deprecated |
|
1047 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1048 | + return $this->_message_resource_manager->installed_message_types(); |
|
1049 | + } |
|
1050 | + |
|
1051 | + |
|
1052 | + /** |
|
1053 | + * @deprecated 4.9.0 |
|
1054 | + * @return array |
|
1055 | + */ |
|
1056 | + public function get_installed_messengers() |
|
1057 | + { |
|
1058 | + // EE_messages has been deprecated |
|
1059 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1060 | + return $this->_message_resource_manager->installed_messengers(); |
|
1061 | + } |
|
1062 | + |
|
1063 | + |
|
1064 | + /** |
|
1065 | + * @deprecated 4.9.0 |
|
1066 | + * @param bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by |
|
1067 | + * message type. |
|
1068 | + * @return array |
|
1069 | + */ |
|
1070 | + public function get_all_contexts($slugs_only = true) |
|
1071 | + { |
|
1072 | + // EE_messages has been deprecated |
|
1073 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1074 | + return $this->_message_resource_manager->get_all_contexts($slugs_only); |
|
1075 | + } |
|
1076 | 1076 | |
1077 | 1077 | |
1078 | 1078 | } |
@@ -1131,63 +1131,63 @@ discard block |
||
1131 | 1131 | |
1132 | 1132 | |
1133 | 1133 | add_filter( |
1134 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
1135 | - function ($event_list_iframe_css) { |
|
1136 | - if (! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) { |
|
1137 | - return $event_list_iframe_css; |
|
1138 | - } |
|
1139 | - deprecated_espresso_action_or_filter_doing_it_wrong( |
|
1140 | - 'FHEE__EventsArchiveIframe__event_list_iframe__css', |
|
1141 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
1142 | - '\EventEspresso\modules\events_archive\EventsArchiveIframe::display()', |
|
1143 | - '4.9.14', |
|
1144 | - '5.0.0', |
|
1145 | - 'filter' |
|
1146 | - ); |
|
1147 | - return apply_filters( |
|
1148 | - 'FHEE__EventsArchiveIframe__event_list_iframe__css', |
|
1149 | - $event_list_iframe_css |
|
1150 | - ); |
|
1151 | - } |
|
1134 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
1135 | + function ($event_list_iframe_css) { |
|
1136 | + if (! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) { |
|
1137 | + return $event_list_iframe_css; |
|
1138 | + } |
|
1139 | + deprecated_espresso_action_or_filter_doing_it_wrong( |
|
1140 | + 'FHEE__EventsArchiveIframe__event_list_iframe__css', |
|
1141 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
1142 | + '\EventEspresso\modules\events_archive\EventsArchiveIframe::display()', |
|
1143 | + '4.9.14', |
|
1144 | + '5.0.0', |
|
1145 | + 'filter' |
|
1146 | + ); |
|
1147 | + return apply_filters( |
|
1148 | + 'FHEE__EventsArchiveIframe__event_list_iframe__css', |
|
1149 | + $event_list_iframe_css |
|
1150 | + ); |
|
1151 | + } |
|
1152 | 1152 | ); |
1153 | 1153 | add_filter( |
1154 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
1155 | - function ($event_list_iframe_js) { |
|
1156 | - if (! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) { |
|
1157 | - return $event_list_iframe_js; |
|
1158 | - } |
|
1159 | - deprecated_espresso_action_or_filter_doing_it_wrong( |
|
1160 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
1161 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
1162 | - '\EventEspresso\modules\events_archive\EventsArchiveIframe::display()', |
|
1163 | - '4.9.14', |
|
1164 | - '5.0.0', |
|
1165 | - 'filter' |
|
1166 | - ); |
|
1167 | - return apply_filters( |
|
1168 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
1169 | - $event_list_iframe_js |
|
1170 | - ); |
|
1171 | - } |
|
1154 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
1155 | + function ($event_list_iframe_js) { |
|
1156 | + if (! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) { |
|
1157 | + return $event_list_iframe_js; |
|
1158 | + } |
|
1159 | + deprecated_espresso_action_or_filter_doing_it_wrong( |
|
1160 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
1161 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
1162 | + '\EventEspresso\modules\events_archive\EventsArchiveIframe::display()', |
|
1163 | + '4.9.14', |
|
1164 | + '5.0.0', |
|
1165 | + 'filter' |
|
1166 | + ); |
|
1167 | + return apply_filters( |
|
1168 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
1169 | + $event_list_iframe_js |
|
1170 | + ); |
|
1171 | + } |
|
1172 | 1172 | ); |
1173 | 1173 | add_action( |
1174 | - 'AHEE__EE_Capabilities__addCaps__complete', |
|
1175 | - function ($capabilities_map) { |
|
1176 | - if (! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) { |
|
1177 | - return; |
|
1178 | - } |
|
1179 | - deprecated_espresso_action_or_filter_doing_it_wrong( |
|
1180 | - 'AHEE__EE_Capabilities__init_role_caps__complete', |
|
1181 | - 'AHEE__EE_Capabilities__addCaps__complete', |
|
1182 | - '\EE_Capabilities::addCaps()', |
|
1183 | - '4.9.42', |
|
1184 | - '5.0.0' |
|
1185 | - ); |
|
1186 | - do_action( |
|
1187 | - 'AHEE__EE_Capabilities__init_role_caps__complete', |
|
1188 | - $capabilities_map |
|
1189 | - ); |
|
1190 | - } |
|
1174 | + 'AHEE__EE_Capabilities__addCaps__complete', |
|
1175 | + function ($capabilities_map) { |
|
1176 | + if (! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) { |
|
1177 | + return; |
|
1178 | + } |
|
1179 | + deprecated_espresso_action_or_filter_doing_it_wrong( |
|
1180 | + 'AHEE__EE_Capabilities__init_role_caps__complete', |
|
1181 | + 'AHEE__EE_Capabilities__addCaps__complete', |
|
1182 | + '\EE_Capabilities::addCaps()', |
|
1183 | + '4.9.42', |
|
1184 | + '5.0.0' |
|
1185 | + ); |
|
1186 | + do_action( |
|
1187 | + 'AHEE__EE_Capabilities__init_role_caps__complete', |
|
1188 | + $capabilities_map |
|
1189 | + ); |
|
1190 | + } |
|
1191 | 1191 | ); |
1192 | 1192 | |
1193 | 1193 | add_filter( |
@@ -1205,22 +1205,22 @@ discard block |
||
1205 | 1205 | 'filter' |
1206 | 1206 | ); |
1207 | 1207 | return apply_filters( |
1208 | - 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', |
|
1209 | - 'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee', |
|
1210 | - '\EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler::findExistingAttendee()', |
|
1211 | - '4.9.34', |
|
1212 | - '5.0.0', |
|
1213 | - 'filter' |
|
1214 | - ); |
|
1215 | - return apply_filters( |
|
1216 | - 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', |
|
1217 | - $existing_attendee, |
|
1218 | - $registration, |
|
1219 | - $attendee_data |
|
1220 | - ); |
|
1221 | - }, |
|
1222 | - 10, |
|
1223 | - 3 |
|
1208 | + 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', |
|
1209 | + 'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee', |
|
1210 | + '\EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler::findExistingAttendee()', |
|
1211 | + '4.9.34', |
|
1212 | + '5.0.0', |
|
1213 | + 'filter' |
|
1214 | + ); |
|
1215 | + return apply_filters( |
|
1216 | + 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', |
|
1217 | + $existing_attendee, |
|
1218 | + $registration, |
|
1219 | + $attendee_data |
|
1220 | + ); |
|
1221 | + }, |
|
1222 | + 10, |
|
1223 | + 3 |
|
1224 | 1224 | ); |
1225 | 1225 | |
1226 | 1226 | /** |
@@ -1231,88 +1231,88 @@ discard block |
||
1231 | 1231 | class EE_Event_List_Query extends WP_Query |
1232 | 1232 | { |
1233 | 1233 | |
1234 | - private $title; |
|
1235 | - |
|
1236 | - private $css_class; |
|
1237 | - |
|
1238 | - private $category_slug; |
|
1239 | - |
|
1240 | - /** |
|
1241 | - * EE_Event_List_Query constructor. |
|
1242 | - * |
|
1243 | - * @param array $args |
|
1244 | - */ |
|
1245 | - public function __construct($args = array()) |
|
1246 | - { |
|
1247 | - \EE_Error::doing_it_wrong( |
|
1248 | - __METHOD__, |
|
1249 | - esc_html__( |
|
1250 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\services\wp_queries\EventListQuery instead.', |
|
1251 | - 'event_espresso' |
|
1252 | - ), |
|
1253 | - '4.9.27', |
|
1254 | - '5.0.0' |
|
1255 | - ); |
|
1256 | - $this->title = isset($args['title']) ? $args['title'] : ''; |
|
1257 | - $this->css_class = isset($args['css_class']) ? $args['css_class'] : ''; |
|
1258 | - $this->category_slug = isset($args['category_slug']) ? $args['category_slug'] : ''; |
|
1259 | - $limit = isset($args['limit']) && absint($args['limit']) ? $args['limit'] : 10; |
|
1260 | - // the current "page" we are viewing |
|
1261 | - $paged = max(1, get_query_var('paged')); |
|
1262 | - // Force these args |
|
1263 | - $args = array_merge( |
|
1264 | - $args, |
|
1265 | - array( |
|
1266 | - 'post_type' => 'espresso_events', |
|
1267 | - 'posts_per_page' => $limit, |
|
1268 | - 'update_post_term_cache' => false, |
|
1269 | - 'update_post_meta_cache' => false, |
|
1270 | - 'paged' => $paged, |
|
1271 | - 'offset' => ($paged - 1) * $limit, |
|
1272 | - ) |
|
1273 | - ); |
|
1274 | - // run the query |
|
1275 | - parent::__construct($args); |
|
1276 | - } |
|
1277 | - |
|
1278 | - |
|
1279 | - /** |
|
1280 | - * event_list_title |
|
1281 | - * |
|
1282 | - * @param string $event_list_title |
|
1283 | - * @return string |
|
1284 | - */ |
|
1285 | - public function event_list_title($event_list_title = '') |
|
1286 | - { |
|
1287 | - if (! empty($this->title)) { |
|
1288 | - return $this->title; |
|
1289 | - } |
|
1290 | - return $event_list_title; |
|
1291 | - } |
|
1292 | - |
|
1293 | - |
|
1294 | - /** |
|
1295 | - * event_list_css |
|
1296 | - * |
|
1297 | - * @param string $event_list_css |
|
1298 | - * @return string |
|
1299 | - */ |
|
1300 | - public function event_list_css($event_list_css = '') |
|
1301 | - { |
|
1302 | - $event_list_css .= ! empty($event_list_css) |
|
1303 | - ? ' ' |
|
1304 | - : ''; |
|
1305 | - $event_list_css .= ! empty($this->css_class) |
|
1306 | - ? $this->css_class |
|
1307 | - : ''; |
|
1308 | - $event_list_css .= ! empty($event_list_css) |
|
1309 | - ? ' ' |
|
1310 | - : ''; |
|
1311 | - $event_list_css .= ! empty($this->category_slug) |
|
1312 | - ? $this->category_slug |
|
1313 | - : ''; |
|
1314 | - return $event_list_css; |
|
1315 | - } |
|
1234 | + private $title; |
|
1235 | + |
|
1236 | + private $css_class; |
|
1237 | + |
|
1238 | + private $category_slug; |
|
1239 | + |
|
1240 | + /** |
|
1241 | + * EE_Event_List_Query constructor. |
|
1242 | + * |
|
1243 | + * @param array $args |
|
1244 | + */ |
|
1245 | + public function __construct($args = array()) |
|
1246 | + { |
|
1247 | + \EE_Error::doing_it_wrong( |
|
1248 | + __METHOD__, |
|
1249 | + esc_html__( |
|
1250 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\services\wp_queries\EventListQuery instead.', |
|
1251 | + 'event_espresso' |
|
1252 | + ), |
|
1253 | + '4.9.27', |
|
1254 | + '5.0.0' |
|
1255 | + ); |
|
1256 | + $this->title = isset($args['title']) ? $args['title'] : ''; |
|
1257 | + $this->css_class = isset($args['css_class']) ? $args['css_class'] : ''; |
|
1258 | + $this->category_slug = isset($args['category_slug']) ? $args['category_slug'] : ''; |
|
1259 | + $limit = isset($args['limit']) && absint($args['limit']) ? $args['limit'] : 10; |
|
1260 | + // the current "page" we are viewing |
|
1261 | + $paged = max(1, get_query_var('paged')); |
|
1262 | + // Force these args |
|
1263 | + $args = array_merge( |
|
1264 | + $args, |
|
1265 | + array( |
|
1266 | + 'post_type' => 'espresso_events', |
|
1267 | + 'posts_per_page' => $limit, |
|
1268 | + 'update_post_term_cache' => false, |
|
1269 | + 'update_post_meta_cache' => false, |
|
1270 | + 'paged' => $paged, |
|
1271 | + 'offset' => ($paged - 1) * $limit, |
|
1272 | + ) |
|
1273 | + ); |
|
1274 | + // run the query |
|
1275 | + parent::__construct($args); |
|
1276 | + } |
|
1277 | + |
|
1278 | + |
|
1279 | + /** |
|
1280 | + * event_list_title |
|
1281 | + * |
|
1282 | + * @param string $event_list_title |
|
1283 | + * @return string |
|
1284 | + */ |
|
1285 | + public function event_list_title($event_list_title = '') |
|
1286 | + { |
|
1287 | + if (! empty($this->title)) { |
|
1288 | + return $this->title; |
|
1289 | + } |
|
1290 | + return $event_list_title; |
|
1291 | + } |
|
1292 | + |
|
1293 | + |
|
1294 | + /** |
|
1295 | + * event_list_css |
|
1296 | + * |
|
1297 | + * @param string $event_list_css |
|
1298 | + * @return string |
|
1299 | + */ |
|
1300 | + public function event_list_css($event_list_css = '') |
|
1301 | + { |
|
1302 | + $event_list_css .= ! empty($event_list_css) |
|
1303 | + ? ' ' |
|
1304 | + : ''; |
|
1305 | + $event_list_css .= ! empty($this->css_class) |
|
1306 | + ? $this->css_class |
|
1307 | + : ''; |
|
1308 | + $event_list_css .= ! empty($event_list_css) |
|
1309 | + ? ' ' |
|
1310 | + : ''; |
|
1311 | + $event_list_css .= ! empty($this->category_slug) |
|
1312 | + ? $this->category_slug |
|
1313 | + : ''; |
|
1314 | + return $event_list_css; |
|
1315 | + } |
|
1316 | 1316 | |
1317 | 1317 | } |
1318 | 1318 | |
@@ -1329,75 +1329,75 @@ discard block |
||
1329 | 1329 | { |
1330 | 1330 | |
1331 | 1331 | |
1332 | - /** |
|
1333 | - * class constructor |
|
1334 | - * |
|
1335 | - * @deprecated 4.9.59.p |
|
1336 | - */ |
|
1337 | - public function __construct() |
|
1338 | - { |
|
1339 | - EE_Error::doing_it_wrong( |
|
1340 | - __METHOD__, |
|
1341 | - sprintf( |
|
1342 | - esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'), |
|
1343 | - __CLASS__, |
|
1344 | - 'EventEspresso\core\services\licensing\LicenseServices' |
|
1345 | - ), |
|
1346 | - '4.9.59.p' |
|
1347 | - ); |
|
1348 | - } |
|
1349 | - |
|
1350 | - |
|
1351 | - /** |
|
1352 | - * The purpose of this function is to display information about Event Espresso data collection |
|
1353 | - * and a optin selection for extra data collecting by users. |
|
1354 | - * |
|
1355 | - * @param bool $extra |
|
1356 | - * @return string html. |
|
1357 | - * @deprecated 4.9.59.p |
|
1358 | - */ |
|
1359 | - public static function espresso_data_collection_optin_text($extra = true) |
|
1360 | - { |
|
1361 | - EE_Error::doing_it_wrong( |
|
1362 | - __METHOD__, |
|
1363 | - sprintf( |
|
1364 | - esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'), |
|
1365 | - __METHOD__, |
|
1366 | - 'EventEspresso\core\domain\services\Stats::optinText' |
|
1367 | - ), |
|
1368 | - '4.9.59.p' |
|
1369 | - ); |
|
1370 | - Stats::optinText($extra); |
|
1371 | - } |
|
1372 | - |
|
1373 | - /** |
|
1374 | - * This is a handy helper method for retrieving whether there is an update available for the given plugin. |
|
1375 | - * |
|
1376 | - * @param string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to |
|
1377 | - * identify plugins. Defaults to core update |
|
1378 | - * @return boolean True if update available, false if not. |
|
1379 | - * @deprecated 4.9.59.p |
|
1380 | - */ |
|
1381 | - public static function is_update_available($basename = '') |
|
1382 | - { |
|
1383 | - EE_Error::doing_it_wrong( |
|
1384 | - __METHOD__, |
|
1385 | - sprintf( |
|
1386 | - esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'), |
|
1387 | - __METHOD__, |
|
1388 | - 'EventEspresso\core\services\licensing\LicenseService::isUpdateAvailable' |
|
1389 | - ), |
|
1390 | - '4.9.59.p' |
|
1391 | - ); |
|
1392 | - return LicenseService::isUpdateAvailable($basename); |
|
1393 | - } |
|
1332 | + /** |
|
1333 | + * class constructor |
|
1334 | + * |
|
1335 | + * @deprecated 4.9.59.p |
|
1336 | + */ |
|
1337 | + public function __construct() |
|
1338 | + { |
|
1339 | + EE_Error::doing_it_wrong( |
|
1340 | + __METHOD__, |
|
1341 | + sprintf( |
|
1342 | + esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'), |
|
1343 | + __CLASS__, |
|
1344 | + 'EventEspresso\core\services\licensing\LicenseServices' |
|
1345 | + ), |
|
1346 | + '4.9.59.p' |
|
1347 | + ); |
|
1348 | + } |
|
1349 | + |
|
1350 | + |
|
1351 | + /** |
|
1352 | + * The purpose of this function is to display information about Event Espresso data collection |
|
1353 | + * and a optin selection for extra data collecting by users. |
|
1354 | + * |
|
1355 | + * @param bool $extra |
|
1356 | + * @return string html. |
|
1357 | + * @deprecated 4.9.59.p |
|
1358 | + */ |
|
1359 | + public static function espresso_data_collection_optin_text($extra = true) |
|
1360 | + { |
|
1361 | + EE_Error::doing_it_wrong( |
|
1362 | + __METHOD__, |
|
1363 | + sprintf( |
|
1364 | + esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'), |
|
1365 | + __METHOD__, |
|
1366 | + 'EventEspresso\core\domain\services\Stats::optinText' |
|
1367 | + ), |
|
1368 | + '4.9.59.p' |
|
1369 | + ); |
|
1370 | + Stats::optinText($extra); |
|
1371 | + } |
|
1372 | + |
|
1373 | + /** |
|
1374 | + * This is a handy helper method for retrieving whether there is an update available for the given plugin. |
|
1375 | + * |
|
1376 | + * @param string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to |
|
1377 | + * identify plugins. Defaults to core update |
|
1378 | + * @return boolean True if update available, false if not. |
|
1379 | + * @deprecated 4.9.59.p |
|
1380 | + */ |
|
1381 | + public static function is_update_available($basename = '') |
|
1382 | + { |
|
1383 | + EE_Error::doing_it_wrong( |
|
1384 | + __METHOD__, |
|
1385 | + sprintf( |
|
1386 | + esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'), |
|
1387 | + __METHOD__, |
|
1388 | + 'EventEspresso\core\services\licensing\LicenseService::isUpdateAvailable' |
|
1389 | + ), |
|
1390 | + '4.9.59.p' |
|
1391 | + ); |
|
1392 | + return LicenseService::isUpdateAvailable($basename); |
|
1393 | + } |
|
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | add_filter( |
1397 | - 'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array', |
|
1398 | - 'ee_deprecated_registrations_report_csv_legacy_fields', |
|
1399 | - 10, |
|
1400 | - 2 |
|
1397 | + 'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array', |
|
1398 | + 'ee_deprecated_registrations_report_csv_legacy_fields', |
|
1399 | + 10, |
|
1400 | + 2 |
|
1401 | 1401 | ); |
1402 | 1402 | /** |
1403 | 1403 | * Filters the CSV row to make it appear like the old labels (which were "$pretty_name[$field_name]"). |
@@ -1414,96 +1414,96 @@ discard block |
||
1414 | 1414 | */ |
1415 | 1415 | function ee_deprecated_registrations_report_csv_legacy_fields($csv_row_data, $reg_row) |
1416 | 1416 | { |
1417 | - // no need for all this if nobody is using the deprecated filter |
|
1418 | - if (has_filter('FHEE__EE_Export__report_registrations__reg_csv_array')) { |
|
1419 | - EE_Error::doing_it_wrong( |
|
1420 | - __FUNCTION__, |
|
1421 | - sprintf( |
|
1422 | - // EE_Error::doing_it_wrong with escape HTML, so don't escape it twice by doing it here too. |
|
1423 | - _x( |
|
1424 | - 'The filter "%1$s" has been deprecated. Please use "%2$s" instead.', |
|
1425 | - 'The filter "FHEE__EE_Export__report_registrations__reg_csv_array" has been deprecated. Please use "FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array" instead.', |
|
1426 | - 'event_espresso' |
|
1427 | - ), |
|
1428 | - 'FHEE__EE_Export__report_registrations__reg_csv_array', |
|
1429 | - 'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array' |
|
1430 | - ), |
|
1431 | - '4.9.69.p', |
|
1432 | - '4.9.75.p' |
|
1433 | - ); |
|
1434 | - // there's code that expected the old csv column headers/labels. Let's oblige. Put it back in the old format! |
|
1435 | - // first: what model fields might be used as column headers? (whose format we need to change) |
|
1436 | - $model_fields = array_merge( |
|
1437 | - EEM_Registration::instance()->field_settings(), |
|
1438 | - EEM_Attendee::instance()->field_settings() |
|
1439 | - ); |
|
1440 | - // create an array that uses the legacy column headers/labels. |
|
1441 | - $new_csv_row = array(); |
|
1442 | - foreach ($csv_row_data as $label => $value) { |
|
1443 | - $new_label = $label; |
|
1444 | - foreach ($model_fields as $field) { |
|
1445 | - if ($label === EEH_Export::get_column_name_for_field($field)) { |
|
1446 | - // re-add the old field name |
|
1447 | - $new_label = $label . '[' . $field->get_name() . ']'; |
|
1448 | - break; |
|
1449 | - } |
|
1450 | - } |
|
1451 | - $new_csv_row[$new_label] = $value; |
|
1452 | - } |
|
1453 | - // before we run it through the deprecated filter, set the method `EEH_Export::get_column_name_for_field()` |
|
1454 | - // to create the old column names, because that's what's in the row temporarily |
|
1455 | - add_filter( |
|
1456 | - 'FHEE__EEH_Export__get_column_name_for_field__add_field_name', |
|
1457 | - '__return_true', |
|
1458 | - 777 |
|
1459 | - ); |
|
1460 | - // now, those old filters can be run on this data. Have fun! |
|
1461 | - /** |
|
1462 | - * Deprecated. Use FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array instead. |
|
1463 | - * |
|
1464 | - * Filter to change the contents of each row of the registrations report CSV file. |
|
1465 | - * This can be used to add or remote columns from the CSV file, or change their values. * |
|
1466 | - * Note: it has this name because originally that's where this filter resided, |
|
1467 | - * and we've left its name as-is for backward compatibility. |
|
1468 | - * Note when using: all rows in the CSV should have the same columns. |
|
1469 | - * |
|
1470 | - * @param array $reg_csv_array keys are column-header names, and values are that columns' value |
|
1471 | - * in this row |
|
1472 | - * @param array $reg_row is the row from the database's wp_esp_registration table |
|
1473 | - */ |
|
1474 | - $updated_row = apply_filters( |
|
1475 | - 'FHEE__EE_Export__report_registrations__reg_csv_array', |
|
1476 | - $new_csv_row, |
|
1477 | - $reg_row |
|
1478 | - ); |
|
1479 | - |
|
1480 | - // ok now we can revert to normal for EEH_Export::get_column_name_for_field(). |
|
1481 | - remove_filter( |
|
1482 | - 'FHEE__EEH_Export__get_column_name_for_field__add_field_name', |
|
1483 | - '__return_true', |
|
1484 | - 777 |
|
1485 | - ); |
|
1486 | - |
|
1487 | - // great. Now that the old filters are done, we can remove the ugly square brackets from column headers/labels. |
|
1488 | - $updated_and_restored_row = array(); |
|
1489 | - foreach ($updated_row as $label => $value) { |
|
1490 | - $matches = array(); |
|
1491 | - if (preg_match( |
|
1492 | - '~([^\[]*)\[(.*)\]~', |
|
1493 | - $label, |
|
1494 | - $matches |
|
1495 | - ) |
|
1496 | - && isset( |
|
1497 | - $matches[0], |
|
1498 | - $matches[1], |
|
1499 | - $matches[2] |
|
1500 | - ) |
|
1501 | - ) { |
|
1502 | - $label = $matches[1]; |
|
1503 | - } |
|
1504 | - $updated_and_restored_row[$label] = $value; |
|
1505 | - } |
|
1506 | - $csv_row_data = $updated_and_restored_row; |
|
1507 | - } |
|
1508 | - return $csv_row_data; |
|
1417 | + // no need for all this if nobody is using the deprecated filter |
|
1418 | + if (has_filter('FHEE__EE_Export__report_registrations__reg_csv_array')) { |
|
1419 | + EE_Error::doing_it_wrong( |
|
1420 | + __FUNCTION__, |
|
1421 | + sprintf( |
|
1422 | + // EE_Error::doing_it_wrong with escape HTML, so don't escape it twice by doing it here too. |
|
1423 | + _x( |
|
1424 | + 'The filter "%1$s" has been deprecated. Please use "%2$s" instead.', |
|
1425 | + 'The filter "FHEE__EE_Export__report_registrations__reg_csv_array" has been deprecated. Please use "FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array" instead.', |
|
1426 | + 'event_espresso' |
|
1427 | + ), |
|
1428 | + 'FHEE__EE_Export__report_registrations__reg_csv_array', |
|
1429 | + 'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array' |
|
1430 | + ), |
|
1431 | + '4.9.69.p', |
|
1432 | + '4.9.75.p' |
|
1433 | + ); |
|
1434 | + // there's code that expected the old csv column headers/labels. Let's oblige. Put it back in the old format! |
|
1435 | + // first: what model fields might be used as column headers? (whose format we need to change) |
|
1436 | + $model_fields = array_merge( |
|
1437 | + EEM_Registration::instance()->field_settings(), |
|
1438 | + EEM_Attendee::instance()->field_settings() |
|
1439 | + ); |
|
1440 | + // create an array that uses the legacy column headers/labels. |
|
1441 | + $new_csv_row = array(); |
|
1442 | + foreach ($csv_row_data as $label => $value) { |
|
1443 | + $new_label = $label; |
|
1444 | + foreach ($model_fields as $field) { |
|
1445 | + if ($label === EEH_Export::get_column_name_for_field($field)) { |
|
1446 | + // re-add the old field name |
|
1447 | + $new_label = $label . '[' . $field->get_name() . ']'; |
|
1448 | + break; |
|
1449 | + } |
|
1450 | + } |
|
1451 | + $new_csv_row[$new_label] = $value; |
|
1452 | + } |
|
1453 | + // before we run it through the deprecated filter, set the method `EEH_Export::get_column_name_for_field()` |
|
1454 | + // to create the old column names, because that's what's in the row temporarily |
|
1455 | + add_filter( |
|
1456 | + 'FHEE__EEH_Export__get_column_name_for_field__add_field_name', |
|
1457 | + '__return_true', |
|
1458 | + 777 |
|
1459 | + ); |
|
1460 | + // now, those old filters can be run on this data. Have fun! |
|
1461 | + /** |
|
1462 | + * Deprecated. Use FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array instead. |
|
1463 | + * |
|
1464 | + * Filter to change the contents of each row of the registrations report CSV file. |
|
1465 | + * This can be used to add or remote columns from the CSV file, or change their values. * |
|
1466 | + * Note: it has this name because originally that's where this filter resided, |
|
1467 | + * and we've left its name as-is for backward compatibility. |
|
1468 | + * Note when using: all rows in the CSV should have the same columns. |
|
1469 | + * |
|
1470 | + * @param array $reg_csv_array keys are column-header names, and values are that columns' value |
|
1471 | + * in this row |
|
1472 | + * @param array $reg_row is the row from the database's wp_esp_registration table |
|
1473 | + */ |
|
1474 | + $updated_row = apply_filters( |
|
1475 | + 'FHEE__EE_Export__report_registrations__reg_csv_array', |
|
1476 | + $new_csv_row, |
|
1477 | + $reg_row |
|
1478 | + ); |
|
1479 | + |
|
1480 | + // ok now we can revert to normal for EEH_Export::get_column_name_for_field(). |
|
1481 | + remove_filter( |
|
1482 | + 'FHEE__EEH_Export__get_column_name_for_field__add_field_name', |
|
1483 | + '__return_true', |
|
1484 | + 777 |
|
1485 | + ); |
|
1486 | + |
|
1487 | + // great. Now that the old filters are done, we can remove the ugly square brackets from column headers/labels. |
|
1488 | + $updated_and_restored_row = array(); |
|
1489 | + foreach ($updated_row as $label => $value) { |
|
1490 | + $matches = array(); |
|
1491 | + if (preg_match( |
|
1492 | + '~([^\[]*)\[(.*)\]~', |
|
1493 | + $label, |
|
1494 | + $matches |
|
1495 | + ) |
|
1496 | + && isset( |
|
1497 | + $matches[0], |
|
1498 | + $matches[1], |
|
1499 | + $matches[2] |
|
1500 | + ) |
|
1501 | + ) { |
|
1502 | + $label = $matches[1]; |
|
1503 | + } |
|
1504 | + $updated_and_restored_row[$label] = $value; |
|
1505 | + } |
|
1506 | + $csv_row_data = $updated_and_restored_row; |
|
1507 | + } |
|
1508 | + return $csv_row_data; |
|
1509 | 1509 | } |
@@ -86,20 +86,20 @@ discard block |
||
86 | 86 | // loop thru and call doing_it_wrong() or remove any that aren't being used |
87 | 87 | foreach ($deprecated_filters as $deprecated_filter => $on) { |
88 | 88 | // was this filter called ? |
89 | - if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter)) { |
|
89 | + if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) { |
|
90 | 90 | // only display doing_it_wrong() notice to Event Admins during non-AJAX requests |
91 | 91 | if (EE_Registry::instance()->CAP->current_user_can( |
92 | 92 | 'ee_read_ee', |
93 | 93 | 'hide_doing_it_wrong_for_deprecated_SPCO_filter' |
94 | 94 | ) && ! defined('DOING_AJAX')) { |
95 | 95 | EE_Error::doing_it_wrong( |
96 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
96 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
97 | 97 | sprintf( |
98 | 98 | esc_html__( |
99 | 99 | 'The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', |
100 | 100 | 'event_espresso' |
101 | 101 | ), |
102 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
102 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
103 | 103 | '<br />', |
104 | 104 | 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
105 | 105 | '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php' |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | ); |
109 | 109 | } |
110 | 110 | } else { |
111 | - unset($deprecated_filters[ $deprecated_filter ]); |
|
111 | + unset($deprecated_filters[$deprecated_filter]); |
|
112 | 112 | } |
113 | 113 | } |
114 | - if (! empty($deprecated_filters)) { |
|
114 | + if ( ! empty($deprecated_filters)) { |
|
115 | 115 | |
116 | 116 | if ($checkout->current_step->slug( |
117 | 117 | ) == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $submit_button_text = apply_filters( |
146 | 146 | 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', |
147 | 147 | $submit_button_text |
148 | - ) . $checkout->next_step->name(); |
|
148 | + ).$checkout->next_step->name(); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | 'event_espresso' |
330 | 330 | ); |
331 | 331 | EE_Error::doing_it_wrong( |
332 | - __CLASS__ . '::' . __FUNCTION__, |
|
332 | + __CLASS__.'::'.__FUNCTION__, |
|
333 | 333 | $msg, |
334 | 334 | '4.8.32.rc.000' |
335 | 335 | ); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | function ee_deprecated_update_attendee_registration_form_old($admin_page) |
357 | 357 | { |
358 | 358 | // check if the old hooks are in use. If not, do the default |
359 | - if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
359 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
360 | 360 | || ! $admin_page instanceof EE_Admin_Page) { |
361 | 361 | return; |
362 | 362 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : false; |
365 | 365 | $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : false; |
366 | 366 | $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
367 | - if (! $REG_ID || ! $qstns) { |
|
367 | + if ( ! $REG_ID || ! $qstns) { |
|
368 | 368 | EE_Error::add_error( |
369 | 369 | esc_html__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), |
370 | 370 | __FILE__, |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | foreach ($qstns as $QST_ID => $qstn) { |
386 | 386 | // if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
387 | - if (! is_array($qstn)) { |
|
387 | + if ( ! is_array($qstn)) { |
|
388 | 388 | $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
389 | 389 | continue; |
390 | 390 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | ); |
402 | 402 | $answer = EEM_Answer::instance()->get_one($query_params); |
403 | 403 | // this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
404 | - if (! $answer instanceof EE_Answer) { |
|
404 | + if ( ! $answer instanceof EE_Answer) { |
|
405 | 405 | $set_values = array( |
406 | 406 | 'QST_ID' => $QST_ID, |
407 | 407 | 'REG_ID' => $REG_ID, |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration) |
443 | 443 | { |
444 | 444 | // check if the old hooks are in use. If not, do the default |
445 | - if (! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
445 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
446 | 446 | || ! $admin_page instanceof EE_Admin_Page) { |
447 | 447 | return $do_default_action; |
448 | 448 | } |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | 'reg_questions_form_action' => 'edit_registration', |
475 | 475 | 'REG_ID' => $registration->ID(), |
476 | 476 | ); |
477 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
477 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
478 | 478 | echo EEH_Template::display_template($template_path, $template_args, true); |
479 | 479 | // indicate that we should not do the default admin page code |
480 | 480 | return false; |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | public function _class_is_deprecated($method) |
593 | 593 | { |
594 | 594 | EE_Error::doing_it_wrong( |
595 | - 'EE_messages::' . $method, |
|
595 | + 'EE_messages::'.$method, |
|
596 | 596 | esc_html__('EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.'), |
597 | 597 | '4.9.0', |
598 | 598 | '4.10.0.p' |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | $error = false; |
732 | 732 | // try to intelligently determine what method we'll call based on the incoming data. |
733 | 733 | // if generating and sending are different then generate and send immediately. |
734 | - if (! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
734 | + if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
735 | 735 | // in the legacy system, when generating and sending were different, that means all the |
736 | 736 | // vars are already in the request object. So let's just use that. |
737 | 737 | try { |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | 'event_espresso' |
745 | 745 | ); |
746 | 746 | // add specific message for developers if WP_DEBUG in on |
747 | - $error_msg .= '||' . $e->getMessage(); |
|
747 | + $error_msg .= '||'.$e->getMessage(); |
|
748 | 748 | EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
749 | 749 | $error = true; |
750 | 750 | } |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | } |
819 | 819 | } |
820 | 820 | // if no error then return the generated message(s). |
821 | - if (! $error && ! $send) { |
|
821 | + if ( ! $error && ! $send) { |
|
822 | 822 | $generated_queue = $processor->generate_queue(false); |
823 | 823 | // get message and return. |
824 | 824 | $generated_queue->get_message_repository()->rewind(); |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | /** @type EE_Messages_Queue $queue */ |
878 | 878 | $queue = EE_Registry::instance()->load_lib('Messages_Queue'); |
879 | 879 | // make sure we have a proper message object |
880 | - if (! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
880 | + if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
881 | 881 | $msg = EE_Message_Factory::create( |
882 | 882 | array( |
883 | 883 | 'MSG_messenger' => $messenger, |
@@ -889,11 +889,11 @@ discard block |
||
889 | 889 | } else { |
890 | 890 | $msg = $message; |
891 | 891 | } |
892 | - if (! $msg instanceof EE_Message) { |
|
892 | + if ( ! $msg instanceof EE_Message) { |
|
893 | 893 | return false; |
894 | 894 | } |
895 | 895 | // make sure any content in a content property (if not empty) is set on the MSG_content. |
896 | - if (! empty($msg->content)) { |
|
896 | + if ( ! empty($msg->content)) { |
|
897 | 897 | $msg->set('MSG_content', $msg->content); |
898 | 898 | } |
899 | 899 | $queue->add($msg); |
@@ -1132,8 +1132,8 @@ discard block |
||
1132 | 1132 | |
1133 | 1133 | add_filter( |
1134 | 1134 | 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
1135 | - function ($event_list_iframe_css) { |
|
1136 | - if (! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) { |
|
1135 | + function($event_list_iframe_css) { |
|
1136 | + if ( ! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) { |
|
1137 | 1137 | return $event_list_iframe_css; |
1138 | 1138 | } |
1139 | 1139 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -1152,8 +1152,8 @@ discard block |
||
1152 | 1152 | ); |
1153 | 1153 | add_filter( |
1154 | 1154 | 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
1155 | - function ($event_list_iframe_js) { |
|
1156 | - if (! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) { |
|
1155 | + function($event_list_iframe_js) { |
|
1156 | + if ( ! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) { |
|
1157 | 1157 | return $event_list_iframe_js; |
1158 | 1158 | } |
1159 | 1159 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -1172,8 +1172,8 @@ discard block |
||
1172 | 1172 | ); |
1173 | 1173 | add_action( |
1174 | 1174 | 'AHEE__EE_Capabilities__addCaps__complete', |
1175 | - function ($capabilities_map) { |
|
1176 | - if (! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) { |
|
1175 | + function($capabilities_map) { |
|
1176 | + if ( ! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) { |
|
1177 | 1177 | return; |
1178 | 1178 | } |
1179 | 1179 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | add_filter( |
1194 | 1194 | 'FHEE_EventEspresso_core_domain_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee', |
1195 | 1195 | function($existing_attendee, $registration, $attendee_data) { |
1196 | - if ( ! has_filter( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee' )) { |
|
1196 | + if ( ! has_filter('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee')) { |
|
1197 | 1197 | return $existing_attendee; |
1198 | 1198 | } |
1199 | 1199 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | */ |
1285 | 1285 | public function event_list_title($event_list_title = '') |
1286 | 1286 | { |
1287 | - if (! empty($this->title)) { |
|
1287 | + if ( ! empty($this->title)) { |
|
1288 | 1288 | return $this->title; |
1289 | 1289 | } |
1290 | 1290 | return $event_list_title; |
@@ -1444,7 +1444,7 @@ discard block |
||
1444 | 1444 | foreach ($model_fields as $field) { |
1445 | 1445 | if ($label === EEH_Export::get_column_name_for_field($field)) { |
1446 | 1446 | // re-add the old field name |
1447 | - $new_label = $label . '[' . $field->get_name() . ']'; |
|
1447 | + $new_label = $label.'['.$field->get_name().']'; |
|
1448 | 1448 | break; |
1449 | 1449 | } |
1450 | 1450 | } |