1
|
|
|
<?php |
2
|
|
|
if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
3
|
|
|
exit( 'No direct script access allowed' ); |
4
|
|
|
} |
5
|
|
|
/** |
6
|
|
|
* ************************************************************************ |
7
|
|
|
* _____ ______ _____ __ __ ______ |
8
|
|
|
* | __ \| ____| /\ | __ \ | \/ | ____| |
9
|
|
|
* | |__) | |__ / \ | | | | | \ / | |__ |
10
|
|
|
* | _ /| __| / /\ \ | | | | | |\/| | __| |
11
|
|
|
* | | \ \| |____ / ____ \| |__| | | | | | |____ |
12
|
|
|
* |_| \_\______/_/ \_\_____/ |_| |_|______| |
13
|
|
|
* |
14
|
|
|
* ************************************************************************ |
15
|
|
|
* |
16
|
|
|
* This file contains all deprecated actions, filters, functions, and classes in EE. |
17
|
|
|
* DO NOT ADD NEW CODE TO THE TOP OF THIS FILE !!! |
18
|
|
|
* PLEASE ADD ALL NEW CODE TO THE BOTTOM THIS FILE !!! |
19
|
|
|
* IF YOU ADD CODE TO THIS FILE, WHY NOT TRY ADDING IT TO THE BOTTOM ? |
20
|
|
|
* THE WHITE ZONE IS FOR LOADING AND UNLOADING ONLY, |
21
|
|
|
* IF YOU HAVE TO LOAD OR UNLOAD, GO TO THE WHITE ZONE !!! |
22
|
|
|
* |
23
|
|
|
* @package Event Espresso |
24
|
|
|
* @subpackage helpers |
25
|
|
|
* @since 4.5.0 |
26
|
|
|
*/ |
27
|
|
|
/** |
28
|
|
|
* ee_deprecated__registration_checkout__button_text |
29
|
|
|
* |
30
|
|
|
* @param string $submit_button_text |
31
|
|
|
* @param \EE_Checkout $checkout |
32
|
|
|
* @return string |
33
|
|
|
*/ |
34
|
|
|
function ee_deprecated__registration_checkout__button_text( $submit_button_text, EE_Checkout $checkout ) { |
35
|
|
|
// list of old filters |
36
|
|
|
$deprecated_filters = array( |
37
|
|
|
'update_registration_details' => true, |
38
|
|
|
'process_payment' => true, |
39
|
|
|
'finalize_registration' => true, |
40
|
|
|
'and_proceed_to_payment' => true, |
41
|
|
|
'proceed_to' => true, |
42
|
|
|
); |
43
|
|
|
// loop thru and call doing_it_wrong() or remove any that aren't being used |
44
|
|
|
foreach ( $deprecated_filters as $deprecated_filter => $on ) { |
45
|
|
|
// was this filter called ? |
46
|
|
|
if ( has_action( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter )) { |
47
|
|
|
// only display doing_it_wrong() notice to Event Admins during non-AJAX requests |
48
|
|
|
if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter' ) && ! defined( 'DOING_AJAX' ) ) { |
49
|
|
|
EE_Error::doing_it_wrong( |
50
|
|
|
'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
51
|
|
|
sprintf( |
52
|
|
|
__( '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"', 'event_espresso' ), |
53
|
|
|
'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
54
|
|
|
'<br />', |
55
|
|
|
'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
56
|
|
|
'/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php' |
57
|
|
|
), |
58
|
|
|
'4.6.10' |
59
|
|
|
); |
60
|
|
|
} |
61
|
|
|
} else { |
62
|
|
|
unset( $deprecated_filters[ $deprecated_filter ] ); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
if ( ! empty( $deprecated_filters )) { |
66
|
|
|
|
67
|
|
|
if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset( $deprecated_filters[ 'update_registration_details' ] )) { |
68
|
|
|
$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text ); |
69
|
|
|
} else if ( $checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset( $deprecated_filters[ 'process_payment' ] ) ) { |
70
|
|
|
$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text ); |
71
|
|
View Code Duplication |
} else if ( $checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset( $deprecated_filters[ 'finalize_registration' ] ) ) { |
72
|
|
|
$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text ); |
73
|
|
|
} |
74
|
|
|
if ( $checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
75
|
|
|
if ( $checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset( $deprecated_filters[ 'and_proceed_to_payment' ] ) ) { |
76
|
|
|
$submit_button_text .= apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text ); |
77
|
|
|
} |
78
|
|
View Code Duplication |
if ( $checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset( $deprecated_filters[ 'proceed_to' ] ) ) { |
79
|
|
|
$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text ) . $checkout->next_step->name(); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
} |
84
|
|
|
return $submit_button_text; |
85
|
|
|
|
86
|
|
|
} |
87
|
|
|
add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2 ); |
88
|
|
|
|
89
|
|
|
|
90
|
|
|
|
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* ee_deprecated_finalize_transaction |
94
|
|
|
* |
95
|
|
|
* @param \EE_Checkout $checkout |
96
|
|
|
* @param boolean $status_updates |
97
|
|
|
*/ |
98
|
|
|
function ee_deprecated_finalize_transaction( EE_Checkout $checkout, $status_updates ) { |
99
|
|
|
$action_ref = NULL; |
100
|
|
|
$action_ref = has_action( 'AHEE__EE_Transaction__finalize__new_transaction' ) ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
101
|
|
|
$action_ref = has_action( 'AHEE__EE_Transaction__finalize__all_transaction' ) ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
102
|
|
|
if ( $action_ref ) { |
|
|
|
|
103
|
|
|
|
104
|
|
|
EE_Error::doing_it_wrong( |
105
|
|
|
$action_ref, |
106
|
|
|
sprintf( |
107
|
|
|
__( '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"', 'event_espresso' ), |
108
|
|
|
'<br />', |
109
|
|
|
'/core/business/EE_Transaction_Processor.class.php', |
110
|
|
|
'AHEE__EE_Transaction_Processor__finalize', |
111
|
|
|
'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', |
112
|
|
|
'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', |
113
|
|
|
'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing' |
114
|
|
|
), |
115
|
|
|
'4.6.0' |
116
|
|
|
); |
117
|
|
|
switch ( $action_ref ) { |
118
|
|
|
case 'AHEE__EE_Transaction__finalize__new_transaction' : |
119
|
|
|
do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request ); |
120
|
|
|
break; |
121
|
|
|
case 'AHEE__EE_Transaction__finalize__all_transaction' : |
122
|
|
|
do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array( 'new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates ), $checkout->admin_request ); |
123
|
|
|
break; |
124
|
|
|
} |
125
|
|
|
} |
126
|
|
|
} |
127
|
|
|
add_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2 ); |
128
|
|
|
/** |
129
|
|
|
* ee_deprecated_finalize_registration |
130
|
|
|
* |
131
|
|
|
* @param EE_Registration $registration |
132
|
|
|
*/ |
133
|
|
|
function ee_deprecated_finalize_registration( EE_Registration $registration ) { |
134
|
|
|
$action_ref = has_action( 'AHEE__EE_Registration__finalize__update_and_new_reg' ) ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
135
|
|
|
if ( $action_ref ) { |
|
|
|
|
136
|
|
|
EE_Error::doing_it_wrong( |
137
|
|
|
$action_ref, |
138
|
|
|
sprintf( |
139
|
|
|
__( '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"', 'event_espresso' ), |
140
|
|
|
'<br />', |
141
|
|
|
'/core/business/EE_Registration_Processor.class.php', |
142
|
|
|
'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook' |
143
|
|
|
), |
144
|
|
|
'4.6.0' |
145
|
|
|
); |
146
|
|
|
do_action( 'AHEE__EE_Registration__finalize__update_and_new_reg', $registration, ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ))); |
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1 ); |
150
|
|
|
|
151
|
|
|
|
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Called after EED_Module::set_hooks() and EED_Module::set_admin_hooks() was called. |
155
|
|
|
* Checks if any deprecated hooks were hooked-into and provide doing_it_wrong messages appropriately. |
156
|
|
|
*/ |
157
|
|
|
function ee_deprecated_hooks(){ |
158
|
|
|
/** |
159
|
|
|
* @var $hooks array where keys are hook names, and their values are array{ |
160
|
|
|
* @type string $version when deprecated |
161
|
|
|
* @type string $alternative saying what to use instead |
162
|
|
|
* @type boolean $still_works whether or not the hook still works |
163
|
|
|
* } |
164
|
|
|
*/ |
165
|
|
|
$hooks = array( |
166
|
|
|
'AHEE__EE_System___do_setup_validations' => array( |
167
|
|
|
'version' => '4.6.0', |
168
|
|
|
'alternative' => __( 'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso' ), |
169
|
|
|
'still_works' => FALSE |
170
|
|
|
) |
171
|
|
|
); |
172
|
|
|
foreach( $hooks as $name => $deprecation_info ){ |
173
|
|
|
if( has_action( $name ) ){ |
174
|
|
|
EE_Error::doing_it_wrong( |
175
|
|
|
$name, |
176
|
|
|
sprintf( |
177
|
|
|
__('This filter is deprecated. %1$s%2$s','event_espresso'), |
178
|
|
|
$deprecation_info[ 'still_works' ] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __( 'It has been completely removed.', 'event_espresso' ), |
179
|
|
|
isset( $deprecation_info[ 'alternative' ] ) ? $deprecation_info[ 'alternative' ] : __( 'Please read the current EE4 documentation further or contact Support.', 'event_espresso' ) |
180
|
|
|
), |
181
|
|
|
isset( $deprecation_info[ 'version' ] ) ? $deprecation_info[ 'version' ] : __( 'recently', 'event_espresso' ) |
182
|
|
|
); |
183
|
|
|
} |
184
|
|
|
} |
185
|
|
|
} |
186
|
|
|
add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks' ); |
187
|
|
|
|
188
|
|
|
|
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* Checks if the filters which were removed as part of https://events.codebasehq.com/projects/event-espresso/tickets/9165 |
192
|
|
|
* are in use. If so, issues a doing_it_wrong AND an error (because the doing_it_wrong |
193
|
|
|
* messages were somehow hidden in the UI) |
194
|
|
|
* @return boolean |
195
|
|
|
*/ |
196
|
|
|
function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() { |
197
|
|
|
$in_use = has_filter( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns' ) |
198
|
|
|
|| has_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' ); |
199
|
|
|
if( $in_use ) { |
200
|
|
|
$msg = __( |
201
|
|
|
'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.' |
202
|
|
|
. '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,' |
203
|
|
|
. '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 ' |
204
|
|
|
. 'to add other actions after a form submission has been received.', |
205
|
|
|
'event_espresso' ) |
206
|
|
|
; |
207
|
|
|
EE_Error::doing_it_wrong( |
208
|
|
|
__CLASS__ . '::' . __FUNCTION__, |
209
|
|
|
$msg, |
210
|
|
|
'4.8.32.rc.000' |
211
|
|
|
); |
212
|
|
|
//it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed |
213
|
|
|
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
214
|
|
|
EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
215
|
|
|
} |
216
|
|
|
} |
217
|
|
|
return $in_use; |
218
|
|
|
} |
219
|
|
|
add_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' ); |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165 |
223
|
|
|
* it is preferred to instead use _update_attendee_registration_form_new() which |
224
|
|
|
* also better handles form validation. Exits |
225
|
|
|
* @param EE_Admin_Page $admin_page |
226
|
|
|
* @return void |
227
|
|
|
*/ |
228
|
|
|
function ee_deprecated_update_attendee_registration_form_old( $admin_page ) { |
229
|
|
|
//check if the old hooks are in use. If not, do the default |
230
|
|
|
if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
231
|
|
|
|| ! $admin_page instanceof EE_Admin_Page ) { |
232
|
|
|
return; |
233
|
|
|
} |
234
|
|
|
$req_data = $admin_page->get_request_data(); |
235
|
|
|
$qstns = isset( $req_data['qstn'] ) ? $req_data['qstn'] : FALSE; |
236
|
|
|
$REG_ID = isset( $req_data['_REG_ID'] ) ? absint( $req_data['_REG_ID'] ) : FALSE; |
237
|
|
|
$qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
238
|
|
|
if ( ! $REG_ID || ! $qstns ) { |
239
|
|
|
EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
240
|
|
|
} |
241
|
|
|
$success = TRUE; |
242
|
|
|
|
243
|
|
|
// allow others to get in on this awesome fun :D |
244
|
|
|
do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
245
|
|
|
// loop thru questions... FINALLY!!! |
246
|
|
|
|
247
|
|
|
foreach ( $qstns as $QST_ID => $qstn ) { |
248
|
|
|
//if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
249
|
|
|
if ( !is_array($qstn) ) { |
250
|
|
|
$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
|
|
|
251
|
|
|
continue; |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
|
255
|
|
|
foreach ( $qstn as $ANS_ID => $ANS_value ) { |
256
|
|
|
//get answer |
257
|
|
|
$query_params = array( |
258
|
|
|
0 => array( |
259
|
|
|
'ANS_ID' => $ANS_ID, |
260
|
|
|
'REG_ID' => $REG_ID, |
261
|
|
|
'QST_ID' => $QST_ID |
262
|
|
|
) |
263
|
|
|
); |
264
|
|
|
$answer = EEM_Answer::instance()->get_one($query_params); |
265
|
|
|
//this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
266
|
|
|
if ( ! $answer instanceof EE_Answer ) { |
267
|
|
|
$set_values = array( |
268
|
|
|
'QST_ID' => $QST_ID, |
269
|
|
|
'REG_ID' => $REG_ID, |
270
|
|
|
'ANS_value' => $qstn |
271
|
|
|
); |
272
|
|
|
$success = EEM_Answer::instance()->insert($set_values); |
273
|
|
|
continue 2; |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
$answer->set('ANS_value', $ANS_value); |
277
|
|
|
$success = $answer->save(); |
278
|
|
|
} |
279
|
|
|
} |
280
|
|
|
$what = __('Registration Form', 'event_espresso'); |
281
|
|
|
$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
282
|
|
|
$admin_page->redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
283
|
|
|
exit; |
284
|
|
|
} |
285
|
|
|
add_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1 ); |
286
|
|
|
/** |
287
|
|
|
* Render the registration admin page's custom questions area in the old fashion |
288
|
|
|
* and firing the old hooks. When this method is removed, we can probably also |
289
|
|
|
* remove the deprecated methods form_before_question_group, form_after_question_group, |
290
|
|
|
* form_form_field_label_wrap and form_form_field_input__wrap in Registrations_Admin_Page |
291
|
|
|
* |
292
|
|
|
* @param boolean $do_default_action |
293
|
|
|
* @param EE_Admin_Page $admin_page |
294
|
|
|
* @param EE_Registration $registration |
295
|
|
|
* @return bool |
296
|
|
|
* @throws \EE_Error |
297
|
|
|
*/ |
298
|
|
|
function ee_deprecated_reg_questions_meta_box_old( $do_default_action, $admin_page, $registration ) { |
299
|
|
|
//check if the old hooks are in use. If not, do the default |
300
|
|
|
if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
301
|
|
|
|| ! $admin_page instanceof EE_Admin_Page ) { |
302
|
|
|
return $do_default_action; |
303
|
|
|
} |
304
|
|
|
add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $admin_page, 'form_before_question_group' ), 10, 1 ); |
305
|
|
|
add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $admin_page, 'form_after_question_group' ), 10, 1 ); |
306
|
|
|
add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $admin_page, 'form_form_field_label_wrap' ), 10, 1 ); |
307
|
|
|
add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $admin_page, 'form_form_field_input__wrap' ), 10, 1 ); |
308
|
|
|
|
309
|
|
|
$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $registration, $registration->get('EVT_ID') ); |
|
|
|
|
310
|
|
|
|
311
|
|
|
EE_Registry::instance()->load_helper( 'Form_Fields' ); |
312
|
|
|
$template_args = array( |
313
|
|
|
'att_questions' => EEH_Form_Fields::generate_question_groups_html( $question_groups ), |
314
|
|
|
'reg_questions_form_action' => 'edit_registration', |
315
|
|
|
'REG_ID' => $registration->ID() |
316
|
|
|
); |
317
|
|
|
$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
318
|
|
|
echo EEH_Template::display_template( $template_path, $template_args, TRUE ); |
319
|
|
|
//indicate that we should not do the default admin page code |
320
|
|
|
return false; |
321
|
|
|
} |
322
|
|
|
add_action( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3 ); |
323
|
|
|
|
324
|
|
|
|
325
|
|
|
|
326
|
|
|
|
327
|
|
|
/** |
328
|
|
|
* Deprecated class for instantiating default templates. This was deprecated because of a substantial change in the constructor |
329
|
|
|
* signature. |
330
|
|
|
* |
331
|
|
|
* @package Event Espresso |
332
|
|
|
* @subpackage messages |
333
|
|
|
* @author Darren Ethier |
334
|
|
|
* @since 4.1 |
335
|
|
|
* @deprecated 4.9.0 Replaced by EE_Messages_Template_Defaults (note the plural s on Messages) |
336
|
|
|
*/ |
337
|
|
|
class EE_Message_Template_Defaults extends EE_Base { |
338
|
|
|
|
339
|
|
|
/** |
340
|
|
|
* EE_Message_Template_Defaults constructor. |
341
|
|
|
* |
342
|
|
|
* @param EE_messages $messages |
343
|
|
|
* @param $messenger_name |
344
|
|
|
* @param $message_type_name |
345
|
|
|
* @param int $GRP_ID |
346
|
|
|
* @return EE_Messages_Template_Defaults |
|
|
|
|
347
|
|
|
*/ |
348
|
|
|
public function __construct( |
349
|
|
|
EE_messages $messages, |
|
|
|
|
350
|
|
|
$messenger_name, |
351
|
|
|
$message_type_name, |
352
|
|
|
$GRP_ID = 0 |
353
|
|
|
) { |
354
|
|
|
EE_Error::doing_it_wrong( |
355
|
|
|
__FUNCTION__, |
356
|
|
|
__( |
357
|
|
|
'The class EE_Message_Template_Defaults has been deprecated and replaced by EE_Messages_Template_Defaults.', |
358
|
|
|
'event_espresso' |
359
|
|
|
), |
360
|
|
|
'4.9.0' |
361
|
|
|
); |
362
|
|
|
/** @var EE_Message_Resource_Manager $message_resource_manager */ |
363
|
|
|
$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
364
|
|
|
$messenger = $message_resource_manager->get_messenger( $messenger_name ); |
365
|
|
|
$message_type = $message_resource_manager->get_message_type( $message_type_name ); |
366
|
|
|
return EE_Registry::instance()->load_lib( |
|
|
|
|
367
|
|
|
'Messages_Template_Defaults', |
368
|
|
|
array( |
369
|
|
|
$GRP_ID, |
370
|
|
|
$messenger, |
371
|
|
|
$message_type, |
372
|
|
|
) |
373
|
|
|
); |
374
|
|
|
} |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
|
378
|
|
|
|
379
|
|
|
//end EE_Message_Template_Defaults class |
380
|
|
|
|
381
|
|
|
|
382
|
|
|
|
383
|
|
|
|
384
|
|
|
/** |
385
|
|
|
* @deprecated 4.9.0 |
386
|
|
|
* @package Event Espresso |
387
|
|
|
* @subpackage includes/core/messages |
388
|
|
|
* @author Darren Ethier, Brent Christensen |
389
|
|
|
* |
390
|
|
|
* ------------------------------------------------------------------------ |
391
|
|
|
*/ |
392
|
|
|
class EE_messages { |
393
|
|
|
|
394
|
|
|
/** @type EE_messenger[] */ |
395
|
|
|
protected $_active_messengers = array(); |
396
|
|
|
|
397
|
|
|
/** @type array */ |
398
|
|
|
protected $_active_message_types = array(); |
399
|
|
|
|
400
|
|
|
/** @type EE_message_type[] */ |
401
|
|
|
protected $_installed_message_types = array(); |
402
|
|
|
|
403
|
|
|
/** @type EE_messenger */ |
404
|
|
|
protected $_messenger; |
405
|
|
|
|
406
|
|
|
/** @type EE_message_type */ |
407
|
|
|
protected $_message_type; |
408
|
|
|
|
409
|
|
|
/** @type array */ |
410
|
|
|
protected $_contexts = array(); |
411
|
|
|
|
412
|
|
|
/** @type EE_Message_Resource_Manager $_message_resource_manager */ |
413
|
|
|
protected $_message_resource_manager; |
414
|
|
|
|
415
|
|
|
|
416
|
|
|
|
417
|
|
|
/** |
418
|
|
|
* EE_messages constructor. |
419
|
|
|
* |
420
|
|
|
* @deprecated 4.9.0 |
421
|
|
|
*/ |
422
|
|
|
public function __construct() { |
423
|
|
|
} |
424
|
|
|
|
425
|
|
|
|
426
|
|
|
|
427
|
|
|
/** |
428
|
|
|
* @param string $method |
429
|
|
|
*/ |
430
|
|
View Code Duplication |
public function _class_is_deprecated( $method ) { |
|
|
|
|
431
|
|
|
EE_Error::doing_it_wrong( |
432
|
|
|
'EE_messages::' . $method, |
433
|
|
|
__( 'EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.' ), |
434
|
|
|
'4.9.0', |
435
|
|
|
'4.10.0.p' |
436
|
|
|
); |
437
|
|
|
// Please use EE_Message_Resource_Manager instead |
438
|
|
|
$this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
|
|
|
439
|
|
|
} |
440
|
|
|
|
441
|
|
|
|
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* @deprecated 4.9.0 |
445
|
|
|
* @param string $messenger_name |
446
|
|
|
* @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive |
447
|
|
|
*/ |
448
|
|
|
public function ensure_messenger_is_active( $messenger_name ) { |
449
|
|
|
// EE_messages has been deprecated |
450
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
451
|
|
|
return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name ); |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
|
455
|
|
|
|
456
|
|
|
/** |
457
|
|
|
* @deprecated 4.9.0 |
458
|
|
|
* @param string $message_type message type name |
459
|
|
|
* @param $messenger |
460
|
|
|
* @return bool true if it got activated (or was active) and false if not. |
461
|
|
|
* @throws \EE_Error |
462
|
|
|
*/ |
463
|
|
|
public function ensure_message_type_is_active( $message_type, $messenger ) { |
464
|
|
|
// EE_messages has been deprecated |
465
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
466
|
|
|
return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger ); |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
|
470
|
|
|
|
471
|
|
|
/** |
472
|
|
|
* @deprecated 4.9.0 |
473
|
|
|
* @param string $messenger_name |
474
|
|
|
* @param array $mts_to_activate (optional) An array of message types to activate with this messenger. If |
475
|
|
|
* included we do NOT setup the default message types (assuming |
476
|
|
|
* they are already setup.) |
477
|
|
|
* @return boolean an array of generated templates or false if nothing generated/activated. |
478
|
|
|
*/ |
479
|
|
|
public function activate_messenger( $messenger_name, $mts_to_activate = array() ) { |
480
|
|
|
// EE_messages has been deprecated |
481
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
482
|
|
|
return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate ); |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
|
486
|
|
|
|
487
|
|
|
/** |
488
|
|
|
* @deprecated 4.9.0 |
489
|
|
|
* @param EE_messenger $messenger messenger used in trigger |
490
|
|
|
* @param EE_message_type $message_type message type used in trigger |
491
|
|
|
* |
492
|
|
|
* @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
493
|
|
|
*/ |
494
|
|
|
public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) { |
495
|
|
|
// EE_messages has been deprecated |
496
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
497
|
|
|
return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type ); |
498
|
|
|
} |
499
|
|
|
|
500
|
|
|
|
501
|
|
|
|
502
|
|
|
/** |
503
|
|
|
* @deprecated 4.9.0 |
504
|
|
|
* @param string $messenger |
505
|
|
|
* @return EE_messenger | null |
506
|
|
|
*/ |
507
|
|
|
public function get_messenger_if_active( $messenger ) { |
508
|
|
|
// EE_messages has been deprecated |
509
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
510
|
|
|
return $this->_message_resource_manager->get_active_messenger( $messenger ); |
511
|
|
|
} |
512
|
|
|
|
513
|
|
|
|
514
|
|
|
|
515
|
|
|
/** |
516
|
|
|
* @deprecated 4.9.0 |
517
|
|
|
* @param EE_Message $message |
518
|
|
|
* @return array An array with 'messenger' and 'message_type' as the index and the corresponding valid object if |
519
|
|
|
* available. |
520
|
|
|
* Eg. Valid Messenger and Message Type: |
521
|
|
|
* array( |
522
|
|
|
* 'messenger' => new EE_Email_messenger(), |
523
|
|
|
* 'message_type' => new EE_Registration_Approved_message_type() |
524
|
|
|
* ) |
525
|
|
|
* Valid Messenger and Invalid Message Type: |
526
|
|
|
* array( |
527
|
|
|
* 'messenger' => new EE_Email_messenger(), |
528
|
|
|
* 'message_type' => null |
529
|
|
|
* ) |
530
|
|
|
*/ |
531
|
|
|
public function validate_for_use( EE_Message $message ) { |
532
|
|
|
// EE_messages has been deprecated |
533
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
534
|
|
|
return array( |
535
|
|
|
'messenger' => $message->messenger_object(), |
536
|
|
|
'message_type' => $message->message_type_object(), |
537
|
|
|
); |
538
|
|
|
} |
539
|
|
|
|
540
|
|
|
|
541
|
|
|
|
542
|
|
|
/** |
543
|
|
|
* @deprecated 4.9.0 |
544
|
|
|
* @param string $type What type of message are we sending (corresponds to message types) |
545
|
|
|
* @param mixed $vars Data being sent for parsing in the message |
546
|
|
|
* @param string $sending_messenger if included then we ONLY use the specified messenger for delivery. Otherwise we cycle through all active messengers. |
547
|
|
|
* @param string $generating_messenger if included then this messenger is used for generating the message templates (but not for sending). |
548
|
|
|
* @param string $context If included then only a message type for a specific context will be generated. |
549
|
|
|
* @param bool $send Default TRUE. If false, then this will just return the generated EE_messages objects which might be used by the trigger to setup a batch message (typically html messenger uses it). |
550
|
|
|
* @return bool |
551
|
|
|
*/ |
552
|
|
|
public function send_message( |
553
|
|
|
$type, |
554
|
|
|
$vars, |
555
|
|
|
$sending_messenger = '', |
556
|
|
|
$generating_messenger = '', |
557
|
|
|
$context = '', |
|
|
|
|
558
|
|
|
$send = true |
559
|
|
|
) { |
560
|
|
|
// EE_messages has been deprecated |
561
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
562
|
|
|
/** @type EE_Messages_Processor $processor */ |
563
|
|
|
$processor = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
564
|
|
|
$error = false; |
565
|
|
|
//try to intelligently determine what method we'll call based on the incoming data. |
566
|
|
|
//if generating and sending are different then generate and send immediately. |
567
|
|
|
if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) { |
568
|
|
|
//in the legacy system, when generating and sending were different, that means all the |
569
|
|
|
//vars are already in the request object. So let's just use that. |
570
|
|
|
try { |
571
|
|
|
/** @type EE_Message_To_Generate_From_Request $mtg */ |
572
|
|
|
$mtg = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' ); |
573
|
|
|
$processor->generate_and_send_now( $mtg ); |
574
|
|
|
} catch ( EE_Error $e ) { |
575
|
|
|
$error_msg = __( |
576
|
|
|
'Please note that a system message failed to send due to a technical issue.', |
577
|
|
|
'event_espresso' |
578
|
|
|
); |
579
|
|
|
// add specific message for developers if WP_DEBUG in on |
580
|
|
|
$error_msg .= '||' . $e->getMessage(); |
581
|
|
|
EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
582
|
|
|
$error = true; |
583
|
|
|
} |
584
|
|
|
} else { |
585
|
|
|
$processor->generate_for_all_active_messengers( $type, $vars, $send ); |
586
|
|
|
//let's find out if there were any errors and how many successfully were queued. |
587
|
|
|
$count_errors = $processor->get_queue()->count_STS_in_queue( |
588
|
|
|
array( EEM_Message::status_failed, EEM_Message::status_debug_only ) |
589
|
|
|
); |
590
|
|
|
$count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete ); |
591
|
|
|
$count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry ); |
592
|
|
|
$count_errors = $count_errors + $count_retry; |
593
|
|
|
if ( $count_errors > 0 ) { |
594
|
|
|
$error = true; |
595
|
|
|
if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) { |
596
|
|
|
$message = sprintf( |
597
|
|
|
__( |
598
|
|
|
'There were %d errors and %d messages successfully queued for generation and sending', |
599
|
|
|
'event_espresso' |
600
|
|
|
), |
601
|
|
|
$count_errors, |
602
|
|
|
$count_queued |
603
|
|
|
); |
604
|
|
|
} elseif ( $count_errors > 1 && $count_queued === 1 ) { |
605
|
|
|
$message = sprintf( |
606
|
|
|
__( |
607
|
|
|
'There were %d errors and %d message successfully queued for generation.', |
608
|
|
|
'event_espresso' |
609
|
|
|
), |
610
|
|
|
$count_errors, |
611
|
|
|
$count_queued |
612
|
|
|
); |
613
|
|
|
} elseif ( $count_errors === 1 && $count_queued > 1 ) { |
614
|
|
|
$message = sprintf( |
615
|
|
|
__( |
616
|
|
|
'There was %d error and %d messages successfully queued for generation.', |
617
|
|
|
'event_espresso' |
618
|
|
|
), |
619
|
|
|
$count_errors, |
620
|
|
|
$count_queued |
621
|
|
|
); |
622
|
|
|
} else { |
623
|
|
|
$message = sprintf( |
624
|
|
|
__( |
625
|
|
|
'There was %d message that failed to be queued for generation.', |
626
|
|
|
'event_espresso' |
627
|
|
|
), |
628
|
|
|
$count_errors |
629
|
|
|
); |
630
|
|
|
} |
631
|
|
|
EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ ); |
632
|
|
|
} else { |
633
|
|
|
if ( $count_queued === 1 ) { |
634
|
|
|
$message = sprintf( |
635
|
|
|
__( |
636
|
|
|
'%d message successfully queued for generation.', |
637
|
|
|
'event_espresso' |
638
|
|
|
), |
639
|
|
|
$count_queued |
640
|
|
|
); |
641
|
|
|
} else { |
642
|
|
|
$message = sprintf( |
643
|
|
|
__( |
644
|
|
|
'%d messages were successfully queued for generation.', |
645
|
|
|
'event_espresso' |
646
|
|
|
), |
647
|
|
|
$count_queued |
648
|
|
|
); |
649
|
|
|
} |
650
|
|
|
EE_Error::add_success( $message ); |
651
|
|
|
} |
652
|
|
|
} |
653
|
|
|
//if no error then return the generated message(s). |
654
|
|
|
if ( ! $error && ! $send ) { |
655
|
|
|
$generated_queue = $processor->generate_queue( false ); |
656
|
|
|
//get message and return. |
657
|
|
|
$generated_queue->get_message_repository()->rewind(); |
658
|
|
|
$messages = array(); |
659
|
|
|
while ( $generated_queue->get_message_repository()->valid() ) { |
660
|
|
|
$message = $generated_queue->get_message_repository()->current(); |
661
|
|
|
if ( $message instanceof EE_Message ) { |
662
|
|
|
//set properties that might be expected by add-ons (backward compat) |
663
|
|
|
$message->content = $message->content(); |
|
|
|
|
664
|
|
|
$message->template_pack = $message->get_template_pack(); |
|
|
|
|
665
|
|
|
$message->template_variation = $message->get_template_pack_variation(); |
|
|
|
|
666
|
|
|
$messages[] = $message; |
667
|
|
|
} |
668
|
|
|
$generated_queue->get_message_repository()->next(); |
669
|
|
|
} |
670
|
|
|
return $messages; |
671
|
|
|
} |
672
|
|
|
return $error ? false |
673
|
|
|
: 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. |
674
|
|
|
} |
675
|
|
|
|
676
|
|
|
|
677
|
|
|
|
678
|
|
|
/** |
679
|
|
|
* @deprecated 4.9.0 |
680
|
|
|
* @param string $type This should correspond with a valid message type |
681
|
|
|
* @param string $context This should correspond with a valid context for the message type |
682
|
|
|
* @param string $messenger This should correspond with a valid messenger. |
683
|
|
|
* @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
684
|
|
|
* @return string The body of the message. |
685
|
|
|
*/ |
686
|
|
|
public function preview_message( $type, $context, $messenger, $send = false ) { |
687
|
|
|
// EE_messages has been deprecated |
688
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
689
|
|
|
return EED_Messages::preview_message( $type, $context, $messenger, $send ); |
690
|
|
|
} |
691
|
|
|
|
692
|
|
|
|
693
|
|
|
|
694
|
|
|
/** |
695
|
|
|
* @since 4.5.0 |
696
|
|
|
* @deprecated 4.9.0 Moved to EED_Messages Module |
697
|
|
|
* @param string $messenger a string matching a valid active messenger in the system |
698
|
|
|
* @param string $message_type Although it seems contrary to the name of the method, a message type name is still required to send along the message type to the messenger because this is used for determining what specific variations might be loaded for the generated message. |
699
|
|
|
* @param stdClass $message a stdClass object in the format expected by the messenger. |
700
|
|
|
* |
701
|
|
|
* @return bool success or fail. |
702
|
|
|
*/ |
703
|
|
|
public function send_message_with_messenger_only( $messenger, $message_type, $message ) { |
704
|
|
|
// EE_messages has been deprecated |
705
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
706
|
|
|
//setup for sending to new method. |
707
|
|
|
/** @type EE_Messages_Queue $queue */ |
708
|
|
|
$queue = EE_Registry::instance()->load_lib( 'Messages_Queue' ); |
709
|
|
|
//make sure we have a proper message object |
710
|
|
|
if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) { |
711
|
|
|
$msg = EE_Message_Factory::create( |
712
|
|
|
array( |
713
|
|
|
'MSG_messenger' => $messenger, |
714
|
|
|
'MSG_message_type' => $message_type, |
715
|
|
|
'MSG_content' => $message->content, |
716
|
|
|
'MSG_subject' => $message->subject |
717
|
|
|
) |
718
|
|
|
); |
719
|
|
|
} else { |
720
|
|
|
$msg = $message; |
721
|
|
|
} |
722
|
|
|
if ( ! $msg instanceof EE_Message ) { |
723
|
|
|
return false; |
724
|
|
|
} |
725
|
|
|
//make sure any content in a content property (if not empty) is set on the MSG_content. |
726
|
|
|
if ( ! empty( $msg->content ) ) { |
|
|
|
|
727
|
|
|
$msg->set( 'MSG_content', $msg->content ); |
|
|
|
|
728
|
|
|
} |
729
|
|
|
$queue->add( $msg ); |
730
|
|
|
return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue ); |
731
|
|
|
} |
732
|
|
|
|
733
|
|
|
|
734
|
|
|
|
735
|
|
|
/** |
736
|
|
|
* @deprecated 4.9.0 |
737
|
|
|
* @param $messenger |
738
|
|
|
* @param string $message_type message type that the templates are being created for |
739
|
|
|
* @param int $GRP_ID |
740
|
|
|
* @param bool $is_global |
741
|
|
|
* @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned. |
742
|
|
|
* @throws \EE_Error |
743
|
|
|
*/ |
744
|
|
|
public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) { |
745
|
|
|
// EE_messages has been deprecated |
746
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
747
|
|
|
EE_Registry::instance()->load_helper( 'MSG_Template' ); |
748
|
|
|
return EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $is_global ); |
749
|
|
|
} |
750
|
|
|
|
751
|
|
|
|
752
|
|
|
|
753
|
|
|
/** |
754
|
|
|
* @deprecated 4.9.0 |
755
|
|
|
* @param string $messenger_name name of EE_messenger |
756
|
|
|
* @param string $message_type_name name of EE_message_type |
757
|
|
|
* @return array |
758
|
|
|
*/ |
759
|
|
|
public function get_fields( $messenger_name, $message_type_name ) { |
760
|
|
|
// EE_messages has been deprecated |
761
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
762
|
|
|
EE_Registry::instance()->load_helper( 'MSG_Template' ); |
763
|
|
|
return EEH_MSG_Template::get_fields( $messenger_name, $message_type_name ); |
764
|
|
|
} |
765
|
|
|
|
766
|
|
|
|
767
|
|
|
|
768
|
|
|
/** |
769
|
|
|
* @deprecated 4.9.0 |
770
|
|
|
* @access public |
771
|
|
|
* @param string $type we can indicate just returning installed message types |
772
|
|
|
* or messengers (or both) via this parameter. |
773
|
|
|
* @param bool $skip_cache if true then we skip the cache and retrieve via files. |
774
|
|
|
* @return array multidimensional array of messenger and message_type objects |
775
|
|
|
* (messengers index, and message_type index); |
776
|
|
|
*/ |
777
|
|
|
public function get_installed( $type = 'all', $skip_cache = false ) { |
778
|
|
|
// EE_messages has been deprecated |
779
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
780
|
|
|
if ( $skip_cache ) { |
781
|
|
|
$this->_message_resource_manager->reset_active_messengers_and_message_types(); |
782
|
|
|
} |
783
|
|
|
switch ( $type ) { |
784
|
|
|
case 'messengers' : |
785
|
|
|
return array( |
786
|
|
|
'messenger' => $this->_message_resource_manager->installed_messengers(), |
787
|
|
|
); |
788
|
|
|
break; |
|
|
|
|
789
|
|
|
case 'message_types' : |
790
|
|
|
return array( |
791
|
|
|
'message_type' => $this->_message_resource_manager->installed_message_types(), |
792
|
|
|
); |
793
|
|
|
break; |
|
|
|
|
794
|
|
|
case 'all' : |
795
|
|
|
default : |
796
|
|
|
return array( |
797
|
|
|
'messenger' => $this->_message_resource_manager->installed_messengers(), |
798
|
|
|
'message_type' => $this->_message_resource_manager->installed_message_types(), |
799
|
|
|
); |
800
|
|
|
break; |
|
|
|
|
801
|
|
|
} |
802
|
|
|
} |
803
|
|
|
|
804
|
|
|
|
805
|
|
|
|
806
|
|
|
/** |
807
|
|
|
* @deprecated 4.9.0 |
808
|
|
|
* @return \EE_messenger[] |
809
|
|
|
*/ |
810
|
|
|
public function get_active_messengers() { |
811
|
|
|
// EE_messages has been deprecated |
812
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
813
|
|
|
return $this->_message_resource_manager->active_messengers(); |
814
|
|
|
} |
815
|
|
|
|
816
|
|
|
|
817
|
|
|
|
818
|
|
|
/** |
819
|
|
|
* @deprecated 4.9.0 |
820
|
|
|
* @return array array of message_type references (string) |
821
|
|
|
*/ |
822
|
|
|
public function get_active_message_types() { |
823
|
|
|
// EE_messages has been deprecated |
824
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
825
|
|
|
return $this->_message_resource_manager->list_of_active_message_types(); |
826
|
|
|
} |
827
|
|
|
|
828
|
|
|
|
829
|
|
|
|
830
|
|
|
/** |
831
|
|
|
* @deprecated 4.9.0 |
832
|
|
|
* @return EE_message_type[] |
833
|
|
|
*/ |
834
|
|
|
public function get_active_message_type_objects() { |
835
|
|
|
// EE_messages has been deprecated |
836
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
837
|
|
|
return $this->_message_resource_manager->get_active_message_type_objects(); |
838
|
|
|
} |
839
|
|
|
|
840
|
|
|
|
841
|
|
|
|
842
|
|
|
/** |
843
|
|
|
* @deprecated 4.9.0 |
844
|
|
|
* @since 4.5.0 |
845
|
|
|
* @param string $messenger The messenger being checked |
846
|
|
|
* @return EE_message_type[] (or empty array if none present) |
847
|
|
|
*/ |
848
|
|
|
public function get_active_message_types_per_messenger( $messenger ) { |
849
|
|
|
// EE_messages has been deprecated |
850
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
851
|
|
|
return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger ); |
852
|
|
|
} |
853
|
|
|
|
854
|
|
|
|
855
|
|
|
|
856
|
|
|
/** |
857
|
|
|
* @deprecated 4.9.0 |
858
|
|
|
* @param string $messenger The string should correspond to the messenger (message types are |
859
|
|
|
* @param string $message_type The string should correspond to a message type. |
860
|
|
|
* @return EE_message_type|null |
861
|
|
|
*/ |
862
|
|
|
public function get_active_message_type( $messenger, $message_type ) { |
863
|
|
|
// EE_messages has been deprecated |
864
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
865
|
|
|
return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type ); |
866
|
|
|
} |
867
|
|
|
|
868
|
|
|
|
869
|
|
|
|
870
|
|
|
/** |
871
|
|
|
* @deprecated 4.9.0 |
872
|
|
|
* @return array|\EE_message_type[] |
873
|
|
|
*/ |
874
|
|
|
public function get_installed_message_types() { |
875
|
|
|
// EE_messages has been deprecated |
876
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
877
|
|
|
return $this->_message_resource_manager->installed_message_types(); |
878
|
|
|
} |
879
|
|
|
|
880
|
|
|
|
881
|
|
|
|
882
|
|
|
/** |
883
|
|
|
* @deprecated 4.9.0 |
884
|
|
|
* @return array |
885
|
|
|
*/ |
886
|
|
|
public function get_installed_messengers() { |
887
|
|
|
// EE_messages has been deprecated |
888
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
889
|
|
|
return $this->_message_resource_manager->installed_messengers(); |
890
|
|
|
} |
891
|
|
|
|
892
|
|
|
|
893
|
|
|
|
894
|
|
|
/** |
895
|
|
|
* @deprecated 4.9.0 |
896
|
|
|
* @param bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type. |
897
|
|
|
* @return array |
898
|
|
|
*/ |
899
|
|
|
public function get_all_contexts( $slugs_only = true ) { |
900
|
|
|
// EE_messages has been deprecated |
901
|
|
|
$this->_class_is_deprecated( __FUNCTION__ ); |
902
|
|
|
return $this->_message_resource_manager->get_all_contexts( $slugs_only ); |
903
|
|
|
} |
904
|
|
|
|
905
|
|
|
|
906
|
|
|
|
907
|
|
|
} |
908
|
|
|
//end EE_messages class |
909
|
|
|
|
910
|
|
|
|
911
|
|
|
|
912
|
|
|
/** |
913
|
|
|
* Class EE_Address_Formatter |
914
|
|
|
* |
915
|
|
|
* @deprecated 4.9.0 |
916
|
|
|
*/ |
917
|
|
|
class EE_Address_Formatter extends \EventEspresso\core\services\address\formatters\AddressFormatter {} |
918
|
|
|
|
919
|
|
|
|
920
|
|
|
|
921
|
|
|
/** |
922
|
|
|
* Class EE_MultiLine_Address_Formatter |
923
|
|
|
* |
924
|
|
|
* @deprecated 4.9.0 |
925
|
|
|
*/ |
926
|
|
|
class EE_MultiLine_Address_Formatter extends \EventEspresso\core\services\address\formatters\NullAddressFormatter {} |
927
|
|
|
|
928
|
|
|
|
929
|
|
|
|
930
|
|
|
/** |
931
|
|
|
* Class EE_Inline_Address_Formatter |
932
|
|
|
* |
933
|
|
|
* @deprecated 4.9.0 |
934
|
|
|
*/ |
935
|
|
|
class EE_Inline_Address_Formatter extends \EventEspresso\core\services\address\formatters\InlineAddressFormatter {} |
936
|
|
|
|
937
|
|
|
|
938
|
|
|
|
939
|
|
|
/** |
940
|
|
|
* Class EE_Null_Address_Formatter |
941
|
|
|
* |
942
|
|
|
* @deprecated 4.9.0 |
943
|
|
|
*/ |
944
|
|
|
class EE_Null_Address_Formatter extends \EventEspresso\core\services\address\formatters\NullAddressFormatter {} |
945
|
|
|
|
946
|
|
|
|
947
|
|
|
|
948
|
|
|
/** |
949
|
|
|
* Class EE_Generic_Address |
950
|
|
|
* |
951
|
|
|
* @deprecated 4.9.0 |
952
|
|
|
*/ |
953
|
|
|
class EE_Generic_Address extends \EventEspresso\core\domain\entities\GenericAddress {} |
954
|
|
|
|
955
|
|
|
|
956
|
|
|
|
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: