@@ -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 | |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | '4.9.0' |
629 | 629 | ); |
630 | 630 | /** @var EE_Message_Resource_Manager $message_resource_manager */ |
631 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
632 | - $messenger = $message_resource_manager->get_messenger( $messenger_name ); |
|
633 | - $message_type = $message_resource_manager->get_message_type( $message_type_name ); |
|
631 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
632 | + $messenger = $message_resource_manager->get_messenger($messenger_name); |
|
633 | + $message_type = $message_resource_manager->get_message_type($message_type_name); |
|
634 | 634 | return EE_Registry::instance()->load_lib( |
635 | 635 | 'Messages_Template_Defaults', |
636 | 636 | array( |
@@ -694,15 +694,15 @@ discard block |
||
694 | 694 | /** |
695 | 695 | * @param string $method |
696 | 696 | */ |
697 | - public function _class_is_deprecated( $method ) { |
|
697 | + public function _class_is_deprecated($method) { |
|
698 | 698 | // EE_messages has been deprecated |
699 | 699 | EE_Error::doing_it_wrong( |
700 | - 'EE_messages::' . $method, |
|
701 | - __( 'EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.' ), |
|
700 | + 'EE_messages::'.$method, |
|
701 | + __('EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.'), |
|
702 | 702 | '4.9.0' |
703 | 703 | ); |
704 | 704 | // Please use EE_Message_Resource_Manager instead |
705 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
705 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | |
@@ -712,10 +712,10 @@ discard block |
||
712 | 712 | * @param string $messenger_name |
713 | 713 | * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive |
714 | 714 | */ |
715 | - public function ensure_messenger_is_active( $messenger_name ) { |
|
715 | + public function ensure_messenger_is_active($messenger_name) { |
|
716 | 716 | // EE_messages has been deprecated |
717 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
718 | - return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name ); |
|
717 | + $this->_class_is_deprecated(__FUNCTION__); |
|
718 | + return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | |
@@ -727,10 +727,10 @@ discard block |
||
727 | 727 | * @return bool true if it got activated (or was active) and false if not. |
728 | 728 | * @throws \EE_Error |
729 | 729 | */ |
730 | - public function ensure_message_type_is_active( $message_type, $messenger ) { |
|
730 | + public function ensure_message_type_is_active($message_type, $messenger) { |
|
731 | 731 | // EE_messages has been deprecated |
732 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
733 | - return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger ); |
|
732 | + $this->_class_is_deprecated(__FUNCTION__); |
|
733 | + return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | |
@@ -743,10 +743,10 @@ discard block |
||
743 | 743 | * they are already setup.) |
744 | 744 | * @return boolean an array of generated templates or false if nothing generated/activated. |
745 | 745 | */ |
746 | - public function activate_messenger( $messenger_name, $mts_to_activate = array() ) { |
|
746 | + public function activate_messenger($messenger_name, $mts_to_activate = array()) { |
|
747 | 747 | // EE_messages has been deprecated |
748 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
749 | - return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate ); |
|
748 | + $this->_class_is_deprecated(__FUNCTION__); |
|
749 | + return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate); |
|
750 | 750 | } |
751 | 751 | |
752 | 752 | |
@@ -758,10 +758,10 @@ discard block |
||
758 | 758 | * |
759 | 759 | * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
760 | 760 | */ |
761 | - public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) { |
|
761 | + public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) { |
|
762 | 762 | // EE_messages has been deprecated |
763 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
764 | - return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type ); |
|
763 | + $this->_class_is_deprecated(__FUNCTION__); |
|
764 | + return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | |
@@ -771,10 +771,10 @@ discard block |
||
771 | 771 | * @param string $messenger |
772 | 772 | * @return EE_messenger | null |
773 | 773 | */ |
774 | - public function get_messenger_if_active( $messenger ) { |
|
774 | + public function get_messenger_if_active($messenger) { |
|
775 | 775 | // EE_messages has been deprecated |
776 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
777 | - return $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
776 | + $this->_class_is_deprecated(__FUNCTION__); |
|
777 | + return $this->_message_resource_manager->get_active_messenger($messenger); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | |
@@ -795,9 +795,9 @@ discard block |
||
795 | 795 | * 'message_type' => null |
796 | 796 | * ) |
797 | 797 | */ |
798 | - public function validate_for_use( EE_Message $message ) { |
|
798 | + public function validate_for_use(EE_Message $message) { |
|
799 | 799 | // EE_messages has been deprecated |
800 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
800 | + $this->_class_is_deprecated(__FUNCTION__); |
|
801 | 801 | return array( |
802 | 802 | 'messenger' => $message->messenger_object(), |
803 | 803 | 'message_type' => $message->message_type_object(), |
@@ -825,41 +825,41 @@ discard block |
||
825 | 825 | $send = true |
826 | 826 | ) { |
827 | 827 | // EE_messages has been deprecated |
828 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
828 | + $this->_class_is_deprecated(__FUNCTION__); |
|
829 | 829 | /** @type EE_Messages_Processor $processor */ |
830 | - $processor = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
830 | + $processor = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
831 | 831 | $error = false; |
832 | 832 | //try to intelligently determine what method we'll call based on the incoming data. |
833 | 833 | //if generating and sending are different then generate and send immediately. |
834 | - if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) { |
|
834 | + if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
835 | 835 | //in the legacy system, when generating and sending were different, that means all the |
836 | 836 | //vars are already in the request object. So let's just use that. |
837 | 837 | try { |
838 | 838 | /** @type EE_Message_To_Generate_From_Request $mtg */ |
839 | - $mtg = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' ); |
|
840 | - $processor->generate_and_send_now( $mtg ); |
|
841 | - } catch ( EE_Error $e ) { |
|
839 | + $mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
840 | + $processor->generate_and_send_now($mtg); |
|
841 | + } catch (EE_Error $e) { |
|
842 | 842 | $error_msg = __( |
843 | 843 | 'Please note that a system message failed to send due to a technical issue.', |
844 | 844 | 'event_espresso' |
845 | 845 | ); |
846 | 846 | // add specific message for developers if WP_DEBUG in on |
847 | - $error_msg .= '||' . $e->getMessage(); |
|
848 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
847 | + $error_msg .= '||'.$e->getMessage(); |
|
848 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
849 | 849 | $error = true; |
850 | 850 | } |
851 | 851 | } else { |
852 | - $processor->generate_for_all_active_messengers( $type, $vars, $send ); |
|
852 | + $processor->generate_for_all_active_messengers($type, $vars, $send); |
|
853 | 853 | //let's find out if there were any errors and how many successfully were queued. |
854 | 854 | $count_errors = $processor->get_queue()->count_STS_in_queue( |
855 | - array( EEM_Message::status_failed, EEM_Message::status_debug_only ) |
|
855 | + array(EEM_Message::status_failed, EEM_Message::status_debug_only) |
|
856 | 856 | ); |
857 | - $count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete ); |
|
858 | - $count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry ); |
|
857 | + $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
858 | + $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry); |
|
859 | 859 | $count_errors = $count_errors + $count_retry; |
860 | - if ( $count_errors > 0 ) { |
|
860 | + if ($count_errors > 0) { |
|
861 | 861 | $error = true; |
862 | - if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) { |
|
862 | + if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) { |
|
863 | 863 | $message = sprintf( |
864 | 864 | __( |
865 | 865 | 'There were %d errors and %d messages successfully queued for generation and sending', |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | $count_errors, |
869 | 869 | $count_queued |
870 | 870 | ); |
871 | - } elseif ( $count_errors > 1 && $count_queued === 1 ) { |
|
871 | + } elseif ($count_errors > 1 && $count_queued === 1) { |
|
872 | 872 | $message = sprintf( |
873 | 873 | __( |
874 | 874 | 'There were %d errors and %d message successfully queued for generation.', |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | $count_errors, |
878 | 878 | $count_queued |
879 | 879 | ); |
880 | - } elseif ( $count_errors === 1 && $count_queued > 1 ) { |
|
880 | + } elseif ($count_errors === 1 && $count_queued > 1) { |
|
881 | 881 | $message = sprintf( |
882 | 882 | __( |
883 | 883 | 'There was %d error and %d messages successfully queued for generation.', |
@@ -895,9 +895,9 @@ discard block |
||
895 | 895 | $count_errors |
896 | 896 | ); |
897 | 897 | } |
898 | - EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ ); |
|
898 | + EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__); |
|
899 | 899 | } else { |
900 | - if ( $count_queued === 1 ) { |
|
900 | + if ($count_queued === 1) { |
|
901 | 901 | $message = sprintf( |
902 | 902 | __( |
903 | 903 | '%d message successfully queued for generation.', |
@@ -914,18 +914,18 @@ discard block |
||
914 | 914 | $count_queued |
915 | 915 | ); |
916 | 916 | } |
917 | - EE_Error::add_success( $message ); |
|
917 | + EE_Error::add_success($message); |
|
918 | 918 | } |
919 | 919 | } |
920 | 920 | //if no error then return the generated message(s). |
921 | - if ( ! $error && ! $send ) { |
|
922 | - $generated_queue = $processor->generate_queue( false ); |
|
921 | + if ( ! $error && ! $send) { |
|
922 | + $generated_queue = $processor->generate_queue(false); |
|
923 | 923 | //get message and return. |
924 | 924 | $generated_queue->get_queue()->rewind(); |
925 | 925 | $messages = array(); |
926 | - while ( $generated_queue->get_queue()->valid() ) { |
|
926 | + while ($generated_queue->get_queue()->valid()) { |
|
927 | 927 | $message = $generated_queue->get_queue()->current(); |
928 | - if ( $message instanceof EE_Message ) { |
|
928 | + if ($message instanceof EE_Message) { |
|
929 | 929 | //set properties that might be expected by add-ons (backward compat) |
930 | 930 | $message->content = $message->content(); |
931 | 931 | $message->template_pack = $message->get_template_pack(); |
@@ -950,10 +950,10 @@ discard block |
||
950 | 950 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
951 | 951 | * @return string The body of the message. |
952 | 952 | */ |
953 | - public function preview_message( $type, $context, $messenger, $send = false ) { |
|
953 | + public function preview_message($type, $context, $messenger, $send = false) { |
|
954 | 954 | // EE_messages has been deprecated |
955 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
956 | - return EED_Messages::preview_message( $type, $context, $messenger, $send ); |
|
955 | + $this->_class_is_deprecated(__FUNCTION__); |
|
956 | + return EED_Messages::preview_message($type, $context, $messenger, $send); |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | |
@@ -967,14 +967,14 @@ discard block |
||
967 | 967 | * |
968 | 968 | * @return bool success or fail. |
969 | 969 | */ |
970 | - public function send_message_with_messenger_only( $messenger, $message_type, $message ) { |
|
970 | + public function send_message_with_messenger_only($messenger, $message_type, $message) { |
|
971 | 971 | // EE_messages has been deprecated |
972 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
972 | + $this->_class_is_deprecated(__FUNCTION__); |
|
973 | 973 | //setup for sending to new method. |
974 | 974 | /** @type EE_Messages_Queue $queue */ |
975 | - $queue = EE_Registry::instance()->load_lib( 'Messages_Queue' ); |
|
975 | + $queue = EE_Registry::instance()->load_lib('Messages_Queue'); |
|
976 | 976 | //make sure we have a proper message object |
977 | - if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) { |
|
977 | + if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
978 | 978 | $msg = EE_Message_Factory::create( |
979 | 979 | array( |
980 | 980 | 'MSG_messenger' => $messenger, |
@@ -986,15 +986,15 @@ discard block |
||
986 | 986 | } else { |
987 | 987 | $msg = $message; |
988 | 988 | } |
989 | - if ( ! $msg instanceof EE_Message ) { |
|
989 | + if ( ! $msg instanceof EE_Message) { |
|
990 | 990 | return false; |
991 | 991 | } |
992 | 992 | //make sure any content in a content property (if not empty) is set on the MSG_content. |
993 | - if ( ! empty( $msg->content ) ) { |
|
994 | - $msg->set( 'MSG_content', $msg->content ); |
|
993 | + if ( ! empty($msg->content)) { |
|
994 | + $msg->set('MSG_content', $msg->content); |
|
995 | 995 | } |
996 | - $queue->add( $msg ); |
|
997 | - return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue ); |
|
996 | + $queue->add($msg); |
|
997 | + return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue); |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | |
@@ -1008,11 +1008,11 @@ discard block |
||
1008 | 1008 | * @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned. |
1009 | 1009 | * @throws \EE_Error |
1010 | 1010 | */ |
1011 | - public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) { |
|
1011 | + public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) { |
|
1012 | 1012 | // EE_messages has been deprecated |
1013 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1014 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1015 | - return EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $is_global ); |
|
1013 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1014 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1015 | + return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | |
@@ -1023,11 +1023,11 @@ discard block |
||
1023 | 1023 | * @param string $message_type_name name of EE_message_type |
1024 | 1024 | * @return array |
1025 | 1025 | */ |
1026 | - public function get_fields( $messenger_name, $message_type_name ) { |
|
1026 | + public function get_fields($messenger_name, $message_type_name) { |
|
1027 | 1027 | // EE_messages has been deprecated |
1028 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1029 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1030 | - return EEH_MSG_Template::get_fields( $messenger_name, $message_type_name ); |
|
1028 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1029 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1030 | + return EEH_MSG_Template::get_fields($messenger_name, $message_type_name); |
|
1031 | 1031 | } |
1032 | 1032 | |
1033 | 1033 | |
@@ -1041,13 +1041,13 @@ discard block |
||
1041 | 1041 | * @return array multidimensional array of messenger and message_type objects |
1042 | 1042 | * (messengers index, and message_type index); |
1043 | 1043 | */ |
1044 | - public function get_installed( $type = 'all', $skip_cache = false ) { |
|
1044 | + public function get_installed($type = 'all', $skip_cache = false) { |
|
1045 | 1045 | // EE_messages has been deprecated |
1046 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1047 | - if ( $skip_cache ) { |
|
1046 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1047 | + if ($skip_cache) { |
|
1048 | 1048 | $this->_message_resource_manager->reset_active_messengers_and_message_types(); |
1049 | 1049 | } |
1050 | - switch ( $type ) { |
|
1050 | + switch ($type) { |
|
1051 | 1051 | case 'messengers' : |
1052 | 1052 | return array( |
1053 | 1053 | 'messenger' => $this->_message_resource_manager->installed_messengers(), |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | */ |
1077 | 1077 | public function get_active_messengers() { |
1078 | 1078 | // EE_messages has been deprecated |
1079 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1079 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1080 | 1080 | return $this->_message_resource_manager->active_messengers(); |
1081 | 1081 | } |
1082 | 1082 | |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | */ |
1089 | 1089 | public function get_active_message_types() { |
1090 | 1090 | // EE_messages has been deprecated |
1091 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1091 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1092 | 1092 | return $this->_message_resource_manager->list_of_active_message_types(); |
1093 | 1093 | } |
1094 | 1094 | |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | */ |
1101 | 1101 | public function get_active_message_type_objects() { |
1102 | 1102 | // EE_messages has been deprecated |
1103 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1103 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1104 | 1104 | return $this->_message_resource_manager->get_active_message_type_objects(); |
1105 | 1105 | } |
1106 | 1106 | |
@@ -1112,10 +1112,10 @@ discard block |
||
1112 | 1112 | * @param string $messenger The messenger being checked |
1113 | 1113 | * @return EE_message_type[] (or empty array if none present) |
1114 | 1114 | */ |
1115 | - public function get_active_message_types_per_messenger( $messenger ) { |
|
1115 | + public function get_active_message_types_per_messenger($messenger) { |
|
1116 | 1116 | // EE_messages has been deprecated |
1117 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1118 | - return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger ); |
|
1117 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1118 | + return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger); |
|
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | |
@@ -1126,10 +1126,10 @@ discard block |
||
1126 | 1126 | * @param string $message_type The string should correspond to a message type. |
1127 | 1127 | * @return EE_message_type|null |
1128 | 1128 | */ |
1129 | - public function get_active_message_type( $messenger, $message_type ) { |
|
1129 | + public function get_active_message_type($messenger, $message_type) { |
|
1130 | 1130 | // EE_messages has been deprecated |
1131 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1132 | - return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type ); |
|
1131 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1132 | + return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type); |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | */ |
1141 | 1141 | public function get_installed_message_types() { |
1142 | 1142 | // EE_messages has been deprecated |
1143 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1143 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1144 | 1144 | return $this->_message_resource_manager->installed_message_types(); |
1145 | 1145 | } |
1146 | 1146 | |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | */ |
1153 | 1153 | public function get_installed_messengers() { |
1154 | 1154 | // EE_messages has been deprecated |
1155 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1155 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1156 | 1156 | return $this->_message_resource_manager->installed_messengers(); |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1163,10 +1163,10 @@ discard block |
||
1163 | 1163 | * @param bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type. |
1164 | 1164 | * @return array |
1165 | 1165 | */ |
1166 | - public function get_all_contexts( $slugs_only = true ) { |
|
1166 | + public function get_all_contexts($slugs_only = true) { |
|
1167 | 1167 | // EE_messages has been deprecated |
1168 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1169 | - return $this->_message_resource_manager->get_all_contexts( $slugs_only ); |
|
1168 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1169 | + return $this->_message_resource_manager->get_all_contexts($slugs_only); |
|
1170 | 1170 | } |
1171 | 1171 | |
1172 | 1172 |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
340 | - * @param $method_name |
|
340 | + * @param string $method_name |
|
341 | 341 | */ |
342 | 342 | public static function doing_it_wrong_call( $method_name ) { |
343 | 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 ); |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | |
1151 | 1151 | /** |
1152 | 1152 | * @deprecated 4.9.0 |
1153 | - * @return array |
|
1153 | + * @return EE_messenger[] |
|
1154 | 1154 | */ |
1155 | 1155 | public function get_installed_messengers() { |
1156 | 1156 | // EE_messages has been deprecated |
@@ -101,42 +101,42 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return EEM_Message |
103 | 103 | */ |
104 | - protected function __construct( $timezone = null ) { |
|
105 | - $this->singular_item = __('Message','event_espresso'); |
|
106 | - $this->plural_item = __('Messages','event_espresso'); |
|
104 | + protected function __construct($timezone = null) { |
|
105 | + $this->singular_item = __('Message', 'event_espresso'); |
|
106 | + $this->plural_item = __('Messages', 'event_espresso'); |
|
107 | 107 | |
108 | 108 | //used for token generator |
109 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
109 | + EE_Registry::instance()->load_helper('URL'); |
|
110 | 110 | |
111 | 111 | $this->_tables = array( |
112 | - 'Message'=>new EE_Primary_Table('esp_message','MSG_ID') |
|
112 | + 'Message'=>new EE_Primary_Table('esp_message', 'MSG_ID') |
|
113 | 113 | ); |
114 | 114 | |
115 | 115 | $allowed_priority = array( |
116 | - self::priority_high => __( 'high', 'event_espresso' ), |
|
117 | - self::priority_medium => __( 'medium', 'event_espresso' ), |
|
118 | - self::priority_low => __( 'low', 'event_espresso' ) |
|
116 | + self::priority_high => __('high', 'event_espresso'), |
|
117 | + self::priority_medium => __('medium', 'event_espresso'), |
|
118 | + self::priority_low => __('low', 'event_espresso') |
|
119 | 119 | ); |
120 | 120 | |
121 | 121 | $this->_fields = array( |
122 | 122 | 'Message'=>array( |
123 | - 'MSG_ID'=>new EE_Primary_Key_Int_Field('MSG_ID', __('Message ID','event_espresso')), |
|
124 | - 'MSG_token' => new EE_Plain_Text_Field( 'MSG_token', __('Unique Token used to represent this row in publicly viewable contexts (eg. a url).', 'event_espresso' ), false, EEH_URL::generate_unique_token() ), |
|
125 | - 'GRP_ID'=>new EE_Foreign_Key_Int_Field( 'GRP_ID', __('Foreign key to the EEM_Message_Template_Group table.', 'event_espresso' ), true, 0, 'Message_Template_Group' ), |
|
126 | - 'TXN_ID' => new EE_Foreign_Key_Int_Field( 'TXN_ID', __( 'Foreign key to the related EE_Transaction. This is required to give context for regenerating the specific message', 'event_espresso' ), true, 0, 'Transaction' ), |
|
127 | - 'MSG_messenger' => new EE_Plain_Text_Field('MSG_messenger', __( 'Corresponds to the EE_messenger::name used to send this message. This will also be used to attempt any resending of the message.', 'event_espresso' ), false, 'email' ), |
|
128 | - 'MSG_message_type' => new EE_Plain_Text_Field( 'MSG_message_type', __( 'Corresponds to the EE_message_type::name used to generate this message.', 'event_espresso' ), false, 'receipt' ), |
|
129 | - 'MSG_context' => new EE_Plain_Text_Field( 'MSG_context', __( 'Context', 'event_espresso' ), false ), |
|
130 | - 'MSG_recipient_ID' => new EE_Foreign_Key_Int_Field( 'MSG_recipient_ID', __( 'Recipient ID', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
|
131 | - 'MSG_recipient_type' => new EE_Any_Foreign_Model_Name_Field( 'MSG_recipient_type', __( 'Recipient Type', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
|
132 | - 'MSG_content' => new EE_Maybe_Serialized_Text_Field( 'MSG_content', __( 'Content', 'event_espresso' ), true, '' ), |
|
133 | - 'MSG_to' => new EE_Maybe_Serialized_Text_Field( 'MSG_to', __( 'Address To', 'event_espresso' ), true ), |
|
134 | - 'MSG_from' => new EE_Maybe_Serialized_Text_Field( 'MSG_from', __( 'Address From', 'event_espresso' ), true ), |
|
135 | - 'MSG_subject' => new EE_Maybe_Serialized_Text_Field( 'MSG_subject', __( 'Subject', 'event_espresso' ), true, '' ), |
|
136 | - 'MSG_priority' => new EE_Enum_Integer_Field( 'MSG_priority', __( 'Priority', 'event_espresso' ), false, self::priority_low, $allowed_priority ), |
|
137 | - 'STS_ID' => new EE_Foreign_Key_String_Field( 'STS_ID', __( 'Status', 'event_espresso' ), false, self::status_incomplete, 'Status' ), |
|
138 | - 'MSG_created' => new EE_Datetime_Field( 'MSG_created', __( 'Created', 'event_espresso' ), false, time() ), |
|
139 | - 'MSG_modified' => new EE_Datetime_Field( 'MSG_modified', __( 'Modified', 'event_espresso' ), true, time() ) |
|
123 | + 'MSG_ID'=>new EE_Primary_Key_Int_Field('MSG_ID', __('Message ID', 'event_espresso')), |
|
124 | + 'MSG_token' => new EE_Plain_Text_Field('MSG_token', __('Unique Token used to represent this row in publicly viewable contexts (eg. a url).', 'event_espresso'), false, EEH_URL::generate_unique_token()), |
|
125 | + 'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('Foreign key to the EEM_Message_Template_Group table.', 'event_espresso'), true, 0, 'Message_Template_Group'), |
|
126 | + 'TXN_ID' => new EE_Foreign_Key_Int_Field('TXN_ID', __('Foreign key to the related EE_Transaction. This is required to give context for regenerating the specific message', 'event_espresso'), true, 0, 'Transaction'), |
|
127 | + 'MSG_messenger' => new EE_Plain_Text_Field('MSG_messenger', __('Corresponds to the EE_messenger::name used to send this message. This will also be used to attempt any resending of the message.', 'event_espresso'), false, 'email'), |
|
128 | + 'MSG_message_type' => new EE_Plain_Text_Field('MSG_message_type', __('Corresponds to the EE_message_type::name used to generate this message.', 'event_espresso'), false, 'receipt'), |
|
129 | + 'MSG_context' => new EE_Plain_Text_Field('MSG_context', __('Context', 'event_espresso'), false), |
|
130 | + 'MSG_recipient_ID' => new EE_Foreign_Key_Int_Field('MSG_recipient_ID', __('Recipient ID', 'event_espresso'), true, null, array('Registration', 'Attendee', 'WP_User')), |
|
131 | + 'MSG_recipient_type' => new EE_Any_Foreign_Model_Name_Field('MSG_recipient_type', __('Recipient Type', 'event_espresso'), true, null, array('Registration', 'Attendee', 'WP_User')), |
|
132 | + 'MSG_content' => new EE_Maybe_Serialized_Text_Field('MSG_content', __('Content', 'event_espresso'), true, ''), |
|
133 | + 'MSG_to' => new EE_Maybe_Serialized_Text_Field('MSG_to', __('Address To', 'event_espresso'), true), |
|
134 | + 'MSG_from' => new EE_Maybe_Serialized_Text_Field('MSG_from', __('Address From', 'event_espresso'), true), |
|
135 | + 'MSG_subject' => new EE_Maybe_Serialized_Text_Field('MSG_subject', __('Subject', 'event_espresso'), true, ''), |
|
136 | + 'MSG_priority' => new EE_Enum_Integer_Field('MSG_priority', __('Priority', 'event_espresso'), false, self::priority_low, $allowed_priority), |
|
137 | + 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status', 'event_espresso'), false, self::status_incomplete, 'Status'), |
|
138 | + 'MSG_created' => new EE_Datetime_Field('MSG_created', __('Created', 'event_espresso'), false, time()), |
|
139 | + 'MSG_modified' => new EE_Datetime_Field('MSG_modified', __('Modified', 'event_espresso'), true, time()) |
|
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | $this->_model_relations = array( |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | 'Message_Template_Group' => new EE_Belongs_To_Relation(), |
147 | 147 | 'Transaction' => new EE_Belongs_To_Relation() |
148 | 148 | ); |
149 | - parent::__construct( $timezone ); |
|
149 | + parent::__construct($timezone); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | public function create_default_object() { |
158 | 158 | /** @type EE_Message $message */ |
159 | 159 | $message = parent::create_default_object(); |
160 | - if ( $message instanceof EE_Message ) { |
|
161 | - return EE_Message_Factory::set_messenger_and_message_type( $message ); |
|
160 | + if ($message instanceof EE_Message) { |
|
161 | + return EE_Message_Factory::set_messenger_and_message_type($message); |
|
162 | 162 | } |
163 | 163 | return null; |
164 | 164 | } |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | * @param mixed $cols_n_values |
170 | 170 | * @return \EE_Message |
171 | 171 | */ |
172 | - public function instantiate_class_from_array_or_object( $cols_n_values ) { |
|
172 | + public function instantiate_class_from_array_or_object($cols_n_values) { |
|
173 | 173 | /** @type EE_Message $message */ |
174 | - $message = parent::instantiate_class_from_array_or_object( $cols_n_values ); |
|
175 | - if ( $message instanceof EE_Message ) { |
|
176 | - return EE_Message_Factory::set_messenger_and_message_type( $message ); |
|
174 | + $message = parent::instantiate_class_from_array_or_object($cols_n_values); |
|
175 | + if ($message instanceof EE_Message) { |
|
176 | + return EE_Message_Factory::set_messenger_and_message_type($message); |
|
177 | 177 | } |
178 | 178 | return null; |
179 | 179 | } |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | * @param string $message_type the message type slug |
187 | 187 | * @return boolean |
188 | 188 | */ |
189 | - public function message_sent_for_attendee( $attendee, $message_type ) { |
|
190 | - $attendee_ID = EEM_Attendee::instance()->ensure_is_ID( $attendee ); |
|
191 | - return $this->exists( array( array( |
|
189 | + public function message_sent_for_attendee($attendee, $message_type) { |
|
190 | + $attendee_ID = EEM_Attendee::instance()->ensure_is_ID($attendee); |
|
191 | + return $this->exists(array(array( |
|
192 | 192 | 'Attendee.ATT_ID' => $attendee_ID, |
193 | 193 | 'MSG_message_type' => $message_type, |
194 | - 'STS_ID' => array( 'IN', $this->stati_indicating_sent() ) |
|
195 | - ) ) ); |
|
194 | + 'STS_ID' => array('IN', $this->stati_indicating_sent()) |
|
195 | + ))); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | * @param string $message_type the message type slug |
205 | 205 | * @return boolean |
206 | 206 | */ |
207 | - public function message_sent_for_registration( $registration, $message_type ) { |
|
208 | - $registrationID = EEM_Registration::instance()->ensure_is_ID( $registration ); |
|
209 | - return $this->exists( array( array( |
|
207 | + public function message_sent_for_registration($registration, $message_type) { |
|
208 | + $registrationID = EEM_Registration::instance()->ensure_is_ID($registration); |
|
209 | + return $this->exists(array(array( |
|
210 | 210 | 'Registration.REG_ID' => $registrationID, |
211 | 211 | 'MSG_message_type' => $message_type, |
212 | - 'STS_ID' => array( 'IN', $this->stati_indicating_sent() ) |
|
213 | - ) ) ); |
|
212 | + 'STS_ID' => array('IN', $this->stati_indicating_sent()) |
|
213 | + ))); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | * @param string $token |
222 | 222 | * @return EE_Message |
223 | 223 | */ |
224 | - public function get_one_by_token( $token ) { |
|
225 | - return $this->get_one( array( array( |
|
224 | + public function get_one_by_token($token) { |
|
225 | + return $this->get_one(array(array( |
|
226 | 226 | 'MSG_token' => $token |
227 | - ) ) ); |
|
227 | + ))); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | * Returns stati that indicate the message HAS been sent |
233 | 233 | * @return array of strings for possible stati |
234 | 234 | */ |
235 | - public function stati_indicating_sent(){ |
|
236 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_sent', array( self::status_sent ) ); |
|
235 | + public function stati_indicating_sent() { |
|
236 | + return apply_filters('FHEE__EEM_Message__stati_indicating_sent', array(self::status_sent)); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | |
@@ -244,13 +244,13 @@ discard block |
||
244 | 244 | * @return array of strings for possible stati. |
245 | 245 | */ |
246 | 246 | public function stati_indicating_to_send() { |
247 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_to_send', array( self::status_idle, self::status_resend ) ); |
|
247 | + return apply_filters('FHEE__EEM_Message__stati_indicating_to_send', array(self::status_idle, self::status_resend)); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
251 | 251 | |
252 | 252 | public function stati_indicating_failed_sending() { |
253 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_failed_sending', array( self::status_failed, self::status_retry, self::status_debug_only ) ); |
|
253 | + return apply_filters('FHEE__EEM_Message__stati_indicating_failed_sending', array(self::status_failed, self::status_retry, self::status_debug_only)); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | // the value, matches the corresponding EEM_Base child reference. |
286 | 286 | $expected_vars = $this->_expected_vars_for_query_inject(); |
287 | 287 | $query_params[0] = array(); |
288 | - foreach ( $expected_vars as $request_key => $model_name ) { |
|
289 | - $request_value = EE_Registry::instance()->REQ->get( $request_key ); |
|
290 | - if ( $request_value ) { |
|
288 | + foreach ($expected_vars as $request_key => $model_name) { |
|
289 | + $request_value = EE_Registry::instance()->REQ->get($request_key); |
|
290 | + if ($request_value) { |
|
291 | 291 | //special case |
292 | - switch ( $request_key ) { |
|
292 | + switch ($request_key) { |
|
293 | 293 | case '_REG_ID' : |
294 | 294 | $query_params[0]['AND**filter_by']['OR**filter_by_REG_ID'] = array( |
295 | 295 | 'Transaction.Registration.REG_ID' => $request_value, |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | ); |
302 | 302 | break; |
303 | 303 | default : |
304 | - $query_params[0]['AND**filter_by'][ 'OR**filter_by_' . $request_key ][ $model_name . '.' . $request_key ] = $request_value; |
|
304 | + $query_params[0]['AND**filter_by']['OR**filter_by_'.$request_key][$model_name.'.'.$request_key] = $request_value; |
|
305 | 305 | break; |
306 | 306 | } |
307 | 307 | } |
@@ -317,53 +317,53 @@ discard block |
||
317 | 317 | $expected_vars = $this->_expected_vars_for_query_inject(); |
318 | 318 | $pretty_label = ''; |
319 | 319 | $label_parts = array(); |
320 | - foreach ( $expected_vars as $request_key => $model_name ) { |
|
321 | - $model = EE_Registry::instance()->load_model( $model_name ); |
|
322 | - if ( $model_field_value = EE_Registry::instance()->REQ->get( $request_key ) ) { |
|
323 | - switch ( $request_key ) { |
|
320 | + foreach ($expected_vars as $request_key => $model_name) { |
|
321 | + $model = EE_Registry::instance()->load_model($model_name); |
|
322 | + if ($model_field_value = EE_Registry::instance()->REQ->get($request_key)) { |
|
323 | + switch ($request_key) { |
|
324 | 324 | case '_REG_ID' : |
325 | 325 | $label_parts[] = sprintf( |
326 | - esc_html__( 'Registration with the ID: %s', 'event_espresso' ), |
|
326 | + esc_html__('Registration with the ID: %s', 'event_espresso'), |
|
327 | 327 | $model_field_value |
328 | 328 | ); |
329 | 329 | break; |
330 | 330 | case 'ATT_ID' : |
331 | 331 | /** @var EE_Attendee $attendee */ |
332 | - $attendee = $model->get_one_by_ID( $model_field_value ); |
|
332 | + $attendee = $model->get_one_by_ID($model_field_value); |
|
333 | 333 | $label_parts[] = $attendee instanceof EE_Attendee |
334 | - ? sprintf( esc_html__( 'Attendee %s', 'event_espresso' ), $attendee->full_name() ) |
|
335 | - : sprintf( esc_html__( 'Attendee ID: %s', 'event_espresso' ), $model_field_value ); |
|
334 | + ? sprintf(esc_html__('Attendee %s', 'event_espresso'), $attendee->full_name()) |
|
335 | + : sprintf(esc_html__('Attendee ID: %s', 'event_espresso'), $model_field_value); |
|
336 | 336 | break; |
337 | 337 | case 'ID' : |
338 | 338 | /** @var EE_WP_User $wpUser */ |
339 | - $wpUser = $model->get_one_by_ID( $model_field_value ); |
|
339 | + $wpUser = $model->get_one_by_ID($model_field_value); |
|
340 | 340 | $label_parts[] = $wpUser instanceof EE_WP_User |
341 | - ? sprintf( esc_html__( 'WP User: %s', 'event_espresso' ), $wpUser->name() ) |
|
342 | - : sprintf( esc_html__( 'WP User ID: %s', 'event_espresso' ), $model_field_value ); |
|
341 | + ? sprintf(esc_html__('WP User: %s', 'event_espresso'), $wpUser->name()) |
|
342 | + : sprintf(esc_html__('WP User ID: %s', 'event_espresso'), $model_field_value); |
|
343 | 343 | break; |
344 | 344 | case 'TXN_ID' : |
345 | 345 | $label_parts[] = sprintf( |
346 | - esc_html__( 'Transaction with the ID: %s', 'event_espresso' ), |
|
346 | + esc_html__('Transaction with the ID: %s', 'event_espresso'), |
|
347 | 347 | $model_field_value |
348 | 348 | ); |
349 | 349 | break; |
350 | 350 | case 'EVT_ID' : |
351 | 351 | /** @var EE_Event $Event */ |
352 | - $Event = $model->get_one_by_ID( $model_field_value ); |
|
352 | + $Event = $model->get_one_by_ID($model_field_value); |
|
353 | 353 | $label_parts[] = $Event instanceof EE_Event |
354 | - ? sprintf( esc_html__( 'for the Event: %s', 'event_espresso' ), $Event->name() ) |
|
355 | - : sprintf( esc_html__( 'for the Event with ID: %s', 'event_espresso' ), $model_field_value ); |
|
354 | + ? sprintf(esc_html__('for the Event: %s', 'event_espresso'), $Event->name()) |
|
355 | + : sprintf(esc_html__('for the Event with ID: %s', 'event_espresso'), $model_field_value); |
|
356 | 356 | break; |
357 | 357 | } |
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
361 | - if ( $label_parts ) { |
|
361 | + if ($label_parts) { |
|
362 | 362 | |
363 | 363 | //prepend to the last element of $label_parts an "and". |
364 | - if ( count( $label_parts ) > 1 ) { |
|
365 | - $label_parts_index_to_prepend = count( $label_parts ) - 1; |
|
366 | - $label_parts[ $label_parts_index_to_prepend ] = 'and' . $label_parts[ $label_parts_index_to_prepend ]; |
|
364 | + if (count($label_parts) > 1) { |
|
365 | + $label_parts_index_to_prepend = count($label_parts) - 1; |
|
366 | + $label_parts[$label_parts_index_to_prepend] = 'and'.$label_parts[$label_parts_index_to_prepend]; |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | $pretty_label .= sprintf( |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | 'A label for the messages returned in a query that are filtered by items in the query. This could be Transaction, Event, Attendee, Registration, or WP_User.', |
373 | 373 | 'event_espresso' |
374 | 374 | ), |
375 | - implode( ', ', $label_parts ) |
|
375 | + implode(', ', $label_parts) |
|
376 | 376 | ); |
377 | 377 | } |
378 | 378 | return $pretty_label; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function localized_status( $statuses, $plural = FALSE, $schema = 'upper' ) { |
84 | 84 | //note these are all in lower case because ucwords() on upper case will NOT convert. |
85 | 85 | $translation_array = array( |
86 | - EEM_Registration::status_id_pending_payment => array( |
|
86 | + EEM_Registration::status_id_pending_payment => array( |
|
87 | 87 | __('pending payment', 'event_espresso'), //singular |
88 | 88 | __('pending payments', 'event_espresso') //plural |
89 | 89 | ), |
@@ -217,22 +217,22 @@ discard block |
||
217 | 217 | __('queued for sending', 'event_espresso'), |
218 | 218 | __('queued for sending', 'event_espresso'), |
219 | 219 | ), |
220 | - EEM_Message::status_failed => array( |
|
221 | - __('failed', 'event_espresso'), |
|
222 | - __('failed', 'event_espresso'), |
|
223 | - ), |
|
220 | + EEM_Message::status_failed => array( |
|
221 | + __('failed', 'event_espresso'), |
|
222 | + __('failed', 'event_espresso'), |
|
223 | + ), |
|
224 | 224 | EEM_Message::status_debug_only => array( |
225 | 225 | __( 'debug only', 'event_espresso' ), |
226 | 226 | __( 'debug only', 'event_espresso' ) |
227 | 227 | ), |
228 | - EEM_Message::status_resend => array( |
|
229 | - __('queued for resending', 'event_espresso'), |
|
230 | - __('queued for resending', 'event_espresso'), |
|
231 | - ), |
|
232 | - EEM_Message::status_incomplete => array( |
|
233 | - __('queued for generating', 'event_espresso'), |
|
234 | - __('queued for generating', 'event_espresso'), |
|
235 | - ), |
|
228 | + EEM_Message::status_resend => array( |
|
229 | + __('queued for resending', 'event_espresso'), |
|
230 | + __('queued for resending', 'event_espresso'), |
|
231 | + ), |
|
232 | + EEM_Message::status_incomplete => array( |
|
233 | + __('queued for generating', 'event_espresso'), |
|
234 | + __('queued for generating', 'event_espresso'), |
|
235 | + ), |
|
236 | 236 | EEM_Message::status_retry => array( |
237 | 237 | __('failed sending, can be retried', 'event_espresso'), |
238 | 238 | __('failed sending, can be retried', 'event_espresso'), |
@@ -261,37 +261,37 @@ discard block |
||
261 | 261 | __('trashed', 'event_espresso'), |
262 | 262 | __('trashed', 'event_espresso') |
263 | 263 | ), |
264 | - ); |
|
264 | + ); |
|
265 | 265 | |
266 | 266 | $translation_array = apply_filters( 'FHEE__EEM_Status__localized_status__translation_array', $translation_array ); |
267 | 267 | |
268 | 268 | if ( !is_array($statuses) ) |
269 | 269 | throw new EE_Error( __('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso') ); |
270 | 270 | |
271 | - $translation = array(); |
|
271 | + $translation = array(); |
|
272 | 272 | |
273 | - foreach ( $statuses as $id => $code ) { |
|
274 | - if ( isset( $translation_array[$id] ) ) { |
|
275 | - $translation[$id] = $plural ? $translation_array[$id][1] : $translation_array[$id][0]; |
|
276 | - } else { |
|
277 | - $translation[$id] = $code; |
|
278 | - } |
|
273 | + foreach ( $statuses as $id => $code ) { |
|
274 | + if ( isset( $translation_array[$id] ) ) { |
|
275 | + $translation[$id] = $plural ? $translation_array[$id][1] : $translation_array[$id][0]; |
|
276 | + } else { |
|
277 | + $translation[$id] = $code; |
|
278 | + } |
|
279 | 279 | |
280 | - //schema |
|
281 | - switch ( $schema ) { |
|
282 | - case 'lower' : |
|
283 | - $translation[$id] = strtolower( $translation[$id] ); //even though these start in lower case, this will catch any statuses added via filter. |
|
284 | - break; |
|
285 | - case 'sentence' : |
|
286 | - $translation[$id] = ucwords( $translation[$id] ); |
|
287 | - break; |
|
288 | - case 'upper' : |
|
289 | - $translation[$id] = strtoupper( $translation[$id] ); |
|
290 | - break; |
|
291 | - } |
|
292 | - } |
|
280 | + //schema |
|
281 | + switch ( $schema ) { |
|
282 | + case 'lower' : |
|
283 | + $translation[$id] = strtolower( $translation[$id] ); //even though these start in lower case, this will catch any statuses added via filter. |
|
284 | + break; |
|
285 | + case 'sentence' : |
|
286 | + $translation[$id] = ucwords( $translation[$id] ); |
|
287 | + break; |
|
288 | + case 'upper' : |
|
289 | + $translation[$id] = strtoupper( $translation[$id] ); |
|
290 | + break; |
|
291 | + } |
|
292 | + } |
|
293 | 293 | |
294 | - return $translation; |
|
294 | + return $translation; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * |
14 | 14 | * ------------------------------------------------------------------------ |
15 | 15 | */ |
16 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
16 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
17 | 17 | /** |
18 | 18 | * |
19 | 19 | * Class EEM_Status |
@@ -32,32 +32,32 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @return EEM_Status |
34 | 34 | */ |
35 | - protected function __construct( $timezone = NULL ) { |
|
36 | - $this->singular_item = __('Status','event_espresso'); |
|
37 | - $this->plural_item = __('Stati','event_espresso'); |
|
35 | + protected function __construct($timezone = NULL) { |
|
36 | + $this->singular_item = __('Status', 'event_espresso'); |
|
37 | + $this->plural_item = __('Stati', 'event_espresso'); |
|
38 | 38 | $this->_tables = array( |
39 | 39 | 'Status'=> new EE_Primary_Table('esp_status', 'STS_ID') |
40 | 40 | ); |
41 | 41 | $this->_fields = array( |
42 | 42 | 'Status'=>array( |
43 | - 'STS_ID'=> new EE_Primary_Key_String_Field('STS_ID', __('Status ID','event_espresso')), |
|
44 | - 'STS_code'=>new EE_Plain_Text_Field('STS_code',__('Status Code','event_espresso'),false, ''), |
|
43 | + 'STS_ID'=> new EE_Primary_Key_String_Field('STS_ID', __('Status ID', 'event_espresso')), |
|
44 | + 'STS_code'=>new EE_Plain_Text_Field('STS_code', __('Status Code', 'event_espresso'), false, ''), |
|
45 | 45 | 'STS_type'=>new EE_Enum_Text_Field( |
46 | 46 | 'STS_type', |
47 | 47 | __("Type", "event_espresso"), |
48 | 48 | false, |
49 | 49 | 'event', |
50 | 50 | array( |
51 | - 'event'=> __("Event", "event_espresso"),//deprecated |
|
51 | + 'event'=> __("Event", "event_espresso"), //deprecated |
|
52 | 52 | 'registration'=> __("Registration", "event_espresso"), |
53 | 53 | 'transaction'=> __("Transaction", "event_espresso"), |
54 | 54 | 'payment'=> __("Payment", "event_espresso"), |
55 | 55 | 'email'=> __("Email", "event_espresso"), |
56 | 56 | 'message' => __("Message", "event_espresso") |
57 | 57 | )), |
58 | - 'STS_can_edit'=>new EE_Boolean_Field('STS_can_edit', __('Editable?','event_espresso'), false), |
|
58 | + 'STS_can_edit'=>new EE_Boolean_Field('STS_can_edit', __('Editable?', 'event_espresso'), false), |
|
59 | 59 | 'STS_desc'=>new EE_Simple_HTML_Field('STS_desc', __("Description", "event_espresso"), false, ''), |
60 | - 'STS_open'=>new EE_Boolean_Field('STS_open', __("Open?", "event_espresso"), false,false) |
|
60 | + 'STS_open'=>new EE_Boolean_Field('STS_open', __("Open?", "event_espresso"), false, false) |
|
61 | 61 | )); |
62 | 62 | $this->_model_relations = array( |
63 | 63 | 'Registration'=>new EE_Has_Many_Relation(), |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | 'Payment'=>new EE_Has_Many_Relation() |
66 | 66 | ); |
67 | 67 | //this model is generally available for reading |
68 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
68 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
69 | 69 | |
70 | - parent::__construct( $timezone ); |
|
70 | + parent::__construct($timezone); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @throws EE_Error |
81 | 81 | * @return array an array of translated strings for the incoming status id. |
82 | 82 | */ |
83 | - public function localized_status( $statuses, $plural = FALSE, $schema = 'upper' ) { |
|
83 | + public function localized_status($statuses, $plural = FALSE, $schema = 'upper') { |
|
84 | 84 | //note these are all in lower case because ucwords() on upper case will NOT convert. |
85 | 85 | $translation_array = array( |
86 | 86 | EEM_Registration::status_id_pending_payment => array( |
@@ -222,8 +222,8 @@ discard block |
||
222 | 222 | __('failed', 'event_espresso'), |
223 | 223 | ), |
224 | 224 | EEM_Message::status_debug_only => array( |
225 | - __( 'debug only', 'event_espresso' ), |
|
226 | - __( 'debug only', 'event_espresso' ) |
|
225 | + __('debug only', 'event_espresso'), |
|
226 | + __('debug only', 'event_espresso') |
|
227 | 227 | ), |
228 | 228 | EEM_Message::status_resend => array( |
229 | 229 | __('queued for resending', 'event_espresso'), |
@@ -263,30 +263,30 @@ discard block |
||
263 | 263 | ), |
264 | 264 | ); |
265 | 265 | |
266 | - $translation_array = apply_filters( 'FHEE__EEM_Status__localized_status__translation_array', $translation_array ); |
|
266 | + $translation_array = apply_filters('FHEE__EEM_Status__localized_status__translation_array', $translation_array); |
|
267 | 267 | |
268 | - if ( !is_array($statuses) ) |
|
269 | - throw new EE_Error( __('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso') ); |
|
268 | + if ( ! is_array($statuses)) |
|
269 | + throw new EE_Error(__('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso')); |
|
270 | 270 | |
271 | 271 | $translation = array(); |
272 | 272 | |
273 | - foreach ( $statuses as $id => $code ) { |
|
274 | - if ( isset( $translation_array[$id] ) ) { |
|
273 | + foreach ($statuses as $id => $code) { |
|
274 | + if (isset($translation_array[$id])) { |
|
275 | 275 | $translation[$id] = $plural ? $translation_array[$id][1] : $translation_array[$id][0]; |
276 | 276 | } else { |
277 | 277 | $translation[$id] = $code; |
278 | 278 | } |
279 | 279 | |
280 | 280 | //schema |
281 | - switch ( $schema ) { |
|
281 | + switch ($schema) { |
|
282 | 282 | case 'lower' : |
283 | - $translation[$id] = strtolower( $translation[$id] ); //even though these start in lower case, this will catch any statuses added via filter. |
|
283 | + $translation[$id] = strtolower($translation[$id]); //even though these start in lower case, this will catch any statuses added via filter. |
|
284 | 284 | break; |
285 | 285 | case 'sentence' : |
286 | - $translation[$id] = ucwords( $translation[$id] ); |
|
286 | + $translation[$id] = ucwords($translation[$id]); |
|
287 | 287 | break; |
288 | 288 | case 'upper' : |
289 | - $translation[$id] = strtoupper( $translation[$id] ); |
|
289 | + $translation[$id] = strtoupper($translation[$id]); |
|
290 | 290 | break; |
291 | 291 | } |
292 | 292 | } |
@@ -1,25 +1,25 @@ |
||
1 | 1 | <div class="changelog point-releases"> |
2 | - <!-- <h3><?php echo _n( 'Minor Release Information', 'Minor Releases', 1 ); ?></h3> --> |
|
3 | - <h3><?php echo _n( 'Major Release Information', 'Major Releases', 1 ); ?></h3> |
|
2 | + <!-- <h3><?php echo _n('Minor Release Information', 'Minor Releases', 1); ?></h3> --> |
|
3 | + <h3><?php echo _n('Major Release Information', 'Major Releases', 1); ?></h3> |
|
4 | 4 | <?php //$type = 'minor'; ?> |
5 | 5 | <?php $type = 'major'; ?> |
6 | - <p><?php printf( __( '<strong>Version %1$s</strong> is a %2$s release.', 'event_espresso'), EVENT_ESPRESSO_VERSION, $type ); ?> |
|
6 | + <p><?php printf(__('<strong>Version %1$s</strong> is a %2$s release.', 'event_espresso'), EVENT_ESPRESSO_VERSION, $type); ?> |
|
7 | 7 | <?php |
8 | - $ver = explode( '.', EVENT_ESPRESSO_VERSION ); |
|
9 | - array_pop( $ver ); |
|
10 | - $ver = implode( '.', $ver ); |
|
8 | + $ver = explode('.', EVENT_ESPRESSO_VERSION); |
|
9 | + array_pop($ver); |
|
10 | + $ver = implode('.', $ver); |
|
11 | 11 | ?> |
12 | - <?php printf( __( 'For more information, see <a href="%s" target="_blank">the release notes</a>.' ), 'http://eventespresso.com/wiki/ee4-changelog/#' . $ver ); ?> |
|
12 | + <?php printf(__('For more information, see <a href="%s" target="_blank">the release notes</a>.'), 'http://eventespresso.com/wiki/ee4-changelog/#'.$ver); ?> |
|
13 | 13 | </p> |
14 | 14 | </div> |
15 | 15 | |
16 | 16 | <div class="changelog"> |
17 | 17 | <?php |
18 | 18 | //maintenance mode on? |
19 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
19 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
20 | 20 | ?> |
21 | 21 | <div class="ee-attention"> |
22 | - <h2 class="ee-maintenance-mode-callout"><?php _e('Event Espresso is in full maintenance mode.' , 'event_espresso'); ?></h2> |
|
22 | + <h2 class="ee-maintenance-mode-callout"><?php _e('Event Espresso is in full maintenance mode.', 'event_espresso'); ?></h2> |
|
23 | 23 | <p> |
24 | 24 | <?php |
25 | 25 | printf( |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * Gets an array for converting between QST_system and QST_IDs for system questions. Eg, if you want to know |
311 | 311 | * which system question QST_ID corresponds to the QST_system 'city', use EEM_Question::instance()->get_Question_ID_from_system_string('city'); |
312 | 312 | * @param $QST_system |
313 | - * @return int of QST_ID for the question that corresponds to that QST_system |
|
313 | + * @return string of QST_ID for the question that corresponds to that QST_system |
|
314 | 314 | */ |
315 | 315 | public function get_Question_ID_from_system_string( $QST_system ){ |
316 | 316 | return $this->get_var( array( array( 'QST_system' => $QST_system ) ) ); |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | |
371 | 371 | /** |
372 | - * @return array |
|
372 | + * @return EEM_Question |
|
373 | 373 | */ |
374 | 374 | public function question_descriptions() { |
375 | 375 | return $this->_question_descriptions; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | -require_once( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
5 | -require_once( EE_CLASSES . 'EE_Question.class.php' ); |
|
4 | +require_once(EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
5 | +require_once(EE_CLASSES.'EE_Question.class.php'); |
|
6 | 6 | |
7 | 7 | |
8 | 8 | |
@@ -101,52 +101,52 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @param null $timezone |
103 | 103 | */ |
104 | - protected function __construct( $timezone = NULL ) { |
|
105 | - $this->singular_item = __('Question','event_espresso'); |
|
106 | - $this->plural_item = __('Questions','event_espresso'); |
|
107 | - $this->_allowed_question_types=apply_filters( |
|
104 | + protected function __construct($timezone = NULL) { |
|
105 | + $this->singular_item = __('Question', 'event_espresso'); |
|
106 | + $this->plural_item = __('Questions', 'event_espresso'); |
|
107 | + $this->_allowed_question_types = apply_filters( |
|
108 | 108 | 'FHEE__EEM_Question__construct__allowed_question_types', |
109 | 109 | array( |
110 | - EEM_Question::QST_type_text =>__('Text','event_espresso'), |
|
111 | - EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'), |
|
112 | - EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'), |
|
113 | - EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'), |
|
114 | - EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'), |
|
115 | - EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'), |
|
116 | - EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'), |
|
117 | - EEM_Question::QST_type_date =>__('Date Picker','event_espresso'), |
|
118 | - EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ), |
|
119 | - EEM_Question::QST_type_email => __( 'Email', 'event_espresso' ), |
|
120 | - EEM_Question::QST_type_us_phone => __( 'USA - Format Phone', 'event_espresso' ), |
|
121 | - EEM_Question::QST_type_decimal => __( 'Number', 'event_espresso' ), |
|
122 | - EEM_Question::QST_type_int => __( 'Whole Number', 'event_espresso' ), |
|
123 | - EEM_Question::QST_type_url => __( 'URL', 'event_espresso' ), |
|
124 | - EEM_Question::QST_type_year => __( 'Year', 'event_espresso' ), |
|
125 | - EEM_Question::QST_type_multi_select => __( 'Multi Select', 'event_espresso' ) |
|
110 | + EEM_Question::QST_type_text =>__('Text', 'event_espresso'), |
|
111 | + EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'), |
|
112 | + EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'), |
|
113 | + EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'), |
|
114 | + EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'), |
|
115 | + EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'), |
|
116 | + EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'), |
|
117 | + EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'), |
|
118 | + EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'), |
|
119 | + EEM_Question::QST_type_email => __('Email', 'event_espresso'), |
|
120 | + EEM_Question::QST_type_us_phone => __('USA - Format Phone', 'event_espresso'), |
|
121 | + EEM_Question::QST_type_decimal => __('Number', 'event_espresso'), |
|
122 | + EEM_Question::QST_type_int => __('Whole Number', 'event_espresso'), |
|
123 | + EEM_Question::QST_type_url => __('URL', 'event_espresso'), |
|
124 | + EEM_Question::QST_type_year => __('Year', 'event_espresso'), |
|
125 | + EEM_Question::QST_type_multi_select => __('Multi Select', 'event_espresso') |
|
126 | 126 | ) |
127 | 127 | ); |
128 | 128 | $this->_question_descriptions = apply_filters( |
129 | 129 | 'FHEE__EEM_Question__construct__allowed_question_types', |
130 | 130 | array( |
131 | - EEM_Question::QST_type_text => __( 'A single line text input field', 'event_espresso' ), |
|
132 | - EEM_Question::QST_type_textarea => __( 'A multi line text input field', 'event_espresso' ), |
|
133 | - EEM_Question::QST_type_checkbox => __( 'Allows multiple preset options to be selected', 'event_espresso' ), |
|
134 | - EEM_Question::QST_type_radio => __( 'Allows a single preset option to be selected', 'event_espresso' ), |
|
135 | - EEM_Question::QST_type_dropdown => __( 'A dropdown that allows a single selection', 'event_espresso' ), |
|
136 | - EEM_Question::QST_type_state => __( 'A dropdown that lists states/provinces', 'event_espresso' ), |
|
137 | - EEM_Question::QST_type_country => __( 'A dropdown that lists countries', 'event_espresso' ), |
|
138 | - EEM_Question::QST_type_date => __( 'A popup calendar that allows date selections', 'event_espresso' ), |
|
139 | - EEM_Question::QST_type_html_textarea => __( 'A multi line text input field that allows HTML', 'event_espresso' ), |
|
140 | - EEM_Question::QST_type_email => __( 'A text field that must contain a valid Email address', 'event_espresso' ), |
|
141 | - EEM_Question::QST_type_us_phone => __( 'A text field that must contain a valid US phone number', 'event_espresso' ), |
|
142 | - EEM_Question::QST_type_decimal => __( 'A text field that allows number values with decimals', 'event_espresso' ), |
|
143 | - EEM_Question::QST_type_int => __( 'A text field that only allows whole numbers (no decimals)', 'event_espresso' ), |
|
144 | - EEM_Question::QST_type_url => __( 'A text field that must contain a valid URL', 'event_espresso' ), |
|
145 | - EEM_Question::QST_type_year => __( 'A dropdown that lists the last 100 years', 'event_espresso' ), |
|
146 | - EEM_Question::QST_type_multi_select => __( 'A dropdown that allows multiple selections', 'event_espresso' ) |
|
131 | + EEM_Question::QST_type_text => __('A single line text input field', 'event_espresso'), |
|
132 | + EEM_Question::QST_type_textarea => __('A multi line text input field', 'event_espresso'), |
|
133 | + EEM_Question::QST_type_checkbox => __('Allows multiple preset options to be selected', 'event_espresso'), |
|
134 | + EEM_Question::QST_type_radio => __('Allows a single preset option to be selected', 'event_espresso'), |
|
135 | + EEM_Question::QST_type_dropdown => __('A dropdown that allows a single selection', 'event_espresso'), |
|
136 | + EEM_Question::QST_type_state => __('A dropdown that lists states/provinces', 'event_espresso'), |
|
137 | + EEM_Question::QST_type_country => __('A dropdown that lists countries', 'event_espresso'), |
|
138 | + EEM_Question::QST_type_date => __('A popup calendar that allows date selections', 'event_espresso'), |
|
139 | + EEM_Question::QST_type_html_textarea => __('A multi line text input field that allows HTML', 'event_espresso'), |
|
140 | + EEM_Question::QST_type_email => __('A text field that must contain a valid Email address', 'event_espresso'), |
|
141 | + EEM_Question::QST_type_us_phone => __('A text field that must contain a valid US phone number', 'event_espresso'), |
|
142 | + EEM_Question::QST_type_decimal => __('A text field that allows number values with decimals', 'event_espresso'), |
|
143 | + EEM_Question::QST_type_int => __('A text field that only allows whole numbers (no decimals)', 'event_espresso'), |
|
144 | + EEM_Question::QST_type_url => __('A text field that must contain a valid URL', 'event_espresso'), |
|
145 | + EEM_Question::QST_type_year => __('A dropdown that lists the last 100 years', 'event_espresso'), |
|
146 | + EEM_Question::QST_type_multi_select => __('A dropdown that allows multiple selections', 'event_espresso') |
|
147 | 147 | ) |
148 | 148 | ); |
149 | - $this->_question_type_categories = (array)apply_filters( |
|
149 | + $this->_question_type_categories = (array) apply_filters( |
|
150 | 150 | 'FHEE__EEM_Question__construct__question_type_categories', |
151 | 151 | array( |
152 | 152 | 'text' => array( |
@@ -171,22 +171,22 @@ discard block |
||
171 | 171 | ); |
172 | 172 | |
173 | 173 | $this->_tables = array( |
174 | - 'Question'=>new EE_Primary_Table('esp_question','QST_ID') |
|
174 | + 'Question'=>new EE_Primary_Table('esp_question', 'QST_ID') |
|
175 | 175 | ); |
176 | 176 | $this->_fields = array( |
177 | 177 | 'Question'=>array( |
178 | - 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')), |
|
179 | - 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''), |
|
180 | - 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''), |
|
181 | - 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), false, '' ), |
|
182 | - 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types), |
|
183 | - 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false), |
|
184 | - 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''), |
|
185 | - 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0), |
|
186 | - 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false), |
|
187 | - 'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso' ), false, EE_INF ), |
|
188 | - 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ), |
|
189 | - 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false) |
|
178 | + 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), |
|
179 | + 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), |
|
180 | + 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), |
|
181 | + 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), false, ''), |
|
182 | + 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), |
|
183 | + 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), |
|
184 | + 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), |
|
185 | + 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), |
|
186 | + 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), |
|
187 | + 'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF), |
|
188 | + 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false), |
|
189 | + 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false) |
|
190 | 190 | ) |
191 | 191 | ); |
192 | 192 | $this->_model_relations = array( |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | 'Question_Group_Question'=>new EE_Has_Many_Relation() |
199 | 199 | ); |
200 | 200 | //this model is generally available for reading |
201 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
202 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
203 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
204 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
205 | - parent::__construct( $timezone ); |
|
201 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
202 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
203 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
204 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
205 | + parent::__construct($timezone); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * but they can be extended |
211 | 211 | * @return string[] |
212 | 212 | */ |
213 | - public function allowed_question_types(){ |
|
213 | + public function allowed_question_types() { |
|
214 | 214 | return $this->_allowed_question_types; |
215 | 215 | } |
216 | 216 | /** |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | * @param string $question_type one of EEM_Question::allowed_question_types( |
219 | 219 | * @return string[] like EEM_Question::allowed_question_types() |
220 | 220 | */ |
221 | - public function question_types_in_same_category( $question_type ) { |
|
222 | - $question_types = array( $question_type ); |
|
223 | - foreach( $this->_question_type_categories as $category => $question_types_in_category ) { |
|
224 | - if( in_array( $question_type, $question_types_in_category ) ) { |
|
221 | + public function question_types_in_same_category($question_type) { |
|
222 | + $question_types = array($question_type); |
|
223 | + foreach ($this->_question_type_categories as $category => $question_types_in_category) { |
|
224 | + if (in_array($question_type, $question_types_in_category)) { |
|
225 | 225 | $question_types = $question_types_in_category; |
226 | 226 | break; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) ); |
|
230 | + return array_intersect_key($this->allowed_question_types(), array_flip($question_types)); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | * @param string $category one of the top-level keys of EEM_Question::question_type_categories() |
237 | 237 | * @return boolean |
238 | 238 | */ |
239 | - public function question_type_is_in_category( $question_type, $category ) { |
|
240 | - if( ! isset( $this->_question_type_categories[ $category ] ) ) { |
|
239 | + public function question_type_is_in_category($question_type, $category) { |
|
240 | + if ( ! isset($this->_question_type_categories[$category])) { |
|
241 | 241 | return false; |
242 | 242 | } |
243 | - return in_array( $question_type, $this->_question_type_categories[ $category ] ); |
|
243 | + return in_array($question_type, $this->_question_type_categories[$category]); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | * @param string $system_question_group_id QSG_system |
258 | 258 | * @return array of system question names (QST_system) |
259 | 259 | */ |
260 | - public function allowed_system_questions_in_system_question_group( $system_question_group_id ) { |
|
260 | + public function allowed_system_questions_in_system_question_group($system_question_group_id) { |
|
261 | 261 | $question_system_ids = array(); |
262 | - switch( $system_question_group_id ) { |
|
262 | + switch ($system_question_group_id) { |
|
263 | 263 | case EEM_Question_Group::system_personal: |
264 | 264 | $question_system_ids = array( |
265 | 265 | EEM_Attendee::system_question_fname, |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | ); |
281 | 281 | break; |
282 | 282 | } |
283 | - return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id ); |
|
283 | + return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | * @param string $system_question_group_id QSG_system |
290 | 290 | * @return array of system question names (QST_system) |
291 | 291 | */ |
292 | - public function required_system_questions_in_system_question_group( $system_question_group_id ) { |
|
292 | + public function required_system_questions_in_system_question_group($system_question_group_id) { |
|
293 | 293 | $question_system_ids = null; |
294 | - switch( $system_question_group_id ) { |
|
294 | + switch ($system_question_group_id) { |
|
295 | 295 | case EEM_Question_Group::system_personal: |
296 | - $question_system_ids = array( |
|
296 | + $question_system_ids = array( |
|
297 | 297 | EEM_Attendee::system_question_fname, |
298 | 298 | EEM_Attendee::system_question_email, |
299 | 299 | ); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | default: |
302 | 302 | $question_system_ids = array(); |
303 | 303 | } |
304 | - return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id ); |
|
304 | + return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | * @param $QST_system |
313 | 313 | * @return int of QST_ID for the question that corresponds to that QST_system |
314 | 314 | */ |
315 | - public function get_Question_ID_from_system_string( $QST_system ){ |
|
316 | - return $this->get_var( array( array( 'QST_system' => $QST_system ) ) ); |
|
315 | + public function get_Question_ID_from_system_string($QST_system) { |
|
316 | + return $this->get_var(array(array('QST_system' => $QST_system))); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function get_latest_question_order() { |
327 | 327 | $columns_to_select = array( |
328 | - 'max_order' => array("MAX(QST_order)","%d") |
|
328 | + 'max_order' => array("MAX(QST_order)", "%d") |
|
329 | 329 | ); |
330 | - $max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select ); |
|
331 | - return isset( $max[0], $max[0]['max_order'] ) ? $max[0]['max_order'] : 0; |
|
330 | + $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select); |
|
331 | + return isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | * @param string $system_question_value |
358 | 358 | * @return int|float |
359 | 359 | */ |
360 | - public function absolute_max_for_system_question( $system_question_value ) { |
|
360 | + public function absolute_max_for_system_question($system_question_value) { |
|
361 | 361 | $maxes = $this->system_question_maxes(); |
362 | - if( isset( $maxes[ $system_question_value ] ) ) { |
|
363 | - return $maxes[ $system_question_value ]; |
|
362 | + if (isset($maxes[$system_question_value])) { |
|
363 | + return $maxes[$system_question_value]; |
|
364 | 364 | } else { |
365 | 365 | return EE_INF; |
366 | 366 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
69 | 69 | * @access public |
70 | 70 | */ |
71 | - public function __construct( $routing = TRUE ) { |
|
72 | - require_once( EE_MODELS . 'EEM_Question.model.php' ); |
|
73 | - require_once( EE_MODELS . 'EEM_Question_Group.model.php' ); |
|
74 | - $this->_question_model= EEM_Question::instance(); |
|
75 | - $this->_question_group_model=EEM_Question_Group::instance(); |
|
76 | - parent::__construct( $routing ); |
|
71 | + public function __construct($routing = TRUE) { |
|
72 | + require_once(EE_MODELS.'EEM_Question.model.php'); |
|
73 | + require_once(EE_MODELS.'EEM_Question_Group.model.php'); |
|
74 | + $this->_question_model = EEM_Question::instance(); |
|
75 | + $this->_question_group_model = EEM_Question_Group::instance(); |
|
76 | + parent::__construct($routing); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | *_set_page_routes |
110 | 110 | */ |
111 | 111 | protected function _set_page_routes() { |
112 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
112 | + $qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
113 | 113 | $this->_page_routes = array( |
114 | 114 | 'default' => array( |
115 | 115 | 'func' => '_questions_overview_list_table', |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | 'update_question' => array( |
132 | 132 | 'func' => '_insert_or_update_question', |
133 | - 'args' => array('new_question' => FALSE ), |
|
133 | + 'args' => array('new_question' => FALSE), |
|
134 | 134 | 'capability' => 'ee_edit_question', |
135 | 135 | 'obj_id' => $qst_id, |
136 | 136 | 'noheader' => TRUE, |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | 'filename' => 'registration_form_questions_overview_views_bulk_actions_search' |
166 | 166 | ) |
167 | 167 | ), |
168 | - 'help_tour' => array( 'Registration_Form_Questions_Overview_Help_Tour'), |
|
168 | + 'help_tour' => array('Registration_Form_Questions_Overview_Help_Tour'), |
|
169 | 169 | 'require_nonce' => FALSE, |
170 | 170 | 'qtips' => array( |
171 | 171 | 'EE_Registration_Form_Tips' |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'filename' => 'registration_form_question_groups' |
185 | 185 | ), |
186 | 186 | ), |
187 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
187 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
188 | 188 | 'require_nonce' => FALSE |
189 | 189 | ), |
190 | 190 | |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | 'label' => __('Edit Question', 'event_espresso'), |
194 | 194 | 'order' => 15, |
195 | 195 | 'persistent' => FALSE, |
196 | - 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
196 | + 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id']), $this->_current_page_view_url) : $this->_admin_base_url |
|
197 | 197 | ), |
198 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
198 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
199 | 199 | 'help_tabs' => array( |
200 | 200 | 'registration_form_edit_question_group_help_tab' => array( |
201 | 201 | 'title' => __('Edit Question', 'event_espresso'), |
202 | 202 | 'filename' => 'registration_form_edit_question' |
203 | 203 | ), |
204 | 204 | ), |
205 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
205 | + 'help_tour' => array('Registration_Form_Edit_Question_Help_Tour'), |
|
206 | 206 | 'require_nonce' => FALSE |
207 | 207 | ), |
208 | 208 | ); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | //none of the below group are currently used for Event Categories |
231 | 231 | protected function _add_feature_pointers() {} |
232 | 232 | public function load_scripts_styles() { |
233 | - wp_register_style( 'espresso_registration', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
233 | + wp_register_style('espresso_registration', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
234 | 234 | wp_enqueue_style('espresso_registration'); |
235 | 235 | } |
236 | 236 | public function admin_init() {} |
@@ -246,20 +246,20 @@ discard block |
||
246 | 246 | |
247 | 247 | public function load_scripts_styles_add_question() { |
248 | 248 | $this->load_scripts_styles_forms(); |
249 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
250 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
249 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
250 | + wp_enqueue_script('espresso_registration_form_single'); |
|
251 | 251 | } |
252 | 252 | public function load_scripts_styles_edit_question() { |
253 | 253 | $this->load_scripts_styles_forms(); |
254 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
255 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
254 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
255 | + wp_enqueue_script('espresso_registration_form_single'); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
259 | 259 | |
260 | 260 | |
261 | 261 | public function recaptcha_info_help_tab() { |
262 | - $template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php'; |
|
262 | + $template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php'; |
|
263 | 263 | EEH_Template::display_template($template, array()); |
264 | 264 | } |
265 | 265 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | ) |
292 | 292 | ); |
293 | 293 | |
294 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
294 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
295 | 295 | $this->_views['trash'] = array( |
296 | 296 | 'slug' => 'trash', |
297 | 297 | 'label' => __('Trash', 'event_espresso'), |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | */ |
310 | 310 | protected function _questions_groups_preview() { |
311 | 311 | $this->_admin_page_title = __('Question Groups (Preview)', 'event_espresso'); |
312 | - $this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="' . esc_attr__( 'Preview Question Groups Overview List Table screenshot', 'event_espresso' ) . '" />'; |
|
313 | - $this->_template_args['preview_text'] = '<strong>'.__( 'Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso' ).'</strong>'; |
|
314 | - $this->display_admin_caf_preview_page( 'question_groups_tab' ); |
|
312 | + $this->_template_args['preview_img'] = '<img src="'.REGISTRATION_FORM_ASSETS_URL.'caf_reg_form_preview.jpg" alt="'.esc_attr__('Preview Question Groups Overview List Table screenshot', 'event_espresso').'" />'; |
|
313 | + $this->_template_args['preview_text'] = '<strong>'.__('Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso').'</strong>'; |
|
314 | + $this->display_admin_caf_preview_page('question_groups_tab'); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -322,58 +322,58 @@ discard block |
||
322 | 322 | * @param \EEM_Base $model |
323 | 323 | * @return array where each key is the name of a model's field/db column, and each value is its value. |
324 | 324 | */ |
325 | - protected function _set_column_values_for(EEM_Base $model){ |
|
326 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
327 | - $set_column_values=array(); |
|
325 | + protected function _set_column_values_for(EEM_Base $model) { |
|
326 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
327 | + $set_column_values = array(); |
|
328 | 328 | |
329 | 329 | //some initial checks for proper values. |
330 | 330 | //if QST_admin_only, then no matter what QST_required is we disable. |
331 | - if ( !empty( $this->_req_data['QST_admin_only'] ) ) { |
|
331 | + if ( ! empty($this->_req_data['QST_admin_only'])) { |
|
332 | 332 | $this->_req_data['QST_required'] = 0; |
333 | 333 | } |
334 | - foreach($model->field_settings() as $fieldName=>$settings){ |
|
334 | + foreach ($model->field_settings() as $fieldName=>$settings) { |
|
335 | 335 | // basically if QSG_identifier is empty or not set |
336 | - if ( $fieldName === 'QSG_identifier' && ( isset( $this->_req_data['QSG_identifier'] ) && empty( $this->_req_data['QSG_identifier'] ) )) { |
|
337 | - $QSG_name = isset( $this->_req_data['QSG_name'] ) ? $this->_req_data['QSG_name'] : '' ; |
|
338 | - $set_column_values[$fieldName] = sanitize_title($QSG_name ) . '-' . uniqid( '', true ); |
|
336 | + if ($fieldName === 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) { |
|
337 | + $QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : ''; |
|
338 | + $set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid('', true); |
|
339 | 339 | // dd($set_column_values); |
340 | 340 | } |
341 | 341 | //if the admin label is blank, use a slug version of the question text |
342 | - else if ( $fieldName === 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
|
343 | - $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
|
344 | - $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
|
342 | + else if ($fieldName === 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) { |
|
343 | + $QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : ''; |
|
344 | + $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10)); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
348 | - else if ( $fieldName === 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
348 | + else if ($fieldName === 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) { |
|
349 | 349 | $set_column_values[$fieldName] = 0; |
350 | 350 | } |
351 | 351 | |
352 | - else if ( $fieldName === 'QST_max' ) { |
|
352 | + else if ($fieldName === 'QST_max') { |
|
353 | 353 | $qst_system = EEM_Question::instance()->get_var( |
354 | 354 | array( |
355 | 355 | array( |
356 | - 'QST_ID' => isset( $this->_req_data[ 'QST_ID' ] ) ? $this->_req_data[ 'QST_ID' ] : 0 |
|
356 | + 'QST_ID' => isset($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0 |
|
357 | 357 | ) |
358 | 358 | ), |
359 | 359 | 'QST_system' ); |
360 | - $max_max = EEM_Question::instance()->absolute_max_for_system_question( $qst_system ); |
|
361 | - if( empty( $this->_req_data[ 'QST_max' ] ) || |
|
362 | - $this->_req_data[ 'QST_max' ] > $max_max ) { |
|
363 | - $set_column_values[ $fieldName ] = $max_max; |
|
360 | + $max_max = EEM_Question::instance()->absolute_max_for_system_question($qst_system); |
|
361 | + if (empty($this->_req_data['QST_max']) || |
|
362 | + $this->_req_data['QST_max'] > $max_max) { |
|
363 | + $set_column_values[$fieldName] = $max_max; |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | |
367 | 367 | |
368 | 368 | //only add a property to the array if it's not null (otherwise the model should just use the default value) |
369 | - if( |
|
370 | - ! isset( $set_column_values[ $fieldName ] ) && |
|
371 | - isset($this->_req_data[$fieldName] ) ){ |
|
372 | - $set_column_values[$fieldName]=$this->_req_data[$fieldName]; |
|
369 | + if ( |
|
370 | + ! isset($set_column_values[$fieldName]) && |
|
371 | + isset($this->_req_data[$fieldName]) ) { |
|
372 | + $set_column_values[$fieldName] = $this->_req_data[$fieldName]; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | } |
376 | - return $set_column_values;//validation fo this data to be performed by the model before insertion. |
|
376 | + return $set_column_values; //validation fo this data to be performed by the model before insertion. |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | |
@@ -392,29 +392,29 @@ discard block |
||
392 | 392 | * _edit_question |
393 | 393 | */ |
394 | 394 | protected function _edit_question() { |
395 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
396 | - $ID=isset( $this->_req_data['QST_ID'] ) && ! empty( $this->_req_data['QST_ID'] ) ? absint( $this->_req_data['QST_ID'] ) : FALSE; |
|
395 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
396 | + $ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE; |
|
397 | 397 | |
398 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
398 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
399 | 399 | // add PRC_ID to title if editing |
400 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
401 | - if($ID){ |
|
402 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
403 | - $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
400 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
401 | + if ($ID) { |
|
402 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
403 | + $additional_hidden_fields = array('QST_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
404 | 404 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
405 | - }else{ |
|
406 | - $question= EE_Question::new_instance(); |
|
405 | + } else { |
|
406 | + $question = EE_Question::new_instance(); |
|
407 | 407 | $question->set_order_to_latest(); |
408 | 408 | $this->_set_add_edit_form_tags('insert_question'); |
409 | 409 | } |
410 | - $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category( $question->type() ) : $this->_question_model->allowed_question_types(); |
|
411 | - $this->_template_args['QST_ID']=$ID; |
|
412 | - $this->_template_args['question']=$question; |
|
413 | - $this->_template_args['question_types']= $question_types; |
|
414 | - $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() ); |
|
410 | + $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types(); |
|
411 | + $this->_template_args['QST_ID'] = $ID; |
|
412 | + $this->_template_args['question'] = $question; |
|
413 | + $this->_template_args['question_types'] = $question_types; |
|
414 | + $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID()); |
|
415 | 415 | $this->_template_args['question_type_descriptions'] = $this->_get_question_type_descriptions(); |
416 | - $this->_set_publish_post_box_vars( 'id', $ID ); |
|
417 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
416 | + $this->_set_publish_post_box_vars('id', $ID); |
|
417 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php', $this->_template_args, TRUE); |
|
418 | 418 | |
419 | 419 | // the details template wrapper |
420 | 420 | $this->display_admin_page_with_sidebar(); |
@@ -429,18 +429,18 @@ discard block |
||
429 | 429 | EE_Registry::instance()->load_helper('HTML'); |
430 | 430 | $descriptions = ''; |
431 | 431 | $question_type_descriptions = EEM_Question::instance()->question_descriptions(); |
432 | - foreach ( $question_type_descriptions as $type => $question_type_description ) { |
|
433 | - if ( $type == 'HTML_TEXTAREA' ) { |
|
432 | + foreach ($question_type_descriptions as $type => $question_type_description) { |
|
433 | + if ($type == 'HTML_TEXTAREA') { |
|
434 | 434 | $html = new EE_Simple_HTML_Validation_Strategy(); |
435 | 435 | $question_type_description .= sprintf( |
436 | - __( '%1$s(allowed tags: %2$s)', 'event_espresso' ), |
|
436 | + __('%1$s(allowed tags: %2$s)', 'event_espresso'), |
|
437 | 437 | '<br/>', |
438 | 438 | $html->get_list_of_allowed_tags() |
439 | 439 | ); |
440 | 440 | } |
441 | 441 | $descriptions .= EEH_HTML::p( |
442 | 442 | $question_type_description, |
443 | - 'question_type_description-' . $type, |
|
443 | + 'question_type_description-'.$type, |
|
444 | 444 | 'question_type_description description', |
445 | 445 | 'display:none;' |
446 | 446 | ); |
@@ -454,58 +454,58 @@ discard block |
||
454 | 454 | * @param bool|true $new_question |
455 | 455 | * @throws \EE_Error |
456 | 456 | */ |
457 | - protected function _insert_or_update_question( $new_question = TRUE) { |
|
458 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
459 | - $set_column_values=$this->_set_column_values_for($this->_question_model); |
|
460 | - if($new_question){ |
|
461 | - $ID=$this->_question_model->insert($set_column_values); |
|
457 | + protected function _insert_or_update_question($new_question = TRUE) { |
|
458 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
459 | + $set_column_values = $this->_set_column_values_for($this->_question_model); |
|
460 | + if ($new_question) { |
|
461 | + $ID = $this->_question_model->insert($set_column_values); |
|
462 | 462 | $success = $ID ? true : false; |
463 | 463 | $action_desc = 'added'; |
464 | - }else{ |
|
465 | - $ID=absint($this->_req_data['QST_ID']); |
|
466 | - $pk=$this->_question_model->primary_key_name(); |
|
467 | - $wheres=array($pk=>$ID); |
|
464 | + } else { |
|
465 | + $ID = absint($this->_req_data['QST_ID']); |
|
466 | + $pk = $this->_question_model->primary_key_name(); |
|
467 | + $wheres = array($pk=>$ID); |
|
468 | 468 | unset($set_column_values[$pk]); |
469 | - $success= $this->_question_model->update($set_column_values,array($wheres)); |
|
470 | - $action_desc='updated'; |
|
469 | + $success = $this->_question_model->update($set_column_values, array($wheres)); |
|
470 | + $action_desc = 'updated'; |
|
471 | 471 | } |
472 | 472 | |
473 | - if ($ID){ |
|
473 | + if ($ID) { |
|
474 | 474 | //save the related options |
475 | 475 | //trash removed options, save old ones |
476 | 476 | //get list of all options |
477 | 477 | /** @type EE_Question $question */ |
478 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
479 | - $options=$question->options(); |
|
480 | - if(! empty($options)){ |
|
481 | - foreach($options as $option_ID=>$option){ |
|
482 | - $option_req_index=$this->_get_option_req_data_index($option_ID); |
|
483 | - if($option_req_index!==FALSE){ |
|
478 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
479 | + $options = $question->options(); |
|
480 | + if ( ! empty($options)) { |
|
481 | + foreach ($options as $option_ID=>$option) { |
|
482 | + $option_req_index = $this->_get_option_req_data_index($option_ID); |
|
483 | + if ($option_req_index !== FALSE) { |
|
484 | 484 | $option->save($this->_req_data['question_options'][$option_req_index]); |
485 | - }else{ |
|
485 | + } else { |
|
486 | 486 | //not found, remove it |
487 | 487 | $option->delete(); |
488 | 488 | } |
489 | 489 | } |
490 | 490 | } |
491 | 491 | //save new related options |
492 | - foreach($this->_req_data['question_options'] as $index=>$option_req_data){ |
|
493 | - if( empty($option_req_data['QSO_ID'] ) && ( ( isset( $option_req_data['QSO_value'] ) && $option_req_data['QSO_value'] !== '' ) || ! empty( $option_req_data['QSO_desc'] ) ) ) {//no ID! save it! |
|
494 | - if( ! isset( $option_req_data['QSO_value'] ) || $option_req_data['QSO_value'] === '' ){ |
|
495 | - $option_req_data['QSO_value']=$option_req_data['QSO_desc']; |
|
492 | + foreach ($this->_req_data['question_options'] as $index=>$option_req_data) { |
|
493 | + if (empty($option_req_data['QSO_ID']) && ((isset($option_req_data['QSO_value']) && $option_req_data['QSO_value'] !== '') || ! empty($option_req_data['QSO_desc']))) {//no ID! save it! |
|
494 | + if ( ! isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') { |
|
495 | + $option_req_data['QSO_value'] = $option_req_data['QSO_desc']; |
|
496 | 496 | } |
497 | - $new_option=EE_Question_Option::new_instance( array( 'QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
497 | + $new_option = EE_Question_Option::new_instance(array('QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
498 | 498 | $new_option->save(); |
499 | 499 | } |
500 | 500 | } |
501 | 501 | } |
502 | - $query_args = array( 'action' => 'edit_question', 'QST_ID' => $ID ); |
|
503 | - if ( $success !== FALSE ) { |
|
504 | - $msg = $new_question ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_model->item_name() ); |
|
505 | - EE_Error::add_success( $msg ); |
|
502 | + $query_args = array('action' => 'edit_question', 'QST_ID' => $ID); |
|
503 | + if ($success !== FALSE) { |
|
504 | + $msg = $new_question ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name()); |
|
505 | + EE_Error::add_success($msg); |
|
506 | 506 | } |
507 | 507 | |
508 | - $this->_redirect_after_action( FALSE, '', $action_desc, $query_args, TRUE); |
|
508 | + $this->_redirect_after_action(FALSE, '', $action_desc, $query_args, TRUE); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
@@ -518,10 +518,10 @@ discard block |
||
518 | 518 | * @param int $ID of the question option to find |
519 | 519 | * @return int index in question_options array if successful, FALSE if unsuccessful |
520 | 520 | */ |
521 | - protected function _get_option_req_data_index($ID){ |
|
522 | - $req_data_for_question_options=$this->_req_data['question_options']; |
|
523 | - foreach($req_data_for_question_options as $num=>$option_data){ |
|
524 | - if( array_key_exists('QSO_ID',$option_data) && (int)$option_data['QSO_ID'] === $ID ){ |
|
521 | + protected function _get_option_req_data_index($ID) { |
|
522 | + $req_data_for_question_options = $this->_req_data['question_options']; |
|
523 | + foreach ($req_data_for_question_options as $num=>$option_data) { |
|
524 | + if (array_key_exists('QSO_ID', $option_data) && (int) $option_data['QSO_ID'] === $ID) { |
|
525 | 525 | return $num; |
526 | 526 | } |
527 | 527 | } |
@@ -543,25 +543,25 @@ discard block |
||
543 | 543 | * @param int $current_page |
544 | 544 | * @return array lik EEM_Base::get_all's $query_params parameter |
545 | 545 | */ |
546 | - protected function get_query_params($model, $per_page=10,$current_page=10){ |
|
546 | + protected function get_query_params($model, $per_page = 10, $current_page = 10) { |
|
547 | 547 | $query_params = array(); |
548 | - $offset=($current_page-1)*$per_page; |
|
549 | - $query_params['limit']=array($offset,$per_page); |
|
550 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
548 | + $offset = ($current_page - 1) * $per_page; |
|
549 | + $query_params['limit'] = array($offset, $per_page); |
|
550 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
551 | 551 | $orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order'; |
552 | 552 | $field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby']; |
553 | - $query_params['order_by']=array( $field_to_order_by => $order ); |
|
554 | - $search_string = array_key_exists('s',$this->_req_data) ? $this->_req_data['s'] : null; |
|
555 | - if(! empty($search_string)){ |
|
556 | - if($model instanceof EEM_Question_Group){ |
|
557 | - $query_params[0]=array( |
|
553 | + $query_params['order_by'] = array($field_to_order_by => $order); |
|
554 | + $search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null; |
|
555 | + if ( ! empty($search_string)) { |
|
556 | + if ($model instanceof EEM_Question_Group) { |
|
557 | + $query_params[0] = array( |
|
558 | 558 | 'OR'=>array( |
559 | - 'QSG_name'=>array('LIKE',"%$search_string%"), |
|
560 | - 'QSG_desc'=>array('LIKE',"%$search_string%")) |
|
559 | + 'QSG_name'=>array('LIKE', "%$search_string%"), |
|
560 | + 'QSG_desc'=>array('LIKE', "%$search_string%")) |
|
561 | 561 | ); |
562 | - }else{ |
|
563 | - $query_params[0]=array( |
|
564 | - 'QST_display_text'=>array('LIKE',"%$search_string%") |
|
562 | + } else { |
|
563 | + $query_params[0] = array( |
|
564 | + 'QST_display_text'=>array('LIKE', "%$search_string%") |
|
565 | 565 | ); |
566 | 566 | } |
567 | 567 | } |
@@ -609,13 +609,13 @@ discard block |
||
609 | 609 | * @param bool|false $count |
610 | 610 | * @return \EE_Soft_Delete_Base_Class[]|int |
611 | 611 | */ |
612 | - public function get_questions( $per_page=10, $current_page = 1, $count = FALSE ) { |
|
612 | + public function get_questions($per_page = 10, $current_page = 1, $count = FALSE) { |
|
613 | 613 | $QST = EEM_Question::instance(); |
614 | 614 | $query_params = $this->get_query_params($QST, $per_page, $current_page); |
615 | - if ($count){ |
|
616 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
615 | + if ($count) { |
|
616 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
617 | 617 | $results = $QST->count($where); |
618 | - }else{ |
|
618 | + } else { |
|
619 | 619 | $results = $QST->get_all($query_params); |
620 | 620 | } |
621 | 621 | return $results; |
@@ -630,10 +630,10 @@ discard block |
||
630 | 630 | * @param bool|false $count |
631 | 631 | * @return \EE_Soft_Delete_Base_Class[]|int |
632 | 632 | */ |
633 | - public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) { |
|
634 | - $query_params =$this->get_query_params( EEM_Question::instance(), $per_page, $current_page); |
|
635 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
636 | - $questions =$count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
633 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
634 | + $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
|
635 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
636 | + $questions = $count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
637 | 637 | return $questions; |
638 | 638 | } |
639 | 639 | |
@@ -645,12 +645,12 @@ discard block |
||
645 | 645 | * @param bool|false $count |
646 | 646 | * @return \EE_Soft_Delete_Base_Class[] |
647 | 647 | */ |
648 | - public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
648 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
649 | 649 | /** @type EEM_Question_Group $questionGroupModel */ |
650 | 650 | $questionGroupModel = EEM_Question_Group::instance(); |
651 | 651 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
652 | 652 | return $questionGroupModel->get_all( |
653 | - $this->get_query_params( $questionGroupModel, $per_page, $current_page ) |
|
653 | + $this->get_query_params($questionGroupModel, $per_page, $current_page) |
|
654 | 654 | ); |
655 | 655 | } |
656 | 656 | |
@@ -667,36 +667,36 @@ discard block |
||
667 | 667 | |
668 | 668 | $this->_template_args['values'] = $this->_yes_no_values; |
669 | 669 | |
670 | - $this->_template_args['use_captcha'] = isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
671 | - $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"': ''; |
|
670 | + $this->_template_args['use_captcha'] = isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
671 | + $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"' : ''; |
|
672 | 672 | |
673 | - $this->_template_args['recaptcha_publickey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''; |
|
674 | - $this->_template_args['recaptcha_privatekey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''; |
|
675 | - $this->_template_args['recaptcha_width'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_width ) ? absint( EE_Registry::instance()->CFG->registration->recaptcha_width ) : 500; |
|
673 | + $this->_template_args['recaptcha_publickey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''; |
|
674 | + $this->_template_args['recaptcha_privatekey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''; |
|
675 | + $this->_template_args['recaptcha_width'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_width) ? absint(EE_Registry::instance()->CFG->registration->recaptcha_width) : 500; |
|
676 | 676 | |
677 | 677 | $this->_template_args['recaptcha_theme_options'] = array( |
678 | - array('id' => 'red','text'=> __('Red', 'event_espresso')), |
|
679 | - array('id' => 'white','text'=> __('White', 'event_espresso')), |
|
680 | - array('id' => 'blackglass','text'=> __('Blackglass', 'event_espresso')), |
|
681 | - array('id' => 'clean','text'=> __('Clean', 'event_espresso')) |
|
678 | + array('id' => 'red', 'text'=> __('Red', 'event_espresso')), |
|
679 | + array('id' => 'white', 'text'=> __('White', 'event_espresso')), |
|
680 | + array('id' => 'blackglass', 'text'=> __('Blackglass', 'event_espresso')), |
|
681 | + array('id' => 'clean', 'text'=> __('Clean', 'event_espresso')) |
|
682 | 682 | ); |
683 | - $this->_template_args['recaptcha_theme'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->get_pretty( 'recaptcha_theme' ) : 'clean'; |
|
683 | + $this->_template_args['recaptcha_theme'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->get_pretty('recaptcha_theme') : 'clean'; |
|
684 | 684 | |
685 | 685 | $this->_template_args['recaptcha_language_options'] = array( |
686 | - array('id' => 'en','text'=> __('English', 'event_espresso')), |
|
687 | - array('id' => 'es','text'=> __('Spanish', 'event_espresso')), |
|
688 | - array('id' => 'nl','text'=> __('Dutch', 'event_espresso')), |
|
689 | - array('id' => 'fr','text'=> __('French', 'event_espresso')), |
|
690 | - array('id' => 'de','text'=> __('German', 'event_espresso')), |
|
691 | - array('id' => 'pt','text'=> __('Portuguese', 'event_espresso')), |
|
692 | - array('id' => 'ru','text'=> __('Russian', 'event_espresso')), |
|
693 | - array('id' => 'tr','text'=> __('Turkish', 'event_espresso')) |
|
686 | + array('id' => 'en', 'text'=> __('English', 'event_espresso')), |
|
687 | + array('id' => 'es', 'text'=> __('Spanish', 'event_espresso')), |
|
688 | + array('id' => 'nl', 'text'=> __('Dutch', 'event_espresso')), |
|
689 | + array('id' => 'fr', 'text'=> __('French', 'event_espresso')), |
|
690 | + array('id' => 'de', 'text'=> __('German', 'event_espresso')), |
|
691 | + array('id' => 'pt', 'text'=> __('Portuguese', 'event_espresso')), |
|
692 | + array('id' => 'ru', 'text'=> __('Russian', 'event_espresso')), |
|
693 | + array('id' => 'tr', 'text'=> __('Turkish', 'event_espresso')) |
|
694 | 694 | ); |
695 | - $this->_template_args['recaptcha_language'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
695 | + $this->_template_args['recaptcha_language'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
696 | 696 | |
697 | - $this->_set_add_edit_form_tags( 'update_reg_form_settings' ); |
|
698 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
699 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE ); |
|
697 | + $this->_set_add_edit_form_tags('update_reg_form_settings'); |
|
698 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
699 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE); |
|
700 | 700 | $this->display_admin_page_with_sidebar(); |
701 | 701 | } |
702 | 702 |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | //(all other times it gets resurrected from a wordpress option) |
14 | 14 | $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | -foreach($stages as $filepath){ |
|
16 | +foreach ($stages as $filepath) { |
|
17 | 17 | $matches = array(); |
18 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
18 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | 19 | $class_to_filepath[$matches[1]] = $filepath; |
20 | 20 | } |
21 | 21 | //give addons a chance to autoload their stages too |
22 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath); |
|
22 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
|
23 | 23 | EEH_Autoloader::register_autoloader($class_to_filepath); |
24 | 24 | |
25 | 25 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @since 4.6.0 |
36 | 36 | * |
37 | 37 | */ |
38 | -class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{ |
|
38 | +class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base { |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * return EE_DMS_Core_4_8_0 |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function can_migrate_from_version($version_array) { |
64 | 64 | $version_string = $version_array['Core']; |
65 | - if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){ |
|
65 | + if ($version_string <= '4.8.0' && $version_string >= '4.7.0') { |
|
66 | 66 | // echo "$version_string can be migrated from"; |
67 | 67 | return true; |
68 | - }elseif( ! $version_string ){ |
|
68 | + }elseif ( ! $version_string) { |
|
69 | 69 | // echo "no version string provided: $version_string"; |
70 | 70 | //no version string provided... this must be pre 4.3 |
71 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | - }else{ |
|
71 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + } else { |
|
73 | 73 | // echo "$version_string doesnt apply"; |
74 | 74 | return false; |
75 | 75 | } |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | * @return bool |
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
94 | - $now_in_mysql = current_time( 'mysql', true ); |
|
93 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
94 | + $now_in_mysql = current_time('mysql', true); |
|
95 | 95 | |
96 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
97 | - $table_name='esp_answer'; |
|
98 | - $sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
96 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
97 | + $table_name = 'esp_answer'; |
|
98 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
99 | 99 | REG_ID int(10) unsigned NOT NULL, |
100 | 100 | QST_ID int(10) unsigned NOT NULL, |
101 | 101 | ANS_value text NOT NULL, |
102 | 102 | PRIMARY KEY (ANS_ID), |
103 | 103 | KEY REG_ID (REG_ID), |
104 | 104 | KEY QST_ID (QST_ID)"; |
105 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
105 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
106 | 106 | |
107 | 107 | $table_name = 'esp_attendee_meta'; |
108 | 108 | $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | CNT_is_EU tinyint(1) DEFAULT '0', |
143 | 143 | CNT_active tinyint(1) DEFAULT '0', |
144 | 144 | PRIMARY KEY (CNT_ISO)"; |
145 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
145 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
146 | 146 | |
147 | 147 | $table_name = 'esp_currency'; |
148 | 148 | $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
153 | 153 | CUR_active tinyint(1) DEFAULT '0', |
154 | 154 | PRIMARY KEY (CUR_code)"; |
155 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
155 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
156 | 156 | |
157 | 157 | |
158 | 158 | $table_name = 'esp_currency_payment_method'; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | KEY EVT_ID (EVT_ID), |
183 | 183 | KEY DTT_is_primary (DTT_is_primary)"; |
184 | 184 | |
185 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
185 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
186 | 186 | |
187 | 187 | $table_name = 'esp_event_meta'; |
188 | 188 | $sql = " |
@@ -201,41 +201,41 @@ discard block |
||
201 | 201 | EVT_donations tinyint(1) NULL, |
202 | 202 | PRIMARY KEY (EVTM_ID), |
203 | 203 | KEY EVT_ID (EVT_ID)"; |
204 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
204 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
205 | 205 | |
206 | 206 | |
207 | 207 | |
208 | - $table_name='esp_event_question_group'; |
|
209 | - $sql="EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
208 | + $table_name = 'esp_event_question_group'; |
|
209 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
210 | 210 | EVT_ID bigint(20) unsigned NOT NULL, |
211 | 211 | QSG_ID int(10) unsigned NOT NULL, |
212 | 212 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
213 | 213 | PRIMARY KEY (EQG_ID), |
214 | 214 | KEY EVT_ID (EVT_ID), |
215 | 215 | KEY QSG_ID (QSG_ID)"; |
216 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
216 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
217 | 217 | |
218 | 218 | |
219 | 219 | |
220 | - $table_name='esp_event_venue'; |
|
221 | - $sql="EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
220 | + $table_name = 'esp_event_venue'; |
|
221 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
222 | 222 | EVT_ID bigint(20) unsigned NOT NULL, |
223 | 223 | VNU_ID bigint(20) unsigned NOT NULL, |
224 | 224 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
225 | 225 | PRIMARY KEY (EVV_ID)"; |
226 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
226 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | 227 | |
228 | 228 | |
229 | 229 | |
230 | - $table_name='esp_extra_meta'; |
|
231 | - $sql="EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
230 | + $table_name = 'esp_extra_meta'; |
|
231 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
232 | 232 | OBJ_ID int(11) DEFAULT NULL, |
233 | 233 | EXM_type varchar(45) DEFAULT NULL, |
234 | 234 | EXM_key varchar(45) DEFAULT NULL, |
235 | 235 | EXM_value text, |
236 | 236 | PRIMARY KEY (EXM_ID), |
237 | 237 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
238 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
238 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
239 | 239 | |
240 | 240 | $table_name = 'esp_extra_join'; |
241 | 241 | $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
249 | 249 | $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
250 | 250 | |
251 | - $table_name='esp_line_item'; |
|
252 | - $sql="LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
251 | + $table_name = 'esp_line_item'; |
|
252 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
253 | 253 | LIN_code varchar(245) NOT NULL DEFAULT '', |
254 | 254 | TXN_ID int(11) DEFAULT NULL, |
255 | 255 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | PRIMARY KEY (LIN_ID), |
269 | 269 | KEY LIN_code (LIN_code(191)), |
270 | 270 | KEY TXN_ID (TXN_ID)"; |
271 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
271 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
272 | 272 | |
273 | 273 | $table_name = 'esp_log'; |
274 | 274 | $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
308 | 308 | PRIMARY KEY (GRP_ID), |
309 | 309 | KEY MTP_user_id (MTP_user_id)"; |
310 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
310 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
311 | 311 | |
312 | 312 | $table_name = 'esp_event_message_template'; |
313 | 313 | $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | PRIMARY KEY (EMT_ID), |
317 | 317 | KEY EVT_ID (EVT_ID), |
318 | 318 | KEY GRP_ID (GRP_ID)"; |
319 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
319 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
320 | 320 | |
321 | 321 | |
322 | 322 | $table_name = 'esp_payment'; |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | PRIMARY KEY (TTM_ID)"; |
390 | 390 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
391 | 391 | |
392 | - $table_name='esp_question'; |
|
393 | - $sql='QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
392 | + $table_name = 'esp_question'; |
|
393 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
394 | 394 | QST_display_text text NOT NULL, |
395 | 395 | QST_admin_label varchar(255) NOT NULL, |
396 | 396 | QST_system varchar(25) DEFAULT NULL, |
@@ -404,22 +404,22 @@ discard block |
||
404 | 404 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
405 | 405 | PRIMARY KEY (QST_ID), |
406 | 406 | KEY QST_order (QST_order)'; |
407 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
407 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
408 | 408 | |
409 | - $table_name='esp_question_group_question'; |
|
410 | - $sql="QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
409 | + $table_name = 'esp_question_group_question'; |
|
410 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
411 | 411 | QSG_ID int(10) unsigned NOT NULL, |
412 | 412 | QST_ID int(10) unsigned NOT NULL, |
413 | 413 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
414 | 414 | PRIMARY KEY (QGQ_ID), |
415 | 415 | KEY QST_ID (QST_ID), |
416 | 416 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
417 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
417 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
418 | 418 | |
419 | 419 | |
420 | 420 | |
421 | - $table_name='esp_question_option'; |
|
422 | - $sql="QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
421 | + $table_name = 'esp_question_option'; |
|
422 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
423 | 423 | QSO_value varchar(255) NOT NULL, |
424 | 424 | QSO_desc text NOT NULL, |
425 | 425 | QST_ID int(10) unsigned NOT NULL, |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | PRIMARY KEY (QSO_ID), |
430 | 430 | KEY QST_ID (QST_ID), |
431 | 431 | KEY QSO_order (QSO_order)"; |
432 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
432 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | 433 | |
434 | 434 | |
435 | 435 | |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | |
476 | 476 | |
477 | 477 | |
478 | - $table_name='esp_checkin'; |
|
479 | - $sql="CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
478 | + $table_name = 'esp_checkin'; |
|
479 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
480 | 480 | REG_ID int(10) unsigned NOT NULL, |
481 | 481 | DTT_ID int(10) unsigned NOT NULL, |
482 | 482 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | PRC_parent int(10) unsigned DEFAULT 0, |
572 | 572 | PRIMARY KEY (PRC_ID), |
573 | 573 | KEY PRT_ID (PRT_ID)"; |
574 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
574 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
575 | 575 | |
576 | 576 | $table_name = "esp_price_type"; |
577 | 577 | $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
610 | 610 | PRIMARY KEY (TKT_ID), |
611 | 611 | KEY TKT_start_date (TKT_start_date)"; |
612 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
612 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
613 | 613 | |
614 | 614 | $table_name = 'esp_question_group'; |
615 | - $sql='QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
615 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
616 | 616 | QSG_name varchar(255) NOT NULL, |
617 | 617 | QSG_identifier varchar(100) NOT NULL, |
618 | 618 | QSG_desc text NULL, |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | PRIMARY KEY (QSG_ID), |
626 | 626 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
627 | 627 | KEY QSG_order (QSG_order)'; |
628 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
628 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
629 | 629 | |
630 | 630 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
631 | 631 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | return $script_4_7_defaults->schema_changes_after_migration(); |
662 | 662 | } |
663 | 663 | |
664 | - public function migration_page_hooks(){ |
|
664 | + public function migration_page_hooks() { |
|
665 | 665 | |
666 | 666 | } |
667 | 667 | |
@@ -675,19 +675,19 @@ discard block |
||
675 | 675 | //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
676 | 676 | //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
677 | 677 | $newer_countries = array( |
678 | - array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ), |
|
679 | - array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
680 | - array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ), |
|
681 | - array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ), |
|
682 | - array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
683 | - array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
684 | - array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
685 | - array( 'MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0 ), |
|
686 | - array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ), |
|
687 | - array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ), |
|
688 | - array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ), |
|
689 | - array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ), |
|
690 | - array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ), |
|
678 | + array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
679 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
680 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
681 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
682 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
683 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
684 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
685 | + array('MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
686 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0), |
|
687 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
688 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
689 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0), |
|
690 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
691 | 691 | ); |
692 | 692 | global $wpdb; |
693 | 693 | $country_table = $wpdb->prefix."esp_country"; |
@@ -706,14 +706,14 @@ discard block |
||
706 | 706 | "CNT_is_EU" => '%d', |
707 | 707 | "CNT_active" => '%d', |
708 | 708 | ); |
709 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $country_table . "'") == $country_table ) { |
|
710 | - foreach( $newer_countries as $country ) { |
|
711 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ; |
|
709 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$country_table."'") == $country_table) { |
|
710 | + foreach ($newer_countries as $country) { |
|
711 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
712 | 712 | $countries = $wpdb->get_var($SQL); |
713 | - if ( ! $countries ) { |
|
713 | + if ( ! $countries) { |
|
714 | 714 | |
715 | - $wpdb->insert( $country_table, |
|
716 | - array_combine( array_keys( $country_format), $country ), |
|
715 | + $wpdb->insert($country_table, |
|
716 | + array_combine(array_keys($country_format), $country), |
|
717 | 717 | $country_format |
718 | 718 | ); |
719 | 719 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
732 | 732 | //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
733 | 733 | $newer_currencies = array( |
734 | - array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ), |
|
734 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
735 | 735 | ); |
736 | 736 | global $wpdb; |
737 | 737 | $currency_table = $wpdb->prefix."esp_currency"; |
@@ -743,14 +743,14 @@ discard block |
||
743 | 743 | "CUR_dec_plc" => '%d', |
744 | 744 | "CUR_active" => '%d', |
745 | 745 | ); |
746 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $currency_table . "'") == $currency_table ) { |
|
747 | - foreach( $newer_currencies as $currency ) { |
|
748 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ; |
|
746 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$currency_table."'") == $currency_table) { |
|
747 | + foreach ($newer_currencies as $currency) { |
|
748 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
749 | 749 | $countries = $wpdb->get_var($SQL); |
750 | - if ( ! $countries ) { |
|
750 | + if ( ! $countries) { |
|
751 | 751 | |
752 | - $wpdb->insert( $currency_table, |
|
753 | - array_combine( array_keys( $currency_format), $currency ), |
|
752 | + $wpdb->insert($currency_table, |
|
753 | + array_combine(array_keys($currency_format), $currency), |
|
754 | 754 | $currency_format |
755 | 755 | ); |
756 | 756 | } |
@@ -762,9 +762,9 @@ discard block |
||
762 | 762 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
763 | 763 | * we should be able to stop doing this in 4.9 |
764 | 764 | */ |
765 | - public function fix_non_default_taxes(){ |
|
765 | + public function fix_non_default_taxes() { |
|
766 | 766 | global $wpdb; |
767 | - $query = $wpdb->prepare( "UPDATE |
|
767 | + $query = $wpdb->prepare("UPDATE |
|
768 | 768 | {$wpdb->prefix}esp_price p INNER JOIN |
769 | 769 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
770 | 770 | SET |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | WHERE |
773 | 773 | p.PRC_is_default = 0 AND |
774 | 774 | pt.PBT_ID = %d |
775 | - ", EEM_Price_Type::base_type_tax ); |
|
776 | - $wpdb->query( $query ); |
|
775 | + ", EEM_Price_Type::base_type_tax); |
|
776 | + $wpdb->query($query); |
|
777 | 777 | } |
778 | 778 | } |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | //(all other times it gets resurrected from a wordpress option) |
9 | 9 | $stages = glob(EE_CORE.'data_migration_scripts/4_9_0_stages/*'); |
10 | 10 | $class_to_filepath = array(); |
11 | -foreach($stages as $filepath){ |
|
11 | +foreach ($stages as $filepath) { |
|
12 | 12 | $matches = array(); |
13 | - preg_match('~4_9_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
13 | + preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
14 | 14 | $class_to_filepath[$matches[1]] = $filepath; |
15 | 15 | } |
16 | 16 | //give addons a chance to autoload their stages too |
17 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages',$class_to_filepath); |
|
17 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath); |
|
18 | 18 | EEH_Autoloader::register_autoloader($class_to_filepath); |
19 | 19 | |
20 | 20 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @since 4.6.0 |
31 | 31 | * |
32 | 32 | */ |
33 | -class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base{ |
|
33 | +class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base { |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * return EE_DMS_Core_4_9_0 |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function can_migrate_from_version($version_array) { |
56 | 56 | $version_string = $version_array['Core']; |
57 | - if( $version_string <= '4.9.0' && $version_string >= '4.8.0' ){ |
|
57 | + if ($version_string <= '4.9.0' && $version_string >= '4.8.0') { |
|
58 | 58 | // echo "$version_string can be migrated from"; |
59 | 59 | return true; |
60 | - } elseif( ! $version_string ){ |
|
60 | + } elseif ( ! $version_string) { |
|
61 | 61 | // echo "no version string provided: $version_string"; |
62 | 62 | //no version string provided... this must be pre 4.3 |
63 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
64 | - }else{ |
|
63 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
64 | + } else { |
|
65 | 65 | // echo "$version_string doesnt apply"; |
66 | 66 | return false; |
67 | 67 | } |
@@ -82,18 +82,18 @@ discard block |
||
82 | 82 | * @return bool |
83 | 83 | */ |
84 | 84 | public function schema_changes_before_migration() { |
85 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
86 | - $now_in_mysql = current_time( 'mysql', true ); |
|
85 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
86 | + $now_in_mysql = current_time('mysql', true); |
|
87 | 87 | |
88 | - $table_name='esp_answer'; |
|
89 | - $sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
88 | + $table_name = 'esp_answer'; |
|
89 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
90 | 90 | REG_ID int(10) unsigned NOT NULL, |
91 | 91 | QST_ID int(10) unsigned NOT NULL, |
92 | 92 | ANS_value text NOT NULL, |
93 | 93 | PRIMARY KEY (ANS_ID), |
94 | 94 | KEY REG_ID (REG_ID), |
95 | 95 | KEY QST_ID (QST_ID)"; |
96 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
96 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
97 | 97 | |
98 | 98 | $table_name = 'esp_attendee_meta'; |
99 | 99 | $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | KEY ATT_fname (ATT_fname)"; |
116 | 116 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
117 | 117 | |
118 | - $table_name='esp_checkin'; |
|
118 | + $table_name = 'esp_checkin'; |
|
119 | 119 | $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
120 | 120 | REG_ID int(10) unsigned NOT NULL, |
121 | 121 | DTT_ID int(10) unsigned NOT NULL, |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | CNT_is_EU tinyint(1) DEFAULT '0', |
144 | 144 | CNT_active tinyint(1) DEFAULT '0', |
145 | 145 | PRIMARY KEY (CNT_ISO)"; |
146 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
146 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
147 | 147 | |
148 | 148 | $table_name = 'esp_currency'; |
149 | 149 | $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
154 | 154 | CUR_active tinyint(1) DEFAULT '0', |
155 | 155 | PRIMARY KEY (CUR_code)"; |
156 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
156 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
157 | 157 | |
158 | 158 | |
159 | 159 | $table_name = 'esp_currency_payment_method'; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | KEY DTT_EVT_start (DTT_EVT_start), |
182 | 182 | KEY EVT_ID (EVT_ID), |
183 | 183 | KEY DTT_is_primary (DTT_is_primary)"; |
184 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
184 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
185 | 185 | |
186 | 186 | $table_name = "esp_datetime_ticket"; |
187 | 187 | $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | PRIMARY KEY (EMT_ID), |
200 | 200 | KEY EVT_ID (EVT_ID), |
201 | 201 | KEY GRP_ID (GRP_ID)"; |
202 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
203 | 203 | |
204 | 204 | $table_name = 'esp_event_meta'; |
205 | 205 | $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | EVT_donations tinyint(1) NULL, |
218 | 218 | PRIMARY KEY (EVTM_ID), |
219 | 219 | KEY EVT_ID (EVT_ID)"; |
220 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
220 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
221 | 221 | |
222 | - $table_name='esp_event_question_group'; |
|
222 | + $table_name = 'esp_event_question_group'; |
|
223 | 223 | $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
224 | 224 | EVT_ID bigint(20) unsigned NOT NULL, |
225 | 225 | QSG_ID int(10) unsigned NOT NULL, |
@@ -227,17 +227,17 @@ discard block |
||
227 | 227 | PRIMARY KEY (EQG_ID), |
228 | 228 | KEY EVT_ID (EVT_ID), |
229 | 229 | KEY QSG_ID (QSG_ID)"; |
230 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
230 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
231 | 231 | |
232 | - $table_name='esp_event_venue'; |
|
232 | + $table_name = 'esp_event_venue'; |
|
233 | 233 | $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
234 | 234 | EVT_ID bigint(20) unsigned NOT NULL, |
235 | 235 | VNU_ID bigint(20) unsigned NOT NULL, |
236 | 236 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
237 | 237 | PRIMARY KEY (EVV_ID)"; |
238 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
238 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
239 | 239 | |
240 | - $table_name='esp_extra_meta'; |
|
240 | + $table_name = 'esp_extra_meta'; |
|
241 | 241 | $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
242 | 242 | OBJ_ID int(11) DEFAULT NULL, |
243 | 243 | EXM_type varchar(45) DEFAULT NULL, |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | EXM_value text, |
246 | 246 | PRIMARY KEY (EXM_ID), |
247 | 247 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
248 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
248 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
249 | 249 | |
250 | 250 | $table_name = 'esp_extra_join'; |
251 | 251 | $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
259 | 259 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
260 | 260 | |
261 | - $table_name='esp_line_item'; |
|
261 | + $table_name = 'esp_line_item'; |
|
262 | 262 | $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
263 | 263 | LIN_code varchar(245) NOT NULL DEFAULT '', |
264 | 264 | TXN_ID int(11) DEFAULT NULL, |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | PRIMARY KEY (LIN_ID), |
279 | 279 | KEY LIN_code (LIN_code(191)), |
280 | 280 | KEY TXN_ID (TXN_ID)"; |
281 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB' ); |
|
281 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
282 | 282 | |
283 | 283 | $table_name = 'esp_log'; |
284 | 284 | $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | KEY STS_ID (STS_ID), |
328 | 328 | KEY MSG_created (MSG_created), |
329 | 329 | KEY MSG_modified (MSG_modified)"; |
330 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
330 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
331 | 331 | |
332 | 332 | $table_name = 'esp_message_template'; |
333 | 333 | $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
353 | 353 | PRIMARY KEY (GRP_ID), |
354 | 354 | KEY MTP_user_id (MTP_user_id)"; |
355 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
355 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
356 | 356 | |
357 | 357 | $table_name = 'esp_payment'; |
358 | 358 | $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | PRIMARY KEY (TTM_ID)"; |
411 | 411 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
412 | 412 | |
413 | - $table_name='esp_question'; |
|
413 | + $table_name = 'esp_question'; |
|
414 | 414 | $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
415 | 415 | QST_display_text text NOT NULL, |
416 | 416 | QST_admin_label varchar(255) NOT NULL, |
@@ -425,9 +425,9 @@ discard block |
||
425 | 425 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
426 | 426 | PRIMARY KEY (QST_ID), |
427 | 427 | KEY QST_order (QST_order)'; |
428 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
428 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
429 | 429 | |
430 | - $table_name='esp_question_group_question'; |
|
430 | + $table_name = 'esp_question_group_question'; |
|
431 | 431 | $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
432 | 432 | QSG_ID int(10) unsigned NOT NULL, |
433 | 433 | QST_ID int(10) unsigned NOT NULL, |
@@ -435,9 +435,9 @@ discard block |
||
435 | 435 | PRIMARY KEY (QGQ_ID), |
436 | 436 | KEY QST_ID (QST_ID), |
437 | 437 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
438 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
438 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
439 | 439 | |
440 | - $table_name='esp_question_option'; |
|
440 | + $table_name = 'esp_question_option'; |
|
441 | 441 | $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
442 | 442 | QSO_value varchar(255) NOT NULL, |
443 | 443 | QSO_desc text NOT NULL, |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | PRIMARY KEY (QSO_ID), |
449 | 449 | KEY QST_ID (QST_ID), |
450 | 450 | KEY QSO_order (QSO_order)"; |
451 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
451 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
452 | 452 | |
453 | 453 | $table_name = 'esp_registration'; |
454 | 454 | $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | PRC_parent int(10) unsigned DEFAULT 0, |
562 | 562 | PRIMARY KEY (PRC_ID), |
563 | 563 | KEY PRT_ID (PRT_ID)"; |
564 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
564 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
565 | 565 | |
566 | 566 | $table_name = "esp_price_type"; |
567 | 567 | $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
599 | 599 | PRIMARY KEY (TKT_ID), |
600 | 600 | KEY TKT_start_date (TKT_start_date)"; |
601 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
601 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
602 | 602 | |
603 | 603 | $table_name = 'esp_question_group'; |
604 | 604 | $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | PRIMARY KEY (QSG_ID), |
615 | 615 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
616 | 616 | KEY QSG_order (QSG_order)'; |
617 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
617 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
618 | 618 | |
619 | 619 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
620 | 620 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -648,5 +648,5 @@ discard block |
||
648 | 648 | return true; |
649 | 649 | } |
650 | 650 | |
651 | - public function migration_page_hooks(){} |
|
651 | + public function migration_page_hooks() {} |
|
652 | 652 | } |
653 | 653 | \ No newline at end of file |
@@ -161,7 +161,7 @@ |
||
161 | 161 | * @param EE_Transaction $transaction |
162 | 162 | * @param string $payment_status One of EEM_Payment's statuses, like 'PAP' (Approved). |
163 | 163 | * By default, searches for approved payments |
164 | - * @return float|false float on success, false on fail |
|
164 | + * @return double float on success, false on fail |
|
165 | 165 | * @throws \EE_Error |
166 | 166 | */ |
167 | 167 | public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class EE_Transaction_Payments |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function instance() { |
46 | 46 | // check if class object is instantiated |
47 | - if ( ! self::$_instance instanceof EE_Transaction_Payments ) { |
|
47 | + if ( ! self::$_instance instanceof EE_Transaction_Payments) { |
|
48 | 48 | self::$_instance = new self(); |
49 | 49 | } |
50 | 50 | return self::$_instance; |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @param string $old_txn_status |
74 | 74 | */ |
75 | - public function set_old_txn_status( $old_txn_status ) { |
|
75 | + public function set_old_txn_status($old_txn_status) { |
|
76 | 76 | // only set the first time |
77 | - if ( $this->_old_txn_status === null ) { |
|
77 | + if ($this->_old_txn_status === null) { |
|
78 | 78 | $this->_old_txn_status = $old_txn_status; |
79 | 79 | } |
80 | 80 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * @param string $new_txn_status |
95 | 95 | */ |
96 | - public function set_new_txn_status( $new_txn_status ) { |
|
96 | + public function set_new_txn_status($new_txn_status) { |
|
97 | 97 | $this->_new_txn_status = $new_txn_status; |
98 | 98 | } |
99 | 99 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return bool |
106 | 106 | */ |
107 | 107 | public function txn_status_updated() { |
108 | - return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
108 | + return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -125,22 +125,22 @@ discard block |
||
125 | 125 | * @return boolean whether the TXN was saved |
126 | 126 | * @throws \EE_Error |
127 | 127 | */ |
128 | - public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){ |
|
128 | + public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) { |
|
129 | 129 | // verify transaction |
130 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
131 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
130 | + if ( ! $transaction instanceof EE_Transaction) { |
|
131 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | // set incoming TXN_Status |
135 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
135 | + $this->set_old_txn_status($transaction->status_ID()); |
|
136 | 136 | // calculate total paid |
137 | - $total_paid = $this->recalculate_total_payments_for_transaction( $transaction ); |
|
137 | + $total_paid = $this->recalculate_total_payments_for_transaction($transaction); |
|
138 | 138 | // if total paid has changed |
139 | - if ( $total_paid !== false && (float)$total_paid !== $transaction->paid() ) { |
|
140 | - $transaction->set_paid( $total_paid ); |
|
139 | + if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) { |
|
140 | + $transaction->set_paid($total_paid); |
|
141 | 141 | // maybe update status, and make sure to save transaction if not done already |
142 | - if ( ! $this->update_transaction_status_based_on_total_paid( $transaction, $update_txn )) { |
|
143 | - if ( $update_txn ) { |
|
142 | + if ( ! $this->update_transaction_status_based_on_total_paid($transaction, $update_txn)) { |
|
143 | + if ($update_txn) { |
|
144 | 144 | return $transaction->save() ? true : false; |
145 | 145 | } |
146 | 146 | } else { |
@@ -164,18 +164,18 @@ discard block |
||
164 | 164 | * @return float|false float on success, false on fail |
165 | 165 | * @throws \EE_Error |
166 | 166 | */ |
167 | - public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
|
167 | + public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved) { |
|
168 | 168 | // verify transaction |
169 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
170 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
169 | + if ( ! $transaction instanceof EE_Transaction) { |
|
170 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | // ensure Payment model is loaded |
174 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
174 | + EE_Registry::instance()->load_model('Payment'); |
|
175 | 175 | // calls EEM_Base::sum() |
176 | 176 | return EEM_Payment::instance()->sum( |
177 | 177 | // query params |
178 | - array( array( 'TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status )), |
|
178 | + array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)), |
|
179 | 179 | // field to sum |
180 | 180 | 'PAY_amount' |
181 | 181 | ); |
@@ -191,36 +191,36 @@ discard block |
||
191 | 191 | * @return boolean whether the TXN was saved |
192 | 192 | * @throws \EE_Error |
193 | 193 | */ |
194 | - public function update_transaction_status_based_on_total_paid( EE_Transaction $transaction, $update_txn = TRUE ) { |
|
194 | + public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = TRUE) { |
|
195 | 195 | // verify transaction |
196 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
196 | + if ( ! $transaction instanceof EE_Transaction) { |
|
197 | 197 | EE_Error::add_error( |
198 | - __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), |
|
198 | + __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
|
199 | 199 | __FILE__, __FUNCTION__, __LINE__ |
200 | 200 | ); |
201 | 201 | return FALSE; |
202 | 202 | } |
203 | 203 | // set incoming TXN_Status |
204 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
204 | + $this->set_old_txn_status($transaction->status_ID()); |
|
205 | 205 | // set transaction status based on comparison of TXN_paid vs TXN_total |
206 | - if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total(), '>' ) ){ |
|
206 | + if (EEH_Money::compare_floats($transaction->paid(), $transaction->total(), '>')) { |
|
207 | 207 | $new_txn_status = EEM_Transaction::overpaid_status_code; |
208 | - } else if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total() ) ) { |
|
208 | + } else if (EEH_Money::compare_floats($transaction->paid(), $transaction->total())) { |
|
209 | 209 | $new_txn_status = EEM_Transaction::complete_status_code; |
210 | - } else if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total(), '<' ) ) { |
|
210 | + } else if (EEH_Money::compare_floats($transaction->paid(), $transaction->total(), '<')) { |
|
211 | 211 | $new_txn_status = EEM_Transaction::incomplete_status_code; |
212 | 212 | } else { |
213 | 213 | EE_Error::add_error( |
214 | - __( 'The total paid calculation for this transaction is inaccurate.', 'event_espresso' ), |
|
214 | + __('The total paid calculation for this transaction is inaccurate.', 'event_espresso'), |
|
215 | 215 | __FILE__, __FUNCTION__, __LINE__ |
216 | 216 | ); |
217 | 217 | return FALSE; |
218 | 218 | } |
219 | - if ( $new_txn_status !== $transaction->status_ID() ) { |
|
219 | + if ($new_txn_status !== $transaction->status_ID()) { |
|
220 | 220 | // set incoming TXN_Status |
221 | - $this->set_new_txn_status( $new_txn_status ); |
|
222 | - $transaction->set_status( $new_txn_status ); |
|
223 | - if ( $update_txn ) { |
|
221 | + $this->set_new_txn_status($new_txn_status); |
|
222 | + $transaction->set_status($new_txn_status); |
|
223 | + if ($update_txn) { |
|
224 | 224 | return $transaction->save() ? TRUE : FALSE; |
225 | 225 | } |
226 | 226 | } |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | * @return boolean |
239 | 239 | * @throws \EE_Error |
240 | 240 | */ |
241 | - public function delete_payment_and_update_transaction( EE_Payment $payment ) { |
|
241 | + public function delete_payment_and_update_transaction(EE_Payment $payment) { |
|
242 | 242 | // verify payment |
243 | - if ( ! $payment instanceof EE_Payment ) { |
|
244 | - EE_Error::add_error( __( 'A valid Payment object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
243 | + if ( ! $payment instanceof EE_Payment) { |
|
244 | + EE_Error::add_error(__('A valid Payment object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
245 | 245 | return false; |
246 | 246 | } |
247 | - if ( ! $this->delete_registration_payments_and_update_registrations( $payment ) ) { |
|
247 | + if ( ! $this->delete_registration_payments_and_update_registrations($payment)) { |
|
248 | 248 | return false; |
249 | 249 | } |
250 | - if ( ! $payment->delete() ) { |
|
251 | - EE_Error::add_error( __( 'The payment could not be deleted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
250 | + if ( ! $payment->delete()) { |
|
251 | + EE_Error::add_error(__('The payment could not be deleted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
252 | 252 | return false; |
253 | 253 | } |
254 | 254 | |
@@ -259,14 +259,14 @@ discard block |
||
259 | 259 | || $TXN_status === EEM_Transaction::failed_status_code |
260 | 260 | || $payment->amount() === 0 |
261 | 261 | ) { |
262 | - EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) ); |
|
262 | + EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso')); |
|
263 | 263 | return true; |
264 | 264 | } |
265 | 265 | |
266 | 266 | |
267 | 267 | //if this fails, that just means that the transaction didn't get its status changed and/or updated. |
268 | 268 | //however the payment was still deleted. |
269 | - if ( ! $this->calculate_total_payments_and_update_status( $transaction ) ) { |
|
269 | + if ( ! $this->calculate_total_payments_and_update_status($transaction)) { |
|
270 | 270 | |
271 | 271 | EE_Error::add_attention( |
272 | 272 | __( |
@@ -300,28 +300,28 @@ discard block |
||
300 | 300 | * @return bool |
301 | 301 | * @throws \EE_Error |
302 | 302 | */ |
303 | - public function delete_registration_payments_and_update_registrations( EE_Payment $payment, $reg_payment_query_params = array() ) { |
|
303 | + public function delete_registration_payments_and_update_registrations(EE_Payment $payment, $reg_payment_query_params = array()) { |
|
304 | 304 | $save_payment = false; |
305 | - $reg_payment_query_params = ! empty( $reg_payment_query_params ) ? $reg_payment_query_params : array( array( 'PAY_ID' => $payment->ID() ) ); |
|
306 | - $registration_payments = EEM_Registration_Payment::instance()->get_all( $reg_payment_query_params ); |
|
307 | - if ( ! empty( $registration_payments )) { |
|
308 | - foreach ( $registration_payments as $registration_payment ) { |
|
309 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
305 | + $reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params : array(array('PAY_ID' => $payment->ID())); |
|
306 | + $registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params); |
|
307 | + if ( ! empty($registration_payments)) { |
|
308 | + foreach ($registration_payments as $registration_payment) { |
|
309 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
310 | 310 | $amount_paid = $registration_payment->amount(); |
311 | 311 | $registration = $registration_payment->registration(); |
312 | - if ( $registration instanceof EE_Registration ) { |
|
313 | - $registration->set_paid( $registration->paid() - $amount_paid ); |
|
314 | - if ( $registration->save() ) { |
|
315 | - if ( $registration_payment->delete() ) { |
|
316 | - $registration->_remove_relation_to( $payment, 'Payment' ); |
|
317 | - $payment->_remove_relation_to( $registration, 'Registration' ); |
|
312 | + if ($registration instanceof EE_Registration) { |
|
313 | + $registration->set_paid($registration->paid() - $amount_paid); |
|
314 | + if ($registration->save()) { |
|
315 | + if ($registration_payment->delete()) { |
|
316 | + $registration->_remove_relation_to($payment, 'Payment'); |
|
317 | + $payment->_remove_relation_to($registration, 'Registration'); |
|
318 | 318 | } |
319 | 319 | $save_payment = true; |
320 | 320 | } |
321 | 321 | } else { |
322 | 322 | EE_Error::add_error( |
323 | 323 | sprintf( |
324 | - __( 'An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso' ), |
|
324 | + __('An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso'), |
|
325 | 325 | $registration_payment->ID() |
326 | 326 | ), |
327 | 327 | __FILE__, __FUNCTION__, __LINE__ |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | } else { |
332 | 332 | EE_Error::add_error( |
333 | 333 | sprintf( |
334 | - __( 'An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso' ), |
|
334 | + __('An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso'), |
|
335 | 335 | $payment->ID() |
336 | 336 | ), |
337 | 337 | __FILE__, __FUNCTION__, __LINE__ |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | } |
341 | 341 | } |
342 | 342 | } |
343 | - if ( $save_payment ) { |
|
343 | + if ($save_payment) { |
|
344 | 344 | $payment->save(); |
345 | 345 | } |
346 | 346 | return true; |