@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | <div id="espresso-thank-you-page-payment-details-dv"> |
19 | 19 | <?php |
20 | - if (! empty($payments)) { ?> |
|
20 | + if (! empty($payments)) { ?> |
|
21 | 21 | <table class="ee-table"> |
22 | 22 | <thead> |
23 | 23 | <tr> |
@@ -37,39 +37,39 @@ discard block |
||
37 | 37 | </thead> |
38 | 38 | <tbody> |
39 | 39 | <?php |
40 | - foreach ($payments as $payment) { |
|
41 | - echo wp_kses($payment, AllowedTags::getAllowedTags()); |
|
42 | - } |
|
43 | - ?> |
|
40 | + foreach ($payments as $payment) { |
|
41 | + echo wp_kses($payment, AllowedTags::getAllowedTags()); |
|
42 | + } |
|
43 | + ?> |
|
44 | 44 | </tbody> |
45 | 45 | </table> |
46 | 46 | <?php |
47 | - } else { |
|
48 | - if ($transaction->total()) { |
|
49 | - echo apply_filters( |
|
50 | - 'FHEE__payment_overview_template__no_payments_made', |
|
51 | - sprintf( |
|
52 | - esc_html__('%sNo payments towards this transaction have been received.%s', 'event_espresso'), |
|
53 | - '<p class="important-notice">', |
|
54 | - '</p>' |
|
55 | - ) |
|
56 | - ); |
|
57 | - do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction); |
|
58 | - } else { |
|
59 | - echo apply_filters( |
|
60 | - 'FHEE__payment_overview_template__no_payment_required', |
|
61 | - sprintf( |
|
62 | - esc_html__('%sNo payment is required for this transaction.%s', 'event_espresso'), |
|
63 | - '<p>', |
|
64 | - '</p>' |
|
65 | - ) |
|
66 | - ); |
|
67 | - do_action('AHEE__thank_you_page_payment_details_template__no_payment_required'); |
|
68 | - } |
|
69 | - } |
|
70 | - echo wp_kses($gateway_content, AllowedTags::getAllowedTags()); |
|
71 | - do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content); |
|
72 | - ?> |
|
47 | + } else { |
|
48 | + if ($transaction->total()) { |
|
49 | + echo apply_filters( |
|
50 | + 'FHEE__payment_overview_template__no_payments_made', |
|
51 | + sprintf( |
|
52 | + esc_html__('%sNo payments towards this transaction have been received.%s', 'event_espresso'), |
|
53 | + '<p class="important-notice">', |
|
54 | + '</p>' |
|
55 | + ) |
|
56 | + ); |
|
57 | + do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction); |
|
58 | + } else { |
|
59 | + echo apply_filters( |
|
60 | + 'FHEE__payment_overview_template__no_payment_required', |
|
61 | + sprintf( |
|
62 | + esc_html__('%sNo payment is required for this transaction.%s', 'event_espresso'), |
|
63 | + '<p>', |
|
64 | + '</p>' |
|
65 | + ) |
|
66 | + ); |
|
67 | + do_action('AHEE__thank_you_page_payment_details_template__no_payment_required'); |
|
68 | + } |
|
69 | + } |
|
70 | + echo wp_kses($gateway_content, AllowedTags::getAllowedTags()); |
|
71 | + do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content); |
|
72 | + ?> |
|
73 | 73 | |
74 | 74 | <br/> |
75 | 75 | <?php do_action('AHEE__thank_you_page_payment_details_template__after_payment_details'); ?> |
@@ -18,97 +18,97 @@ |
||
18 | 18 | </h2> |
19 | 19 | <h3> |
20 | 20 | <?php echo esc_html( |
21 | - sprintf( |
|
22 | - // translators: 1: number of events |
|
23 | - _n('%1$d Event', '%1$d Events', count($events), 'event_espresso'), |
|
24 | - count($events) |
|
25 | - ) |
|
26 | - ); |
|
21 | + sprintf( |
|
22 | + // translators: 1: number of events |
|
23 | + _n('%1$d Event', '%1$d Events', count($events), 'event_espresso'), |
|
24 | + count($events) |
|
25 | + ) |
|
26 | + ); |
|
27 | 27 | ?> |
28 | 28 | </h3> |
29 | 29 | <ul> |
30 | 30 | <?php |
31 | - foreach ($events as $event) { |
|
32 | - ?> |
|
31 | + foreach ($events as $event) { |
|
32 | + ?> |
|
33 | 33 | <li> |
34 | 34 | <?php echo esc_html($event->name()); ?> |
35 | 35 | </li> |
36 | 36 | <?php |
37 | - } |
|
38 | - ?> |
|
37 | + } |
|
38 | + ?> |
|
39 | 39 | </ul> |
40 | 40 | <h3> |
41 | 41 | <?php echo esc_html( |
42 | - sprintf( |
|
43 | - // translators: 1: number of datetimes |
|
44 | - _n('%1$d Datetime', '%1$d Datetimes', count($datetimes), 'event_espresso'), |
|
45 | - count($datetimes) |
|
46 | - ) |
|
47 | - ); |
|
42 | + sprintf( |
|
43 | + // translators: 1: number of datetimes |
|
44 | + _n('%1$d Datetime', '%1$d Datetimes', count($datetimes), 'event_espresso'), |
|
45 | + count($datetimes) |
|
46 | + ) |
|
47 | + ); |
|
48 | 48 | ?> |
49 | 49 | </h3> |
50 | 50 | <ul> |
51 | 51 | <?php |
52 | - foreach ($datetimes as $datetime) { |
|
53 | - ?> |
|
52 | + foreach ($datetimes as $datetime) { |
|
53 | + ?> |
|
54 | 54 | <li> |
55 | 55 | <?php echo esc_html($datetime->get_dtt_display_name(true)); ?> |
56 | 56 | </li> |
57 | 57 | <?php |
58 | - } |
|
59 | - ?> |
|
58 | + } |
|
59 | + ?> |
|
60 | 60 | </ul> |
61 | 61 | <h3> |
62 | 62 | <?php echo esc_html( |
63 | - sprintf( |
|
64 | - _n('%1$d Registration', '%1$d Registrations', $reg_count, 'event_espresso'), |
|
65 | - $reg_count |
|
66 | - ) |
|
67 | - ); |
|
63 | + sprintf( |
|
64 | + _n('%1$d Registration', '%1$d Registrations', $reg_count, 'event_espresso'), |
|
65 | + $reg_count |
|
66 | + ) |
|
67 | + ); |
|
68 | 68 | ?> |
69 | 69 | </h3> |
70 | 70 | <?php |
71 | 71 | if ($reg_count > count($registrations)) { |
72 | - ?> |
|
72 | + ?> |
|
73 | 73 | <p class="notice"> |
74 | 74 | <?php printf( |
75 | - esc_html__('Only showing first %1$d.', 'event_espresso'), |
|
76 | - count($registrations) |
|
77 | - ); |
|
78 | - ?> |
|
75 | + esc_html__('Only showing first %1$d.', 'event_espresso'), |
|
76 | + count($registrations) |
|
77 | + ); |
|
78 | + ?> |
|
79 | 79 | </p> |
80 | 80 | <?php |
81 | 81 | } |
82 | 82 | ?> |
83 | 83 | <?php |
84 | 84 | if ($reg_count > 0) { |
85 | - ?> |
|
85 | + ?> |
|
86 | 86 | <p> |
87 | 87 | <?php esc_html_e( |
88 | - 'Note: contacts will not be deleted, only their registrations for the enumerated events.', |
|
89 | - 'event_espresso' |
|
90 | - ); ?> |
|
88 | + 'Note: contacts will not be deleted, only their registrations for the enumerated events.', |
|
89 | + 'event_espresso' |
|
90 | + ); ?> |
|
91 | 91 | </p> |
92 | 92 | <?php |
93 | 93 | } |
94 | 94 | ?> |
95 | 95 | <ul> |
96 | 96 | <?php |
97 | - foreach ($registrations as $registration) { |
|
98 | - ?> |
|
97 | + foreach ($registrations as $registration) { |
|
98 | + ?> |
|
99 | 99 | <li> |
100 | 100 | <?php echo esc_html( |
101 | - sprintf( |
|
102 | - _x('%1$s (%2$d of %3$d)', 'Registration name (number of count)', 'event_espresso'), |
|
103 | - $registration->attendeeName(true), |
|
104 | - $registration->count(), |
|
105 | - $registration->group_size() |
|
106 | - ) |
|
107 | - ); ?> |
|
101 | + sprintf( |
|
102 | + _x('%1$s (%2$d of %3$d)', 'Registration name (number of count)', 'event_espresso'), |
|
103 | + $registration->attendeeName(true), |
|
104 | + $registration->count(), |
|
105 | + $registration->group_size() |
|
106 | + ) |
|
107 | + ); ?> |
|
108 | 108 | </li> |
109 | 109 | <?php |
110 | - } |
|
111 | - ?> |
|
110 | + } |
|
111 | + ?> |
|
112 | 112 | </ul> |
113 | 113 | <form action="<?php echo esc_url_raw($form_url); ?>" method="POST"> |
114 | 114 | <?php echo wp_kses($form->get_html_and_js(), AllowedTags::getWithFormTags()); ?> |
@@ -18,20 +18,20 @@ |
||
18 | 18 | <?php esc_html_e('Select from Venue Manager List', 'event_espresso'); ?> |
19 | 19 | </label> |
20 | 20 | <?php |
21 | - echo wp_kses($venue_selector, AllowedTags::getWithFormTags()); |
|
22 | - echo wp_kses($new_venue_link, AllowedTags::getWithFormTags()); |
|
23 | - foreach ($venues as $venue) : |
|
24 | - if (! $venue instanceof EE_Venue) { |
|
25 | - continue; |
|
26 | - } |
|
27 | - $selected = $evt_venue_id === $venue->ID() ? 'ee-venue-selected' : 'ee-venue-not-selected'; |
|
28 | - $edit_url = EE_Admin_Page::add_query_args_and_nonce( |
|
29 | - ['action' => 'edit', 'post' => $venue->ID()], |
|
30 | - EE_VENUES_ADMIN_URL |
|
31 | - ); |
|
32 | - $state_name = is_object($venue->state_obj()) ? $venue->state_obj()->name() : null; |
|
33 | - $country_name = is_object($venue->country_obj()) ? $venue->country_obj()->name() : null; |
|
34 | - ?> |
|
21 | + echo wp_kses($venue_selector, AllowedTags::getWithFormTags()); |
|
22 | + echo wp_kses($new_venue_link, AllowedTags::getWithFormTags()); |
|
23 | + foreach ($venues as $venue) : |
|
24 | + if (! $venue instanceof EE_Venue) { |
|
25 | + continue; |
|
26 | + } |
|
27 | + $selected = $evt_venue_id === $venue->ID() ? 'ee-venue-selected' : 'ee-venue-not-selected'; |
|
28 | + $edit_url = EE_Admin_Page::add_query_args_and_nonce( |
|
29 | + ['action' => 'edit', 'post' => $venue->ID()], |
|
30 | + EE_VENUES_ADMIN_URL |
|
31 | + ); |
|
32 | + $state_name = is_object($venue->state_obj()) ? $venue->state_obj()->name() : null; |
|
33 | + $country_name = is_object($venue->country_obj()) ? $venue->country_obj()->name() : null; |
|
34 | + ?> |
|
35 | 35 | <div class='eebox <?php echo sanitize_html_class($selected); ?>' id="eebox_<?php echo absint($venue->ID()); ?>"> |
36 | 36 | <p class='address-view'> |
37 | 37 | <span><?php esc_html_e('Address:', 'event_espresso'); ?> </span> |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | echo wp_kses($venue_selector, AllowedTags::getWithFormTags()); |
22 | 22 | echo wp_kses($new_venue_link, AllowedTags::getWithFormTags()); |
23 | 23 | foreach ($venues as $venue) : |
24 | - if (! $venue instanceof EE_Venue) { |
|
24 | + if ( ! $venue instanceof EE_Venue) { |
|
25 | 25 | continue; |
26 | 26 | } |
27 | 27 | $selected = $evt_venue_id === $venue->ID() ? 'ee-venue-selected' : 'ee-venue-not-selected'; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | <p class='address-view'> |
37 | 37 | <span><?php esc_html_e('Address:', 'event_espresso'); ?> </span> |
38 | 38 | <?php echo esc_html($venue->address()); ?> |
39 | - <?php echo ($venue->address2() ? '<br />' . esc_html($venue->address2()) : ''); ?> |
|
39 | + <?php echo ($venue->address2() ? '<br />'.esc_html($venue->address2()) : ''); ?> |
|
40 | 40 | <br /> |
41 | 41 | <span><?php esc_html_e('City:', 'event_espresso'); ?> </span> |
42 | 42 | <?php echo esc_html($venue->city()); ?> |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | use EventEspresso\core\services\request\sanitizers\AllowedTags; |
16 | 16 | |
17 | -$active_message = sprintf( |
|
17 | +$active_message = sprintf( |
|
18 | 18 | esc_html__( |
19 | 19 | 'The template for %1$s is currently %2$sactive%3$s.', |
20 | 20 | 'event_espresso' |
@@ -15,22 +15,22 @@ discard block |
||
15 | 15 | use EventEspresso\core\services\request\sanitizers\AllowedTags; |
16 | 16 | |
17 | 17 | $active_message = sprintf( |
18 | - esc_html__( |
|
19 | - 'The template for %1$s is currently %2$sactive%3$s.', |
|
20 | - 'event_espresso' |
|
21 | - ), |
|
22 | - $context_label, |
|
23 | - '<strong>', |
|
24 | - '</strong>' |
|
18 | + esc_html__( |
|
19 | + 'The template for %1$s is currently %2$sactive%3$s.', |
|
20 | + 'event_espresso' |
|
21 | + ), |
|
22 | + $context_label, |
|
23 | + '<strong>', |
|
24 | + '</strong>' |
|
25 | 25 | ); |
26 | 26 | $inactive_message = sprintf( |
27 | - esc_html__( |
|
28 | - 'The template for %1$s is currently %2$sinactive%3$s.', |
|
29 | - 'event_espresso' |
|
30 | - ), |
|
31 | - $context_label, |
|
32 | - '<strong>', |
|
33 | - '</strong>' |
|
27 | + esc_html__( |
|
28 | + 'The template for %1$s is currently %2$sinactive%3$s.', |
|
29 | + 'event_espresso' |
|
30 | + ), |
|
31 | + $context_label, |
|
32 | + '<strong>', |
|
33 | + '</strong>' |
|
34 | 34 | ); |
35 | 35 | |
36 | 36 | $context = esc_attr($context); |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | </span> |
45 | 45 | <span class="ee-on-off-toggle-label"> |
46 | 46 | <?php |
47 | - echo ($is_active |
|
48 | - ? wp_kses($active_message, AllowedTags::getAllowedTags()) |
|
49 | - : wp_kses($inactive_message, AllowedTags::getAllowedTags())); |
|
50 | - ?> |
|
47 | + echo ($is_active |
|
48 | + ? wp_kses($active_message, AllowedTags::getAllowedTags()) |
|
49 | + : wp_kses($inactive_message, AllowedTags::getAllowedTags())); |
|
50 | + ?> |
|
51 | 51 | </span> |
52 | 52 | <div class="hidden js-data"> |
53 | 53 | <span class="ee-active-message"><?php echo wp_kses($active_message, AllowedTags::getAllowedTags()); ?></span> |
@@ -15,23 +15,23 @@ |
||
15 | 15 | <div class="<?php echo esc_attr($messenger); ?>-content"> |
16 | 16 | <?php echo wp_kses($content, AllowedTags::getWithFormTags()); ?> |
17 | 17 | <?php if (empty($inactive_message_types) && empty($active_message_types)) : |
18 | - echo '<p>' |
|
19 | - . esc_html__( |
|
20 | - 'This messenger is not currently used with any message types for templates but merely adds to the shortcodes available for templates on other messenger and message types.', |
|
21 | - 'event_espresso' |
|
22 | - ) |
|
23 | - . '</p>'; |
|
24 | - else : ?> |
|
18 | + echo '<p>' |
|
19 | + . esc_html__( |
|
20 | + 'This messenger is not currently used with any message types for templates but merely adds to the shortcodes available for templates on other messenger and message types.', |
|
21 | + 'event_espresso' |
|
22 | + ) |
|
23 | + . '</p>'; |
|
24 | + else : ?> |
|
25 | 25 | <p class="active-on-message <?php echo esc_attr($hide_on_message); ?>"> |
26 | 26 | <?php printf( |
27 | - esc_html__( |
|
28 | - 'Below are message types that are currently %sactive%s with this messenger. Drag them over to the "Inactive Message Types" box to deactivate them.', |
|
29 | - 'event_espresso' |
|
30 | - ), |
|
31 | - '<strong>', |
|
32 | - '</strong>' |
|
33 | - ); |
|
34 | - ?> |
|
27 | + esc_html__( |
|
28 | + 'Below are message types that are currently %sactive%s with this messenger. Drag them over to the "Inactive Message Types" box to deactivate them.', |
|
29 | + 'event_espresso' |
|
30 | + ), |
|
31 | + '<strong>', |
|
32 | + '</strong>' |
|
33 | + ); |
|
34 | + ?> |
|
35 | 35 | <p> |
36 | 36 | <div<?php if ($active) : ?> |
37 | 37 | id="active-message-types" |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | protected function _extend_properties() |
66 | 66 | { |
67 | - define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/'); |
|
67 | + define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/'); |
|
68 | 68 | $this->_ajax_func = ['ee_msgs_create_new_custom' => 'create_new_custom']; |
69 | 69 | $this->_metaboxes = [ |
70 | 70 | 0 => [ |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | $this->_scripts_styles = [ |
80 | 80 | 'registers' => [ |
81 | 81 | 'events_msg_admin' => [ |
82 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js', |
|
82 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js', |
|
83 | 83 | 'depends' => ['ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array'], |
84 | 84 | ], |
85 | 85 | 'events_msg_admin_css' => [ |
86 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css', |
|
86 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css', |
|
87 | 87 | 'type' => 'css', |
88 | 88 | ], |
89 | 89 | ], |
@@ -155,18 +155,18 @@ discard block |
||
155 | 155 | ['action' => 'settings'], |
156 | 156 | EE_MSG_ADMIN_URL |
157 | 157 | ); |
158 | - $error_msg = sprintf( |
|
158 | + $error_msg = sprintf( |
|
159 | 159 | esc_html__( |
160 | 160 | 'There are no active messengers. So no notifications will go out for %1$sany%2$s events. You will want to %3$sActivate a Messenger%4$s.', |
161 | 161 | 'event_espresso' |
162 | 162 | ), |
163 | 163 | '<strong>', |
164 | 164 | '</strong>', |
165 | - '<a href="' . esc_url_raw($msg_activate_url) . '">', |
|
165 | + '<a href="'.esc_url_raw($msg_activate_url).'">', |
|
166 | 166 | '</a>' |
167 | 167 | ); |
168 | - $error_content = '<div class="error"><p>' . $error_msg . '</p></div>'; |
|
169 | - $internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>'; |
|
168 | + $error_content = '<div class="error"><p>'.$error_msg.'</p></div>'; |
|
169 | + $internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>'; |
|
170 | 170 | |
171 | 171 | echo wp_kses($error_content, AllowedTags::getAllowedTags()); |
172 | 172 | echo wp_kses($internal_content, AllowedTags::getAllowedTags()); |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | ['event' => $EVT_ID] |
188 | 188 | ); |
189 | 189 | |
190 | - if (! empty($tab_content)) { |
|
191 | - $tabs[ $name ] = $tab_content; |
|
190 | + if ( ! empty($tab_content)) { |
|
191 | + $tabs[$name] = $tab_content; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $notices = ' |
202 | 202 | <div id="espresso-ajax-loading" class="ajax-loader-grey"> |
203 | 203 | <span class="ee-spinner ee-spin"></span> |
204 | - <span class="hidden">' . esc_html__('loading...', 'event_espresso') . '</span> |
|
204 | + <span class="hidden">' . esc_html__('loading...', 'event_espresso').'</span> |
|
205 | 205 | </div> |
206 | 206 | <div class="ee-notices"></div>'; |
207 | 207 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | } |
211 | 211 | |
212 | 212 | do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content'); |
213 | - echo wp_kses($notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>', AllowedTags::getWithFormTags()); |
|
213 | + echo wp_kses($notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>', AllowedTags::getWithFormTags()); |
|
214 | 214 | do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content'); |
215 | 215 | return ''; |
216 | 216 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function create_new_custom() |
230 | 230 | { |
231 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { |
|
231 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { |
|
232 | 232 | wp_die(esc_html__('You don\'t have privileges to do this action', 'event_espresso')); |
233 | 233 | } |
234 | 234 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | public function edit_admin_footer() |
272 | 272 | { |
273 | 273 | EEH_Template::display_template( |
274 | - EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php' |
|
274 | + EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php' |
|
275 | 275 | ); |
276 | 276 | } |
277 | 277 |
@@ -15,293 +15,293 @@ |
||
15 | 15 | */ |
16 | 16 | class espresso_events_Messages_Hooks_Extend extends espresso_events_Messages_Hooks |
17 | 17 | { |
18 | - /** |
|
19 | - * @var Messages_Admin_Page |
|
20 | - */ |
|
21 | - protected $_page_object; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * espresso_events_Messages_Hooks_Extend constructor. |
|
26 | - * |
|
27 | - * @param EE_Admin_Page $admin_page |
|
28 | - * @throws EE_Error |
|
29 | - */ |
|
30 | - public function __construct(EE_Admin_Page $admin_page) |
|
31 | - { |
|
32 | - /** |
|
33 | - * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages |
|
34 | - */ |
|
35 | - if ( |
|
36 | - ! EE_Registry::instance()->CAP->current_user_can( |
|
37 | - 'ee_edit_messages', |
|
38 | - 'messages_events_editor_metabox' |
|
39 | - ) |
|
40 | - ) { |
|
41 | - return; |
|
42 | - } |
|
43 | - add_filter( |
|
44 | - 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
45 | - [$this, 'caf_updates'], |
|
46 | - 10 |
|
47 | - ); |
|
48 | - add_action( |
|
49 | - 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', |
|
50 | - [$this, 'duplicate_custom_message_settings'], |
|
51 | - 10, |
|
52 | - 2 |
|
53 | - ); |
|
54 | - parent::__construct($admin_page); |
|
55 | - } |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * extending the properties set in espresso_events_Messages_Hooks |
|
60 | - * |
|
61 | - * @access protected |
|
62 | - * @return void |
|
63 | - */ |
|
64 | - protected function _extend_properties() |
|
65 | - { |
|
66 | - define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/'); |
|
67 | - $this->_ajax_func = ['ee_msgs_create_new_custom' => 'create_new_custom']; |
|
68 | - $this->_metaboxes = [ |
|
69 | - 0 => [ |
|
70 | - 'page_route' => ['edit', 'create_new'], |
|
71 | - 'func' => 'messages_metabox', |
|
72 | - 'label' => esc_html__('Notifications', 'event_espresso'), |
|
73 | - 'priority' => 'high', |
|
74 | - ], |
|
75 | - ]; |
|
76 | - |
|
77 | - // see explanation for layout in EE_Admin_Hooks |
|
78 | - $this->_scripts_styles = [ |
|
79 | - 'registers' => [ |
|
80 | - 'events_msg_admin' => [ |
|
81 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js', |
|
82 | - 'depends' => ['ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array'], |
|
83 | - ], |
|
84 | - 'events_msg_admin_css' => [ |
|
85 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css', |
|
86 | - 'type' => 'css', |
|
87 | - ], |
|
88 | - ], |
|
89 | - 'enqueues' => [ |
|
90 | - 'events_msg_admin' => ['edit', 'create_new'], |
|
91 | - 'events_msg_admin_css' => ['edit', 'create_new'], |
|
92 | - ], |
|
93 | - ]; |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - public function caf_updates($update_callbacks) |
|
98 | - { |
|
99 | - $update_callbacks[] = [$this, 'attach_evt_message_templates']; |
|
100 | - return $update_callbacks; |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - /** |
|
105 | - * Handles attaching Message Templates to the Event on save. |
|
106 | - * |
|
107 | - * @param EE_Event $event EE event object |
|
108 | - * @param array $data The request data from the form |
|
109 | - * @return bool success or fail |
|
110 | - * @throws EE_Error |
|
111 | - * @throws ReflectionException |
|
112 | - */ |
|
113 | - public function attach_evt_message_templates(EE_Event $event, array $data): bool |
|
114 | - { |
|
115 | - $success = true; |
|
116 | - if (isset($data['event_message_templates_relation'])) { |
|
117 | - // first get all existing relations on the Event for message types. |
|
118 | - $existing_templates = EEM_Event_Message_Template::instance()->messageTemplateGroupIDsForEvent($event); |
|
119 | - $current_templates = $data['event_message_templates_relation']; |
|
120 | - // new templates are those in the $current_templates array that don't exist in $existing_templates |
|
121 | - $templates_to_add = array_diff($current_templates, $existing_templates); |
|
122 | - foreach ($templates_to_add as $template_to_add) { |
|
123 | - $added_template = $event->_add_relation_to($template_to_add, 'Message_Template_Group'); |
|
124 | - // toggle success to false if we don't get back a template group object |
|
125 | - $success = $added_template instanceof EE_Message_Template_Group ? $success : false; |
|
126 | - } |
|
127 | - // templates to remove are those in the $existing_templates array that don't exist in $current_templates |
|
128 | - $templates_to_remove = array_diff($existing_templates, $current_templates); |
|
129 | - foreach ($templates_to_remove as $template_to_remove) { |
|
130 | - $removed_template = $event->_remove_relation_to($template_to_remove, 'Message_Template_Group'); |
|
131 | - // toggle success to false if we don't get back a template group object |
|
132 | - $success = $removed_template instanceof EE_Message_Template_Group ? $success : false; |
|
133 | - } |
|
134 | - } |
|
135 | - return $success; |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * @param $event |
|
141 | - * @param $callback_args |
|
142 | - * @return string |
|
143 | - * @throws EE_Error |
|
144 | - * @throws ReflectionException |
|
145 | - */ |
|
146 | - public function messages_metabox($event, $callback_args) |
|
147 | - { |
|
148 | - // convert 'evt_id' to 'EVT_ID' |
|
149 | - $EVT_ID = $this->request->getRequestParam('EVT_ID', 0, 'int'); |
|
150 | - $EVT_ID = $this->request->getRequestParam('post', $EVT_ID, 'int'); |
|
151 | - $EVT_ID = $this->request->getRequestParam('evt_id', $EVT_ID, 'int'); |
|
152 | - $this->request->setRequestParam('EVT_ID', $EVT_ID); |
|
153 | - |
|
154 | - // get the active messengers (b/c messenger objects have the active message templates) |
|
155 | - /** @type EE_Message_Resource_Manager $message_resource_manager */ |
|
156 | - $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
157 | - $active_messengers = $message_resource_manager->active_messengers(); |
|
158 | - $tabs = []; |
|
159 | - |
|
160 | - // empty messengers? |
|
161 | - // Note message types will always have at least one available because every messenger has a default message type |
|
162 | - // associated with it (payment) if no other message types are selected. |
|
163 | - if (empty($active_messengers)) { |
|
164 | - $msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( |
|
165 | - ['action' => 'settings'], |
|
166 | - EE_MSG_ADMIN_URL |
|
167 | - ); |
|
168 | - $error_msg = sprintf( |
|
169 | - esc_html__( |
|
170 | - 'There are no active messengers. So no notifications will go out for %1$sany%2$s events. You will want to %3$sActivate a Messenger%4$s.', |
|
171 | - 'event_espresso' |
|
172 | - ), |
|
173 | - '<strong>', |
|
174 | - '</strong>', |
|
175 | - '<a href="' . esc_url_raw($msg_activate_url) . '">', |
|
176 | - '</a>' |
|
177 | - ); |
|
178 | - $error_content = '<div class="error"><p>' . $error_msg . '</p></div>'; |
|
179 | - $internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>'; |
|
180 | - |
|
181 | - echo wp_kses($error_content, AllowedTags::getAllowedTags()); |
|
182 | - echo wp_kses($internal_content, AllowedTags::getAllowedTags()); |
|
183 | - return ''; |
|
184 | - } |
|
185 | - |
|
186 | - // get content for active messengers |
|
187 | - foreach ($active_messengers as $name => $messenger) { |
|
188 | - // first check if there are any active message types for this messenger. |
|
189 | - $active_mts = $message_resource_manager->get_active_message_types_for_messenger($name); |
|
190 | - if (empty($active_mts)) { |
|
191 | - continue; |
|
192 | - } |
|
193 | - |
|
194 | - $tab_content = $messenger->get_messenger_admin_page_content( |
|
195 | - 'events', |
|
196 | - 'edit', |
|
197 | - ['event' => $EVT_ID] |
|
198 | - ); |
|
199 | - |
|
200 | - if (! empty($tab_content)) { |
|
201 | - $tabs[ $name ] = $tab_content; |
|
202 | - } |
|
203 | - } |
|
204 | - |
|
205 | - // we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper. |
|
206 | - $tabbed_content = EEH_Tabbed_Content::display($tabs); |
|
207 | - if ($tabbed_content instanceof WP_Error) { |
|
208 | - $tabbed_content = $tabbed_content->get_error_message(); |
|
209 | - } |
|
210 | - |
|
211 | - $notices = ' |
|
18 | + /** |
|
19 | + * @var Messages_Admin_Page |
|
20 | + */ |
|
21 | + protected $_page_object; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * espresso_events_Messages_Hooks_Extend constructor. |
|
26 | + * |
|
27 | + * @param EE_Admin_Page $admin_page |
|
28 | + * @throws EE_Error |
|
29 | + */ |
|
30 | + public function __construct(EE_Admin_Page $admin_page) |
|
31 | + { |
|
32 | + /** |
|
33 | + * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages |
|
34 | + */ |
|
35 | + if ( |
|
36 | + ! EE_Registry::instance()->CAP->current_user_can( |
|
37 | + 'ee_edit_messages', |
|
38 | + 'messages_events_editor_metabox' |
|
39 | + ) |
|
40 | + ) { |
|
41 | + return; |
|
42 | + } |
|
43 | + add_filter( |
|
44 | + 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
45 | + [$this, 'caf_updates'], |
|
46 | + 10 |
|
47 | + ); |
|
48 | + add_action( |
|
49 | + 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', |
|
50 | + [$this, 'duplicate_custom_message_settings'], |
|
51 | + 10, |
|
52 | + 2 |
|
53 | + ); |
|
54 | + parent::__construct($admin_page); |
|
55 | + } |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * extending the properties set in espresso_events_Messages_Hooks |
|
60 | + * |
|
61 | + * @access protected |
|
62 | + * @return void |
|
63 | + */ |
|
64 | + protected function _extend_properties() |
|
65 | + { |
|
66 | + define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/'); |
|
67 | + $this->_ajax_func = ['ee_msgs_create_new_custom' => 'create_new_custom']; |
|
68 | + $this->_metaboxes = [ |
|
69 | + 0 => [ |
|
70 | + 'page_route' => ['edit', 'create_new'], |
|
71 | + 'func' => 'messages_metabox', |
|
72 | + 'label' => esc_html__('Notifications', 'event_espresso'), |
|
73 | + 'priority' => 'high', |
|
74 | + ], |
|
75 | + ]; |
|
76 | + |
|
77 | + // see explanation for layout in EE_Admin_Hooks |
|
78 | + $this->_scripts_styles = [ |
|
79 | + 'registers' => [ |
|
80 | + 'events_msg_admin' => [ |
|
81 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js', |
|
82 | + 'depends' => ['ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array'], |
|
83 | + ], |
|
84 | + 'events_msg_admin_css' => [ |
|
85 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css', |
|
86 | + 'type' => 'css', |
|
87 | + ], |
|
88 | + ], |
|
89 | + 'enqueues' => [ |
|
90 | + 'events_msg_admin' => ['edit', 'create_new'], |
|
91 | + 'events_msg_admin_css' => ['edit', 'create_new'], |
|
92 | + ], |
|
93 | + ]; |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + public function caf_updates($update_callbacks) |
|
98 | + { |
|
99 | + $update_callbacks[] = [$this, 'attach_evt_message_templates']; |
|
100 | + return $update_callbacks; |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + /** |
|
105 | + * Handles attaching Message Templates to the Event on save. |
|
106 | + * |
|
107 | + * @param EE_Event $event EE event object |
|
108 | + * @param array $data The request data from the form |
|
109 | + * @return bool success or fail |
|
110 | + * @throws EE_Error |
|
111 | + * @throws ReflectionException |
|
112 | + */ |
|
113 | + public function attach_evt_message_templates(EE_Event $event, array $data): bool |
|
114 | + { |
|
115 | + $success = true; |
|
116 | + if (isset($data['event_message_templates_relation'])) { |
|
117 | + // first get all existing relations on the Event for message types. |
|
118 | + $existing_templates = EEM_Event_Message_Template::instance()->messageTemplateGroupIDsForEvent($event); |
|
119 | + $current_templates = $data['event_message_templates_relation']; |
|
120 | + // new templates are those in the $current_templates array that don't exist in $existing_templates |
|
121 | + $templates_to_add = array_diff($current_templates, $existing_templates); |
|
122 | + foreach ($templates_to_add as $template_to_add) { |
|
123 | + $added_template = $event->_add_relation_to($template_to_add, 'Message_Template_Group'); |
|
124 | + // toggle success to false if we don't get back a template group object |
|
125 | + $success = $added_template instanceof EE_Message_Template_Group ? $success : false; |
|
126 | + } |
|
127 | + // templates to remove are those in the $existing_templates array that don't exist in $current_templates |
|
128 | + $templates_to_remove = array_diff($existing_templates, $current_templates); |
|
129 | + foreach ($templates_to_remove as $template_to_remove) { |
|
130 | + $removed_template = $event->_remove_relation_to($template_to_remove, 'Message_Template_Group'); |
|
131 | + // toggle success to false if we don't get back a template group object |
|
132 | + $success = $removed_template instanceof EE_Message_Template_Group ? $success : false; |
|
133 | + } |
|
134 | + } |
|
135 | + return $success; |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * @param $event |
|
141 | + * @param $callback_args |
|
142 | + * @return string |
|
143 | + * @throws EE_Error |
|
144 | + * @throws ReflectionException |
|
145 | + */ |
|
146 | + public function messages_metabox($event, $callback_args) |
|
147 | + { |
|
148 | + // convert 'evt_id' to 'EVT_ID' |
|
149 | + $EVT_ID = $this->request->getRequestParam('EVT_ID', 0, 'int'); |
|
150 | + $EVT_ID = $this->request->getRequestParam('post', $EVT_ID, 'int'); |
|
151 | + $EVT_ID = $this->request->getRequestParam('evt_id', $EVT_ID, 'int'); |
|
152 | + $this->request->setRequestParam('EVT_ID', $EVT_ID); |
|
153 | + |
|
154 | + // get the active messengers (b/c messenger objects have the active message templates) |
|
155 | + /** @type EE_Message_Resource_Manager $message_resource_manager */ |
|
156 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
157 | + $active_messengers = $message_resource_manager->active_messengers(); |
|
158 | + $tabs = []; |
|
159 | + |
|
160 | + // empty messengers? |
|
161 | + // Note message types will always have at least one available because every messenger has a default message type |
|
162 | + // associated with it (payment) if no other message types are selected. |
|
163 | + if (empty($active_messengers)) { |
|
164 | + $msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( |
|
165 | + ['action' => 'settings'], |
|
166 | + EE_MSG_ADMIN_URL |
|
167 | + ); |
|
168 | + $error_msg = sprintf( |
|
169 | + esc_html__( |
|
170 | + 'There are no active messengers. So no notifications will go out for %1$sany%2$s events. You will want to %3$sActivate a Messenger%4$s.', |
|
171 | + 'event_espresso' |
|
172 | + ), |
|
173 | + '<strong>', |
|
174 | + '</strong>', |
|
175 | + '<a href="' . esc_url_raw($msg_activate_url) . '">', |
|
176 | + '</a>' |
|
177 | + ); |
|
178 | + $error_content = '<div class="error"><p>' . $error_msg . '</p></div>'; |
|
179 | + $internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>'; |
|
180 | + |
|
181 | + echo wp_kses($error_content, AllowedTags::getAllowedTags()); |
|
182 | + echo wp_kses($internal_content, AllowedTags::getAllowedTags()); |
|
183 | + return ''; |
|
184 | + } |
|
185 | + |
|
186 | + // get content for active messengers |
|
187 | + foreach ($active_messengers as $name => $messenger) { |
|
188 | + // first check if there are any active message types for this messenger. |
|
189 | + $active_mts = $message_resource_manager->get_active_message_types_for_messenger($name); |
|
190 | + if (empty($active_mts)) { |
|
191 | + continue; |
|
192 | + } |
|
193 | + |
|
194 | + $tab_content = $messenger->get_messenger_admin_page_content( |
|
195 | + 'events', |
|
196 | + 'edit', |
|
197 | + ['event' => $EVT_ID] |
|
198 | + ); |
|
199 | + |
|
200 | + if (! empty($tab_content)) { |
|
201 | + $tabs[ $name ] = $tab_content; |
|
202 | + } |
|
203 | + } |
|
204 | + |
|
205 | + // we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper. |
|
206 | + $tabbed_content = EEH_Tabbed_Content::display($tabs); |
|
207 | + if ($tabbed_content instanceof WP_Error) { |
|
208 | + $tabbed_content = $tabbed_content->get_error_message(); |
|
209 | + } |
|
210 | + |
|
211 | + $notices = ' |
|
212 | 212 | <div id="espresso-ajax-loading" class="ajax-loader-grey"> |
213 | 213 | <span class="ee-spinner ee-spin"></span> |
214 | 214 | <span class="hidden">' . esc_html__('loading...', 'event_espresso') . '</span> |
215 | 215 | </div> |
216 | 216 | <div class="ee-notices"></div>'; |
217 | 217 | |
218 | - if (defined('DOING_AJAX')) { |
|
219 | - return $tabbed_content; |
|
220 | - } |
|
221 | - |
|
222 | - do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content'); |
|
223 | - echo wp_kses($notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>', AllowedTags::getWithFormTags()); |
|
224 | - do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content'); |
|
225 | - return ''; |
|
226 | - } |
|
227 | - |
|
228 | - |
|
229 | - /** |
|
230 | - * Ajax callback for ee_msgs_create_new_custom ajax request. |
|
231 | - * Takes incoming GRP_ID and name and description values from ajax request |
|
232 | - * to create a new custom template based off of the incoming GRP_ID. |
|
233 | - * |
|
234 | - * @access public |
|
235 | - * @return void |
|
236 | - * @throws EE_Error |
|
237 | - * @throws ReflectionException |
|
238 | - */ |
|
239 | - public function create_new_custom() |
|
240 | - { |
|
241 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { |
|
242 | - wp_die(esc_html__('You don\'t have privileges to do this action', 'event_espresso')); |
|
243 | - } |
|
244 | - |
|
245 | - /** @var RequestInterface $request */ |
|
246 | - $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
247 | - |
|
248 | - // let's clean up the request data a bit for downstream usage of name and description. |
|
249 | - $templateName = $this->request->getRequestParam('custom_template_args[MTP_name]', ''); |
|
250 | - $request->setRequestParam('templateName', $templateName); |
|
251 | - $templateDescription = $this->request->getRequestParam('custom_template_args[MTP_description]', ''); |
|
252 | - $request->setRequestParam('templateDescription', $templateDescription); |
|
253 | - |
|
254 | - // set EE_Admin_Page object (see method details in EE_Admin_Hooks parent |
|
255 | - $this->_set_page_object(); |
|
256 | - |
|
257 | - // is this a template switch if so EE_Admin_Page child needs this object |
|
258 | - $this->_page_object->set_hook_object($this); |
|
259 | - |
|
260 | - $this->_page_object->add_message_template( |
|
261 | - $this->request->getRequestParam('messageType', ''), |
|
262 | - $this->request->getRequestParam('messenger', ''), |
|
263 | - $this->request->getRequestParam('group_ID', 0, 'int') |
|
264 | - ); |
|
265 | - } |
|
266 | - |
|
267 | - |
|
268 | - public function create_new_admin_footer() |
|
269 | - { |
|
270 | - $this->edit_admin_footer(); |
|
271 | - } |
|
272 | - |
|
273 | - |
|
274 | - /** |
|
275 | - * This is the dynamic method for this class |
|
276 | - * that will end up hooking into the 'admin_footer' hook on the 'edit_event' route in the events page. |
|
277 | - * |
|
278 | - * @return void |
|
279 | - * @throws DomainException |
|
280 | - */ |
|
281 | - public function edit_admin_footer() |
|
282 | - { |
|
283 | - EEH_Template::display_template( |
|
284 | - EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php' |
|
285 | - ); |
|
286 | - } |
|
287 | - |
|
288 | - |
|
289 | - /** |
|
290 | - * Callback for AHEE__Extend_Events_Admin_Page___duplicate_event__after hook used to ensure new events duplicate |
|
291 | - * the assigned custom message templates. |
|
292 | - * |
|
293 | - * @param EE_Event $new_event |
|
294 | - * @param EE_Event $original_event |
|
295 | - * @throws EE_Error |
|
296 | - * @throws ReflectionException |
|
297 | - */ |
|
298 | - public function duplicate_custom_message_settings(EE_Event $new_event, EE_Event $original_event) |
|
299 | - { |
|
300 | - $message_template_groups = $original_event->get_many_related('Message_Template_Group'); |
|
301 | - foreach ($message_template_groups as $message_template_group) { |
|
302 | - $new_event->_add_relation_to($message_template_group, 'Message_Template_Group'); |
|
303 | - } |
|
304 | - // save new event |
|
305 | - $new_event->save(); |
|
306 | - } |
|
218 | + if (defined('DOING_AJAX')) { |
|
219 | + return $tabbed_content; |
|
220 | + } |
|
221 | + |
|
222 | + do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content'); |
|
223 | + echo wp_kses($notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>', AllowedTags::getWithFormTags()); |
|
224 | + do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content'); |
|
225 | + return ''; |
|
226 | + } |
|
227 | + |
|
228 | + |
|
229 | + /** |
|
230 | + * Ajax callback for ee_msgs_create_new_custom ajax request. |
|
231 | + * Takes incoming GRP_ID and name and description values from ajax request |
|
232 | + * to create a new custom template based off of the incoming GRP_ID. |
|
233 | + * |
|
234 | + * @access public |
|
235 | + * @return void |
|
236 | + * @throws EE_Error |
|
237 | + * @throws ReflectionException |
|
238 | + */ |
|
239 | + public function create_new_custom() |
|
240 | + { |
|
241 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { |
|
242 | + wp_die(esc_html__('You don\'t have privileges to do this action', 'event_espresso')); |
|
243 | + } |
|
244 | + |
|
245 | + /** @var RequestInterface $request */ |
|
246 | + $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
247 | + |
|
248 | + // let's clean up the request data a bit for downstream usage of name and description. |
|
249 | + $templateName = $this->request->getRequestParam('custom_template_args[MTP_name]', ''); |
|
250 | + $request->setRequestParam('templateName', $templateName); |
|
251 | + $templateDescription = $this->request->getRequestParam('custom_template_args[MTP_description]', ''); |
|
252 | + $request->setRequestParam('templateDescription', $templateDescription); |
|
253 | + |
|
254 | + // set EE_Admin_Page object (see method details in EE_Admin_Hooks parent |
|
255 | + $this->_set_page_object(); |
|
256 | + |
|
257 | + // is this a template switch if so EE_Admin_Page child needs this object |
|
258 | + $this->_page_object->set_hook_object($this); |
|
259 | + |
|
260 | + $this->_page_object->add_message_template( |
|
261 | + $this->request->getRequestParam('messageType', ''), |
|
262 | + $this->request->getRequestParam('messenger', ''), |
|
263 | + $this->request->getRequestParam('group_ID', 0, 'int') |
|
264 | + ); |
|
265 | + } |
|
266 | + |
|
267 | + |
|
268 | + public function create_new_admin_footer() |
|
269 | + { |
|
270 | + $this->edit_admin_footer(); |
|
271 | + } |
|
272 | + |
|
273 | + |
|
274 | + /** |
|
275 | + * This is the dynamic method for this class |
|
276 | + * that will end up hooking into the 'admin_footer' hook on the 'edit_event' route in the events page. |
|
277 | + * |
|
278 | + * @return void |
|
279 | + * @throws DomainException |
|
280 | + */ |
|
281 | + public function edit_admin_footer() |
|
282 | + { |
|
283 | + EEH_Template::display_template( |
|
284 | + EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php' |
|
285 | + ); |
|
286 | + } |
|
287 | + |
|
288 | + |
|
289 | + /** |
|
290 | + * Callback for AHEE__Extend_Events_Admin_Page___duplicate_event__after hook used to ensure new events duplicate |
|
291 | + * the assigned custom message templates. |
|
292 | + * |
|
293 | + * @param EE_Event $new_event |
|
294 | + * @param EE_Event $original_event |
|
295 | + * @throws EE_Error |
|
296 | + * @throws ReflectionException |
|
297 | + */ |
|
298 | + public function duplicate_custom_message_settings(EE_Event $new_event, EE_Event $original_event) |
|
299 | + { |
|
300 | + $message_template_groups = $original_event->get_many_related('Message_Template_Group'); |
|
301 | + foreach ($message_template_groups as $message_template_group) { |
|
302 | + $new_event->_add_relation_to($message_template_group, 'Message_Template_Group'); |
|
303 | + } |
|
304 | + // save new event |
|
305 | + $new_event->save(); |
|
306 | + } |
|
307 | 307 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | </select> |
59 | 59 | |
60 | 60 | <!-- events if we don't have an EVENT_ID --> |
61 | - <?php if (! empty($active_events)) : ?> |
|
61 | + <?php if ( ! empty($active_events)) : ?> |
|
62 | 62 | <label for="EVT_ID_select"><?php esc_html_e('Select Event', 'event_espresso'); ?></label> |
63 | 63 | <select name="EVT_ID" id="EVT_ID_select"> |
64 | 64 | <?php foreach ($active_events as $event) : ?> |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | $header = $event_name |
16 | - ? sprintf( |
|
17 | - /* translators: %s: event name */ |
|
18 | - esc_html__('%1$s Custom Template', 'event_espresso'), |
|
19 | - $event_name |
|
20 | - ) |
|
21 | - : ''; |
|
16 | + ? sprintf( |
|
17 | + /* translators: %s: event name */ |
|
18 | + esc_html__('%1$s Custom Template', 'event_espresso'), |
|
19 | + $event_name |
|
20 | + ) |
|
21 | + : ''; |
|
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <div id="admin-primary-mbox-dv" class="admin-primary-mbox-dv"> |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | > |
36 | 36 | <input type="hidden" id="evt_id" name="EVT_ID" value="<?php echo absint($EVT_ID) ?: ''; ?>" /> |
37 | 37 | <?php |
38 | - if (isset($hidden_fields)) { |
|
39 | - echo wp_kses($hidden_fields, AllowedTags::getWithFormTags()); |
|
40 | - } ?> |
|
38 | + if (isset($hidden_fields)) { |
|
39 | + echo wp_kses($hidden_fields, AllowedTags::getWithFormTags()); |
|
40 | + } ?> |
|
41 | 41 | <!--active_messengers --> |
42 | 42 | <label for="MTP-messenger"><?php esc_html_e('Select Messenger', 'event_espresso'); ?></label> |
43 | 43 | <select name="MTP_messenger" id="MTP-messenger"> |
@@ -16,13 +16,13 @@ |
||
16 | 16 | <div class="ee-new-registration-step-content"> |
17 | 17 | <?php echo wp_kses($content, AllowedTags::getWithFormTags()); ?> |
18 | 18 | <?php |
19 | - if ( |
|
20 | - $show_notification_toggle |
|
21 | - && EE_Registry::instance()->CAP->current_user_can( |
|
22 | - 'ee_send_message', |
|
23 | - 'registration_message_type' |
|
24 | - ) |
|
25 | - ) : ?> |
|
19 | + if ( |
|
20 | + $show_notification_toggle |
|
21 | + && EE_Registry::instance()->CAP->current_user_can( |
|
22 | + 'ee_send_message', |
|
23 | + 'registration_message_type' |
|
24 | + ) |
|
25 | + ) : ?> |
|
26 | 26 | <div class="ee-attention"> |
27 | 27 | <label for="txn_reg_status_change" class="last"> |
28 | 28 | <?php esc_html_e('Send Related Messages?', 'event_espresso'); ?> |
@@ -14,56 +14,56 @@ discard block |
||
14 | 14 | |
15 | 15 | <div id="single-page-checkout" class="ui-widget"> |
16 | 16 | <?php do_action( |
17 | - 'AHEE__registration_page_registration_questions__template__after_spco_attendee_information_header' |
|
18 | - ) ?> |
|
17 | + 'AHEE__registration_page_registration_questions__template__after_spco_attendee_information_header' |
|
18 | + ) ?> |
|
19 | 19 | <div id="spco-attendee_information-dv" class="spco-step-dv"> |
20 | 20 | |
21 | 21 | <p id="spco-attendee_information-pg" class="spco-steps-pg small-text drk-grey-text"> |
22 | 22 | <?php printf( |
23 | - esc_html__( |
|
24 | - 'In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', |
|
25 | - 'event_espresso' |
|
26 | - ), |
|
27 | - '<br />', |
|
28 | - '<span class="asterisk">*</span>' |
|
29 | - ); ?> |
|
23 | + esc_html__( |
|
24 | + 'In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', |
|
25 | + 'event_espresso' |
|
26 | + ), |
|
27 | + '<br />', |
|
28 | + '<span class="asterisk">*</span>' |
|
29 | + ); ?> |
|
30 | 30 | </p> |
31 | 31 | |
32 | 32 | <?php |
33 | - global $css_class; |
|
34 | - $att_nmbr = 0; |
|
35 | - $prev_event = ''; |
|
36 | - |
|
37 | - if ($event_queue['total_items'] > 0) { |
|
38 | - foreach ($event_queue['items'] as $line_item => $item) { |
|
39 | - $att_nmbr++; |
|
40 | - if ($item['attendee_questions'] != '') { ?> |
|
33 | + global $css_class; |
|
34 | + $att_nmbr = 0; |
|
35 | + $prev_event = ''; |
|
36 | + |
|
37 | + if ($event_queue['total_items'] > 0) { |
|
38 | + foreach ($event_queue['items'] as $line_item => $item) { |
|
39 | + $att_nmbr++; |
|
40 | + if ($item['attendee_questions'] != '') { ?> |
|
41 | 41 | <div id="spco-attendee-panel-dv-<?php echo esc_attr($line_item); ?>" class="spco-attendee-panel-dv"> |
42 | 42 | <?php |
43 | - if ($item['ticket']->name() != $prev_event) { ?> |
|
43 | + if ($item['ticket']->name() != $prev_event) { ?> |
|
44 | 44 | <p class="spco-ticket-info-pg"> |
45 | 45 | <?php |
46 | - echo esc_html($item['ticket']->name()) . ': '; |
|
47 | - echo esc_html( |
|
48 | - EEH_Template::format_currency($item['ticket']->price(), false, false) |
|
49 | - ); |
|
50 | - $qty_price = $item['ticket']->price() * $ticket_count[ $item['ticket']->ID() ]; |
|
51 | - echo ($item['ticket']->qty() |
|
52 | - ? ' x ' |
|
53 | - . sprintf( |
|
54 | - /* translators: %s: ticket count */ |
|
55 | - esc_html__('%1$s tickets', 'event_espresso'), |
|
56 | - absint($ticket_count[ $item['ticket']->ID() ]) |
|
57 | - ) |
|
58 | - . ' = ' |
|
59 | - . EEH_Template::format_currency($qty_price) |
|
60 | - : ''); |
|
61 | - echo ($item['ticket']->description() |
|
62 | - ? '<br/>' |
|
63 | - . esc_html__('Ticket Details: ', 'event_espresso') |
|
64 | - . wp_kses($item['ticket']->description(), AllowedTags::getAllowedTags()) |
|
65 | - : ''); |
|
66 | - ?> |
|
46 | + echo esc_html($item['ticket']->name()) . ': '; |
|
47 | + echo esc_html( |
|
48 | + EEH_Template::format_currency($item['ticket']->price(), false, false) |
|
49 | + ); |
|
50 | + $qty_price = $item['ticket']->price() * $ticket_count[ $item['ticket']->ID() ]; |
|
51 | + echo ($item['ticket']->qty() |
|
52 | + ? ' x ' |
|
53 | + . sprintf( |
|
54 | + /* translators: %s: ticket count */ |
|
55 | + esc_html__('%1$s tickets', 'event_espresso'), |
|
56 | + absint($ticket_count[ $item['ticket']->ID() ]) |
|
57 | + ) |
|
58 | + . ' = ' |
|
59 | + . EEH_Template::format_currency($qty_price) |
|
60 | + : ''); |
|
61 | + echo ($item['ticket']->description() |
|
62 | + ? '<br/>' |
|
63 | + . esc_html__('Ticket Details: ', 'event_espresso') |
|
64 | + . wp_kses($item['ticket']->description(), AllowedTags::getAllowedTags()) |
|
65 | + : ''); |
|
66 | + ?> |
|
67 | 67 | </p> |
68 | 68 | <?php } ?> |
69 | 69 | |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | </legend> |
76 | 76 | |
77 | 77 | <?php |
78 | - // do an action before the questions output, including the item and count |
|
79 | - do_action( |
|
80 | - 'AHEE__registration_page_registration_questions__template___before_questions', |
|
81 | - $item, |
|
82 | - $att_nmbr |
|
83 | - ); |
|
78 | + // do an action before the questions output, including the item and count |
|
79 | + do_action( |
|
80 | + 'AHEE__registration_page_registration_questions__template___before_questions', |
|
81 | + $item, |
|
82 | + $att_nmbr |
|
83 | + ); |
|
84 | 84 | |
85 | - echo esc_html($item['attendee_questions']); |
|
85 | + echo esc_html($item['attendee_questions']); |
|
86 | 86 | |
87 | - if ($att_nmbr == 1 && $print_copy_info) { ?> |
|
87 | + if ($att_nmbr == 1 && $print_copy_info) { ?> |
|
88 | 88 | <input id='primary-attendee' |
89 | 89 | name="qstn[primary_attendee]" |
90 | 90 | type="hidden" |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | <p class="spco-copy-all-attendee-pg"> |
97 | 97 | <label class="wide"> |
98 | 98 | <?php esc_html_e( |
99 | - 'Use Registrant #1\'s information for ALL registrants', |
|
100 | - 'event_espresso' |
|
101 | - ); ?> |
|
99 | + 'Use Registrant #1\'s information for ALL registrants', |
|
100 | + 'event_espresso' |
|
101 | + ); ?> |
|
102 | 102 | <input class='spco-copy-all-attendee-chk ui-widget-content ui-corner-all' |
103 | 103 | id="spco-copy-all-attendee-chk" |
104 | 104 | type="checkbox" |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | |
110 | 110 | <p class="spco-copy-attendee-pg"> |
111 | 111 | <?php esc_html_e( |
112 | - 'This option allows you to use the above information for all additional registrant question fields. <span>( Please note that some events may have additional questions that you may still be required to answer in order to complete your registration. )</span>', |
|
113 | - 'event_espresso' |
|
114 | - ); ?> |
|
112 | + 'This option allows you to use the above information for all additional registrant question fields. <span>( Please note that some events may have additional questions that you may still be required to answer in order to complete your registration. )</span>', |
|
113 | + 'event_espresso' |
|
114 | + ); ?> |
|
115 | 115 | </p> |
116 | 116 | |
117 | 117 | <a id="display-more-attendee-copy-options" |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | </a> |
131 | 131 | <p class="spco-copy-attendee-pg"> |
132 | 132 | <?php esc_html_e( |
133 | - 'The following checkboxes allow you to use the above information for only the selected additional event registrants.', |
|
134 | - 'event_espresso' |
|
135 | - ); ?> |
|
133 | + 'The following checkboxes allow you to use the above information for only the selected additional event registrants.', |
|
134 | + 'event_espresso' |
|
135 | + ); ?> |
|
136 | 136 | </p> |
137 | 137 | |
138 | 138 | <?php |
139 | - foreach ($additional_event_attendees as $event_attendees) { |
|
140 | - foreach ($event_attendees as $attendee) { |
|
141 | - if ($attendee['event_hdr']) { ?> |
|
139 | + foreach ($additional_event_attendees as $event_attendees) { |
|
140 | + foreach ($event_attendees as $attendee) { |
|
141 | + if ($attendee['event_hdr']) { ?> |
|
142 | 142 | <h6 class="spco-copy-attendee-event-hdr"> |
143 | 143 | <?php echo esc_html($attendee['event_hdr']); ?> |
144 | 144 | </h6> |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | <p class="event_form_field spco-copy-attendee-chk-pg"> |
148 | 148 | <label> |
149 | 149 | <?php |
150 | - echo esc_html__('Attendee #', 'event_espresso') |
|
151 | - . esc_html($attendee['att_nmbr']); |
|
152 | - ?> |
|
150 | + echo esc_html__('Attendee #', 'event_espresso') |
|
151 | + . esc_html($attendee['att_nmbr']); |
|
152 | + ?> |
|
153 | 153 | <input class="spco-copy-attendee-chk <?php echo esc_attr($css_class); ?>" |
154 | 154 | id="spco-copy-attendee-chk-<?php echo esc_attr($attendee['input_id']);?>" |
155 | 155 | type="checkbox" |
@@ -167,25 +167,25 @@ discard block |
||
167 | 167 | <div class="clear-float"></div> |
168 | 168 | </div> |
169 | 169 | <?php |
170 | - $print_copy_info = false; |
|
171 | - } elseif ($att_nmbr == 1) { |
|
172 | - ?> |
|
170 | + $print_copy_info = false; |
|
171 | + } elseif ($att_nmbr == 1) { |
|
172 | + ?> |
|
173 | 173 | <p id="spco-auto-copy-attendee-pg" class="smaller-text lt-grey-text"> |
174 | 174 | <?php esc_html_e( |
175 | - 'The above information will be used for any additional tickets/registrants.', |
|
176 | - 'event_espresso' |
|
177 | - ); ?> |
|
175 | + 'The above information will be used for any additional tickets/registrants.', |
|
176 | + 'event_espresso' |
|
177 | + ); ?> |
|
178 | 178 | </p> |
179 | 179 | <?php |
180 | - } |
|
181 | - ?> |
|
180 | + } |
|
181 | + ?> |
|
182 | 182 | </fieldset> |
183 | 183 | |
184 | 184 | </div> |
185 | 185 | <?php |
186 | - } else { |
|
187 | - if ($att_nmbr == 1) { |
|
188 | - ?> |
|
186 | + } else { |
|
187 | + if ($att_nmbr == 1) { |
|
188 | + ?> |
|
189 | 189 | <div class='spco-attendee-panel-dv' |
190 | 190 | id="spco-attendee-panel-dv-<?php echo esc_attr($line_item); ?>" |
191 | 191 | > |
@@ -199,21 +199,21 @@ discard block |
||
199 | 199 | > |
200 | 200 | <h6> |
201 | 201 | <?php esc_html_e( |
202 | - 'No information is required to attend this event. Please proceed to the next Step', |
|
203 | - 'event_espresso' |
|
204 | - ); ?> |
|
202 | + 'No information is required to attend this event. Please proceed to the next Step', |
|
203 | + 'event_espresso' |
|
204 | + ); ?> |
|
205 | 205 | </h6> |
206 | 206 | <input type="hidden" id="no-questions" name="qstn[]" value="0" /> |
207 | 207 | </fieldset> |
208 | 208 | </div> |
209 | 209 | <?php |
210 | - } |
|
211 | - } |
|
212 | - echo esc_html($item['additional_attendee_reg_info']); |
|
213 | - $prev_event = $item['ticket']->name(); |
|
214 | - } // $event_queue['items'] as $line_item |
|
215 | - } // $event_queue['total_items'] |
|
216 | - ?> |
|
210 | + } |
|
211 | + } |
|
212 | + echo esc_html($item['additional_attendee_reg_info']); |
|
213 | + $prev_event = $item['ticket']->name(); |
|
214 | + } // $event_queue['items'] as $line_item |
|
215 | + } // $event_queue['total_items'] |
|
216 | + ?> |
|
217 | 217 | <div> |
218 | 218 | <a id="spco-display-event-questions-lnk" |
219 | 219 | class="act-like-link smaller-text hidden hide-if-no-js float-right" |
@@ -43,17 +43,17 @@ discard block |
||
43 | 43 | if ($item['ticket']->name() != $prev_event) { ?> |
44 | 44 | <p class="spco-ticket-info-pg"> |
45 | 45 | <?php |
46 | - echo esc_html($item['ticket']->name()) . ': '; |
|
46 | + echo esc_html($item['ticket']->name()).': '; |
|
47 | 47 | echo esc_html( |
48 | 48 | EEH_Template::format_currency($item['ticket']->price(), false, false) |
49 | 49 | ); |
50 | - $qty_price = $item['ticket']->price() * $ticket_count[ $item['ticket']->ID() ]; |
|
50 | + $qty_price = $item['ticket']->price() * $ticket_count[$item['ticket']->ID()]; |
|
51 | 51 | echo ($item['ticket']->qty() |
52 | 52 | ? ' x ' |
53 | 53 | . sprintf( |
54 | 54 | /* translators: %s: ticket count */ |
55 | 55 | esc_html__('%1$s tickets', 'event_espresso'), |
56 | - absint($ticket_count[ $item['ticket']->ID() ]) |
|
56 | + absint($ticket_count[$item['ticket']->ID()]) |
|
57 | 57 | ) |
58 | 58 | . ' = ' |
59 | 59 | . EEH_Template::format_currency($qty_price) |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | id="spco-attendee-wrap-<?php echo esc_attr($line_item); ?>" |
72 | 72 | > |
73 | 73 | <legend class="spco-attendee-lgnd smaller-text lt-grey-text"> |
74 | - <?php echo esc_html__('Registrant #', 'event_espresso') . $att_nmbr; ?> |
|
74 | + <?php echo esc_html__('Registrant #', 'event_espresso').$att_nmbr; ?> |
|
75 | 75 | </legend> |
76 | 76 | |
77 | 77 | <?php |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | . esc_html($attendee['att_nmbr']); |
152 | 152 | ?> |
153 | 153 | <input class="spco-copy-attendee-chk <?php echo esc_attr($css_class); ?>" |
154 | - id="spco-copy-attendee-chk-<?php echo esc_attr($attendee['input_id']);?>" |
|
154 | + id="spco-copy-attendee-chk-<?php echo esc_attr($attendee['input_id']); ?>" |
|
155 | 155 | type="checkbox" |
156 | 156 | value="<?php echo esc_attr($attendee['input_id']); ?>" |
157 | 157 | /> |