@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * ************************************************************************ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param \EE_Checkout $checkout |
32 | 32 | * @return string |
33 | 33 | */ |
34 | -function ee_deprecated__registration_checkout__button_text( $submit_button_text, EE_Checkout $checkout ) { |
|
34 | +function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout) { |
|
35 | 35 | // list of old filters |
36 | 36 | $deprecated_filters = array( |
37 | 37 | 'update_registration_details' => true, |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | 'proceed_to' => true, |
42 | 42 | ); |
43 | 43 | // loop thru and call doing_it_wrong() or remove any that aren't being used |
44 | - foreach ( $deprecated_filters as $deprecated_filter => $on ) { |
|
44 | + foreach ($deprecated_filters as $deprecated_filter => $on) { |
|
45 | 45 | // was this filter called ? |
46 | - if ( has_action( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter )) { |
|
46 | + if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) { |
|
47 | 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' ) ) { |
|
48 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter') && ! defined('DOING_AJAX')) { |
|
49 | 49 | EE_Error::doing_it_wrong( |
50 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
50 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
51 | 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, |
|
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 | 54 | '<br />', |
55 | 55 | 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
56 | 56 | '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php' |
@@ -60,24 +60,24 @@ discard block |
||
60 | 60 | ); |
61 | 61 | } |
62 | 62 | } else { |
63 | - unset( $deprecated_filters[ $deprecated_filter ] ); |
|
63 | + unset($deprecated_filters[$deprecated_filter]); |
|
64 | 64 | } |
65 | 65 | } |
66 | - if ( ! empty( $deprecated_filters )) { |
|
67 | - |
|
68 | - if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset( $deprecated_filters[ 'update_registration_details' ] )) { |
|
69 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text ); |
|
70 | - } else if ( $checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset( $deprecated_filters[ 'process_payment' ] ) ) { |
|
71 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text ); |
|
72 | - } else if ( $checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset( $deprecated_filters[ 'finalize_registration' ] ) ) { |
|
73 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text ); |
|
66 | + if ( ! empty($deprecated_filters)) { |
|
67 | + |
|
68 | + if ($checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) { |
|
69 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text); |
|
70 | + } else if ($checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) { |
|
71 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text); |
|
72 | + } else if ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) { |
|
73 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text); |
|
74 | 74 | } |
75 | - if ( $checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
76 | - if ( $checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset( $deprecated_filters[ 'and_proceed_to_payment' ] ) ) { |
|
77 | - $submit_button_text .= apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text ); |
|
75 | + if ($checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
76 | + if ($checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) { |
|
77 | + $submit_button_text .= apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text); |
|
78 | 78 | } |
79 | - if ( $checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset( $deprecated_filters[ 'proceed_to' ] ) ) { |
|
80 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text ) . $checkout->next_step->name(); |
|
79 | + if ($checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) { |
|
80 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text).$checkout->next_step->name(); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | return $submit_button_text; |
86 | 86 | |
87 | 87 | } |
88 | -add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2 ); |
|
88 | +add_filter('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2); |
|
89 | 89 | |
90 | 90 | |
91 | 91 | |
@@ -96,16 +96,16 @@ discard block |
||
96 | 96 | * @param \EE_Checkout $checkout |
97 | 97 | * @param boolean $status_updates |
98 | 98 | */ |
99 | -function ee_deprecated_finalize_transaction( EE_Checkout $checkout, $status_updates ) { |
|
99 | +function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates) { |
|
100 | 100 | $action_ref = NULL; |
101 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__new_transaction' ) ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
102 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__all_transaction' ) ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
103 | - if ( $action_ref ) { |
|
101 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction') ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
102 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction') ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
103 | + if ($action_ref) { |
|
104 | 104 | |
105 | 105 | EE_Error::doing_it_wrong( |
106 | 106 | $action_ref, |
107 | 107 | sprintf( |
108 | - __( '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 | + __('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'), |
|
109 | 109 | '<br />', |
110 | 110 | '/core/business/EE_Transaction_Processor.class.php', |
111 | 111 | 'AHEE__EE_Transaction_Processor__finalize', |
@@ -116,29 +116,29 @@ discard block |
||
116 | 116 | '4.6.0', |
117 | 117 | E_USER_DEPRECATED |
118 | 118 | ); |
119 | - switch ( $action_ref ) { |
|
119 | + switch ($action_ref) { |
|
120 | 120 | case 'AHEE__EE_Transaction__finalize__new_transaction' : |
121 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request ); |
|
121 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request); |
|
122 | 122 | break; |
123 | 123 | case 'AHEE__EE_Transaction__finalize__all_transaction' : |
124 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array( 'new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates ), $checkout->admin_request ); |
|
124 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates), $checkout->admin_request); |
|
125 | 125 | break; |
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
129 | -add_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2 ); |
|
129 | +add_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2); |
|
130 | 130 | /** |
131 | 131 | * ee_deprecated_finalize_registration |
132 | 132 | * |
133 | 133 | * @param EE_Registration $registration |
134 | 134 | */ |
135 | -function ee_deprecated_finalize_registration( EE_Registration $registration ) { |
|
136 | - $action_ref = has_action( 'AHEE__EE_Registration__finalize__update_and_new_reg' ) ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
137 | - if ( $action_ref ) { |
|
135 | +function ee_deprecated_finalize_registration(EE_Registration $registration) { |
|
136 | + $action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg') ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
137 | + if ($action_ref) { |
|
138 | 138 | EE_Error::doing_it_wrong( |
139 | 139 | $action_ref, |
140 | 140 | sprintf( |
141 | - __( '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' ), |
|
141 | + __('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'), |
|
142 | 142 | '<br />', |
143 | 143 | '/core/business/EE_Registration_Processor.class.php', |
144 | 144 | 'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook' |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | '4.6.0', |
147 | 147 | E_USER_DEPRECATED |
148 | 148 | ); |
149 | - do_action( 'AHEE__EE_Registration__finalize__update_and_new_reg', $registration, ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ))); |
|
149 | + do_action('AHEE__EE_Registration__finalize__update_and_new_reg', $registration, (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX))); |
|
150 | 150 | } |
151 | 151 | } |
152 | -add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1 ); |
|
152 | +add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1); |
|
153 | 153 | |
154 | 154 | |
155 | 155 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return array |
172 | 172 | */ |
173 | -function ee_deprecated_get_templates( $templates, EE_messenger $messenger, EE_message_type $message_type, EE_Messages_Template_Pack $template_pack ) { |
|
173 | +function ee_deprecated_get_templates($templates, EE_messenger $messenger, EE_message_type $message_type, EE_Messages_Template_Pack $template_pack) { |
|
174 | 174 | $old_default_classnames = array( |
175 | 175 | 'EE_Messages_Email_Cancelled_Registration_Defaults', |
176 | 176 | 'EE_Messages_Email_Declined_Registration_Defaults', |
@@ -186,23 +186,23 @@ discard block |
||
186 | 186 | |
187 | 187 | $old_class_instance = new stdClass(); |
188 | 188 | |
189 | - foreach ( $old_default_classnames as $classname ) { |
|
190 | - $filter_ref = 'FHEE__' . $classname . '___create_new_templates___templates'; |
|
191 | - if ( has_filter( $filter_ref ) ) { |
|
192 | - EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Template_Pack___get_templates__templates" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
189 | + foreach ($old_default_classnames as $classname) { |
|
190 | + $filter_ref = 'FHEE__'.$classname.'___create_new_templates___templates'; |
|
191 | + if (has_filter($filter_ref)) { |
|
192 | + EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Template_Pack___get_templates__templates" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
193 | 193 | } |
194 | - $templates = apply_filters( $filter_ref, $templates, $old_class_instance ); |
|
194 | + $templates = apply_filters($filter_ref, $templates, $old_class_instance); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | return $templates; |
198 | 198 | } |
199 | -add_filter( 'FHEE__EE_Template_Pack___get_templates__templates', 'ee_deprecated_get_templates', 10, 4 ); |
|
199 | +add_filter('FHEE__EE_Template_Pack___get_templates__templates', 'ee_deprecated_get_templates', 10, 4); |
|
200 | 200 | |
201 | 201 | /** |
202 | 202 | * Called after EED_Module::set_hooks() and EED_Module::set_admin_hooks() was called. |
203 | 203 | * Checks if any deprecated hooks were hooked-into and provide doing_it_wrong messages appropriately. |
204 | 204 | */ |
205 | -function ee_deprecated_hooks(){ |
|
205 | +function ee_deprecated_hooks() { |
|
206 | 206 | /** |
207 | 207 | * @var $hooks array where keys are hook names, and their values are array{ |
208 | 208 | * @type string $version when deprecated |
@@ -213,26 +213,26 @@ discard block |
||
213 | 213 | $hooks = array( |
214 | 214 | 'AHEE__EE_System___do_setup_validations' => array( |
215 | 215 | 'version' => '4.6.0', |
216 | - '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' ), |
|
216 | + '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'), |
|
217 | 217 | 'still_works' => FALSE |
218 | 218 | ) |
219 | 219 | ); |
220 | - foreach( $hooks as $name => $deprecation_info ){ |
|
221 | - if( has_action( $name ) ){ |
|
220 | + foreach ($hooks as $name => $deprecation_info) { |
|
221 | + if (has_action($name)) { |
|
222 | 222 | EE_Error::doing_it_wrong( |
223 | 223 | $name, |
224 | 224 | sprintf( |
225 | - __('This filter is deprecated. %1$s%2$s','event_espresso'), |
|
226 | - $deprecation_info[ 'still_works' ] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __( 'It has been completely removed.', 'event_espresso' ), |
|
227 | - isset( $deprecation_info[ 'alternative' ] ) ? $deprecation_info[ 'alternative' ] : __( 'Please read the current EE4 documentation further or contact Support.', 'event_espresso' ) |
|
225 | + __('This filter is deprecated. %1$s%2$s', 'event_espresso'), |
|
226 | + $deprecation_info['still_works'] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __('It has been completely removed.', 'event_espresso'), |
|
227 | + isset($deprecation_info['alternative']) ? $deprecation_info['alternative'] : __('Please read the current EE4 documentation further or contact Support.', 'event_espresso') |
|
228 | 228 | ), |
229 | - isset( $deprecation_info[ 'version' ] ) ? $deprecation_info[ 'version' ] : __( 'recently', 'event_espresso' ), |
|
229 | + isset($deprecation_info['version']) ? $deprecation_info['version'] : __('recently', 'event_espresso'), |
|
230 | 230 | E_USER_DEPRECATED |
231 | 231 | ); |
232 | 232 | } |
233 | 233 | } |
234 | 234 | } |
235 | -add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks' ); |
|
235 | +add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks'); |
|
236 | 236 | |
237 | 237 | |
238 | 238 | |
@@ -255,25 +255,25 @@ discard block |
||
255 | 255 | * |
256 | 256 | * @return string The default contents for the messenger, message type, context and field. |
257 | 257 | */ |
258 | -function ee_deprecated_get_default_field_content( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack ) { |
|
258 | +function ee_deprecated_get_default_field_content($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) { |
|
259 | 259 | |
260 | 260 | $classnames_to_try = array( |
261 | - get_class( $messenger ) => $messenger, |
|
262 | - get_class( $message_type ) => $message_type, |
|
261 | + get_class($messenger) => $messenger, |
|
262 | + get_class($message_type) => $message_type, |
|
263 | 263 | 'EE_Messages_Base' => $message_type |
264 | 264 | ); |
265 | 265 | |
266 | - foreach ( $classnames_to_try as $classname => $obj ) { |
|
267 | - $filter_ref = 'FHEE__' . $classname . '__get_default_field_content'; |
|
268 | - if ( has_filter( $filter_ref ) ) { |
|
269 | - EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_specific_template__contents" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
266 | + foreach ($classnames_to_try as $classname => $obj) { |
|
267 | + $filter_ref = 'FHEE__'.$classname.'__get_default_field_content'; |
|
268 | + if (has_filter($filter_ref)) { |
|
269 | + EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_specific_template__contents" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
270 | 270 | } |
271 | - $contents = apply_filters( $filter_ref, $contents, $obj ); |
|
271 | + $contents = apply_filters($filter_ref, $contents, $obj); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | return $contents; |
275 | 275 | } |
276 | -add_filter( 'FHEE__EE_Messages_Template_Pack__get_specific_template__contents', 'ee_deprecated_get_default_field_content', 10, 7 ); |
|
276 | +add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', 'ee_deprecated_get_default_field_content', 10, 7); |
|
277 | 277 | |
278 | 278 | |
279 | 279 | |
@@ -301,23 +301,23 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @return string The path to the file being used. |
303 | 303 | */ |
304 | -function ee_deprecated_get_inline_css_template_filters( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack ) { |
|
304 | +function ee_deprecated_get_inline_css_template_filters($variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack) { |
|
305 | 305 | |
306 | - if ( $messenger == 'email' ) { |
|
306 | + if ($messenger == 'email') { |
|
307 | 307 | $filter_ref = $url ? 'FHEE__EE_Email_messenger__get_inline_css_template__css_url' : 'FHEE__EE_Email_messenger__get_inline_css_template__css_path'; |
308 | - } elseif ( $messenger == 'html' ) { |
|
308 | + } elseif ($messenger == 'html') { |
|
309 | 309 | $filter_ref = $url ? 'FHEE__EE_Html_messenger__get_inline_css_template__css_url' : 'FHEE__EE_Html_messenger__get_inline_css_template__css_path'; |
310 | 310 | } else { |
311 | 311 | return $variation_path; |
312 | 312 | } |
313 | 313 | |
314 | - if ( has_filter( $filter_ref ) ) { |
|
315 | - EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated. It is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_variation" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
314 | + if (has_filter($filter_ref)) { |
|
315 | + EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated. It is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_variation" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
316 | 316 | } |
317 | 317 | |
318 | - return apply_filters( $filter_ref, $variation_path, $url, $type ); |
|
318 | + return apply_filters($filter_ref, $variation_path, $url, $type); |
|
319 | 319 | } |
320 | -add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', 'ee_deprecated_get_inline_css_template_filters', 10, 8 ); |
|
320 | +add_filter('FHEE__EE_Messages_Template_Pack__get_variation', 'ee_deprecated_get_inline_css_template_filters', 10, 8); |
|
321 | 321 | |
322 | 322 | |
323 | 323 | |
@@ -333,78 +333,78 @@ discard block |
||
333 | 333 | class EE_Messages_Init extends EE_Base { |
334 | 334 | |
335 | 335 | public function __construct() { |
336 | - self::doing_it_wrong_call( __METHOD__ ); |
|
336 | + self::doing_it_wrong_call(__METHOD__); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
340 | 340 | * @param $method_name |
341 | 341 | */ |
342 | - public static function doing_it_wrong_call( $method_name ) { |
|
343 | - EE_Error::doing_it_wrong( __CLASS__, sprintf( __('The %s in this class is deprecated as of EE4.5.0. All functionality formerly in this class is now in the EED_Messages module.', 'event_espresso'), $method_name ), '4.5.0', E_USER_DEPRECATED ); |
|
342 | + public static function doing_it_wrong_call($method_name) { |
|
343 | + EE_Error::doing_it_wrong(__CLASS__, sprintf(__('The %s in this class is deprecated as of EE4.5.0. All functionality formerly in this class is now in the EED_Messages module.', 'event_espresso'), $method_name), '4.5.0', E_USER_DEPRECATED); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
347 | 347 | * @deprecated 4.5.0 |
348 | 348 | */ |
349 | 349 | public static function set_autoloaders() { |
350 | - self::doing_it_wrong_call( __METHOD__ ); |
|
350 | + self::doing_it_wrong_call(__METHOD__); |
|
351 | 351 | EED_Messages::set_autoloaders(); |
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
355 | 355 | * @deprecated 4.5.0 |
356 | 356 | */ |
357 | - public function payment_reminder( $transaction ) { |
|
358 | - self::doing_it_wrong_call( __METHOD__ ); |
|
359 | - EED_Messages::payment_reminder( $transaction ); |
|
357 | + public function payment_reminder($transaction) { |
|
358 | + self::doing_it_wrong_call(__METHOD__); |
|
359 | + EED_Messages::payment_reminder($transaction); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
363 | 363 | * @deprecated 4.5.0 |
364 | 364 | */ |
365 | - public function payment( $transaction, $payment ) { |
|
366 | - self::doing_it_wrong_call( __METHOD__ ); |
|
367 | - EED_Messages::payment( $transaction, $payment ); |
|
365 | + public function payment($transaction, $payment) { |
|
366 | + self::doing_it_wrong_call(__METHOD__); |
|
367 | + EED_Messages::payment($transaction, $payment); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | 371 | * @deprecated 4.5.0 |
372 | 372 | */ |
373 | - public function cancelled_registration( $transaction ) { |
|
374 | - self::doing_it_wrong_call( __METHOD__ ); |
|
375 | - EED_Messages::cancelled_registration( $transaction ); |
|
373 | + public function cancelled_registration($transaction) { |
|
374 | + self::doing_it_wrong_call(__METHOD__); |
|
375 | + EED_Messages::cancelled_registration($transaction); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
379 | 379 | * @deprecated 4.5.0 |
380 | 380 | */ |
381 | - public function maybe_registration( $transaction, $reg_msg, $from_admin ) { |
|
382 | - self::doing_it_wrong_call( __METHOD__ ); |
|
383 | - EED_Messages::maybe_registration( $transaction, $reg_msg, $from_admin ); |
|
381 | + public function maybe_registration($transaction, $reg_msg, $from_admin) { |
|
382 | + self::doing_it_wrong_call(__METHOD__); |
|
383 | + EED_Messages::maybe_registration($transaction, $reg_msg, $from_admin); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
387 | 387 | * @deprecated 4.5.0 |
388 | 388 | */ |
389 | - public function process_resend( $success, $req_data ) { |
|
390 | - self::doing_it_wrong_call( __METHOD__ ); |
|
391 | - EED_Messages::process_resend( $req_data ); |
|
389 | + public function process_resend($success, $req_data) { |
|
390 | + self::doing_it_wrong_call(__METHOD__); |
|
391 | + EED_Messages::process_resend($req_data); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
395 | 395 | * @deprecated 4.5.0 |
396 | 396 | */ |
397 | - public function process_admin_payment( $success, $payment ) { |
|
398 | - self::doing_it_wrong_call( __METHOD__ ); |
|
399 | - EED_Messages::process_admin_payment( $payment ); |
|
397 | + public function process_admin_payment($success, $payment) { |
|
398 | + self::doing_it_wrong_call(__METHOD__); |
|
399 | + EED_Messages::process_admin_payment($payment); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
403 | 403 | * @deprecated 4.5.0 |
404 | 404 | */ |
405 | - public function send_newsletter_message( $contacts, $grp_id ) { |
|
406 | - self::doing_it_wrong_call( __METHOD__ ); |
|
407 | - EED_Messages::send_newsletter_message( $contacts, $grp_id ); |
|
405 | + public function send_newsletter_message($contacts, $grp_id) { |
|
406 | + self::doing_it_wrong_call(__METHOD__); |
|
407 | + EED_Messages::send_newsletter_message($contacts, $grp_id); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | |
@@ -425,13 +425,13 @@ discard block |
||
425 | 425 | * |
426 | 426 | * @return array additional cpts. |
427 | 427 | */ |
428 | -function ee_deprecated_get_cpts( $cpts ) { |
|
429 | - if ( has_filter( 'FHEE__EE_Register_CPTs__construct__CPTs' ) ) { |
|
430 | - EE_Error::doing_it_wrong( 'FHEE__EE_Register_CPTs__construct__CPTs', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_CPTs__cpts" found in EE_Register_CPTs::get_CPTs()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
428 | +function ee_deprecated_get_cpts($cpts) { |
|
429 | + if (has_filter('FHEE__EE_Register_CPTs__construct__CPTs')) { |
|
430 | + EE_Error::doing_it_wrong('FHEE__EE_Register_CPTs__construct__CPTs', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_CPTs__cpts" found in EE_Register_CPTs::get_CPTs()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
431 | 431 | } |
432 | - return apply_filters( 'FHEE__EE_Register_CPTs__construct__CPTs', $cpts ); |
|
432 | + return apply_filters('FHEE__EE_Register_CPTs__construct__CPTs', $cpts); |
|
433 | 433 | } |
434 | -add_filter( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', 'ee_deprecated_get_cpts', 10 ); |
|
434 | +add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', 'ee_deprecated_get_cpts', 10); |
|
435 | 435 | |
436 | 436 | |
437 | 437 | |
@@ -445,13 +445,13 @@ discard block |
||
445 | 445 | * |
446 | 446 | * @return array additional custom taxonomies. |
447 | 447 | */ |
448 | -function ee_deprecated_get_taxonomies( $cts ) { |
|
449 | - if ( has_filter( 'FHEE__EE_Register_CPTs__construct__taxonomies' ) ) { |
|
450 | - EE_Error::doing_it_wrong( 'FHEE__EE_Register_CPTs__construct__taxonomies', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_taxonomies__taxonomies" found in EE_Register_CPTs::get_taxonomies()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
448 | +function ee_deprecated_get_taxonomies($cts) { |
|
449 | + if (has_filter('FHEE__EE_Register_CPTs__construct__taxonomies')) { |
|
450 | + EE_Error::doing_it_wrong('FHEE__EE_Register_CPTs__construct__taxonomies', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_taxonomies__taxonomies" found in EE_Register_CPTs::get_taxonomies()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
451 | 451 | } |
452 | - return apply_filters( 'FHEE__EE_Register_CPTs__construct__taxonomies', $cts ); |
|
452 | + return apply_filters('FHEE__EE_Register_CPTs__construct__taxonomies', $cts); |
|
453 | 453 | } |
454 | -add_filter( 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', 'ee_deprecated_get_taxonomies', 10 ); |
|
454 | +add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', 'ee_deprecated_get_taxonomies', 10); |
|
455 | 455 | |
456 | 456 | |
457 | 457 | |
@@ -463,9 +463,9 @@ discard block |
||
463 | 463 | * @return boolean |
464 | 464 | */ |
465 | 465 | function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() { |
466 | - $in_use = has_filter( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns' ) |
|
467 | - || has_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' ); |
|
468 | - if( $in_use ) { |
|
466 | + $in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns') |
|
467 | + || has_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save'); |
|
468 | + if ($in_use) { |
|
469 | 469 | $msg = __( |
470 | 470 | '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.' |
471 | 471 | . '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,' |
@@ -474,18 +474,18 @@ discard block |
||
474 | 474 | 'event_espresso' ) |
475 | 475 | ; |
476 | 476 | EE_Error::doing_it_wrong( |
477 | - __CLASS__ . '::' . __FUNCTION__, |
|
477 | + __CLASS__.'::'.__FUNCTION__, |
|
478 | 478 | $msg, |
479 | 479 | '4.8.32.rc.000' |
480 | 480 | ); |
481 | 481 | //it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed |
482 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
483 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
482 | + if (is_admin() && ! defined('DOING_AJAX')) { |
|
483 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | return $in_use; |
487 | 487 | } |
488 | -add_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' ); |
|
488 | +add_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks'); |
|
489 | 489 | |
490 | 490 | /** |
491 | 491 | * @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165 |
@@ -494,34 +494,34 @@ discard block |
||
494 | 494 | * @param EE_Admin_Page $admin_page |
495 | 495 | * @return void |
496 | 496 | */ |
497 | -function ee_deprecated_update_attendee_registration_form_old( $admin_page ) { |
|
497 | +function ee_deprecated_update_attendee_registration_form_old($admin_page) { |
|
498 | 498 | //check if the old hooks are in use. If not, do the default |
499 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
500 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
499 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
500 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
501 | 501 | return; |
502 | 502 | } |
503 | 503 | $req_data = $admin_page->get_request_data(); |
504 | - $qstns = isset( $req_data['qstn'] ) ? $req_data['qstn'] : FALSE; |
|
505 | - $REG_ID = isset( $req_data['_REG_ID'] ) ? absint( $req_data['_REG_ID'] ) : FALSE; |
|
506 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
507 | - if ( ! $REG_ID || ! $qstns ) { |
|
508 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
504 | + $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : FALSE; |
|
505 | + $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : FALSE; |
|
506 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
507 | + if ( ! $REG_ID || ! $qstns) { |
|
508 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
509 | 509 | } |
510 | 510 | $success = TRUE; |
511 | 511 | |
512 | 512 | // allow others to get in on this awesome fun :D |
513 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
513 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
514 | 514 | // loop thru questions... FINALLY!!! |
515 | 515 | |
516 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
516 | + foreach ($qstns as $QST_ID => $qstn) { |
|
517 | 517 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
518 | - if ( !is_array($qstn) ) { |
|
519 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
518 | + if ( ! is_array($qstn)) { |
|
519 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
520 | 520 | continue; |
521 | 521 | } |
522 | 522 | |
523 | 523 | |
524 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
524 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
525 | 525 | //get answer |
526 | 526 | $query_params = array( |
527 | 527 | 0 => array( |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | ); |
533 | 533 | $answer = EEM_Answer::instance()->get_one($query_params); |
534 | 534 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
535 | - if ( ! $answer instanceof EE_Answer ) { |
|
535 | + if ( ! $answer instanceof EE_Answer) { |
|
536 | 536 | $set_values = array( |
537 | 537 | 'QST_ID' => $QST_ID, |
538 | 538 | 'REG_ID' => $REG_ID, |
@@ -547,11 +547,11 @@ discard block |
||
547 | 547 | } |
548 | 548 | } |
549 | 549 | $what = __('Registration Form', 'event_espresso'); |
550 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
551 | - $admin_page->redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
550 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
551 | + $admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
552 | 552 | exit; |
553 | 553 | } |
554 | -add_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1 ); |
|
554 | +add_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1); |
|
555 | 555 | /** |
556 | 556 | * Render the registration admin page's custom questions area in the old fashion |
557 | 557 | * and firing the old hooks. When this method is removed, we can probably also |
@@ -564,31 +564,31 @@ discard block |
||
564 | 564 | * @return bool |
565 | 565 | * @throws \EE_Error |
566 | 566 | */ |
567 | -function ee_deprecated_reg_questions_meta_box_old( $do_default_action, $admin_page, $registration ) { |
|
567 | +function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration) { |
|
568 | 568 | //check if the old hooks are in use. If not, do the default |
569 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
570 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
569 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
570 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
571 | 571 | return $do_default_action; |
572 | 572 | } |
573 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $admin_page, 'form_before_question_group' ), 10, 1 ); |
|
574 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $admin_page, 'form_after_question_group' ), 10, 1 ); |
|
575 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $admin_page, 'form_form_field_label_wrap' ), 10, 1 ); |
|
576 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $admin_page, 'form_form_field_input__wrap' ), 10, 1 ); |
|
573 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($admin_page, 'form_before_question_group'), 10, 1); |
|
574 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($admin_page, 'form_after_question_group'), 10, 1); |
|
575 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1); |
|
576 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1); |
|
577 | 577 | |
578 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $registration, $registration->get('EVT_ID') ); |
|
578 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($registration, $registration->get('EVT_ID')); |
|
579 | 579 | |
580 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
580 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
581 | 581 | $template_args = array( |
582 | - 'att_questions' => EEH_Form_Fields::generate_question_groups_html( $question_groups ), |
|
582 | + 'att_questions' => EEH_Form_Fields::generate_question_groups_html($question_groups), |
|
583 | 583 | 'reg_questions_form_action' => 'edit_registration', |
584 | 584 | 'REG_ID' => $registration->ID() |
585 | 585 | ); |
586 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
587 | - echo EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
586 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
587 | + echo EEH_Template::display_template($template_path, $template_args, TRUE); |
|
588 | 588 | //indicate that we should not do the default admin page code |
589 | 589 | return false; |
590 | 590 | } |
591 | -add_action( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3 ); |
|
591 | +add_action('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3); |
|
592 | 592 | |
593 | 593 | |
594 | 594 | |
@@ -629,9 +629,9 @@ discard block |
||
629 | 629 | '4.9.0' |
630 | 630 | ); |
631 | 631 | /** @var EE_Message_Resource_Manager $message_resource_manager */ |
632 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
633 | - $messenger = $message_resource_manager->get_messenger( $messenger_name ); |
|
634 | - $message_type = $message_resource_manager->get_message_type( $message_type_name ); |
|
632 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
633 | + $messenger = $message_resource_manager->get_messenger($messenger_name); |
|
634 | + $message_type = $message_resource_manager->get_message_type($message_type_name); |
|
635 | 635 | return EE_Registry::instance()->load_lib( |
636 | 636 | 'Messages_Template_Defaults', |
637 | 637 | array( |
@@ -696,17 +696,17 @@ discard block |
||
696 | 696 | /** |
697 | 697 | * @param string $method |
698 | 698 | */ |
699 | - public function _class_is_deprecated( $method ) { |
|
699 | + public function _class_is_deprecated($method) { |
|
700 | 700 | // EE_messages has been deprecated, but let's not throw doing_it_wrong() just yet |
701 | - if ( version_compare( EVENT_ESPRESSO_VERSION, '4.10.0.p', '>=' ) ) { |
|
701 | + if (version_compare(EVENT_ESPRESSO_VERSION, '4.10.0.p', '>=')) { |
|
702 | 702 | EE_Error::doing_it_wrong( |
703 | - 'EE_messages::' . $method, |
|
704 | - __( 'EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.' ), |
|
703 | + 'EE_messages::'.$method, |
|
704 | + __('EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.'), |
|
705 | 705 | '4.9.0' |
706 | 706 | ); |
707 | 707 | } |
708 | 708 | // Please use EE_Message_Resource_Manager instead |
709 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
709 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | |
@@ -716,10 +716,10 @@ discard block |
||
716 | 716 | * @param string $messenger_name |
717 | 717 | * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive |
718 | 718 | */ |
719 | - public function ensure_messenger_is_active( $messenger_name ) { |
|
719 | + public function ensure_messenger_is_active($messenger_name) { |
|
720 | 720 | // EE_messages has been deprecated |
721 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
722 | - return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name ); |
|
721 | + $this->_class_is_deprecated(__FUNCTION__); |
|
722 | + return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name); |
|
723 | 723 | } |
724 | 724 | |
725 | 725 | |
@@ -731,10 +731,10 @@ discard block |
||
731 | 731 | * @return bool true if it got activated (or was active) and false if not. |
732 | 732 | * @throws \EE_Error |
733 | 733 | */ |
734 | - public function ensure_message_type_is_active( $message_type, $messenger ) { |
|
734 | + public function ensure_message_type_is_active($message_type, $messenger) { |
|
735 | 735 | // EE_messages has been deprecated |
736 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
737 | - return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger ); |
|
736 | + $this->_class_is_deprecated(__FUNCTION__); |
|
737 | + return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | |
@@ -747,10 +747,10 @@ discard block |
||
747 | 747 | * they are already setup.) |
748 | 748 | * @return boolean an array of generated templates or false if nothing generated/activated. |
749 | 749 | */ |
750 | - public function activate_messenger( $messenger_name, $mts_to_activate = array() ) { |
|
750 | + public function activate_messenger($messenger_name, $mts_to_activate = array()) { |
|
751 | 751 | // EE_messages has been deprecated |
752 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
753 | - return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate ); |
|
752 | + $this->_class_is_deprecated(__FUNCTION__); |
|
753 | + return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | |
@@ -762,10 +762,10 @@ discard block |
||
762 | 762 | * |
763 | 763 | * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
764 | 764 | */ |
765 | - public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) { |
|
765 | + public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) { |
|
766 | 766 | // EE_messages has been deprecated |
767 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
768 | - return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type ); |
|
767 | + $this->_class_is_deprecated(__FUNCTION__); |
|
768 | + return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | |
@@ -775,10 +775,10 @@ discard block |
||
775 | 775 | * @param string $messenger |
776 | 776 | * @return EE_messenger | null |
777 | 777 | */ |
778 | - public function get_messenger_if_active( $messenger ) { |
|
778 | + public function get_messenger_if_active($messenger) { |
|
779 | 779 | // EE_messages has been deprecated |
780 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
781 | - return $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
780 | + $this->_class_is_deprecated(__FUNCTION__); |
|
781 | + return $this->_message_resource_manager->get_active_messenger($messenger); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -799,9 +799,9 @@ discard block |
||
799 | 799 | * 'message_type' => null |
800 | 800 | * ) |
801 | 801 | */ |
802 | - public function validate_for_use( EE_Message $message ) { |
|
802 | + public function validate_for_use(EE_Message $message) { |
|
803 | 803 | // EE_messages has been deprecated |
804 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
804 | + $this->_class_is_deprecated(__FUNCTION__); |
|
805 | 805 | return array( |
806 | 806 | 'messenger' => $message->messenger_object(), |
807 | 807 | 'message_type' => $message->message_type_object(), |
@@ -829,41 +829,41 @@ discard block |
||
829 | 829 | $send = true |
830 | 830 | ) { |
831 | 831 | // EE_messages has been deprecated |
832 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
832 | + $this->_class_is_deprecated(__FUNCTION__); |
|
833 | 833 | /** @type EE_Messages_Processor $processor */ |
834 | - $processor = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
834 | + $processor = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
835 | 835 | $error = false; |
836 | 836 | //try to intelligently determine what method we'll call based on the incoming data. |
837 | 837 | //if generating and sending are different then generate and send immediately. |
838 | - if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) { |
|
838 | + if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
839 | 839 | //in the legacy system, when generating and sending were different, that means all the |
840 | 840 | //vars are already in the request object. So let's just use that. |
841 | 841 | try { |
842 | 842 | /** @type EE_Message_To_Generate_From_Request $mtg */ |
843 | - $mtg = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' ); |
|
844 | - $processor->generate_and_send_now( $mtg ); |
|
845 | - } catch ( EE_Error $e ) { |
|
843 | + $mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
844 | + $processor->generate_and_send_now($mtg); |
|
845 | + } catch (EE_Error $e) { |
|
846 | 846 | $error_msg = __( |
847 | 847 | 'Please note that a system message failed to send due to a technical issue.', |
848 | 848 | 'event_espresso' |
849 | 849 | ); |
850 | 850 | // add specific message for developers if WP_DEBUG in on |
851 | - $error_msg .= '||' . $e->getMessage(); |
|
852 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
851 | + $error_msg .= '||'.$e->getMessage(); |
|
852 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
853 | 853 | $error = true; |
854 | 854 | } |
855 | 855 | } else { |
856 | - $processor->generate_for_all_active_messengers( $type, $vars, $send ); |
|
856 | + $processor->generate_for_all_active_messengers($type, $vars, $send); |
|
857 | 857 | //let's find out if there were any errors and how many successfully were queued. |
858 | 858 | $count_errors = $processor->get_queue()->count_STS_in_queue( |
859 | - array( EEM_Message::status_failed, EEM_Message::status_debug_only ) |
|
859 | + array(EEM_Message::status_failed, EEM_Message::status_debug_only) |
|
860 | 860 | ); |
861 | - $count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete ); |
|
862 | - $count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry ); |
|
861 | + $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
862 | + $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry); |
|
863 | 863 | $count_errors = $count_errors + $count_retry; |
864 | - if ( $count_errors > 0 ) { |
|
864 | + if ($count_errors > 0) { |
|
865 | 865 | $error = true; |
866 | - if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) { |
|
866 | + if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) { |
|
867 | 867 | $message = sprintf( |
868 | 868 | __( |
869 | 869 | 'There were %d errors and %d messages successfully queued for generation and sending', |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | $count_errors, |
873 | 873 | $count_queued |
874 | 874 | ); |
875 | - } elseif ( $count_errors > 1 && $count_queued === 1 ) { |
|
875 | + } elseif ($count_errors > 1 && $count_queued === 1) { |
|
876 | 876 | $message = sprintf( |
877 | 877 | __( |
878 | 878 | 'There were %d errors and %d message successfully queued for generation.', |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | $count_errors, |
882 | 882 | $count_queued |
883 | 883 | ); |
884 | - } elseif ( $count_errors === 1 && $count_queued > 1 ) { |
|
884 | + } elseif ($count_errors === 1 && $count_queued > 1) { |
|
885 | 885 | $message = sprintf( |
886 | 886 | __( |
887 | 887 | 'There was %d error and %d messages successfully queued for generation.', |
@@ -899,9 +899,9 @@ discard block |
||
899 | 899 | $count_errors |
900 | 900 | ); |
901 | 901 | } |
902 | - EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ ); |
|
902 | + EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__); |
|
903 | 903 | } else { |
904 | - if ( $count_queued === 1 ) { |
|
904 | + if ($count_queued === 1) { |
|
905 | 905 | $message = sprintf( |
906 | 906 | __( |
907 | 907 | '%d message successfully queued for generation.', |
@@ -918,18 +918,18 @@ discard block |
||
918 | 918 | $count_queued |
919 | 919 | ); |
920 | 920 | } |
921 | - EE_Error::add_success( $message ); |
|
921 | + EE_Error::add_success($message); |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | //if no error then return the generated message(s). |
925 | - if ( ! $error && ! $send ) { |
|
926 | - $generated_queue = $processor->generate_queue( false ); |
|
925 | + if ( ! $error && ! $send) { |
|
926 | + $generated_queue = $processor->generate_queue(false); |
|
927 | 927 | //get message and return. |
928 | 928 | $generated_queue->get_message_repository()->rewind(); |
929 | 929 | $messages = array(); |
930 | - while ( $generated_queue->get_message_repository()->valid() ) { |
|
930 | + while ($generated_queue->get_message_repository()->valid()) { |
|
931 | 931 | $message = $generated_queue->get_message_repository()->current(); |
932 | - if ( $message instanceof EE_Message ) { |
|
932 | + if ($message instanceof EE_Message) { |
|
933 | 933 | //set properties that might be expected by add-ons (backward compat) |
934 | 934 | $message->content = $message->content(); |
935 | 935 | $message->template_pack = $message->get_template_pack(); |
@@ -954,10 +954,10 @@ discard block |
||
954 | 954 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
955 | 955 | * @return string The body of the message. |
956 | 956 | */ |
957 | - public function preview_message( $type, $context, $messenger, $send = false ) { |
|
957 | + public function preview_message($type, $context, $messenger, $send = false) { |
|
958 | 958 | // EE_messages has been deprecated |
959 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
960 | - return EED_Messages::preview_message( $type, $context, $messenger, $send ); |
|
959 | + $this->_class_is_deprecated(__FUNCTION__); |
|
960 | + return EED_Messages::preview_message($type, $context, $messenger, $send); |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | |
@@ -971,14 +971,14 @@ discard block |
||
971 | 971 | * |
972 | 972 | * @return bool success or fail. |
973 | 973 | */ |
974 | - public function send_message_with_messenger_only( $messenger, $message_type, $message ) { |
|
974 | + public function send_message_with_messenger_only($messenger, $message_type, $message) { |
|
975 | 975 | // EE_messages has been deprecated |
976 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
976 | + $this->_class_is_deprecated(__FUNCTION__); |
|
977 | 977 | //setup for sending to new method. |
978 | 978 | /** @type EE_Messages_Queue $queue */ |
979 | - $queue = EE_Registry::instance()->load_lib( 'Messages_Queue' ); |
|
979 | + $queue = EE_Registry::instance()->load_lib('Messages_Queue'); |
|
980 | 980 | //make sure we have a proper message object |
981 | - if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) { |
|
981 | + if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
982 | 982 | $msg = EE_Message_Factory::create( |
983 | 983 | array( |
984 | 984 | 'MSG_messenger' => $messenger, |
@@ -990,15 +990,15 @@ discard block |
||
990 | 990 | } else { |
991 | 991 | $msg = $message; |
992 | 992 | } |
993 | - if ( ! $msg instanceof EE_Message ) { |
|
993 | + if ( ! $msg instanceof EE_Message) { |
|
994 | 994 | return false; |
995 | 995 | } |
996 | 996 | //make sure any content in a content property (if not empty) is set on the MSG_content. |
997 | - if ( ! empty( $msg->content ) ) { |
|
998 | - $msg->set( 'MSG_content', $msg->content ); |
|
997 | + if ( ! empty($msg->content)) { |
|
998 | + $msg->set('MSG_content', $msg->content); |
|
999 | 999 | } |
1000 | - $queue->add( $msg ); |
|
1001 | - return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue ); |
|
1000 | + $queue->add($msg); |
|
1001 | + return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue); |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | |
@@ -1012,11 +1012,11 @@ discard block |
||
1012 | 1012 | * @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned. |
1013 | 1013 | * @throws \EE_Error |
1014 | 1014 | */ |
1015 | - public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) { |
|
1015 | + public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) { |
|
1016 | 1016 | // EE_messages has been deprecated |
1017 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1018 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1019 | - return EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $is_global ); |
|
1017 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1018 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1019 | + return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global); |
|
1020 | 1020 | } |
1021 | 1021 | |
1022 | 1022 | |
@@ -1027,11 +1027,11 @@ discard block |
||
1027 | 1027 | * @param string $message_type_name name of EE_message_type |
1028 | 1028 | * @return array |
1029 | 1029 | */ |
1030 | - public function get_fields( $messenger_name, $message_type_name ) { |
|
1030 | + public function get_fields($messenger_name, $message_type_name) { |
|
1031 | 1031 | // EE_messages has been deprecated |
1032 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1033 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1034 | - return EEH_MSG_Template::get_fields( $messenger_name, $message_type_name ); |
|
1032 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1033 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1034 | + return EEH_MSG_Template::get_fields($messenger_name, $message_type_name); |
|
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | |
@@ -1045,13 +1045,13 @@ discard block |
||
1045 | 1045 | * @return array multidimensional array of messenger and message_type objects |
1046 | 1046 | * (messengers index, and message_type index); |
1047 | 1047 | */ |
1048 | - public function get_installed( $type = 'all', $skip_cache = false ) { |
|
1048 | + public function get_installed($type = 'all', $skip_cache = false) { |
|
1049 | 1049 | // EE_messages has been deprecated |
1050 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1051 | - if ( $skip_cache ) { |
|
1050 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1051 | + if ($skip_cache) { |
|
1052 | 1052 | $this->_message_resource_manager->reset_active_messengers_and_message_types(); |
1053 | 1053 | } |
1054 | - switch ( $type ) { |
|
1054 | + switch ($type) { |
|
1055 | 1055 | case 'messengers' : |
1056 | 1056 | return array( |
1057 | 1057 | 'messenger' => $this->_message_resource_manager->installed_messengers(), |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | */ |
1081 | 1081 | public function get_active_messengers() { |
1082 | 1082 | // EE_messages has been deprecated |
1083 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1083 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1084 | 1084 | return $this->_message_resource_manager->active_messengers(); |
1085 | 1085 | } |
1086 | 1086 | |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | */ |
1093 | 1093 | public function get_active_message_types() { |
1094 | 1094 | // EE_messages has been deprecated |
1095 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1095 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1096 | 1096 | return $this->_message_resource_manager->list_of_active_message_types(); |
1097 | 1097 | } |
1098 | 1098 | |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | */ |
1105 | 1105 | public function get_active_message_type_objects() { |
1106 | 1106 | // EE_messages has been deprecated |
1107 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1107 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1108 | 1108 | return $this->_message_resource_manager->get_active_message_type_objects(); |
1109 | 1109 | } |
1110 | 1110 | |
@@ -1116,10 +1116,10 @@ discard block |
||
1116 | 1116 | * @param string $messenger The messenger being checked |
1117 | 1117 | * @return EE_message_type[] (or empty array if none present) |
1118 | 1118 | */ |
1119 | - public function get_active_message_types_per_messenger( $messenger ) { |
|
1119 | + public function get_active_message_types_per_messenger($messenger) { |
|
1120 | 1120 | // EE_messages has been deprecated |
1121 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1122 | - return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger ); |
|
1121 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1122 | + return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger); |
|
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | |
@@ -1130,10 +1130,10 @@ discard block |
||
1130 | 1130 | * @param string $message_type The string should correspond to a message type. |
1131 | 1131 | * @return EE_message_type|null |
1132 | 1132 | */ |
1133 | - public function get_active_message_type( $messenger, $message_type ) { |
|
1133 | + public function get_active_message_type($messenger, $message_type) { |
|
1134 | 1134 | // EE_messages has been deprecated |
1135 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1136 | - return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type ); |
|
1135 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1136 | + return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type); |
|
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | */ |
1145 | 1145 | public function get_installed_message_types() { |
1146 | 1146 | // EE_messages has been deprecated |
1147 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1147 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1148 | 1148 | return $this->_message_resource_manager->installed_message_types(); |
1149 | 1149 | } |
1150 | 1150 | |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | */ |
1157 | 1157 | public function get_installed_messengers() { |
1158 | 1158 | // EE_messages has been deprecated |
1159 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1159 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1160 | 1160 | return $this->_message_resource_manager->installed_messengers(); |
1161 | 1161 | } |
1162 | 1162 | |
@@ -1167,10 +1167,10 @@ discard block |
||
1167 | 1167 | * @param bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type. |
1168 | 1168 | * @return array |
1169 | 1169 | */ |
1170 | - public function get_all_contexts( $slugs_only = true ) { |
|
1170 | + public function get_all_contexts($slugs_only = true) { |
|
1171 | 1171 | // EE_messages has been deprecated |
1172 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1173 | - return $this->_message_resource_manager->get_all_contexts( $slugs_only ); |
|
1172 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1173 | + return $this->_message_resource_manager->get_all_contexts($slugs_only); |
|
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 |