@@ -1,5 +1,5 @@ |
||
1 | 1 | <p><strong><?php esc_html_e('Message Types', 'event_espresso'); ?></strong></p> |
2 | -<p><?php printf( esc_html__('Messages are email notifications that are sent out by Event Espresso. Message Types are the %1$skinds%2$s of messages that get delivered. They can be thought of as the "type" of package that is being delivered by the messenger. For example, Event Espresso comes with two Message Types attached to the Email Messenger:', 'event_espresso'), '<em>', '</em>'); ?></p> |
|
2 | +<p><?php printf(esc_html__('Messages are email notifications that are sent out by Event Espresso. Message Types are the %1$skinds%2$s of messages that get delivered. They can be thought of as the "type" of package that is being delivered by the messenger. For example, Event Espresso comes with two Message Types attached to the Email Messenger:', 'event_espresso'), '<em>', '</em>'); ?></p> |
|
3 | 3 | <p> |
4 | 4 | <ul> |
5 | 5 | <li> |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <p><strong><?php esc_html_e('Message Templates', 'event_espresso'); ?></strong></p> |
2 | -<p><?php printf( esc_html__('Message Templates are the %1$sformat%2$s of the messages going out. Think of them as a “form letter”. Templates tell the Messages system how to style your messages and the content (information) they will have when they are delivered.', 'event_espresso'), '<em>', '</em>'); ?></p> |
|
2 | +<p><?php printf(esc_html__('Message Templates are the %1$sformat%2$s of the messages going out. Think of them as a “form letter”. Templates tell the Messages system how to style your messages and the content (information) they will have when they are delivered.', 'event_espresso'), '<em>', '</em>'); ?></p> |
|
3 | 3 | <p><?php esc_html_e('There is a template created for each Messenger / Message Type and context combination. For example, messages that are sent for Payment Confirmation have a template for Event Administrator and a different one for Primary Registrant. Whereas, messages that are sent for the Registration confirmation have 3 templates: one for Event Administrator, one for the Primary Registrant, and another for each additional Registrant(s).', 'event_espresso'); ?></p> |
4 | -<p><?php esc_html_e('With the Event Espresso Messages system, every Messenger, Message Type, and context will have a global template created with some default content on creation. You have the ability to edit the global template that will be used for all events you create. Additionally, you have the ability to create custom templates for each event on the edit event page for the event (in a metabox labelled "Notifications").', 'event_espresso' ); ?></p> |
|
5 | 4 | \ No newline at end of file |
5 | +<p><?php esc_html_e('With the Event Espresso Messages system, every Messenger, Message Type, and context will have a global template created with some default content on creation. You have the ability to edit the global template that will be used for all events you create. Additionally, you have the ability to create custom templates for each event on the edit event page for the event (in a metabox labelled "Notifications").', 'event_espresso'); ?></p> |
|
6 | 6 | \ No newline at end of file |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <h2><?php esc_html_e('What are Message Templates', 'event_espresso'); ?></h2> |
2 | -<p><?php printf( esc_html__('Message Templates are the %1$sformat%2$s of the messages going out. Think of them like a “Form letter”. Templates are used to tell the system what you want your messages to look like and the content they will have when they are delivered.', 'event_espresso'), '<em>', '</em>' ); ?></p> |
|
2 | +<p><?php printf(esc_html__('Message Templates are the %1$sformat%2$s of the messages going out. Think of them like a “Form letter”. Templates are used to tell the system what you want your messages to look like and the content they will have when they are delivered.', 'event_espresso'), '<em>', '</em>'); ?></p> |
|
3 | 3 | <p><?php esc_html_e('There is a template created for each messenger/message type AND context combination. So example, Emails that are sent for the Payment confirmation have a template for Event Administrator and a different one for Primary Registrant. Whereas, emails that are sent for the Registration confirmation have 3 templates, one for Event Administrator, Primary Registrant, and Registrant.', 'event_espresso'); ?></p> |
4 | -<p><?php esc_html_e('With the Event Espresso Messages system, every Messenger, Message Type and Context will have a global template created with some default content on creation. You have the ability to edit this global template that will be used for all events you create. However, you also have the ability to create custom templates for each event on the edit event page for the event (in a metabox labelled "Notifications").', 'event_espresso' ); ?></p> |
|
5 | 4 | \ No newline at end of file |
5 | +<p><?php esc_html_e('With the Event Espresso Messages system, every Messenger, Message Type and Context will have a global template created with some default content on creation. You have the ability to edit this global template that will be used for all events you create. However, you also have the ability to create custom templates for each event on the edit event page for the event (in a metabox labelled "Notifications").', 'event_espresso'); ?></p> |
|
6 | 6 | \ No newline at end of file |
@@ -2,29 +2,29 @@ |
||
2 | 2 | <p><?php _e('Here are a few things that you should know about the Message Template Editor:', 'event_espresso'); ?></p> |
3 | 3 | <p><strong><?php esc_html_e('1. The Event Editor Title', 'event_espresso'); ?></strong></p> |
4 | 4 | <p><?php echo $img1; ?></p> |
5 | -<p><?php printf( esc_html__( 'The Event Editor title is very helpful in indicating which template you are currently editing. In the example above, we can see that we are editing the template that for the %1$sEmail%2$s messenger, the %1$sPayment%2$s message type, and the %1$sEvent Admin%2$s context (which for this message type means "recipient").', 'event_espresso'), '<strong>','</strong>' ); ?></p> |
|
5 | +<p><?php printf(esc_html__('The Event Editor title is very helpful in indicating which template you are currently editing. In the example above, we can see that we are editing the template that for the %1$sEmail%2$s messenger, the %1$sPayment%2$s message type, and the %1$sEvent Admin%2$s context (which for this message type means "recipient").', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
6 | 6 | <p><strong><?php esc_html_e('2. "Context Switcher" and Preview Button', 'event_espresso'); ?></strong></p> |
7 | 7 | <p><?php echo $img2; ?></p> |
8 | 8 | <p><?php esc_html_e('The context switcher allows you to quickly switch between templates. The current context you are working on is displayed in the dropdown. You can switch to any other template for contexts available to the messenger and message type template group you are working on.', 'event_espresso'); ?></p> |
9 | 9 | <p><?php esc_html_e('Remember that contexts can represent different things. In this example they represent "recipients" and so they are labelled as such. In this example (for email payment confirmations), you may want Event Administrators to receive different information than Primary Registrants (the other context available to edit).', 'event_espresso'); ?></p> |
10 | -<p><?php printf( esc_html__('The %sPreview%s button is simply a link to a special view of the current template displayed to give you an idea of how the actual message will look when delivered. More information on what the preview displays is available in the content of the help tab on the preview page.', 'event_espresso'), '<strong>', '</strong>' ); ?> |
|
10 | +<p><?php printf(esc_html__('The %sPreview%s button is simply a link to a special view of the current template displayed to give you an idea of how the actual message will look when delivered. More information on what the preview displays is available in the content of the help tab on the preview page.', 'event_espresso'), '<strong>', '</strong>'); ?> |
|
11 | 11 | </p> |
12 | 12 | <p><strong><?php esc_html_e('3. Template Form Fields', 'event_espresso'); ?></strong></p> |
13 | 13 | <p><?php echo $img3; ?><?php esc_html_e('The middle area of the page is dedicated to all the fields related to the message template. These fields are dynamic in the sense that different messengers may require different fields (and sometimes different message types will add or subtract fields as well.', 'event_espresso'); ?></p> |
14 | -<p><?php printf( esc_html__('When editing a "Email Payment Template", you will notice that there is a field labelled "Event List" along with "Main Content". The Event List field is a special field that holds the template for whenever the %1$s[EVENT_LIST]%2$s shortcode is used in the "Main Content" field. This is so you can more finely control how each "event" in the event list displays when shown in the Main content. The "Email Registration Template", has an additional field called "Registration List". It functions much the same except that the contents of the "Registration List" field are used to indicate how each registrant is listed in the Main Content when the %1$s[ATTENDEE_LIST]%2$s shortcode is parsed.', 'event_espresso'), '<strong>', '</strong>' ); ?></p> |
|
14 | +<p><?php printf(esc_html__('When editing a "Email Payment Template", you will notice that there is a field labelled "Event List" along with "Main Content". The Event List field is a special field that holds the template for whenever the %1$s[EVENT_LIST]%2$s shortcode is used in the "Main Content" field. This is so you can more finely control how each "event" in the event list displays when shown in the Main content. The "Email Registration Template", has an additional field called "Registration List". It functions much the same except that the contents of the "Registration List" field are used to indicate how each registrant is listed in the Main Content when the %1$s[ATTENDEE_LIST]%2$s shortcode is parsed.', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
15 | 15 | <div style="clear:both"></div> |
16 | 16 | <p><strong><?php esc_html_e('4. Valid Shortcodes Metabox', 'event_espresso'); ?></strong></p> |
17 | 17 | <p> |
18 | 18 | <?php echo $img4; ?><?php esc_html_e('The "Valid Shortcodes" metabox contains a list of all the shortcodes that can be used for the displayed template. This list is dynamic and will vary between templates.', 'event_espresso'); ?> |
19 | 19 | </p> |
20 | 20 | <p><?php _e('This box is at a fixed height, but contents are scrollable. You can click the question mark to find out what the given shortcode will parse to when used in your template.', 'event_espresso'); ?></p> |
21 | -<p><?php printf( esc_html__('%sAn important note:%s The system has been designed so that when you save the template, checks will be performed on each field to make sure that only valid shortcodes (or values) are used within them. You will get a warning box with clear instructions if you\'ve tried to use a particular shortcode in a field that does not support it. Also, you\'ll want to try the Preview button if you\'ve made any changes to the template to see if the changes are as you expected!', 'event_espresso'), '<strong>', '</strong>' ); ?> |
|
21 | +<p><?php printf(esc_html__('%sAn important note:%s The system has been designed so that when you save the template, checks will be performed on each field to make sure that only valid shortcodes (or values) are used within them. You will get a warning box with clear instructions if you\'ve tried to use a particular shortcode in a field that does not support it. Also, you\'ll want to try the Preview button if you\'ve made any changes to the template to see if the changes are as you expected!', 'event_espresso'), '<strong>', '</strong>'); ?> |
|
22 | 22 | </p> |
23 | 23 | <div style="clear:both"></div> |
24 | 24 | <p><strong><?php esc_html_e('5. Override All Custom', 'event_espresso'); ?></strong></p> |
25 | 25 | <p> |
26 | 26 | <?php echo $img5; ?> |
27 | - <?php printf( esc_html__( 'When you are editing a template that is a global template (not a custom event template), you\'ll see an option in the Publish metabox in the right column labelled "Override all custom". When this option is selected, custom event templates for that %1$smessenger%2$s, %1$smessage type%2$s, and %1$scontext%2$s will be ignored and the global template will be used. Why would you want to do this? For this given example, you may want to be able to allow custom event templates to be able to modify the looks and content of what goes out to Primary Registrant but to never affect what the Event Administrator receives (as set by the global template).', 'event_espresso'), '<em>', '</em>' ); ?> |
|
27 | + <?php printf(esc_html__('When you are editing a template that is a global template (not a custom event template), you\'ll see an option in the Publish metabox in the right column labelled "Override all custom". When this option is selected, custom event templates for that %1$smessenger%2$s, %1$smessage type%2$s, and %1$scontext%2$s will be ignored and the global template will be used. Why would you want to do this? For this given example, you may want to be able to allow custom event templates to be able to modify the looks and content of what goes out to Primary Registrant but to never affect what the Event Administrator receives (as set by the global template).', 'event_espresso'), '<em>', '</em>'); ?> |
|
28 | 28 | </p> |
29 | 29 | <p> |
30 | 30 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong><br /> |
@@ -41,7 +41,7 @@ |
||
41 | 41 | </li> |
42 | 42 | <li> |
43 | 43 | <?php esc_html_e('Messenger', 'event_espresso'); ?><br /> |
44 | - <?php printf( esc_html__('This column displays a number of different elements for the listed template. First is the messenger that this template is delivered by. The messenger title is linked to the editor for the first %1$scontext%2$s listed (context is labelled "recipients" for payment message types)', 'event_espresso'), '<em>', '</em>'); ?><br /> |
|
44 | + <?php printf(esc_html__('This column displays a number of different elements for the listed template. First is the messenger that this template is delivered by. The messenger title is linked to the editor for the first %1$scontext%2$s listed (context is labelled "recipients" for payment message types)', 'event_espresso'), '<em>', '</em>'); ?><br /> |
|
45 | 45 | <?php esc_html_e('Below the Messenger title, is a list of different contexts. The context label varies for each message type but it is usually labelled "Recipients". You can click on each context title to go to the specific template for that context and edit it as desired.', 'event_espresso'); ?> |
46 | 46 | </li> |
47 | 47 | </ul> |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <h2><?php esc_html_e('What are Message Types?', 'event_espresso'); ?></h2> |
2 | -<p><?php printf( esc_html__('Message Types are the %1$skinds%2$s of messages that get delivered. Think of them as the "type" of package that is being delivered by the messenger. For example, Event Espresso comes with two Message Types attached to the Email messenger: Registration Confirmation (which is triggered by frontend event registrations), and Payment Confirmation (which is triggered by frontend payments).', 'event_espresso'), '<em>', '</em>'); ?></p> |
|
2 | +<p><?php printf(esc_html__('Message Types are the %1$skinds%2$s of messages that get delivered. Think of them as the "type" of package that is being delivered by the messenger. For example, Event Espresso comes with two Message Types attached to the Email messenger: Registration Confirmation (which is triggered by frontend event registrations), and Payment Confirmation (which is triggered by frontend payments).', 'event_espresso'), '<em>', '</em>'); ?></p> |
|
3 | 3 | <p><?php esc_html_e('Future iterations of Event Espresso 4.0 (premium versions), will include more and more different message types that can be attached to the various messengers that are available', 'event_espresso'); ?></p> |
4 | 4 | |
5 | 5 | <h3><?php esc_html_e('Contexts', 'event_espresso'); ?></h3> |
6 | -<p><?php printf( esc_html__('Each message type (or %1$skind%1$s of message remember!) has different contexts for messages created for that message type. Contexts are dynamic but generally speaking they tend to represent recipients. So for example, Registration Confirmation message type has three types of recipients for every time a registration confirmation is triggered: Event Administrator, Primary Registrant, and Registrant (which may be multiple messages if there are more than one attendee per event). Whereas the Payment Message Type only has two recipients (Event Administrator, Primary Registrant [the one making the payment]).', 'event_espresso' ), '<em>', '</em>'); ?></p> |
|
6 | +<p><?php printf(esc_html__('Each message type (or %1$skind%1$s of message remember!) has different contexts for messages created for that message type. Contexts are dynamic but generally speaking they tend to represent recipients. So for example, Registration Confirmation message type has three types of recipients for every time a registration confirmation is triggered: Event Administrator, Primary Registrant, and Registrant (which may be multiple messages if there are more than one attendee per event). Whereas the Payment Message Type only has two recipients (Event Administrator, Primary Registrant [the one making the payment]).', 'event_espresso'), '<em>', '</em>'); ?></p> |
|
7 | 7 | <p><?php esc_html_e('You will most likely never see the word "context" in any of the Messages system labelling because they are dynamic per message type. Usually, contexts will be labelled "Recipients" but there may be cases down the road where a message type might use contexts to represent something totally different', 'event_espresso'); ?></p> |
8 | 8 | \ No newline at end of file |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | * @return void |
31 | 31 | */ |
32 | 32 | public static function set_hooks() { |
33 | - if ( |
|
33 | + if ( |
|
34 | 34 | apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) && |
35 | 35 | \EE_Registry::instance()->CFG->registration->use_bot_trap |
36 | 36 | ) { |
37 | - \EED_Bot_Trap::set_trap(); |
|
37 | + \EED_Bot_Trap::set_trap(); |
|
38 | 38 | // redirect bots to bogus success page |
39 | 39 | \EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' ); |
40 | 40 | } |
@@ -49,18 +49,18 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_trap() { |
52 | - define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS); |
|
53 | - add_action( |
|
54 | - 'AHEE__ticket_selector_chart__template__after_ticket_selector', |
|
55 | - array('EED_Bot_Trap', 'generate_bot_trap'), |
|
56 | - 10, 2 |
|
57 | - ); |
|
58 | - add_action( |
|
59 | - 'EED_Ticket_Selector__process_ticket_selections__before', |
|
60 | - array('EED_Bot_Trap', 'process_bot_trap'), |
|
61 | - 1, 2 |
|
62 | - ); |
|
63 | - } |
|
52 | + define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS); |
|
53 | + add_action( |
|
54 | + 'AHEE__ticket_selector_chart__template__after_ticket_selector', |
|
55 | + array('EED_Bot_Trap', 'generate_bot_trap'), |
|
56 | + 10, 2 |
|
57 | + ); |
|
58 | + add_action( |
|
59 | + 'EED_Ticket_Selector__process_ticket_selections__before', |
|
60 | + array('EED_Bot_Trap', 'process_bot_trap'), |
|
61 | + 1, 2 |
|
62 | + ); |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | 66 | |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | * @return void |
72 | 72 | */ |
73 | 73 | public static function set_hooks_admin() { |
74 | - if ( |
|
75 | - defined('DOING_AJAX') |
|
76 | - && DOING_AJAX |
|
77 | - && apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) |
|
78 | - && \EE_Registry::instance()->CFG->registration->use_bot_trap |
|
79 | - ) { |
|
80 | - \EED_Bot_Trap::set_trap(); |
|
81 | - } |
|
82 | - add_action( |
|
74 | + if ( |
|
75 | + defined('DOING_AJAX') |
|
76 | + && DOING_AJAX |
|
77 | + && apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) |
|
78 | + && \EE_Registry::instance()->CFG->registration->use_bot_trap |
|
79 | + ) { |
|
80 | + \EED_Bot_Trap::set_trap(); |
|
81 | + } |
|
82 | + add_action( |
|
83 | 83 | 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
84 | 84 | array( 'EED_Bot_Trap', 'bot_trap_settings_form' ), |
85 | 85 | 5 |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | |
131 | 131 | |
132 | 132 | /** |
133 | - * process_bot_trap |
|
134 | - * |
|
135 | - * @param array|string $triggered_trap_callback Callback that will be executed for handling the |
|
136 | - * response if the bot trap is triggered. |
|
137 | - * It should receive one argument: a boolean indicating |
|
138 | - * whether the trap was triggered by suspicious timing or not. |
|
133 | + * process_bot_trap |
|
134 | + * |
|
135 | + * @param array|string $triggered_trap_callback Callback that will be executed for handling the |
|
136 | + * response if the bot trap is triggered. |
|
137 | + * It should receive one argument: a boolean indicating |
|
138 | + * whether the trap was triggered by suspicious timing or not. |
|
139 | 139 | */ |
140 | 140 | public static function process_bot_trap( $triggered_trap_callback = array() ) { |
141 | - // what's your email address Mr. Bot ? |
|
141 | + // what's your email address Mr. Bot ? |
|
142 | 142 | $empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] ) |
143 | - && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === '' |
|
144 | - ? true |
|
145 | - : false; |
|
143 | + && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === '' |
|
144 | + ? true |
|
145 | + : false; |
|
146 | 146 | // get encrypted timestamp for when the form was originally displayed |
147 | 147 | $bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) |
148 | - ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) |
|
149 | - : ''; |
|
148 | + ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) |
|
149 | + : ''; |
|
150 | 150 | // decrypt and convert to absolute integer |
151 | 151 | if ( EE_Registry::instance()->CFG->registration->use_encryption ) { |
152 | 152 | EE_Registry::instance()->load_core( 'EE_Encryption' ); |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | } |
157 | 157 | // ticket form submitted too impossibly fast ( after now ) or more than an hour later ??? |
158 | 158 | $suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS ) |
159 | - ? true |
|
160 | - : false; |
|
159 | + ? true |
|
160 | + : false; |
|
161 | 161 | // are we human ? |
162 | 162 | if ( $empty_trap && ! $suspicious_timing ) { |
163 | - do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered'); |
|
163 | + do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered'); |
|
164 | 164 | return; |
165 | 165 | } |
166 | 166 | // check the given callback is valid first before executing |
167 | 167 | if ( ! is_callable($triggered_trap_callback ) ) { |
168 | 168 | // invalid callback so lets just sub in our default. |
169 | - $triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' ); |
|
169 | + $triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' ); |
|
170 | 170 | } |
171 | 171 | call_user_func_array($triggered_trap_callback, array( $suspicious_timing ) ); |
172 | 172 | } |
@@ -192,21 +192,21 @@ discard block |
||
192 | 192 | ); |
193 | 193 | } |
194 | 194 | $redirect_url = apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url); |
195 | - // if AJAX, return the redirect URL |
|
196 | - if (defined('DOING_AJAX') && DOING_AJAX) { |
|
197 | - echo wp_json_encode( |
|
198 | - array_merge( |
|
199 | - \EE_Error::get_notices(false), |
|
200 | - array( |
|
201 | - 'redirect_url' => $redirect_url |
|
202 | - ) |
|
203 | - ) |
|
204 | - ); |
|
205 | - exit(); |
|
206 | - } |
|
207 | - wp_safe_redirect($redirect_url); |
|
208 | - exit(); |
|
209 | - } |
|
195 | + // if AJAX, return the redirect URL |
|
196 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
197 | + echo wp_json_encode( |
|
198 | + array_merge( |
|
199 | + \EE_Error::get_notices(false), |
|
200 | + array( |
|
201 | + 'redirect_url' => $redirect_url |
|
202 | + ) |
|
203 | + ) |
|
204 | + ); |
|
205 | + exit(); |
|
206 | + } |
|
207 | + wp_safe_redirect($redirect_url); |
|
208 | + exit(); |
|
209 | + } |
|
210 | 210 | |
211 | 211 | |
212 | 212 | |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | * @return void |
238 | 238 | */ |
239 | 239 | public static function bot_trap_settings_form() { |
240 | - EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js(); |
|
241 | - echo EED_Bot_Trap::_bot_trap_settings_form()->get_html(); |
|
242 | - } |
|
240 | + EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js(); |
|
241 | + echo EED_Bot_Trap::_bot_trap_settings_form()->get_html(); |
|
242 | + } |
|
243 | 243 | |
244 | 244 | |
245 | 245 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @return EED_Bot_Trap |
19 | 19 | */ |
20 | 20 | public static function instance() { |
21 | - return parent::get_instance( __CLASS__ ); |
|
21 | + return parent::get_instance(__CLASS__); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public static function set_hooks() { |
33 | 33 | if ( |
34 | - apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) && |
|
34 | + apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) && |
|
35 | 35 | \EE_Registry::instance()->CFG->registration->use_bot_trap |
36 | 36 | ) { |
37 | 37 | \EED_Bot_Trap::set_trap(); |
38 | 38 | // redirect bots to bogus success page |
39 | - \EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' ); |
|
39 | + \EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success'); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_trap() { |
52 | - define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS); |
|
52 | + define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__).DS); |
|
53 | 53 | add_action( |
54 | 54 | 'AHEE__ticket_selector_chart__template__after_ticket_selector', |
55 | 55 | array('EED_Bot_Trap', 'generate_bot_trap'), |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | } |
82 | 82 | add_action( |
83 | 83 | 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
84 | - array( 'EED_Bot_Trap', 'bot_trap_settings_form' ), |
|
84 | + array('EED_Bot_Trap', 'bot_trap_settings_form'), |
|
85 | 85 | 5 |
86 | 86 | ); |
87 | 87 | add_filter( |
88 | 88 | 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
89 | - array( 'EED_Bot_Trap', 'update_bot_trap_settings_form' ), |
|
89 | + array('EED_Bot_Trap', 'update_bot_trap_settings_form'), |
|
90 | 90 | 10, 1 |
91 | 91 | ); |
92 | 92 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param WP $WP |
101 | 101 | * @return void |
102 | 102 | */ |
103 | - public function run( $WP ) {} |
|
103 | + public function run($WP) {} |
|
104 | 104 | |
105 | 105 | |
106 | 106 | |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | * @return void |
112 | 112 | */ |
113 | 113 | public static function generate_bot_trap() { |
114 | - $do_not_enter = esc_html__( 'please do not enter anything in this input', 'event_espresso' ); |
|
114 | + $do_not_enter = esc_html__('please do not enter anything in this input', 'event_espresso'); |
|
115 | 115 | $time = microtime(true); |
116 | 116 | $html = '<div class="tkt-slctr-request-processor-dv" style="float:left; margin:0 0 0 -999em; height: 0;">'; |
117 | - $html .= '<label for="tkt-slctr-request-processor-email-' . $time . '">' . $do_not_enter . '</label>'; |
|
118 | - $html .= '<input type="email" id="tkt-slctr-request-processor-email-' . $time .'" name="tkt-slctr-request-processor-email" value=""/>'; |
|
117 | + $html .= '<label for="tkt-slctr-request-processor-email-'.$time.'">'.$do_not_enter.'</label>'; |
|
118 | + $html .= '<input type="email" id="tkt-slctr-request-processor-email-'.$time.'" name="tkt-slctr-request-processor-email" value=""/>'; |
|
119 | 119 | $html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="'; |
120 | - if ( EE_Registry::instance()->CFG->registration->use_encryption ) { |
|
121 | - EE_Registry::instance()->load_core( 'EE_Encryption' ); |
|
122 | - $html .= EE_Encryption::instance()->encrypt( $time ); |
|
120 | + if (EE_Registry::instance()->CFG->registration->use_encryption) { |
|
121 | + EE_Registry::instance()->load_core('EE_Encryption'); |
|
122 | + $html .= EE_Encryption::instance()->encrypt($time); |
|
123 | 123 | } else { |
124 | 124 | $html .= $time; |
125 | 125 | } |
@@ -137,38 +137,38 @@ discard block |
||
137 | 137 | * It should receive one argument: a boolean indicating |
138 | 138 | * whether the trap was triggered by suspicious timing or not. |
139 | 139 | */ |
140 | - public static function process_bot_trap( $triggered_trap_callback = array() ) { |
|
140 | + public static function process_bot_trap($triggered_trap_callback = array()) { |
|
141 | 141 | // what's your email address Mr. Bot ? |
142 | - $empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] ) |
|
143 | - && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === '' |
|
142 | + $empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email']) |
|
143 | + && $_REQUEST['tkt-slctr-request-processor-email'] === '' |
|
144 | 144 | ? true |
145 | 145 | : false; |
146 | 146 | // get encrypted timestamp for when the form was originally displayed |
147 | - $bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) |
|
148 | - ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) |
|
147 | + $bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token']) |
|
148 | + ? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token']) |
|
149 | 149 | : ''; |
150 | 150 | // decrypt and convert to absolute integer |
151 | - if ( EE_Registry::instance()->CFG->registration->use_encryption ) { |
|
152 | - EE_Registry::instance()->load_core( 'EE_Encryption' ); |
|
153 | - $bot_trap_timestamp = absint( EE_Encryption::instance()->decrypt( $bot_trap_timestamp ) ); |
|
151 | + if (EE_Registry::instance()->CFG->registration->use_encryption) { |
|
152 | + EE_Registry::instance()->load_core('EE_Encryption'); |
|
153 | + $bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp)); |
|
154 | 154 | } else { |
155 | - $bot_trap_timestamp = absint( $bot_trap_timestamp ); |
|
155 | + $bot_trap_timestamp = absint($bot_trap_timestamp); |
|
156 | 156 | } |
157 | 157 | // ticket form submitted too impossibly fast ( after now ) or more than an hour later ??? |
158 | - $suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS ) |
|
158 | + $suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS) |
|
159 | 159 | ? true |
160 | 160 | : false; |
161 | 161 | // are we human ? |
162 | - if ( $empty_trap && ! $suspicious_timing ) { |
|
162 | + if ($empty_trap && ! $suspicious_timing) { |
|
163 | 163 | do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered'); |
164 | 164 | return; |
165 | 165 | } |
166 | 166 | // check the given callback is valid first before executing |
167 | - if ( ! is_callable($triggered_trap_callback ) ) { |
|
167 | + if ( ! is_callable($triggered_trap_callback)) { |
|
168 | 168 | // invalid callback so lets just sub in our default. |
169 | - $triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' ); |
|
169 | + $triggered_trap_callback = array('EED_Bot_Trap', 'triggered_trap_response'); |
|
170 | 170 | } |
171 | - call_user_func_array($triggered_trap_callback, array( $suspicious_timing ) ); |
|
171 | + call_user_func_array($triggered_trap_callback, array($suspicious_timing)); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -179,15 +179,15 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @param bool $suspicious_timing If true, then the bot trap was triggered due to the suspicious timing test. |
181 | 181 | */ |
182 | - public static function triggered_trap_response( $suspicious_timing ) { |
|
182 | + public static function triggered_trap_response($suspicious_timing) { |
|
183 | 183 | // UH OH... |
184 | 184 | $redirect_url = add_query_arg( |
185 | - array( 'ee' => 'ticket_selection_received' ), |
|
185 | + array('ee' => 'ticket_selection_received'), |
|
186 | 186 | EE_Registry::instance()->CFG->core->reg_page_url() |
187 | 187 | ); |
188 | - if ( $suspicious_timing ) { |
|
188 | + if ($suspicious_timing) { |
|
189 | 189 | $redirect_url = add_query_arg( |
190 | - array( 'ee-notice' => urlencode( esc_html__( 'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso' ) ) ), |
|
190 | + array('ee-notice' => urlencode(esc_html__('We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso'))), |
|
191 | 191 | $redirect_url |
192 | 192 | ); |
193 | 193 | } |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | * @return void |
219 | 219 | */ |
220 | 220 | public static function display_bot_trap_success() { |
221 | - add_filter( 'FHEE__EED_Single_Page_Checkout__run', '__return_false' ); |
|
222 | - $bot_notice = esc_html__( 'Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso' ); |
|
223 | - $bot_notice = isset( $_REQUEST[ 'ee-notice' ] ) && $_REQUEST[ 'ee-notice' ] !== '' ? sanitize_text_field( stripslashes( $_REQUEST[ 'ee-notice' ] ) ) : $bot_notice; |
|
224 | - EE_Registry::instance()->REQ->add_output( EEH_HTML::div( $bot_notice, '', 'ee-attention' ) ); |
|
221 | + add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false'); |
|
222 | + $bot_notice = esc_html__('Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso'); |
|
223 | + $bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== '' ? sanitize_text_field(stripslashes($_REQUEST['ee-notice'])) : $bot_notice; |
|
224 | + EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention')); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -256,20 +256,20 @@ discard block |
||
256 | 256 | 'html_id' => 'bot_trap_settings', |
257 | 257 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
258 | 258 | 'subsections' => array( |
259 | - 'bot_trap_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( esc_html__( 'Bot Trap Settings', 'event_espresso' ) ) ), |
|
259 | + 'bot_trap_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(esc_html__('Bot Trap Settings', 'event_espresso'))), |
|
260 | 260 | 'use_bot_trap' => new EE_Yes_No_Input( |
261 | 261 | array( |
262 | - 'html_label_text' => esc_html__( 'Enable Bot Trap', 'event_espresso' ), |
|
263 | - 'html_help_text' => esc_html__( 'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso' ), |
|
264 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_bot_trap ) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true, |
|
262 | + 'html_label_text' => esc_html__('Enable Bot Trap', 'event_espresso'), |
|
263 | + 'html_help_text' => esc_html__('The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso'), |
|
264 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_bot_trap) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true, |
|
265 | 265 | 'required' => false |
266 | 266 | ) |
267 | 267 | ), |
268 | 268 | 'use_encryption' => new EE_Yes_No_Input( |
269 | 269 | array( |
270 | - 'html_label_text' => esc_html__( 'Encrypt Bot Trap Data', 'event_espresso' ), |
|
271 | - 'html_help_text' => esc_html__( 'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso' ), |
|
272 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_encryption ) ? EE_Registry::instance()->CFG->registration->use_encryption : true, |
|
270 | + 'html_label_text' => esc_html__('Encrypt Bot Trap Data', 'event_espresso'), |
|
271 | + 'html_help_text' => esc_html__('One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso'), |
|
272 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_encryption) ? EE_Registry::instance()->CFG->registration->use_encryption : true, |
|
273 | 273 | 'required' => false |
274 | 274 | ) |
275 | 275 | ), |
@@ -287,30 +287,30 @@ discard block |
||
287 | 287 | * @param \EE_Registration_Config $EE_Registration_Config |
288 | 288 | * @return \EE_Registration_Config |
289 | 289 | */ |
290 | - public static function update_bot_trap_settings_form( EE_Registration_Config $EE_Registration_Config ) { |
|
290 | + public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config) { |
|
291 | 291 | try { |
292 | 292 | $bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form(); |
293 | 293 | // if not displaying a form, then check for form submission |
294 | - if ( $bot_trap_settings_form->was_submitted() ) { |
|
294 | + if ($bot_trap_settings_form->was_submitted()) { |
|
295 | 295 | // capture form data |
296 | 296 | $bot_trap_settings_form->receive_form_submission(); |
297 | 297 | // validate form data |
298 | - if ( $bot_trap_settings_form->is_valid() ) { |
|
298 | + if ($bot_trap_settings_form->is_valid()) { |
|
299 | 299 | // grab validated data from form |
300 | 300 | $valid_data = $bot_trap_settings_form->valid_data(); |
301 | - if ( isset( $valid_data[ 'use_bot_trap' ], $valid_data[ 'use_encryption' ] ) ) { |
|
302 | - $EE_Registration_Config->use_bot_trap = $valid_data[ 'use_bot_trap' ]; |
|
303 | - $EE_Registration_Config->use_encryption = $valid_data[ 'use_encryption' ]; |
|
301 | + if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) { |
|
302 | + $EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap']; |
|
303 | + $EE_Registration_Config->use_encryption = $valid_data['use_encryption']; |
|
304 | 304 | } else { |
305 | - EE_Error::add_error( esc_html__( 'Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
305 | + EE_Error::add_error(esc_html__('Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
306 | 306 | } |
307 | 307 | } else { |
308 | - if ( $bot_trap_settings_form->submission_error_message() != '' ) { |
|
309 | - EE_Error::add_error( $bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
308 | + if ($bot_trap_settings_form->submission_error_message() != '') { |
|
309 | + EE_Error::add_error($bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | } |
313 | - } catch ( EE_Error $e ) { |
|
313 | + } catch (EE_Error $e) { |
|
314 | 314 | $e->get_error(); |
315 | 315 | } |
316 | 316 | return $EE_Registration_Config; |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * EED_Bot_Trap Class |
4 | 6 | * |
@@ -250,7 +250,7 @@ |
||
250 | 250 | if ( NULL === error_get_last() || ! headers_sent() ) { |
251 | 251 | header('Content-Type: application/json; charset=UTF-8'); |
252 | 252 | } |
253 | - echo wp_json_encode( $json ); |
|
253 | + echo wp_json_encode( $json ); |
|
254 | 254 | exit(); |
255 | 255 | } |
256 | 256 |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | * @since 4.8.30.rc.007 |
18 | 18 | * |
19 | 19 | */ |
20 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
21 | - exit( 'No direct script access allowed' ); |
|
20 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
21 | + exit('No direct script access allowed'); |
|
22 | 22 | } |
23 | 23 | |
24 | -define( 'BATCH_URL', plugin_dir_url( __FILE__ ) ); |
|
24 | +define('BATCH_URL', plugin_dir_url(__FILE__)); |
|
25 | 25 | |
26 | -class EED_Batch extends EED_Module{ |
|
26 | +class EED_Batch extends EED_Module { |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Possibly value for $_REQUEST[ 'batch' ]. Indicates to run a job that |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | public static function set_hooks() { |
71 | 71 | //because this is a possibel attack vector, let's have this disabled until |
72 | 72 | //we at least have a real use for it on the frontend |
73 | - if( apply_filters( 'FHEE__EED_Batch__set_hooks__enable_frontend_batch', false ) ) { |
|
74 | - add_action( 'wp_enqueue_scripts', array( self::instance(), 'enqueue_scripts' ) ); |
|
75 | - add_filter( 'template_include', array( self::instance(), 'override_template' ), 99 ); |
|
73 | + if (apply_filters('FHEE__EED_Batch__set_hooks__enable_frontend_batch', false)) { |
|
74 | + add_action('wp_enqueue_scripts', array(self::instance(), 'enqueue_scripts')); |
|
75 | + add_filter('template_include', array(self::instance(), 'override_template'), 99); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
@@ -80,28 +80,28 @@ discard block |
||
80 | 80 | * Initializes some hooks for the admin in order to run batch jobs |
81 | 81 | */ |
82 | 82 | public static function set_hooks_admin() { |
83 | - add_action( 'admin_menu', array( self::instance(), 'register_admin_pages' ) ); |
|
84 | - add_action( 'admin_enqueue_scripts', array( self::instance(), 'enqueue_scripts' ) ); |
|
83 | + add_action('admin_menu', array(self::instance(), 'register_admin_pages')); |
|
84 | + add_action('admin_enqueue_scripts', array(self::instance(), 'enqueue_scripts')); |
|
85 | 85 | |
86 | 86 | //ajax |
87 | - add_action('wp_ajax_espresso_batch_continue',array(self::instance(),'batch_continue')); |
|
88 | - add_action('wp_ajax_espresso_batch_cleanup',array(self::instance(),'batch_cleanup')); |
|
89 | - add_action('wp_ajax_nopriv_espresso_batch_continue',array(self::instance(),'batch_continue')); |
|
90 | - add_action('wp_ajax_nopriv_espresso_batch_cleanup',array(self::instance(),'batch_cleanup')); |
|
87 | + add_action('wp_ajax_espresso_batch_continue', array(self::instance(), 'batch_continue')); |
|
88 | + add_action('wp_ajax_espresso_batch_cleanup', array(self::instance(), 'batch_cleanup')); |
|
89 | + add_action('wp_ajax_nopriv_espresso_batch_continue', array(self::instance(), 'batch_continue')); |
|
90 | + add_action('wp_ajax_nopriv_espresso_batch_cleanup', array(self::instance(), 'batch_cleanup')); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Enqueues batch scripts on the frontend or admin, and creates a job |
95 | 95 | */ |
96 | 96 | public function enqueue_scripts() { |
97 | - if( isset( $_REQUEST[ 'espresso_batch' ] ) |
|
97 | + if (isset($_REQUEST['espresso_batch']) |
|
98 | 98 | || |
99 | 99 | ( |
100 | - isset( $_REQUEST[ 'page' ] ) |
|
101 | - && $_REQUEST[ 'page' ] == 'espresso_batch' |
|
100 | + isset($_REQUEST['page']) |
|
101 | + && $_REQUEST['page'] == 'espresso_batch' |
|
102 | 102 | ) |
103 | 103 | ) { |
104 | - switch( $this->batch_request_type() ) { |
|
104 | + switch ($this->batch_request_type()) { |
|
105 | 105 | case self::batch_job: |
106 | 106 | $this->enqueue_scripts_styles_batch_create(); |
107 | 107 | break; |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function enqueue_scripts_styles_batch_create() { |
119 | 119 | $job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job(); |
120 | - wp_enqueue_script( 'batch_runner_init', BATCH_URL . 'assets/batch_runner_init.js', array( 'batch_runner' ), EVENT_ESPRESSO_VERSION, true ); |
|
121 | - wp_localize_script( 'batch_runner_init', 'ee_job_response', $job_response->to_array() ); |
|
122 | - wp_localize_script( 'batch_runner_init', 'ee_job_i18n', |
|
120 | + wp_enqueue_script('batch_runner_init', BATCH_URL.'assets/batch_runner_init.js', array('batch_runner'), EVENT_ESPRESSO_VERSION, true); |
|
121 | + wp_localize_script('batch_runner_init', 'ee_job_response', $job_response->to_array()); |
|
122 | + wp_localize_script('batch_runner_init', 'ee_job_i18n', |
|
123 | 123 | array( |
124 | - 'return_url' => $_REQUEST['return_url' ], |
|
124 | + 'return_url' => $_REQUEST['return_url'], |
|
125 | 125 | )); |
126 | 126 | } |
127 | 127 | |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | public function enqueue_scripts_styles_batch_file_create() { |
132 | 132 | //creates a job based on the request variable |
133 | 133 | $job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job(); |
134 | - wp_enqueue_script( 'batch_file_runner_init', BATCH_URL . 'assets/batch_file_runner_init.js', array( 'batch_runner' ), EVENT_ESPRESSO_VERSION, true ); |
|
135 | - wp_localize_script( 'batch_file_runner_init', 'ee_job_response', $job_response->to_array() ); |
|
136 | - wp_localize_script( 'batch_file_runner_init', 'ee_job_i18n', |
|
134 | + wp_enqueue_script('batch_file_runner_init', BATCH_URL.'assets/batch_file_runner_init.js', array('batch_runner'), EVENT_ESPRESSO_VERSION, true); |
|
135 | + wp_localize_script('batch_file_runner_init', 'ee_job_response', $job_response->to_array()); |
|
136 | + wp_localize_script('batch_file_runner_init', 'ee_job_i18n', |
|
137 | 137 | array( |
138 | 138 | 'download_and_redirecting' => sprintf( |
139 | 139 | __('File Generation complete. Downloading, and %1$sredirecting%2$s...', 'event_espresso'), |
140 | - '<a href="' . $_REQUEST['return_url' ] .'">', |
|
140 | + '<a href="'.$_REQUEST['return_url'].'">', |
|
141 | 141 | '</a>' ), |
142 | - 'return_url' => $_REQUEST['return_url' ], |
|
142 | + 'return_url' => $_REQUEST['return_url'], |
|
143 | 143 | )); |
144 | 144 | } |
145 | 145 | |
@@ -150,18 +150,18 @@ discard block |
||
150 | 150 | * @return \EventEspressoBatchRequest\Helpers\JobStepResponse |
151 | 151 | */ |
152 | 152 | protected function _enqueue_batch_job_scripts_and_styles_and_start_job() { |
153 | - wp_register_script( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.js', array( 'jquery' ) ); |
|
154 | - wp_enqueue_style( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION ); |
|
155 | - wp_enqueue_script( 'batch_runner', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js', array( 'progress_bar' )); |
|
153 | + wp_register_script('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.js', array('jquery')); |
|
154 | + wp_enqueue_style('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION); |
|
155 | + wp_enqueue_script('batch_runner', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/batch_runner.js', array('progress_bar')); |
|
156 | 156 | //just copy the bits of EE admin's eei18n that we need in the JS |
157 | - wp_localize_script( 'batch_runner', 'eei18n', array( 'ajax_url' => WP_AJAX_URL, 'is_admin' => (bool)is_admin() ) ); |
|
158 | - $job_handler_classname = stripslashes( $_GET[ 'job_handler' ] ); |
|
157 | + wp_localize_script('batch_runner', 'eei18n', array('ajax_url' => WP_AJAX_URL, 'is_admin' => (bool) is_admin())); |
|
158 | + $job_handler_classname = stripslashes($_GET['job_handler']); |
|
159 | 159 | $request_data = array_diff_key( |
160 | 160 | $_REQUEST, |
161 | - array_flip( array( 'action', 'page', 'ee', 'batch' ) ) ); |
|
161 | + array_flip(array('action', 'page', 'ee', 'batch')) ); |
|
162 | 162 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
163 | 163 | //eg 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' |
164 | - $job_response = $batch_runner->create_job( $job_handler_classname, $request_data ); |
|
164 | + $job_response = $batch_runner->create_job($job_handler_classname, $request_data); |
|
165 | 165 | //remember the response for later. We need it to display the page body |
166 | 166 | $this->_job_step_response = $job_response; |
167 | 167 | return $job_response; |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | * @param string $template |
173 | 173 | * @return string |
174 | 174 | */ |
175 | - public function override_template( $template ) { |
|
176 | - if( isset( $_REQUEST[ 'espresso_batch' ] ) && isset( $_REQUEST[ 'batch' ] ) ) { |
|
177 | - return EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_frontend_wrapper.template.html'; |
|
175 | + public function override_template($template) { |
|
176 | + if (isset($_REQUEST['espresso_batch']) && isset($_REQUEST['batch'])) { |
|
177 | + return EE_MODULES.'batch'.DS.'templates'.DS.'batch_frontend_wrapper.template.html'; |
|
178 | 178 | } |
179 | 179 | return $template; |
180 | 180 | } |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | public function register_admin_pages() { |
186 | 186 | add_submenu_page( |
187 | 187 | '', //parent slug. we don't want this to actually appear in the menu |
188 | - __( 'Batch Job', 'event_espresso' ), //page title |
|
188 | + __('Batch Job', 'event_espresso'), //page title |
|
189 | 189 | 'n/a', //menu title |
190 | 190 | 'read', //we want this page to actually be accessible to anyone, |
191 | 191 | 'espresso_batch', //menu slug |
192 | - array( self::instance(), 'show_admin_page' ) |
|
192 | + array(self::instance(), 'show_admin_page') |
|
193 | 193 | ); |
194 | 194 | } |
195 | 195 | |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function show_admin_page() { |
201 | 201 | echo EEH_Template::locate_template( |
202 | - EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_wrapper.template.html', |
|
203 | - array( 'batch_request_type' => $this->batch_request_type() ) |
|
202 | + EE_MODULES.'batch'.DS.'templates'.DS.'batch_wrapper.template.html', |
|
203 | + array('batch_request_type' => $this->batch_request_type()) |
|
204 | 204 | ); |
205 | 205 | } |
206 | 206 | |
@@ -208,10 +208,10 @@ discard block |
||
208 | 208 | * Receives ajax calls for continuing a job |
209 | 209 | */ |
210 | 210 | public function batch_continue() { |
211 | - $job_id = sanitize_text_field( $_REQUEST[ 'job_id' ] ); |
|
211 | + $job_id = sanitize_text_field($_REQUEST['job_id']); |
|
212 | 212 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
213 | - $response_obj = $batch_runner->continue_job( $job_id); |
|
214 | - $this->_return_json( $response_obj->to_array() ); |
|
213 | + $response_obj = $batch_runner->continue_job($job_id); |
|
214 | + $this->_return_json($response_obj->to_array()); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | * @return type |
220 | 220 | */ |
221 | 221 | public function batch_cleanup() { |
222 | - $job_id = sanitize_text_field( $_REQUEST[ 'job_id' ] ); |
|
222 | + $job_id = sanitize_text_field($_REQUEST['job_id']); |
|
223 | 223 | $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor(); |
224 | - $response_obj = $batch_runner->cleanup_job( $job_id ); |
|
225 | - $this->_return_json( $response_obj->to_array() ); |
|
224 | + $response_obj = $batch_runner->cleanup_job($job_id); |
|
225 | + $this->_return_json($response_obj->to_array()); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * 'isEEajax' => true,//indicates this is a response from EE |
239 | 239 | * ) |
240 | 240 | */ |
241 | - protected function _return_json( $data ) { |
|
241 | + protected function _return_json($data) { |
|
242 | 242 | $json = array( |
243 | 243 | 'notices' => EE_Error::get_notices(), |
244 | 244 | 'data' => $data, |
@@ -247,10 +247,10 @@ discard block |
||
247 | 247 | |
248 | 248 | |
249 | 249 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
250 | - if ( NULL === error_get_last() || ! headers_sent() ) { |
|
250 | + if (NULL === error_get_last() || ! headers_sent()) { |
|
251 | 251 | header('Content-Type: application/json; charset=UTF-8'); |
252 | 252 | } |
253 | - echo wp_json_encode( $json ); |
|
253 | + echo wp_json_encode($json); |
|
254 | 254 | exit(); |
255 | 255 | } |
256 | 256 | |
@@ -266,16 +266,16 @@ discard block |
||
266 | 266 | * @return string: EED_Batch::batch_job, EED_Batch::batch_file_job, EED_Batch::batch_not_job |
267 | 267 | */ |
268 | 268 | public function batch_request_type() { |
269 | - if( $this->_batch_request_type === null ) { |
|
270 | - if( isset( $_GET[ 'batch' ] ) ) { |
|
271 | - if( $_GET[ 'batch' ] == self::batch_job ) { |
|
269 | + if ($this->_batch_request_type === null) { |
|
270 | + if (isset($_GET['batch'])) { |
|
271 | + if ($_GET['batch'] == self::batch_job) { |
|
272 | 272 | $this->_batch_request_type = self::batch_job; |
273 | - } elseif( $_GET[ 'batch' ] == self::batch_file_job ) { |
|
273 | + } elseif ($_GET['batch'] == self::batch_file_job) { |
|
274 | 274 | $this->_batch_request_type = self::batch_file_job; |
275 | 275 | } |
276 | 276 | } |
277 | 277 | //if we didn't find that it was a batch request, indicate it wasn't |
278 | - if( $this->_batch_request_type === null ) { |
|
278 | + if ($this->_batch_request_type === null) { |
|
279 | 279 | $this->_batch_request_type = self::batch_not_job; |
280 | 280 | } |
281 | 281 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * Unnecessary |
287 | 287 | * @param type $WP |
288 | 288 | */ |
289 | - public function run( $WP ) { |
|
289 | + public function run($WP) { |
|
290 | 290 | |
291 | 291 | } |
292 | 292 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return void |
92 | 92 | */ |
93 | 93 | public static function set_hooks() { |
94 | - add_action( 'wp_loaded', array( 'EES_Espresso_Thank_You', 'set_definitions' ), 2 ); |
|
94 | + add_action('wp_loaded', array('EES_Espresso_Thank_You', 'set_definitions'), 2); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -104,22 +104,22 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public static function set_hooks_admin() { |
106 | 106 | // AJAX for IPN monitoring |
107 | - add_filter( 'heartbeat_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 ); |
|
107 | + add_filter('heartbeat_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3); |
|
108 | 108 | add_filter( |
109 | 109 | 'heartbeat_nopriv_received', |
110 | - array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), |
|
110 | + array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), |
|
111 | 111 | 10, |
112 | 112 | 3 |
113 | 113 | ); |
114 | 114 | add_action( |
115 | 115 | 'wp_ajax_espresso_resend_reg_confirmation_email', |
116 | - array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), |
|
116 | + array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), |
|
117 | 117 | 10, |
118 | 118 | 2 |
119 | 119 | ); |
120 | 120 | add_action( |
121 | 121 | 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', |
122 | - array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), |
|
122 | + array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), |
|
123 | 123 | 10, |
124 | 124 | 2 |
125 | 125 | ); |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | * @return void |
135 | 135 | */ |
136 | 136 | public static function set_definitions() { |
137 | - define( 'THANK_YOU_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
138 | - define( 'THANK_YOU_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ ) ) . 'templates' . DS ); |
|
137 | + define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
138 | + define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | * @return EE_Transaction |
148 | 148 | */ |
149 | 149 | public function get_txn() { |
150 | - if ( $this->_current_txn instanceof EE_Transaction ) { |
|
150 | + if ($this->_current_txn instanceof EE_Transaction) { |
|
151 | 151 | return $this->_current_txn; |
152 | 152 | } |
153 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
154 | - if ( ! $TXN_model instanceof EEM_Transaction ) { |
|
153 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
154 | + if ( ! $TXN_model instanceof EEM_Transaction) { |
|
155 | 155 | EE_Error::add_error( |
156 | - __( 'The transaction model could not be established.', 'event_espresso' ), |
|
156 | + __('The transaction model could not be established.', 'event_espresso'), |
|
157 | 157 | __FILE__, |
158 | 158 | __FUNCTION__, |
159 | 159 | __LINE__ |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | return null; |
162 | 162 | } |
163 | 163 | //get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request |
164 | - $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link( $this->_reg_url_link ); |
|
164 | + $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link); |
|
165 | 165 | // verify TXN |
166 | - if ( WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction ) { |
|
166 | + if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) { |
|
167 | 167 | EE_Error::add_error( |
168 | 168 | __( |
169 | 169 | 'No transaction information could be retrieved or the transaction data is not of the correct type.', |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | * @param int $since |
188 | 188 | * @return mixed array of EE_Payment || FALSE |
189 | 189 | */ |
190 | - public function get_txn_payments( $since = 0 ) { |
|
191 | - if ( ! $this->get_txn() ) { |
|
190 | + public function get_txn_payments($since = 0) { |
|
191 | + if ( ! $this->get_txn()) { |
|
192 | 192 | return false; |
193 | 193 | } |
194 | - $args = array( 'order_by' => array( 'PAY_timestamp' => 'ASC' ) ); |
|
195 | - if ( $since > 0 ) { |
|
196 | - $args[0] = array( 'PAY_timestamp' => array( '>', $since ) ); |
|
194 | + $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
|
195 | + if ($since > 0) { |
|
196 | + $args[0] = array('PAY_timestamp' => array('>', $since)); |
|
197 | 197 | } |
198 | 198 | // get array of payments with most recent first |
199 | - return $this->_current_txn->payments( $args ); |
|
199 | + return $this->_current_txn->payments($args); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | * @return void |
209 | 209 | */ |
210 | 210 | private function _get_reg_url_link() { |
211 | - if ( ! empty( $this->_reg_url_link ) ) { |
|
211 | + if ( ! empty($this->_reg_url_link)) { |
|
212 | 212 | return; |
213 | 213 | } |
214 | 214 | // only do thank you page stuff if we have a REG_url_link in the url |
215 | - if ( WP_DEBUG && ! EE_Registry::instance()->REQ->is_set( 'e_reg_url_link' ) ) { |
|
215 | + if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
216 | 216 | EE_Error::add_error( |
217 | 217 | __( |
218 | 218 | 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | return; |
226 | 226 | } |
227 | 227 | // check for reg_url_link |
228 | - $this->_reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link' ); |
|
228 | + $this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link'); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | * @param string $reg_url_link |
238 | 238 | * @return string |
239 | 239 | */ |
240 | - public function set_reg_url_link( $reg_url_link = null ) { |
|
241 | - $this->_reg_url_link = ! empty( $reg_url_link ) ? $reg_url_link : $this->_reg_url_link; |
|
240 | + public function set_reg_url_link($reg_url_link = null) { |
|
241 | + $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | |
@@ -251,28 +251,28 @@ discard block |
||
251 | 251 | * @param WP $WP |
252 | 252 | * @return void |
253 | 253 | */ |
254 | - public function run( WP $WP ) { |
|
254 | + public function run(WP $WP) { |
|
255 | 255 | // remove site_url() from thank you page URL |
256 | - $thank_you_page_URL = substr( EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen( home_url() ) ); |
|
256 | + $thank_you_page_URL = substr(EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen(home_url())); |
|
257 | 257 | // remove other non-essential details from URL |
258 | - $thank_you_page_URL = trim( parse_url( $thank_you_page_URL, PHP_URL_PATH ), '/' ); |
|
258 | + $thank_you_page_URL = trim(parse_url($thank_you_page_URL, PHP_URL_PATH), '/'); |
|
259 | 259 | // ensure this shortcode doesn't trigger on anything BUT the thank you page |
260 | - if ( isset( $WP->request ) && trim( $WP->request, '/' ) !== $thank_you_page_URL ) { |
|
260 | + if (isset($WP->request) && trim($WP->request, '/') !== $thank_you_page_URL) { |
|
261 | 261 | return; |
262 | 262 | } else if ( |
263 | - isset( $WP->query_vars['page_id'] ) |
|
264 | - && (int)$WP->query_vars['page_id'] !== (int)EE_Registry::instance()->CFG->core->thank_you_page_id |
|
263 | + isset($WP->query_vars['page_id']) |
|
264 | + && (int) $WP->query_vars['page_id'] !== (int) EE_Registry::instance()->CFG->core->thank_you_page_id |
|
265 | 265 | ) { |
266 | 266 | return; |
267 | 267 | } |
268 | 268 | $this->_get_reg_url_link(); |
269 | 269 | // resend_reg_confirmation_email ? |
270 | - if ( EE_Registry::instance()->REQ->is_set( 'resend' ) ) { |
|
270 | + if (EE_Registry::instance()->REQ->is_set('resend')) { |
|
271 | 271 | EES_Espresso_Thank_You::resend_reg_confirmation_email(); |
272 | 272 | } |
273 | 273 | // load assets |
274 | - add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 10 ); |
|
275 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
274 | + add_action('wp_enqueue_scripts', array($this, 'load_js'), 10); |
|
275 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
276 | 276 | $this->_translate_strings(); |
277 | 277 | } |
278 | 278 | |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | public function load_js() { |
327 | 327 | wp_register_script( |
328 | 328 | 'thank_you_page', |
329 | - THANK_YOU_ASSETS_URL . 'thank_you_page.js', |
|
330 | - array( 'espresso_core', 'heartbeat' ), |
|
329 | + THANK_YOU_ASSETS_URL.'thank_you_page.js', |
|
330 | + array('espresso_core', 'heartbeat'), |
|
331 | 331 | EVENT_ESPRESSO_VERSION, |
332 | 332 | true |
333 | 333 | ); |
334 | - wp_enqueue_script( 'thank_you_page' ); |
|
334 | + wp_enqueue_script('thank_you_page'); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
@@ -345,9 +345,9 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public function init() { |
347 | 347 | $this->_get_reg_url_link(); |
348 | - if ( ! $this->get_txn() ) { |
|
348 | + if ( ! $this->get_txn()) { |
|
349 | 349 | echo EEH_HTML::div( |
350 | - EEH_HTML::h4( __( 'We\'re sorry...', 'event_espresso' ), '', '' ) . |
|
350 | + EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', ''). |
|
351 | 351 | sprintf( |
352 | 352 | __( |
353 | 353 | 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | return null; |
362 | 362 | } |
363 | 363 | // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" |
364 | - if ( $this->_current_txn->status_ID() === EEM_Transaction::failed_status_code ) { |
|
365 | - $this->_current_txn->set_status( EEM_Transaction::incomplete_status_code ); |
|
364 | + if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) { |
|
365 | + $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); |
|
366 | 366 | $this->_current_txn->save(); |
367 | 367 | } |
368 | 368 | $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration |
@@ -375,15 +375,15 @@ discard block |
||
375 | 375 | ); |
376 | 376 | $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
377 | 377 | // txn status ? |
378 | - if ( $this->_current_txn->is_completed() ) { |
|
378 | + if ($this->_current_txn->is_completed()) { |
|
379 | 379 | $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
380 | 380 | } else if ( |
381 | 381 | $this->_current_txn->is_incomplete() |
382 | - && ( $this->_primary_registrant->is_approved() |
|
383 | - || $this->_primary_registrant->is_pending_payment() ) |
|
382 | + && ($this->_primary_registrant->is_approved() |
|
383 | + || $this->_primary_registrant->is_pending_payment()) |
|
384 | 384 | ) { |
385 | 385 | $this->_show_try_pay_again_link = true; |
386 | - } else if ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() ) { |
|
386 | + } else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { |
|
387 | 387 | // its pending |
388 | 388 | $this->_show_try_pay_again_link = isset( |
389 | 389 | EE_Registry::instance()->CFG->registration->show_pending_payment_options |
@@ -409,21 +409,21 @@ discard block |
||
409 | 409 | } |
410 | 410 | // link to SPCO |
411 | 411 | $revisit_spco_url = add_query_arg( |
412 | - array( 'ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link ), |
|
412 | + array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link), |
|
413 | 413 | EE_Registry::instance()->CFG->core->reg_page_url() |
414 | 414 | ); |
415 | 415 | // link to SPCO payment_options |
416 | 416 | $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration |
417 | 417 | ? $this->_primary_registrant->payment_overview_url() |
418 | 418 | : add_query_arg( |
419 | - array( 'step' => 'payment_options' ), |
|
419 | + array('step' => 'payment_options'), |
|
420 | 420 | $revisit_spco_url |
421 | 421 | ); |
422 | 422 | // link to SPCO attendee_information |
423 | 423 | $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration |
424 | 424 | ? $this->_primary_registrant->edit_attendee_information_url() |
425 | 425 | : false; |
426 | - do_action( 'AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn ); |
|
426 | + do_action('AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn); |
|
427 | 427 | // set no cache headers and constants |
428 | 428 | EE_System::do_not_cache(); |
429 | 429 | } |
@@ -438,15 +438,15 @@ discard block |
||
438 | 438 | * @return string |
439 | 439 | * @throws \EE_Error |
440 | 440 | */ |
441 | - public function process_shortcode( $attributes = array() ) { |
|
441 | + public function process_shortcode($attributes = array()) { |
|
442 | 442 | $this->init(); |
443 | - if ( ! $this->_current_txn instanceof EE_Transaction ) { |
|
443 | + if ( ! $this->_current_txn instanceof EE_Transaction) { |
|
444 | 444 | return EE_Error::get_notices(); |
445 | 445 | } |
446 | 446 | //EEH_Debug_Tools::log( __CLASS__, __FUNCTION__, __LINE__, array( $this->_current_txn ), true, 'EE_Transaction: ' . $this->_current_txn->ID() ); |
447 | 447 | // link to receipt |
448 | - $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url( 'html' ); |
|
449 | - if ( ! empty( $template_args['TXN_receipt_url'] ) ) { |
|
448 | + $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html'); |
|
449 | + if ( ! empty($template_args['TXN_receipt_url'])) { |
|
450 | 450 | $template_args['order_conf_desc'] = __( |
451 | 451 | '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', |
452 | 452 | 'event_espresso' |
@@ -458,13 +458,13 @@ discard block |
||
458 | 458 | ); |
459 | 459 | } |
460 | 460 | $template_args['transaction'] = $this->_current_txn; |
461 | - $template_args['revisit'] = EE_Registry::instance()->REQ->get( 'revisit', false ); |
|
462 | - add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_registration_details' ) ); |
|
463 | - if ( $this->_is_primary && ! $this->_current_txn->is_free() ) { |
|
464 | - add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_ajax_content' ) ); |
|
461 | + $template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false); |
|
462 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details')); |
|
463 | + if ($this->_is_primary && ! $this->_current_txn->is_free()) { |
|
464 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
|
465 | 465 | } |
466 | 466 | return EEH_Template::locate_template( |
467 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', |
|
467 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php', |
|
468 | 468 | $template_args, |
469 | 469 | true, |
470 | 470 | true |
@@ -485,15 +485,15 @@ discard block |
||
485 | 485 | * @return array |
486 | 486 | * @throws \EE_Error |
487 | 487 | */ |
488 | - public static function thank_you_page_IPN_monitor( $response = array(), $data = array() ) { |
|
488 | + public static function thank_you_page_IPN_monitor($response = array(), $data = array()) { |
|
489 | 489 | // does this heartbeat contain our data ? |
490 | - if ( ! isset( $data['espresso_thank_you_page'] ) ) { |
|
490 | + if ( ! isset($data['espresso_thank_you_page'])) { |
|
491 | 491 | return $response; |
492 | 492 | } |
493 | 493 | // check for reg_url_link in the incoming heartbeat data |
494 | - if ( ! isset( $data['espresso_thank_you_page']['e_reg_url_link'] ) ) { |
|
494 | + if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) { |
|
495 | 495 | $response['espresso_thank_you_page'] = array( |
496 | - 'errors' => ! empty( $notices['errors'] ) |
|
496 | + 'errors' => ! empty($notices['errors']) |
|
497 | 497 | ? $notices['errors'] |
498 | 498 | : __( |
499 | 499 | 'No transaction information could be retrieved because the registration URL link is missing or invalid.', |
@@ -508,15 +508,15 @@ discard block |
||
508 | 508 | EES_Espresso_Thank_You::set_definitions(); |
509 | 509 | /** @var $espresso_thank_you_page EES_Espresso_Thank_You */ |
510 | 510 | $espresso_thank_you_page = EES_Espresso_Thank_You::instance(); |
511 | - $espresso_thank_you_page->set_reg_url_link( $data['espresso_thank_you_page']['e_reg_url_link'] ); |
|
511 | + $espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']); |
|
512 | 512 | $espresso_thank_you_page->init(); |
513 | 513 | //get TXN |
514 | 514 | $TXN = $espresso_thank_you_page->get_txn(); |
515 | 515 | // no TXN? then get out |
516 | - if ( ! $TXN instanceof EE_Transaction ) { |
|
516 | + if ( ! $TXN instanceof EE_Transaction) { |
|
517 | 517 | $notices = EE_Error::get_notices(); |
518 | 518 | $response['espresso_thank_you_page'] = array( |
519 | - 'errors' => ! empty( $notices['errors'] ) |
|
519 | + 'errors' => ! empty($notices['errors']) |
|
520 | 520 | ? $notices['errors'] |
521 | 521 | : sprintf( |
522 | 522 | __( |
@@ -529,13 +529,13 @@ discard block |
||
529 | 529 | return $response; |
530 | 530 | } |
531 | 531 | // grab transient of TXN's status |
532 | - $txn_status = isset( $data['espresso_thank_you_page']['txn_status'] ) |
|
532 | + $txn_status = isset($data['espresso_thank_you_page']['txn_status']) |
|
533 | 533 | ? $data['espresso_thank_you_page']['txn_status'] |
534 | 534 | : null; |
535 | 535 | // has the TXN status changed since we last checked (or empty because this is the first time running through this code)? |
536 | - if ( $txn_status !== $TXN->status_ID() ) { |
|
536 | + if ($txn_status !== $TXN->status_ID()) { |
|
537 | 537 | // switch between two possible basic outcomes |
538 | - switch ( $TXN->status_ID() ) { |
|
538 | + switch ($TXN->status_ID()) { |
|
539 | 539 | // TXN has been updated in some way |
540 | 540 | case EEM_Transaction::overpaid_status_code: |
541 | 541 | case EEM_Transaction::complete_status_code: |
@@ -550,25 +550,25 @@ discard block |
||
550 | 550 | case EEM_Transaction::failed_status_code: |
551 | 551 | default: |
552 | 552 | // keep on waiting... |
553 | - return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] ); |
|
553 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
554 | 554 | } |
555 | 555 | // or is the TXN still failed (never been updated) ??? |
556 | - } else if ( $TXN->failed() ) { |
|
556 | + } else if ($TXN->failed()) { |
|
557 | 557 | // keep on waiting... |
558 | - return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] ); |
|
558 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
559 | 559 | } |
560 | 560 | // TXN is happening so let's get the payments now |
561 | 561 | // if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked |
562 | - $since = isset( $data['espresso_thank_you_page']['get_payments_since'] ) |
|
562 | + $since = isset($data['espresso_thank_you_page']['get_payments_since']) |
|
563 | 563 | ? $data['espresso_thank_you_page']['get_payments_since'] |
564 | 564 | : 0; |
565 | 565 | // then check for payments |
566 | - $payments = $espresso_thank_you_page->get_txn_payments( $since ); |
|
566 | + $payments = $espresso_thank_you_page->get_txn_payments($since); |
|
567 | 567 | // has a payment been processed ? |
568 | - if ( ! empty( $payments ) || $espresso_thank_you_page->_is_offline_payment_method ) { |
|
569 | - if ( $since ) { |
|
568 | + if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) { |
|
569 | + if ($since) { |
|
570 | 570 | $response['espresso_thank_you_page'] = array( |
571 | - 'new_payments' => $espresso_thank_you_page->get_new_payments( $payments ), |
|
571 | + 'new_payments' => $espresso_thank_you_page->get_new_payments($payments), |
|
572 | 572 | 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
573 | 573 | 'txn_status' => $TXN->status_ID() |
574 | 574 | ); |
@@ -594,9 +594,9 @@ discard block |
||
594 | 594 | * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data |
595 | 595 | * @return array |
596 | 596 | */ |
597 | - private function _update_server_wait_time( $thank_you_page_data = array() ) { |
|
597 | + private function _update_server_wait_time($thank_you_page_data = array()) { |
|
598 | 598 | $response['espresso_thank_you_page'] = array( |
599 | - 'still_waiting' => isset( $thank_you_page_data['initial_access'] ) |
|
599 | + 'still_waiting' => isset($thank_you_page_data['initial_access']) |
|
600 | 600 | ? time() - $thank_you_page_data['initial_access'] |
601 | 601 | : 0, |
602 | 602 | 'txn_status' => $this->_current_txn->status_ID() |
@@ -621,17 +621,17 @@ discard block |
||
621 | 621 | $template_args['is_primary'] = $this->_is_primary; |
622 | 622 | $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url; |
623 | 623 | $template_args['resend_reg_confirmation_url'] = add_query_arg( |
624 | - array( 'token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true' ), |
|
624 | + array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'), |
|
625 | 625 | EE_Registry::instance()->CFG->core->thank_you_page_url() |
626 | 626 | ); |
627 | 627 | // verify template arguments |
628 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
628 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
629 | 629 | EEH_Template_Validator::verify_isnt_null( |
630 | 630 | $template_args['SPCO_attendee_information_url'], |
631 | 631 | '$SPCO_attendee_information_url' |
632 | 632 | ); |
633 | 633 | echo EEH_Template::locate_template( |
634 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', |
|
634 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php', |
|
635 | 635 | $template_args, |
636 | 636 | true, |
637 | 637 | true |
@@ -644,16 +644,16 @@ discard block |
||
644 | 644 | * resend_reg_confirmation_email |
645 | 645 | */ |
646 | 646 | public static function resend_reg_confirmation_email() { |
647 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
648 | - $reg_url_link = EE_Registry::instance()->REQ->get( 'token' ); |
|
647 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
648 | + $reg_url_link = EE_Registry::instance()->REQ->get('token'); |
|
649 | 649 | // was a REG_ID passed ? |
650 | - if ( $reg_url_link ) { |
|
651 | - $registration = EE_Registry::instance()->load_model( 'Registration' )->get_one( |
|
652 | - array( array( 'REG_url_link' => $reg_url_link ) ) |
|
650 | + if ($reg_url_link) { |
|
651 | + $registration = EE_Registry::instance()->load_model('Registration')->get_one( |
|
652 | + array(array('REG_url_link' => $reg_url_link)) |
|
653 | 653 | ); |
654 | - if ( $registration instanceof EE_Registration ) { |
|
654 | + if ($registration instanceof EE_Registration) { |
|
655 | 655 | // resend email |
656 | - EED_Messages::process_resend( array( '_REG_ID' => $registration->ID() ) ); |
|
656 | + EED_Messages::process_resend(array('_REG_ID' => $registration->ID())); |
|
657 | 657 | } else { |
658 | 658 | EE_Error::add_error( |
659 | 659 | __( |
@@ -677,16 +677,16 @@ discard block |
||
677 | 677 | ); |
678 | 678 | } |
679 | 679 | // request sent via AJAX ? |
680 | - if ( EE_FRONT_AJAX ) { |
|
681 | - echo wp_json_encode( EE_Error::get_notices( false ) ); |
|
680 | + if (EE_FRONT_AJAX) { |
|
681 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
682 | 682 | die(); |
683 | 683 | // or was JS disabled ? |
684 | 684 | } else { |
685 | 685 | // save errors so that they get picked up on the next request |
686 | - EE_Error::get_notices( true, true ); |
|
686 | + EE_Error::get_notices(true, true); |
|
687 | 687 | wp_safe_redirect( |
688 | 688 | add_query_arg( |
689 | - array( 'e_reg_url_link' => $reg_url_link ), |
|
689 | + array('e_reg_url_link' => $reg_url_link), |
|
690 | 690 | EE_Registry::instance()->CFG->core->thank_you_page_url() |
691 | 691 | ) |
692 | 692 | ); |
@@ -702,26 +702,26 @@ discard block |
||
702 | 702 | * @return void |
703 | 703 | */ |
704 | 704 | public function get_ajax_content() { |
705 | - if ( ! $this->get_txn() ) { |
|
705 | + if ( ! $this->get_txn()) { |
|
706 | 706 | return; |
707 | 707 | } |
708 | 708 | // first determine which event(s) require pre-approval or not |
709 | 709 | $events = array(); |
710 | 710 | $events_requiring_pre_approval = array(); |
711 | - foreach ( $this->_current_txn->registrations() as $registration ) { |
|
712 | - if ( $registration instanceof EE_Registration ) { |
|
711 | + foreach ($this->_current_txn->registrations() as $registration) { |
|
712 | + if ($registration instanceof EE_Registration) { |
|
713 | 713 | $event = $registration->event(); |
714 | - if ( $event instanceof EE_Event ) { |
|
715 | - if ( $registration->is_not_approved() && $registration->event() instanceof EE_Event ) { |
|
716 | - $events_requiring_pre_approval[ $event->ID() ] = $event; |
|
714 | + if ($event instanceof EE_Event) { |
|
715 | + if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
|
716 | + $events_requiring_pre_approval[$event->ID()] = $event; |
|
717 | 717 | } else { |
718 | - $events[ $event->ID() ] = $event; |
|
718 | + $events[$event->ID()] = $event; |
|
719 | 719 | } |
720 | 720 | } |
721 | 721 | } |
722 | 722 | } |
723 | - $this->display_details_for_events_requiring_pre_approval( $events_requiring_pre_approval ); |
|
724 | - $this->display_details_for_events( $events ); |
|
723 | + $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval); |
|
724 | + $this->display_details_for_events($events); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | |
@@ -733,8 +733,8 @@ discard block |
||
733 | 733 | * @param EE_Event[] $events |
734 | 734 | * @return string |
735 | 735 | */ |
736 | - public function display_details_for_events( $events = array() ) { |
|
737 | - if ( ! empty( $events ) ) { |
|
736 | + public function display_details_for_events($events = array()) { |
|
737 | + if ( ! empty($events)) { |
|
738 | 738 | ?> |
739 | 739 | <div id="espresso-thank-you-page-ajax-content-dv"> |
740 | 740 | <div id="espresso-thank-you-page-ajax-transaction-dv"></div> |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | 'event_espresso' |
747 | 747 | ); ?></span> |
748 | 748 | </div> |
749 | - <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed ) : ?> |
|
749 | + <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?> |
|
750 | 750 | <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear"> |
751 | 751 | <?php echo apply_filters( |
752 | 752 | 'EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg', |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | ); ?> |
758 | 758 | <br/> |
759 | 759 | <span class="jst-rght ee-block small-text lt-grey-text"> |
760 | - <?php _e( 'current wait time ', 'event_espresso' ); ?> |
|
760 | + <?php _e('current wait time ', 'event_espresso'); ?> |
|
761 | 761 | <span id="espresso-thank-you-page-ajax-time-dv">00:00:00</span></span> |
762 | 762 | </p> |
763 | 763 | <?php endif; ?> |
@@ -777,11 +777,11 @@ discard block |
||
777 | 777 | * @param EE_Event[] $events |
778 | 778 | * @return string |
779 | 779 | */ |
780 | - public function display_details_for_events_requiring_pre_approval( $events = array() ) { |
|
781 | - if ( ! empty( $events ) ) { |
|
780 | + public function display_details_for_events_requiring_pre_approval($events = array()) { |
|
781 | + if ( ! empty($events)) { |
|
782 | 782 | ?> |
783 | 783 | <div id="espresso-thank-you-page-not-approved-message-dv"> |
784 | - <h4 class="orange-text"><?php _e( 'Important Notice:', 'event_espresso' ); ?></h4> |
|
784 | + <h4 class="orange-text"><?php _e('Important Notice:', 'event_espresso'); ?></h4> |
|
785 | 785 | <p id="events-requiring-pre-approval-pg" class="small-text"> |
786 | 786 | <?php echo apply_filters( |
787 | 787 | 'AHEE__EES_Espresso_Thank_You__get_ajax_content__not_approved_message', |
@@ -792,8 +792,8 @@ discard block |
||
792 | 792 | ); ?> |
793 | 793 | </p> |
794 | 794 | <ul class="events-requiring-pre-approval-ul"> |
795 | - <?php foreach ( $events as $event ) { |
|
796 | - if ( $event instanceof EE_Event ) { |
|
795 | + <?php foreach ($events as $event) { |
|
796 | + if ($event instanceof EE_Event) { |
|
797 | 797 | echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', |
798 | 798 | $event->name(), |
799 | 799 | '</li>'; |
@@ -820,12 +820,12 @@ discard block |
||
820 | 820 | $template_args = array(); |
821 | 821 | $template_args['transaction'] = $this->_current_txn; |
822 | 822 | $template_args['reg_url_link'] = $this->_reg_url_link; |
823 | - $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name( true ); |
|
823 | + $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true); |
|
824 | 824 | // link to SPCO payment_options |
825 | 825 | $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
826 | 826 | $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
827 | 827 | // verify template arguments |
828 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
828 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
829 | 829 | EEH_Template_Validator::verify_isnt_null( |
830 | 830 | $template_args['show_try_pay_again_link'], |
831 | 831 | '$show_try_pay_again_link' |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | '$SPCO_payment_options_url' |
836 | 836 | ); |
837 | 837 | return EEH_Template::locate_template( |
838 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', |
|
838 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php', |
|
839 | 839 | $template_args, |
840 | 840 | true, |
841 | 841 | true |
@@ -852,9 +852,9 @@ discard block |
||
852 | 852 | * @return string |
853 | 853 | * @throws \EE_Error |
854 | 854 | */ |
855 | - public function get_payment_row_html( $payment = null ) { |
|
855 | + public function get_payment_row_html($payment = null) { |
|
856 | 856 | $html = ''; |
857 | - if ( $payment instanceof EE_Payment ) { |
|
857 | + if ($payment instanceof EE_Payment) { |
|
858 | 858 | if ( |
859 | 859 | $payment->payment_method() instanceof EE_Payment_Method |
860 | 860 | && $payment->status() === EEM_Payment::status_id_failed |
@@ -863,31 +863,31 @@ discard block |
||
863 | 863 | // considering the registrant has made it to the Thank You page, |
864 | 864 | // any failed payments may actually be pending and the IPN is just slow |
865 | 865 | // so let's |
866 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
866 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
867 | 867 | } |
868 | 868 | $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined |
869 | - ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' |
|
869 | + ? '<br /><span class="small-text">'.$payment->gateway_response().'</span>' |
|
870 | 870 | : ''; |
871 | 871 | $html .= ' |
872 | 872 | <tr> |
873 | 873 | <td> |
874 | - ' . $payment->timestamp() . ' |
|
874 | + ' . $payment->timestamp().' |
|
875 | 875 | </td> |
876 | 876 | <td> |
877 | 877 | ' . ( |
878 | 878 | $payment->payment_method() instanceof EE_Payment_Method |
879 | 879 | ? $payment->payment_method()->name() |
880 | - : __( 'Unknown', 'event_espresso' ) |
|
881 | - ) . ' |
|
880 | + : __('Unknown', 'event_espresso') |
|
881 | + ).' |
|
882 | 882 | </td> |
883 | 883 | <td class="jst-rght"> |
884 | - ' . EEH_Template::format_currency( $payment->amount() ) . ' |
|
884 | + ' . EEH_Template::format_currency($payment->amount()).' |
|
885 | 885 | </td> |
886 | 886 | <td class="jst-rght" style="line-height:1;"> |
887 | - ' . $payment->pretty_status( true ) . $payment_declined_msg . ' |
|
887 | + ' . $payment->pretty_status(true).$payment_declined_msg.' |
|
888 | 888 | </td> |
889 | 889 | </tr>'; |
890 | - do_action( 'AHEE__thank_you_page_payment_details_template__after_each_payment', $payment ); |
|
890 | + do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
|
891 | 891 | } |
892 | 892 | return $html; |
893 | 893 | } |
@@ -902,14 +902,14 @@ discard block |
||
902 | 902 | * @return string |
903 | 903 | * @throws \EE_Error |
904 | 904 | */ |
905 | - public function get_payment_details( $payments = array() ) { |
|
905 | + public function get_payment_details($payments = array()) { |
|
906 | 906 | //prepare variables for displaying |
907 | 907 | $template_args = array(); |
908 | 908 | $template_args['transaction'] = $this->_current_txn; |
909 | 909 | $template_args['reg_url_link'] = $this->_reg_url_link; |
910 | 910 | $template_args['payments'] = array(); |
911 | - foreach ( $payments as $payment ) { |
|
912 | - $template_args['payments'][] = $this->get_payment_row_html( $payment ); |
|
911 | + foreach ($payments as $payment) { |
|
912 | + $template_args['payments'][] = $this->get_payment_row_html($payment); |
|
913 | 913 | } |
914 | 914 | //create a hacky payment object, but dont save it |
915 | 915 | $payment = EE_Payment::new_instance( |
@@ -922,8 +922,8 @@ discard block |
||
922 | 922 | ) |
923 | 923 | ); |
924 | 924 | $payment_method = $this->_current_txn->payment_method(); |
925 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
926 | - $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content( $payment ); |
|
925 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
926 | + $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment); |
|
927 | 927 | } else { |
928 | 928 | $template_args['gateway_content'] = ''; |
929 | 929 | } |
@@ -931,19 +931,19 @@ discard block |
||
931 | 931 | $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
932 | 932 | $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
933 | 933 | // verify template arguments |
934 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
935 | - EEH_Template_Validator::verify_isnt_null( $template_args['payments'], '$payments' ); |
|
934 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
935 | + EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); |
|
936 | 936 | EEH_Template_Validator::verify_isnt_null( |
937 | 937 | $template_args['show_try_pay_again_link'], |
938 | 938 | '$show_try_pay_again_link' |
939 | 939 | ); |
940 | - EEH_Template_Validator::verify_isnt_null( $template_args['gateway_content'], '$gateway_content' ); |
|
940 | + EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); |
|
941 | 941 | EEH_Template_Validator::verify_isnt_null( |
942 | 942 | $template_args['SPCO_payment_options_url'], |
943 | 943 | '$SPCO_payment_options_url' |
944 | 944 | ); |
945 | 945 | return EEH_Template::locate_template( |
946 | - THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', |
|
946 | + THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php', |
|
947 | 947 | $template_args, |
948 | 948 | true, |
949 | 949 | true |
@@ -960,11 +960,11 @@ discard block |
||
960 | 960 | * @return string |
961 | 961 | * @throws \EE_Error |
962 | 962 | */ |
963 | - public function get_new_payments( $payments = array() ) { |
|
963 | + public function get_new_payments($payments = array()) { |
|
964 | 964 | $payments_html = ''; |
965 | 965 | //prepare variables for displaying |
966 | - foreach ( $payments as $payment ) { |
|
967 | - $payments_html .= $this->get_payment_row_html( $payment ); |
|
966 | + foreach ($payments as $payment) { |
|
967 | + $payments_html .= $this->get_payment_row_html($payment); |
|
968 | 968 | } |
969 | 969 | return $payments_html; |
970 | 970 | } |