@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @since 4.3.2 |
8 | 8 | */ |
9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
10 | - exit('No direct script access allowed'); |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
@@ -22,735 +22,735 @@ discard block |
||
22 | 22 | { |
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * constructor. |
|
27 | - */ |
|
28 | - public function __construct() |
|
29 | - { |
|
30 | - $this->_caf_hooks(); |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * Contains all the hooks filters for setting up caffeinated messages functionality. |
|
36 | - * |
|
37 | - * @since 4.3.2 |
|
38 | - * |
|
39 | - * @return void |
|
40 | - */ |
|
41 | - private function _caf_hooks() |
|
42 | - { |
|
43 | - add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5); |
|
44 | - add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), |
|
45 | - 5, 2); |
|
46 | - add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, |
|
47 | - 2); |
|
48 | - add_filter('FHEE__EE_Html_messenger__get_template_fields', array($this, 'html_messenger_template_fields'), 5, |
|
49 | - 2); |
|
50 | - add_filter('FHEE__EE_Html_messenger__get_validator_config', array($this, 'html_messenger_validator_config'), 5, |
|
51 | - 2); |
|
52 | - add_filter('FHEE__EE_Pdf_messenger__get_template_fields', array($this, 'pdf_messenger_template_fields'), 5, 2); |
|
53 | - add_filter('FHEE__EE_Pdf_messenger__get_validator_config', array($this, 'pdf_messenger_validator_config'), 5, |
|
54 | - 2); |
|
55 | - add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', |
|
56 | - array($this, 'new_default_templates'), 5, 7); |
|
57 | - add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, |
|
58 | - 2); |
|
59 | - |
|
60 | - //shortcode parsers |
|
61 | - add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2); |
|
62 | - add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5); |
|
63 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', |
|
64 | - array($this, 'additional_recipient_details_shortcodes'), 5, 2); |
|
65 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', |
|
66 | - array($this, 'additional_recipient_details_parser'), 5, 5); |
|
67 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', |
|
68 | - array($this, 'additional_primary_registration_details_shortcodes'), 5, 2); |
|
69 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', |
|
70 | - array($this, 'additional_primary_registration_details_parser'), 5, 5); |
|
71 | - |
|
72 | - /** |
|
73 | - * @since 4.2.0 |
|
74 | - */ |
|
75 | - add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2); |
|
76 | - add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5); |
|
77 | - |
|
78 | - /** |
|
79 | - * @since 4.3.0 |
|
80 | - */ |
|
81 | - //eat our own dog food! |
|
82 | - add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types')); |
|
83 | - add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes')); |
|
84 | - do_action('EE_Brewing_Regular___messages_caf'); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * This just allows us to add additional paths to the autoloader (EED_Messages::autoload_messages()) for the |
|
90 | - * messages system. |
|
91 | - * |
|
92 | - * @param array $dir_ref original array of paths |
|
93 | - * |
|
94 | - * @return array appended paths |
|
95 | - */ |
|
96 | - public function messages_autoload_paths($dir_ref) |
|
97 | - { |
|
98 | - $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
|
99 | - |
|
100 | - return $dir_ref; |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) |
|
105 | - { |
|
106 | - $validator_config['attendee_list'] = array( |
|
107 | - 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
|
108 | - 'required' => array('[ATTENDEE_LIST]') |
|
109 | - ); |
|
110 | - $validator_config['question_list'] = array( |
|
111 | - 'shortcodes' => array('question'), |
|
112 | - 'required' => array('[QUESTION_LIST]') |
|
113 | - ); |
|
114 | - |
|
115 | - return $validator_config; |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - public function html_messenger_validator_config($validator_config, EE_Html_messenger $messenger) |
|
120 | - { |
|
121 | - $validator_config['attendee_list'] = array( |
|
122 | - 'shortcodes' => array('attendee', 'question_list'), |
|
123 | - 'required' => array('[ATTENDEE_LIST]') |
|
124 | - ); |
|
125 | - $validator_config['question_list'] = array( |
|
126 | - 'shortcodes' => array('question'), |
|
127 | - 'required' => array('[QUESTION_LIST]') |
|
128 | - ); |
|
129 | - |
|
130 | - return $validator_config; |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - public function pdf_messenger_validator_config($validator_config, EE_Pdf_messenger $messenger) |
|
135 | - { |
|
136 | - $validator_config['attendee_list'] = array( |
|
137 | - 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
|
138 | - 'required' => array('[ATTENDEE_LIST]') |
|
139 | - ); |
|
140 | - $validator_config['question_list'] = array( |
|
141 | - 'shortcodes' => array('question'), |
|
142 | - 'required' => array('[QUESTION_LIST]') |
|
143 | - ); |
|
144 | - |
|
145 | - return $validator_config; |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) |
|
150 | - { |
|
151 | - $template_fields['extra']['content']['question_list'] = array( |
|
152 | - 'input' => 'textarea', |
|
153 | - 'label' => '[QUESTION_LIST]', |
|
154 | - 'type' => 'string', |
|
155 | - 'required' => true, |
|
156 | - 'validation' => true, |
|
157 | - 'format' => '%s', |
|
158 | - 'css_class' => 'large-text', |
|
159 | - 'rows' => '5', |
|
160 | - 'shortcodes_required' => array('[QUESTION_LIST]') |
|
161 | - ); |
|
162 | - |
|
163 | - return $template_fields; |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - public function html_messenger_template_fields($template_fields, EE_Html_messenger $messenger) |
|
168 | - { |
|
169 | - $template_fields['extra']['content']['question_list'] = array( |
|
170 | - 'input' => 'textarea', |
|
171 | - 'label' => '[QUESTION_LIST]', |
|
172 | - 'type' => 'string', |
|
173 | - 'required' => true, |
|
174 | - 'validation' => true, |
|
175 | - 'format' => '%s', |
|
176 | - 'css_class' => 'large-text', |
|
177 | - 'rows' => '5', |
|
178 | - 'shortcodes_required' => array('[QUESTION_LIST]') |
|
179 | - ); |
|
180 | - |
|
181 | - return $template_fields; |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - public function pdf_messenger_template_fields($template_fields, EE_Pdf_messenger $messenger) |
|
186 | - { |
|
187 | - $template_fields['extra']['content']['question_list'] = array( |
|
188 | - 'input' => 'textarea', |
|
189 | - 'label' => '[QUESTION_LIST]', |
|
190 | - 'type' => 'string', |
|
191 | - 'required' => true, |
|
192 | - 'validation' => true, |
|
193 | - 'format' => '%s', |
|
194 | - 'css_class' => 'large-text', |
|
195 | - 'rows' => '5', |
|
196 | - 'shortcodes_required' => array('[QUESTION_LIST]') |
|
197 | - ); |
|
198 | - |
|
199 | - return $template_fields; |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - public function new_default_templates( |
|
204 | - $contents, |
|
205 | - $actual_path, |
|
206 | - EE_messenger $messenger, |
|
207 | - EE_message_type $message_type, |
|
208 | - $field, |
|
209 | - $context, |
|
210 | - EE_Messages_Template_Pack $template_pack |
|
211 | - ) { |
|
212 | - |
|
213 | - //we're only modifying templates for the default template pack |
|
214 | - if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) { |
|
215 | - return $contents; |
|
216 | - } |
|
217 | - |
|
218 | - //the template file name we're replacing contents for. |
|
219 | - $template_file_prefix = $field . '_' . $context; |
|
220 | - $msg_prefix = $messenger->name . '_' . $message_type->name . '_'; |
|
221 | - |
|
222 | - $base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/'; |
|
223 | - |
|
224 | - if ($messenger->name == 'email' && $message_type->name == 'registration') { |
|
25 | + /** |
|
26 | + * constructor. |
|
27 | + */ |
|
28 | + public function __construct() |
|
29 | + { |
|
30 | + $this->_caf_hooks(); |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * Contains all the hooks filters for setting up caffeinated messages functionality. |
|
36 | + * |
|
37 | + * @since 4.3.2 |
|
38 | + * |
|
39 | + * @return void |
|
40 | + */ |
|
41 | + private function _caf_hooks() |
|
42 | + { |
|
43 | + add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5); |
|
44 | + add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), |
|
45 | + 5, 2); |
|
46 | + add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, |
|
47 | + 2); |
|
48 | + add_filter('FHEE__EE_Html_messenger__get_template_fields', array($this, 'html_messenger_template_fields'), 5, |
|
49 | + 2); |
|
50 | + add_filter('FHEE__EE_Html_messenger__get_validator_config', array($this, 'html_messenger_validator_config'), 5, |
|
51 | + 2); |
|
52 | + add_filter('FHEE__EE_Pdf_messenger__get_template_fields', array($this, 'pdf_messenger_template_fields'), 5, 2); |
|
53 | + add_filter('FHEE__EE_Pdf_messenger__get_validator_config', array($this, 'pdf_messenger_validator_config'), 5, |
|
54 | + 2); |
|
55 | + add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', |
|
56 | + array($this, 'new_default_templates'), 5, 7); |
|
57 | + add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, |
|
58 | + 2); |
|
59 | + |
|
60 | + //shortcode parsers |
|
61 | + add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2); |
|
62 | + add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5); |
|
63 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', |
|
64 | + array($this, 'additional_recipient_details_shortcodes'), 5, 2); |
|
65 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', |
|
66 | + array($this, 'additional_recipient_details_parser'), 5, 5); |
|
67 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', |
|
68 | + array($this, 'additional_primary_registration_details_shortcodes'), 5, 2); |
|
69 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', |
|
70 | + array($this, 'additional_primary_registration_details_parser'), 5, 5); |
|
71 | + |
|
72 | + /** |
|
73 | + * @since 4.2.0 |
|
74 | + */ |
|
75 | + add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2); |
|
76 | + add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5); |
|
77 | + |
|
78 | + /** |
|
79 | + * @since 4.3.0 |
|
80 | + */ |
|
81 | + //eat our own dog food! |
|
82 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types')); |
|
83 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes')); |
|
84 | + do_action('EE_Brewing_Regular___messages_caf'); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * This just allows us to add additional paths to the autoloader (EED_Messages::autoload_messages()) for the |
|
90 | + * messages system. |
|
91 | + * |
|
92 | + * @param array $dir_ref original array of paths |
|
93 | + * |
|
94 | + * @return array appended paths |
|
95 | + */ |
|
96 | + public function messages_autoload_paths($dir_ref) |
|
97 | + { |
|
98 | + $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
|
99 | + |
|
100 | + return $dir_ref; |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) |
|
105 | + { |
|
106 | + $validator_config['attendee_list'] = array( |
|
107 | + 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
|
108 | + 'required' => array('[ATTENDEE_LIST]') |
|
109 | + ); |
|
110 | + $validator_config['question_list'] = array( |
|
111 | + 'shortcodes' => array('question'), |
|
112 | + 'required' => array('[QUESTION_LIST]') |
|
113 | + ); |
|
114 | + |
|
115 | + return $validator_config; |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + public function html_messenger_validator_config($validator_config, EE_Html_messenger $messenger) |
|
120 | + { |
|
121 | + $validator_config['attendee_list'] = array( |
|
122 | + 'shortcodes' => array('attendee', 'question_list'), |
|
123 | + 'required' => array('[ATTENDEE_LIST]') |
|
124 | + ); |
|
125 | + $validator_config['question_list'] = array( |
|
126 | + 'shortcodes' => array('question'), |
|
127 | + 'required' => array('[QUESTION_LIST]') |
|
128 | + ); |
|
129 | + |
|
130 | + return $validator_config; |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + public function pdf_messenger_validator_config($validator_config, EE_Pdf_messenger $messenger) |
|
135 | + { |
|
136 | + $validator_config['attendee_list'] = array( |
|
137 | + 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
|
138 | + 'required' => array('[ATTENDEE_LIST]') |
|
139 | + ); |
|
140 | + $validator_config['question_list'] = array( |
|
141 | + 'shortcodes' => array('question'), |
|
142 | + 'required' => array('[QUESTION_LIST]') |
|
143 | + ); |
|
144 | + |
|
145 | + return $validator_config; |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) |
|
150 | + { |
|
151 | + $template_fields['extra']['content']['question_list'] = array( |
|
152 | + 'input' => 'textarea', |
|
153 | + 'label' => '[QUESTION_LIST]', |
|
154 | + 'type' => 'string', |
|
155 | + 'required' => true, |
|
156 | + 'validation' => true, |
|
157 | + 'format' => '%s', |
|
158 | + 'css_class' => 'large-text', |
|
159 | + 'rows' => '5', |
|
160 | + 'shortcodes_required' => array('[QUESTION_LIST]') |
|
161 | + ); |
|
162 | + |
|
163 | + return $template_fields; |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + public function html_messenger_template_fields($template_fields, EE_Html_messenger $messenger) |
|
168 | + { |
|
169 | + $template_fields['extra']['content']['question_list'] = array( |
|
170 | + 'input' => 'textarea', |
|
171 | + 'label' => '[QUESTION_LIST]', |
|
172 | + 'type' => 'string', |
|
173 | + 'required' => true, |
|
174 | + 'validation' => true, |
|
175 | + 'format' => '%s', |
|
176 | + 'css_class' => 'large-text', |
|
177 | + 'rows' => '5', |
|
178 | + 'shortcodes_required' => array('[QUESTION_LIST]') |
|
179 | + ); |
|
180 | + |
|
181 | + return $template_fields; |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + public function pdf_messenger_template_fields($template_fields, EE_Pdf_messenger $messenger) |
|
186 | + { |
|
187 | + $template_fields['extra']['content']['question_list'] = array( |
|
188 | + 'input' => 'textarea', |
|
189 | + 'label' => '[QUESTION_LIST]', |
|
190 | + 'type' => 'string', |
|
191 | + 'required' => true, |
|
192 | + 'validation' => true, |
|
193 | + 'format' => '%s', |
|
194 | + 'css_class' => 'large-text', |
|
195 | + 'rows' => '5', |
|
196 | + 'shortcodes_required' => array('[QUESTION_LIST]') |
|
197 | + ); |
|
198 | + |
|
199 | + return $template_fields; |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + public function new_default_templates( |
|
204 | + $contents, |
|
205 | + $actual_path, |
|
206 | + EE_messenger $messenger, |
|
207 | + EE_message_type $message_type, |
|
208 | + $field, |
|
209 | + $context, |
|
210 | + EE_Messages_Template_Pack $template_pack |
|
211 | + ) { |
|
212 | + |
|
213 | + //we're only modifying templates for the default template pack |
|
214 | + if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) { |
|
215 | + return $contents; |
|
216 | + } |
|
217 | + |
|
218 | + //the template file name we're replacing contents for. |
|
219 | + $template_file_prefix = $field . '_' . $context; |
|
220 | + $msg_prefix = $messenger->name . '_' . $message_type->name . '_'; |
|
221 | + |
|
222 | + $base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/'; |
|
223 | + |
|
224 | + if ($messenger->name == 'email' && $message_type->name == 'registration') { |
|
225 | 225 | |
226 | - switch ($template_file_prefix) { |
|
226 | + switch ($template_file_prefix) { |
|
227 | 227 | |
228 | - case 'question_list_admin' : |
|
229 | - case 'question_list_attendee' : |
|
230 | - case 'question_list_primary_attendee' : |
|
231 | - $path = $base_path . $msg_prefix . 'question_list.template.php'; |
|
232 | - $contents = EEH_Template::display_template($path, array(), true); |
|
233 | - break; |
|
228 | + case 'question_list_admin' : |
|
229 | + case 'question_list_attendee' : |
|
230 | + case 'question_list_primary_attendee' : |
|
231 | + $path = $base_path . $msg_prefix . 'question_list.template.php'; |
|
232 | + $contents = EEH_Template::display_template($path, array(), true); |
|
233 | + break; |
|
234 | 234 | |
235 | - case 'attendee_list_primary_attendee' : |
|
236 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
237 | - $contents = EEH_Template::display_template($path, array(), true); |
|
238 | - break; |
|
235 | + case 'attendee_list_primary_attendee' : |
|
236 | + $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
237 | + $contents = EEH_Template::display_template($path, array(), true); |
|
238 | + break; |
|
239 | 239 | |
240 | - case 'attendee_list_admin' : |
|
241 | - $path = $base_path . $msg_prefix . 'attendee_list_admin.template.php'; |
|
242 | - $contents = EEH_Template::display_template($path, |
|
243 | - array(), true); |
|
244 | - break; |
|
240 | + case 'attendee_list_admin' : |
|
241 | + $path = $base_path . $msg_prefix . 'attendee_list_admin.template.php'; |
|
242 | + $contents = EEH_Template::display_template($path, |
|
243 | + array(), true); |
|
244 | + break; |
|
245 | 245 | |
246 | - case 'attendee_list_attendee' : |
|
247 | - $contents = ''; |
|
248 | - break; |
|
246 | + case 'attendee_list_attendee' : |
|
247 | + $contents = ''; |
|
248 | + break; |
|
249 | 249 | |
250 | - case 'event_list_attendee' : |
|
251 | - $path = $base_path . $msg_prefix . 'event_list_attendee.template.php'; |
|
252 | - $contents = EEH_Template::display_template($path, array(), true); |
|
253 | - break; |
|
254 | - } |
|
255 | - } elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') { |
|
256 | - switch ($template_file_prefix) { |
|
250 | + case 'event_list_attendee' : |
|
251 | + $path = $base_path . $msg_prefix . 'event_list_attendee.template.php'; |
|
252 | + $contents = EEH_Template::display_template($path, array(), true); |
|
253 | + break; |
|
254 | + } |
|
255 | + } elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') { |
|
256 | + switch ($template_file_prefix) { |
|
257 | 257 | |
258 | - case 'content_attendee' : |
|
259 | - $path = $base_path . $msg_prefix . 'content.template.php'; |
|
260 | - $contents = EEH_Template::display_template($path, array(), true); |
|
261 | - break; |
|
258 | + case 'content_attendee' : |
|
259 | + $path = $base_path . $msg_prefix . 'content.template.php'; |
|
260 | + $contents = EEH_Template::display_template($path, array(), true); |
|
261 | + break; |
|
262 | 262 | |
263 | - case 'newsletter_content_attendee' : |
|
264 | - $path = $base_path . $msg_prefix . 'newsletter_content.template.php'; |
|
265 | - $contents = EEH_Template::display_template($path, array(), true); |
|
266 | - break; |
|
263 | + case 'newsletter_content_attendee' : |
|
264 | + $path = $base_path . $msg_prefix . 'newsletter_content.template.php'; |
|
265 | + $contents = EEH_Template::display_template($path, array(), true); |
|
266 | + break; |
|
267 | 267 | |
268 | - case 'newsletter_subject_attendee' : |
|
269 | - $path = $base_path . $msg_prefix . 'subject.template.php'; |
|
270 | - $contents = EEH_Template::display_template($path, array(), true); |
|
271 | - break; |
|
272 | - } |
|
273 | - } elseif ($messenger->name == 'html' && $message_type->name == 'receipt') { |
|
274 | - switch ($template_file_prefix) { |
|
275 | - case 'attendee_list_purchaser' : |
|
276 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
277 | - $contents = EEH_Template::display_template($path, array(), true); |
|
278 | - break; |
|
279 | - } |
|
280 | - } |
|
281 | - |
|
282 | - return $contents; |
|
283 | - |
|
284 | - } |
|
285 | - |
|
286 | - |
|
287 | - public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) |
|
288 | - { |
|
289 | - //make sure question_list and question are ONLY added for the core message types. Any other message types will have to explicitly set question_list as a valid shortcode. |
|
290 | - $include_with = array( |
|
291 | - 'registration', |
|
292 | - 'cancelled_registration', |
|
293 | - 'declined_registration', |
|
294 | - 'not_approved_registration', |
|
295 | - 'payment_declined', |
|
296 | - 'payment_failed', |
|
297 | - 'payment_cancelled', |
|
298 | - 'payment', |
|
299 | - 'payment_reminder', |
|
300 | - 'pending_approval', |
|
301 | - 'registration_summary', |
|
302 | - 'invoice', |
|
303 | - 'receipt' |
|
304 | - ); |
|
305 | - if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) { |
|
306 | - $contexts = array_keys($msg->get_contexts()); |
|
307 | - foreach ($contexts as $context) { |
|
308 | - $valid_shortcodes[$context][] = 'question_list'; |
|
309 | - $valid_shortcodes[$context][] = 'question'; |
|
310 | - } |
|
311 | - } |
|
312 | - |
|
313 | - return $valid_shortcodes; |
|
314 | - } |
|
315 | - |
|
316 | - |
|
317 | - public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) |
|
318 | - { |
|
319 | - $shortcodes['[ANSWER_*]'] = __('This is a special dynamic shortcode. Right after the "*", add the exact text of a existing question, and if there is an answer for that question for this registrant, that will take the place of this shortcode.', |
|
320 | - 'event_espresso'); |
|
321 | - |
|
322 | - return $shortcodes; |
|
323 | - } |
|
324 | - |
|
325 | - |
|
326 | - public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
327 | - { |
|
328 | - |
|
329 | - if (strpos($shortcode, |
|
330 | - '[ANSWER_*') === false || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations) |
|
331 | - ) { |
|
332 | - return $parsed; |
|
333 | - } |
|
334 | - |
|
335 | - //let's get the question from the code. |
|
336 | - $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
|
337 | - $shortcode = trim(str_replace(']', '', $shortcode)); |
|
338 | - |
|
339 | - $registration = $data instanceof EE_Registration ? $data : null; |
|
340 | - $registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
341 | - |
|
342 | - $aee = $data instanceof EE_Messages_Addressee ? $data : null; |
|
343 | - $aee = ! $aee instanceof EE_Messages_Addressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee; |
|
344 | - |
|
345 | - if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) { |
|
346 | - return $parsed; |
|
347 | - } |
|
348 | - |
|
349 | - //now let's figure out which question has this text. |
|
350 | - foreach ($aee->questions as $ansid => $question) { |
|
351 | - if ( |
|
352 | - $question instanceof EE_Question |
|
353 | - && trim($question->display_text()) == trim($shortcode) |
|
354 | - && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) |
|
355 | - ) { |
|
356 | - return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', |
|
357 | - 'no_wpautop'); |
|
358 | - } |
|
359 | - } |
|
360 | - |
|
361 | - //nothing! |
|
362 | - return $parsed; |
|
363 | - } |
|
364 | - |
|
365 | - |
|
366 | - /** |
|
367 | - * Callback for additional shortcodes filter for adding additional datetime shortcodes. |
|
368 | - * |
|
369 | - * @since 4.2 |
|
370 | - * |
|
371 | - * @param array $shortcodes array of shortcodes and |
|
372 | - * descriptions |
|
373 | - * @param EE_Datetime_Shortcodes $shortcode_parser EE_Shortcodes object |
|
374 | - * |
|
375 | - * @return array array of shortcodes and |
|
376 | - * descriptions |
|
377 | - */ |
|
378 | - public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) |
|
379 | - { |
|
380 | - $shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', |
|
381 | - 'event_espresso'); |
|
382 | - $shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', |
|
383 | - 'event_espresso'); |
|
384 | - $shortcodes['[DTT_NAME_OR_DATES]'] = __('When parsed, if the Datetime has a name, it is used, otherwise a formatted string including the start date and end date will be used.', |
|
385 | - 'event_espresso'); |
|
386 | - |
|
387 | - return $shortcodes; |
|
388 | - } |
|
389 | - |
|
390 | - |
|
391 | - /** |
|
392 | - * Callback for additional shortcodes parser filter used for adding parser for new |
|
393 | - * Datetime shortcodes |
|
394 | - * |
|
395 | - * @since 4.2 |
|
396 | - * |
|
397 | - * @param string $parsed The finished parsed string for the given shortcode. |
|
398 | - * @param string $shortcode The shortcode being parsed. |
|
399 | - * @param object $data The incoming data object for the Shortcode Parser. |
|
400 | - * @param object $extra_data The incoming extra date object for the Shortcode |
|
401 | - * Parser. |
|
402 | - * @param EE_Datetime_Shortcodes $shortcode_parser |
|
403 | - * |
|
404 | - * @return string The new parsed string. |
|
405 | - */ |
|
406 | - public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
407 | - { |
|
408 | - |
|
409 | - if ( ! $data instanceof EE_Datetime) { |
|
410 | - return ''; //get out because we can only parse with the datetime object. |
|
411 | - } |
|
412 | - |
|
413 | - switch ($shortcode) { |
|
414 | - case '[DTT_NAME]' : |
|
415 | - return $data->name(); |
|
416 | - break; |
|
417 | - case '[DTT_DESCRIPTION]' : |
|
418 | - return $data->description(); |
|
419 | - break; |
|
420 | - case '[DTT_NAME_OR_DATES]' : |
|
421 | - return $data->get_dtt_display_name(true); |
|
422 | - break; |
|
423 | - default : |
|
424 | - return $parsed; |
|
425 | - break; |
|
426 | - } |
|
427 | - } |
|
428 | - |
|
429 | - |
|
430 | - public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) |
|
431 | - { |
|
432 | - $shortcodes['[RECIPIENT_QUESTION_LIST]'] = __('This is used to indicate where you want the list of questions and answers to show for the person receiving the message.', |
|
433 | - 'event_espresso'); |
|
434 | - |
|
435 | - return $shortcodes; |
|
436 | - } |
|
437 | - |
|
438 | - |
|
439 | - /** |
|
440 | - * Callback for FHEE__EE_Recipient_List_Shortcodes__parser_after filter (dynamic filter). |
|
441 | - * |
|
442 | - * @param string $parsed The original parsed content for the shortcode |
|
443 | - * @param string $shortcode The shortcode being parsed |
|
444 | - * @param array $data The shortcode parser data array |
|
445 | - * @param array $extra_data The shortcode parser extra data array |
|
446 | - * @param \EE_Shortcodes $shortcode_parser Shortcode parser. |
|
447 | - * |
|
448 | - * @return string |
|
449 | - */ |
|
450 | - public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
451 | - { |
|
452 | - |
|
453 | - if (array($data) && ! isset($data['data'])) { |
|
454 | - return $parsed; |
|
455 | - } |
|
456 | - |
|
457 | - $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : null; |
|
458 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
459 | - |
|
460 | - if ( ! $recipient instanceof EE_Messages_Addressee) { |
|
461 | - return $parsed; |
|
462 | - } |
|
463 | - |
|
464 | - switch ($shortcode) { |
|
465 | - case '[RECIPIENT_QUESTION_LIST]' : |
|
466 | - $att = $recipient->att_obj; |
|
467 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $recipient->attendees[$att->ID()]['reg_objs'] : array(); |
|
468 | - $registrations_on_attendee = empty($registrations_on_attendee) && $recipient->reg_obj instanceof EE_Registration ? array($recipient->reg_obj) : $registrations_on_attendee; |
|
469 | - $answers = array(); |
|
268 | + case 'newsletter_subject_attendee' : |
|
269 | + $path = $base_path . $msg_prefix . 'subject.template.php'; |
|
270 | + $contents = EEH_Template::display_template($path, array(), true); |
|
271 | + break; |
|
272 | + } |
|
273 | + } elseif ($messenger->name == 'html' && $message_type->name == 'receipt') { |
|
274 | + switch ($template_file_prefix) { |
|
275 | + case 'attendee_list_purchaser' : |
|
276 | + $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
277 | + $contents = EEH_Template::display_template($path, array(), true); |
|
278 | + break; |
|
279 | + } |
|
280 | + } |
|
281 | + |
|
282 | + return $contents; |
|
283 | + |
|
284 | + } |
|
285 | + |
|
286 | + |
|
287 | + public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) |
|
288 | + { |
|
289 | + //make sure question_list and question are ONLY added for the core message types. Any other message types will have to explicitly set question_list as a valid shortcode. |
|
290 | + $include_with = array( |
|
291 | + 'registration', |
|
292 | + 'cancelled_registration', |
|
293 | + 'declined_registration', |
|
294 | + 'not_approved_registration', |
|
295 | + 'payment_declined', |
|
296 | + 'payment_failed', |
|
297 | + 'payment_cancelled', |
|
298 | + 'payment', |
|
299 | + 'payment_reminder', |
|
300 | + 'pending_approval', |
|
301 | + 'registration_summary', |
|
302 | + 'invoice', |
|
303 | + 'receipt' |
|
304 | + ); |
|
305 | + if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) { |
|
306 | + $contexts = array_keys($msg->get_contexts()); |
|
307 | + foreach ($contexts as $context) { |
|
308 | + $valid_shortcodes[$context][] = 'question_list'; |
|
309 | + $valid_shortcodes[$context][] = 'question'; |
|
310 | + } |
|
311 | + } |
|
312 | + |
|
313 | + return $valid_shortcodes; |
|
314 | + } |
|
315 | + |
|
316 | + |
|
317 | + public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) |
|
318 | + { |
|
319 | + $shortcodes['[ANSWER_*]'] = __('This is a special dynamic shortcode. Right after the "*", add the exact text of a existing question, and if there is an answer for that question for this registrant, that will take the place of this shortcode.', |
|
320 | + 'event_espresso'); |
|
321 | + |
|
322 | + return $shortcodes; |
|
323 | + } |
|
324 | + |
|
325 | + |
|
326 | + public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
327 | + { |
|
328 | + |
|
329 | + if (strpos($shortcode, |
|
330 | + '[ANSWER_*') === false || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations) |
|
331 | + ) { |
|
332 | + return $parsed; |
|
333 | + } |
|
334 | + |
|
335 | + //let's get the question from the code. |
|
336 | + $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
|
337 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
338 | + |
|
339 | + $registration = $data instanceof EE_Registration ? $data : null; |
|
340 | + $registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
341 | + |
|
342 | + $aee = $data instanceof EE_Messages_Addressee ? $data : null; |
|
343 | + $aee = ! $aee instanceof EE_Messages_Addressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee; |
|
344 | + |
|
345 | + if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) { |
|
346 | + return $parsed; |
|
347 | + } |
|
348 | + |
|
349 | + //now let's figure out which question has this text. |
|
350 | + foreach ($aee->questions as $ansid => $question) { |
|
351 | + if ( |
|
352 | + $question instanceof EE_Question |
|
353 | + && trim($question->display_text()) == trim($shortcode) |
|
354 | + && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) |
|
355 | + ) { |
|
356 | + return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', |
|
357 | + 'no_wpautop'); |
|
358 | + } |
|
359 | + } |
|
360 | + |
|
361 | + //nothing! |
|
362 | + return $parsed; |
|
363 | + } |
|
364 | + |
|
365 | + |
|
366 | + /** |
|
367 | + * Callback for additional shortcodes filter for adding additional datetime shortcodes. |
|
368 | + * |
|
369 | + * @since 4.2 |
|
370 | + * |
|
371 | + * @param array $shortcodes array of shortcodes and |
|
372 | + * descriptions |
|
373 | + * @param EE_Datetime_Shortcodes $shortcode_parser EE_Shortcodes object |
|
374 | + * |
|
375 | + * @return array array of shortcodes and |
|
376 | + * descriptions |
|
377 | + */ |
|
378 | + public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) |
|
379 | + { |
|
380 | + $shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', |
|
381 | + 'event_espresso'); |
|
382 | + $shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', |
|
383 | + 'event_espresso'); |
|
384 | + $shortcodes['[DTT_NAME_OR_DATES]'] = __('When parsed, if the Datetime has a name, it is used, otherwise a formatted string including the start date and end date will be used.', |
|
385 | + 'event_espresso'); |
|
386 | + |
|
387 | + return $shortcodes; |
|
388 | + } |
|
389 | + |
|
390 | + |
|
391 | + /** |
|
392 | + * Callback for additional shortcodes parser filter used for adding parser for new |
|
393 | + * Datetime shortcodes |
|
394 | + * |
|
395 | + * @since 4.2 |
|
396 | + * |
|
397 | + * @param string $parsed The finished parsed string for the given shortcode. |
|
398 | + * @param string $shortcode The shortcode being parsed. |
|
399 | + * @param object $data The incoming data object for the Shortcode Parser. |
|
400 | + * @param object $extra_data The incoming extra date object for the Shortcode |
|
401 | + * Parser. |
|
402 | + * @param EE_Datetime_Shortcodes $shortcode_parser |
|
403 | + * |
|
404 | + * @return string The new parsed string. |
|
405 | + */ |
|
406 | + public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
407 | + { |
|
408 | + |
|
409 | + if ( ! $data instanceof EE_Datetime) { |
|
410 | + return ''; //get out because we can only parse with the datetime object. |
|
411 | + } |
|
412 | + |
|
413 | + switch ($shortcode) { |
|
414 | + case '[DTT_NAME]' : |
|
415 | + return $data->name(); |
|
416 | + break; |
|
417 | + case '[DTT_DESCRIPTION]' : |
|
418 | + return $data->description(); |
|
419 | + break; |
|
420 | + case '[DTT_NAME_OR_DATES]' : |
|
421 | + return $data->get_dtt_display_name(true); |
|
422 | + break; |
|
423 | + default : |
|
424 | + return $parsed; |
|
425 | + break; |
|
426 | + } |
|
427 | + } |
|
428 | + |
|
429 | + |
|
430 | + public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) |
|
431 | + { |
|
432 | + $shortcodes['[RECIPIENT_QUESTION_LIST]'] = __('This is used to indicate where you want the list of questions and answers to show for the person receiving the message.', |
|
433 | + 'event_espresso'); |
|
434 | + |
|
435 | + return $shortcodes; |
|
436 | + } |
|
437 | + |
|
438 | + |
|
439 | + /** |
|
440 | + * Callback for FHEE__EE_Recipient_List_Shortcodes__parser_after filter (dynamic filter). |
|
441 | + * |
|
442 | + * @param string $parsed The original parsed content for the shortcode |
|
443 | + * @param string $shortcode The shortcode being parsed |
|
444 | + * @param array $data The shortcode parser data array |
|
445 | + * @param array $extra_data The shortcode parser extra data array |
|
446 | + * @param \EE_Shortcodes $shortcode_parser Shortcode parser. |
|
447 | + * |
|
448 | + * @return string |
|
449 | + */ |
|
450 | + public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
451 | + { |
|
452 | + |
|
453 | + if (array($data) && ! isset($data['data'])) { |
|
454 | + return $parsed; |
|
455 | + } |
|
456 | + |
|
457 | + $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : null; |
|
458 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
459 | + |
|
460 | + if ( ! $recipient instanceof EE_Messages_Addressee) { |
|
461 | + return $parsed; |
|
462 | + } |
|
463 | + |
|
464 | + switch ($shortcode) { |
|
465 | + case '[RECIPIENT_QUESTION_LIST]' : |
|
466 | + $att = $recipient->att_obj; |
|
467 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $recipient->attendees[$att->ID()]['reg_objs'] : array(); |
|
468 | + $registrations_on_attendee = empty($registrations_on_attendee) && $recipient->reg_obj instanceof EE_Registration ? array($recipient->reg_obj) : $registrations_on_attendee; |
|
469 | + $answers = array(); |
|
470 | 470 | |
471 | - $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
472 | - $valid_shortcodes = array('question'); |
|
471 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
472 | + $valid_shortcodes = array('question'); |
|
473 | 473 | |
474 | - //if the context is main_content then get all answers for all registrations on this attendee |
|
475 | - if ($data['data'] instanceof EE_Messages_Addressee) { |
|
474 | + //if the context is main_content then get all answers for all registrations on this attendee |
|
475 | + if ($data['data'] instanceof EE_Messages_Addressee) { |
|
476 | 476 | |
477 | - foreach ($registrations_on_attendee as $reg) { |
|
478 | - if ($reg instanceof EE_Registration) { |
|
479 | - $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
480 | - foreach ($anss as $ans) { |
|
481 | - if ($ans instanceof EE_Answer) { |
|
482 | - $answers[$ans->ID()] = $ans; |
|
483 | - } |
|
484 | - } |
|
485 | - } |
|
486 | - } |
|
487 | - } |
|
477 | + foreach ($registrations_on_attendee as $reg) { |
|
478 | + if ($reg instanceof EE_Registration) { |
|
479 | + $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
480 | + foreach ($anss as $ans) { |
|
481 | + if ($ans instanceof EE_Answer) { |
|
482 | + $answers[$ans->ID()] = $ans; |
|
483 | + } |
|
484 | + } |
|
485 | + } |
|
486 | + } |
|
487 | + } |
|
488 | 488 | |
489 | - //if the context is the event list parser, then let's return just the answers for all registrations attached to the recipient for that event. |
|
490 | - if ($data['data'] instanceof EE_Event) { |
|
491 | - $event = $data['data']; |
|
492 | - foreach ($registrations_on_attendee as $reg) { |
|
493 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
494 | - $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
495 | - foreach ($anss as $ans) { |
|
496 | - if ($ans instanceof EE_Answer) { |
|
497 | - $answers[$ans->ID()] = $ans; |
|
498 | - } |
|
499 | - } |
|
500 | - } |
|
501 | - } |
|
502 | - } |
|
489 | + //if the context is the event list parser, then let's return just the answers for all registrations attached to the recipient for that event. |
|
490 | + if ($data['data'] instanceof EE_Event) { |
|
491 | + $event = $data['data']; |
|
492 | + foreach ($registrations_on_attendee as $reg) { |
|
493 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
494 | + $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
495 | + foreach ($anss as $ans) { |
|
496 | + if ($ans instanceof EE_Answer) { |
|
497 | + $answers[$ans->ID()] = $ans; |
|
498 | + } |
|
499 | + } |
|
500 | + } |
|
501 | + } |
|
502 | + } |
|
503 | 503 | |
504 | - $questions = $questions = isset($recipient->questions) ? $recipient->questions : array(); |
|
504 | + $questions = $questions = isset($recipient->questions) ? $recipient->questions : array(); |
|
505 | 505 | |
506 | - //if $extra_data does not have a 'data' key then let's make sure we add it and set the EE_Messages_Addressee |
|
507 | - //object on it. |
|
508 | - if ( ! isset( $extra_data['data'] ) ) { |
|
509 | - $extra_data['data'] = $recipient; |
|
510 | - } |
|
506 | + //if $extra_data does not have a 'data' key then let's make sure we add it and set the EE_Messages_Addressee |
|
507 | + //object on it. |
|
508 | + if ( ! isset( $extra_data['data'] ) ) { |
|
509 | + $extra_data['data'] = $recipient; |
|
510 | + } |
|
511 | 511 | |
512 | - return $this->_parse_question_list_for_primary_or_recipient_registration( |
|
513 | - $shortcode_parser, |
|
514 | - $questions, |
|
515 | - $answers, |
|
516 | - $template, |
|
517 | - $valid_shortcodes, |
|
518 | - $extra_data |
|
519 | - ); |
|
520 | - break; |
|
512 | + return $this->_parse_question_list_for_primary_or_recipient_registration( |
|
513 | + $shortcode_parser, |
|
514 | + $questions, |
|
515 | + $answers, |
|
516 | + $template, |
|
517 | + $valid_shortcodes, |
|
518 | + $extra_data |
|
519 | + ); |
|
520 | + break; |
|
521 | 521 | |
522 | - default : |
|
523 | - return $parsed; |
|
524 | - break; |
|
525 | - } |
|
526 | - } |
|
527 | - |
|
528 | - |
|
529 | - public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) |
|
530 | - { |
|
531 | - $shortcodes['[PRIMARY_REGISTRANT_QUESTION_LIST]'] = __('This is used to indicate the questions and answers for the primary_registrant. It should be placed in the "[attendee_list]" field', |
|
532 | - 'event_espresso'); |
|
533 | - |
|
534 | - return $shortcodes; |
|
535 | - } |
|
536 | - |
|
537 | - |
|
538 | - /** |
|
539 | - * Callback for FHEE__EE_Primary_Registration_List_Shortcodes__parser_after filter (dynamic filter). |
|
540 | - * |
|
541 | - * @param string $parsed The original parsed content for the shortcode |
|
542 | - * @param string $shortcode The shortcode being parsed |
|
543 | - * @param array $data The shortcode parser data array |
|
544 | - * @param array $extra_data The shortcode parser extra data array |
|
545 | - * @param \EE_Shortcodes $shortcode_parser Shortcode parser. |
|
546 | - * |
|
547 | - * @return string |
|
548 | - */ |
|
549 | - public function additional_primary_registration_details_parser( |
|
550 | - $parsed, |
|
551 | - $shortcode, |
|
552 | - $data, |
|
553 | - $extra_data, |
|
554 | - $shortcode_parser |
|
555 | - ) { |
|
556 | - if (array($data) && ! isset($data['data'])) { |
|
557 | - return $parsed; |
|
558 | - } |
|
559 | - |
|
560 | - $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : null; |
|
561 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
562 | - |
|
563 | - if ( ! $recipient instanceof EE_Messages_Addressee) { |
|
564 | - return $parsed; |
|
565 | - } |
|
566 | - |
|
567 | - switch ($shortcode) { |
|
568 | - case '[PRIMARY_REGISTRANT_QUESTION_LIST]' : |
|
569 | - if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration) { |
|
570 | - return ''; |
|
571 | - } |
|
572 | - $registration = $recipient->primary_reg_obj; |
|
573 | - $answers = isset($recipient->registrations[$registration->ID()]['ans_objs']) |
|
574 | - ? $recipient->registrations[$registration->ID()]['ans_objs'] |
|
575 | - : array(); |
|
576 | - if (empty($answers)) { |
|
577 | - return ''; |
|
578 | - } |
|
579 | - $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
580 | - $valid_shortcodes = array('question'); |
|
581 | - $answers = $recipient->registrations[$registration->ID()]['ans_objs']; |
|
582 | - $questions = isset($recipient->questions) ? $recipient->questions : array(); |
|
583 | - //if $extra_data does not have a 'data' key then let's make sure we add it and set the EE_Messages_Addressee |
|
584 | - //object on it. |
|
585 | - if ( ! isset( $extra_data['data'] ) ){ |
|
586 | - $extra_data['data'] = $recipient; |
|
587 | - } |
|
588 | - return $this->_parse_question_list_for_primary_or_recipient_registration( |
|
589 | - $shortcode_parser, |
|
590 | - $questions, |
|
591 | - $answers, |
|
592 | - $template, |
|
593 | - $valid_shortcodes, |
|
594 | - $extra_data |
|
595 | - ); |
|
596 | - break; |
|
522 | + default : |
|
523 | + return $parsed; |
|
524 | + break; |
|
525 | + } |
|
526 | + } |
|
527 | + |
|
528 | + |
|
529 | + public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) |
|
530 | + { |
|
531 | + $shortcodes['[PRIMARY_REGISTRANT_QUESTION_LIST]'] = __('This is used to indicate the questions and answers for the primary_registrant. It should be placed in the "[attendee_list]" field', |
|
532 | + 'event_espresso'); |
|
533 | + |
|
534 | + return $shortcodes; |
|
535 | + } |
|
536 | + |
|
537 | + |
|
538 | + /** |
|
539 | + * Callback for FHEE__EE_Primary_Registration_List_Shortcodes__parser_after filter (dynamic filter). |
|
540 | + * |
|
541 | + * @param string $parsed The original parsed content for the shortcode |
|
542 | + * @param string $shortcode The shortcode being parsed |
|
543 | + * @param array $data The shortcode parser data array |
|
544 | + * @param array $extra_data The shortcode parser extra data array |
|
545 | + * @param \EE_Shortcodes $shortcode_parser Shortcode parser. |
|
546 | + * |
|
547 | + * @return string |
|
548 | + */ |
|
549 | + public function additional_primary_registration_details_parser( |
|
550 | + $parsed, |
|
551 | + $shortcode, |
|
552 | + $data, |
|
553 | + $extra_data, |
|
554 | + $shortcode_parser |
|
555 | + ) { |
|
556 | + if (array($data) && ! isset($data['data'])) { |
|
557 | + return $parsed; |
|
558 | + } |
|
559 | + |
|
560 | + $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : null; |
|
561 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
562 | + |
|
563 | + if ( ! $recipient instanceof EE_Messages_Addressee) { |
|
564 | + return $parsed; |
|
565 | + } |
|
566 | + |
|
567 | + switch ($shortcode) { |
|
568 | + case '[PRIMARY_REGISTRANT_QUESTION_LIST]' : |
|
569 | + if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration) { |
|
570 | + return ''; |
|
571 | + } |
|
572 | + $registration = $recipient->primary_reg_obj; |
|
573 | + $answers = isset($recipient->registrations[$registration->ID()]['ans_objs']) |
|
574 | + ? $recipient->registrations[$registration->ID()]['ans_objs'] |
|
575 | + : array(); |
|
576 | + if (empty($answers)) { |
|
577 | + return ''; |
|
578 | + } |
|
579 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
580 | + $valid_shortcodes = array('question'); |
|
581 | + $answers = $recipient->registrations[$registration->ID()]['ans_objs']; |
|
582 | + $questions = isset($recipient->questions) ? $recipient->questions : array(); |
|
583 | + //if $extra_data does not have a 'data' key then let's make sure we add it and set the EE_Messages_Addressee |
|
584 | + //object on it. |
|
585 | + if ( ! isset( $extra_data['data'] ) ){ |
|
586 | + $extra_data['data'] = $recipient; |
|
587 | + } |
|
588 | + return $this->_parse_question_list_for_primary_or_recipient_registration( |
|
589 | + $shortcode_parser, |
|
590 | + $questions, |
|
591 | + $answers, |
|
592 | + $template, |
|
593 | + $valid_shortcodes, |
|
594 | + $extra_data |
|
595 | + ); |
|
596 | + break; |
|
597 | 597 | |
598 | - default : |
|
599 | - return $parsed; |
|
600 | - break; |
|
601 | - } |
|
602 | - } |
|
603 | - |
|
604 | - |
|
605 | - /** |
|
606 | - * Takes care of registering the message types that are only available in caffeinated EE. |
|
607 | - * |
|
608 | - * @since 4.3.2 |
|
609 | - * |
|
610 | - * @return void |
|
611 | - */ |
|
612 | - public function register_caf_message_types() |
|
613 | - { |
|
614 | - //register newsletter message type |
|
615 | - $setup_args = array( |
|
616 | - 'mtfilename' => 'EE_Newsletter_message_type.class.php', |
|
617 | - 'autoloadpaths' => array( |
|
618 | - EE_CAF_LIBRARIES . 'messages/message_type/newsletter/' |
|
619 | - ), |
|
620 | - 'messengers_to_activate_with' => array('email'), |
|
621 | - 'messengers_to_validate_with' => array('email'), |
|
622 | - 'messengers_supporting_default_template_pack_with' => array('email') |
|
623 | - ); |
|
624 | - EE_Register_Message_Type::register('newsletter', $setup_args); |
|
625 | - |
|
626 | - //register payment reminder message type |
|
627 | - $setup_args = array( |
|
628 | - 'mtfilename' => 'EE_Payment_Reminder_message_type.class.php', |
|
629 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/'), |
|
630 | - 'messengers_to_activate_with' => array('email'), |
|
631 | - 'messengers_to_validate_with' => array('email'), |
|
632 | - 'messengers_supporting_default_template_pack_with' => array('email') |
|
633 | - ); |
|
634 | - EE_Register_Message_Type::register('payment_reminder', $setup_args); |
|
635 | - |
|
636 | - //register payment declined message type |
|
637 | - $setup_args = array( |
|
638 | - 'mtfilename' => 'EE_Payment_Declined_message_type.class.php', |
|
639 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/'), |
|
640 | - 'messengers_to_activate_with' => array('email'), |
|
641 | - 'messengers_to_validate_with' => array('email'), |
|
642 | - 'messengers_supporting_default_template_pack_with' => array('email') |
|
643 | - ); |
|
644 | - EE_Register_Message_Type::register('payment_declined', $setup_args); |
|
645 | - |
|
646 | - //register registration declined message type |
|
647 | - $setup_args = array( |
|
648 | - 'mtfilename' => 'EE_Declined_Registration_message_type.class.php', |
|
649 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/'), |
|
650 | - 'messengers_to_activate_with' => array('email'), |
|
651 | - 'messengers_to_validate_with' => array('email'), |
|
652 | - 'messengers_supporting_default_template_pack_with' => array('email') |
|
653 | - ); |
|
654 | - EE_Register_Message_Type::register('declined_registration', $setup_args); |
|
655 | - |
|
656 | - //register registration cancelled message type |
|
657 | - $setup_args = array( |
|
658 | - 'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php', |
|
659 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/'), |
|
660 | - 'messengers_to_activate_with' => array('email'), |
|
661 | - 'messengers_to_validate_with' => array('email'), |
|
662 | - 'messengers_supporting_default_template_pack_with' => array('email') |
|
663 | - ); |
|
664 | - EE_Register_Message_Type::register('cancelled_registration', $setup_args); |
|
665 | - |
|
666 | - |
|
667 | - //register payment failed message type |
|
668 | - $setup_args = array( |
|
669 | - 'mtfilename' => 'EE_Payment_Failed_message_type.class.php', |
|
670 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/'), |
|
671 | - 'messengers_to_activate_with' => array('email'), |
|
672 | - 'messengers_to_validate_with' => array('email'), |
|
673 | - 'messengers_supporting_default_template_pack_with' => array('email') |
|
674 | - ); |
|
675 | - EE_Register_Message_Type::register('payment_failed', $setup_args); |
|
676 | - |
|
677 | - //register payment declined message type |
|
678 | - $setup_args = array( |
|
679 | - 'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php', |
|
680 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/'), |
|
681 | - 'messengers_to_activate_with' => array('email'), |
|
682 | - 'messengers_to_validate_with' => array('email'), |
|
683 | - 'messengers_supporting_default_template_pack_with' => array('email') |
|
684 | - ); |
|
685 | - EE_Register_Message_Type::register('payment_cancelled', $setup_args); |
|
686 | - } |
|
687 | - |
|
688 | - |
|
689 | - /** |
|
690 | - * Takes care of registering the shortcode libraries implemented with caffeinated EE and set up related items. |
|
691 | - * |
|
692 | - * @since 4.3.2 |
|
693 | - * |
|
694 | - * @return void |
|
695 | - */ |
|
696 | - public function register_caf_shortcodes() |
|
697 | - { |
|
698 | - $setup_args = array( |
|
699 | - 'autoloadpaths' => array( |
|
700 | - EE_CAF_LIBRARIES . 'shortcodes/' |
|
701 | - ), |
|
702 | - 'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'), |
|
703 | - 'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'), |
|
704 | - 'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]') |
|
705 | - ); |
|
706 | - EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args); |
|
707 | - } |
|
708 | - |
|
709 | - |
|
710 | - /** |
|
711 | - * Parses a question list shortcode using given data and template |
|
712 | - * |
|
713 | - * @param \EE_Shortcodes $shortcode_parser |
|
714 | - * @param EE_Question[] $questions An array of questions indexed by answer id. |
|
715 | - * @param EE_Answer[] $answers An array of answer objects |
|
716 | - * @param string $template Template content to be parsed. |
|
717 | - * @param array $valid_shortcodes Valid shortcodes for the template being parsed. |
|
718 | - * @param array $extra_data Extra data that might be used when parsing the template. |
|
719 | - */ |
|
720 | - protected function _parse_question_list_for_primary_or_recipient_registration( |
|
721 | - $shortcode_parser, |
|
722 | - $questions, |
|
723 | - $answers, |
|
724 | - $template, |
|
725 | - $valid_shortcodes, |
|
726 | - $extra_data |
|
727 | - ) { |
|
728 | - $question_list = ''; |
|
729 | - /** @var EEH_Parse_Shortcodes $shortcode_helper */ |
|
730 | - $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
|
731 | - foreach ($answers as $answer) { |
|
732 | - if ($answer instanceof EE_Answer) { |
|
733 | - //first see if the question is in our $questions array. If not then try to get from answer object. |
|
734 | - $question = isset($questions[$answer->ID()]) ? $questions[$answer->ID()] : null; |
|
735 | - $question = ! $question instanceof EE_Question ? $answer->question() : $question; |
|
736 | - if ( |
|
737 | - ! $question instanceof EE_Question |
|
738 | - || ( |
|
739 | - $question instanceof EE_Question |
|
740 | - && $question->admin_only() |
|
741 | - ) |
|
742 | - ) { |
|
743 | - continue; |
|
744 | - } |
|
745 | - $question_list .= $shortcode_helper->parse_question_list_template( |
|
746 | - $template, |
|
747 | - $answer, |
|
748 | - $valid_shortcodes, |
|
749 | - $extra_data |
|
750 | - ); |
|
751 | - } |
|
752 | - } |
|
753 | - |
|
754 | - return $question_list; |
|
755 | - } |
|
598 | + default : |
|
599 | + return $parsed; |
|
600 | + break; |
|
601 | + } |
|
602 | + } |
|
603 | + |
|
604 | + |
|
605 | + /** |
|
606 | + * Takes care of registering the message types that are only available in caffeinated EE. |
|
607 | + * |
|
608 | + * @since 4.3.2 |
|
609 | + * |
|
610 | + * @return void |
|
611 | + */ |
|
612 | + public function register_caf_message_types() |
|
613 | + { |
|
614 | + //register newsletter message type |
|
615 | + $setup_args = array( |
|
616 | + 'mtfilename' => 'EE_Newsletter_message_type.class.php', |
|
617 | + 'autoloadpaths' => array( |
|
618 | + EE_CAF_LIBRARIES . 'messages/message_type/newsletter/' |
|
619 | + ), |
|
620 | + 'messengers_to_activate_with' => array('email'), |
|
621 | + 'messengers_to_validate_with' => array('email'), |
|
622 | + 'messengers_supporting_default_template_pack_with' => array('email') |
|
623 | + ); |
|
624 | + EE_Register_Message_Type::register('newsletter', $setup_args); |
|
625 | + |
|
626 | + //register payment reminder message type |
|
627 | + $setup_args = array( |
|
628 | + 'mtfilename' => 'EE_Payment_Reminder_message_type.class.php', |
|
629 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/'), |
|
630 | + 'messengers_to_activate_with' => array('email'), |
|
631 | + 'messengers_to_validate_with' => array('email'), |
|
632 | + 'messengers_supporting_default_template_pack_with' => array('email') |
|
633 | + ); |
|
634 | + EE_Register_Message_Type::register('payment_reminder', $setup_args); |
|
635 | + |
|
636 | + //register payment declined message type |
|
637 | + $setup_args = array( |
|
638 | + 'mtfilename' => 'EE_Payment_Declined_message_type.class.php', |
|
639 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/'), |
|
640 | + 'messengers_to_activate_with' => array('email'), |
|
641 | + 'messengers_to_validate_with' => array('email'), |
|
642 | + 'messengers_supporting_default_template_pack_with' => array('email') |
|
643 | + ); |
|
644 | + EE_Register_Message_Type::register('payment_declined', $setup_args); |
|
645 | + |
|
646 | + //register registration declined message type |
|
647 | + $setup_args = array( |
|
648 | + 'mtfilename' => 'EE_Declined_Registration_message_type.class.php', |
|
649 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/'), |
|
650 | + 'messengers_to_activate_with' => array('email'), |
|
651 | + 'messengers_to_validate_with' => array('email'), |
|
652 | + 'messengers_supporting_default_template_pack_with' => array('email') |
|
653 | + ); |
|
654 | + EE_Register_Message_Type::register('declined_registration', $setup_args); |
|
655 | + |
|
656 | + //register registration cancelled message type |
|
657 | + $setup_args = array( |
|
658 | + 'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php', |
|
659 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/'), |
|
660 | + 'messengers_to_activate_with' => array('email'), |
|
661 | + 'messengers_to_validate_with' => array('email'), |
|
662 | + 'messengers_supporting_default_template_pack_with' => array('email') |
|
663 | + ); |
|
664 | + EE_Register_Message_Type::register('cancelled_registration', $setup_args); |
|
665 | + |
|
666 | + |
|
667 | + //register payment failed message type |
|
668 | + $setup_args = array( |
|
669 | + 'mtfilename' => 'EE_Payment_Failed_message_type.class.php', |
|
670 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/'), |
|
671 | + 'messengers_to_activate_with' => array('email'), |
|
672 | + 'messengers_to_validate_with' => array('email'), |
|
673 | + 'messengers_supporting_default_template_pack_with' => array('email') |
|
674 | + ); |
|
675 | + EE_Register_Message_Type::register('payment_failed', $setup_args); |
|
676 | + |
|
677 | + //register payment declined message type |
|
678 | + $setup_args = array( |
|
679 | + 'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php', |
|
680 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/'), |
|
681 | + 'messengers_to_activate_with' => array('email'), |
|
682 | + 'messengers_to_validate_with' => array('email'), |
|
683 | + 'messengers_supporting_default_template_pack_with' => array('email') |
|
684 | + ); |
|
685 | + EE_Register_Message_Type::register('payment_cancelled', $setup_args); |
|
686 | + } |
|
687 | + |
|
688 | + |
|
689 | + /** |
|
690 | + * Takes care of registering the shortcode libraries implemented with caffeinated EE and set up related items. |
|
691 | + * |
|
692 | + * @since 4.3.2 |
|
693 | + * |
|
694 | + * @return void |
|
695 | + */ |
|
696 | + public function register_caf_shortcodes() |
|
697 | + { |
|
698 | + $setup_args = array( |
|
699 | + 'autoloadpaths' => array( |
|
700 | + EE_CAF_LIBRARIES . 'shortcodes/' |
|
701 | + ), |
|
702 | + 'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'), |
|
703 | + 'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'), |
|
704 | + 'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]') |
|
705 | + ); |
|
706 | + EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args); |
|
707 | + } |
|
708 | + |
|
709 | + |
|
710 | + /** |
|
711 | + * Parses a question list shortcode using given data and template |
|
712 | + * |
|
713 | + * @param \EE_Shortcodes $shortcode_parser |
|
714 | + * @param EE_Question[] $questions An array of questions indexed by answer id. |
|
715 | + * @param EE_Answer[] $answers An array of answer objects |
|
716 | + * @param string $template Template content to be parsed. |
|
717 | + * @param array $valid_shortcodes Valid shortcodes for the template being parsed. |
|
718 | + * @param array $extra_data Extra data that might be used when parsing the template. |
|
719 | + */ |
|
720 | + protected function _parse_question_list_for_primary_or_recipient_registration( |
|
721 | + $shortcode_parser, |
|
722 | + $questions, |
|
723 | + $answers, |
|
724 | + $template, |
|
725 | + $valid_shortcodes, |
|
726 | + $extra_data |
|
727 | + ) { |
|
728 | + $question_list = ''; |
|
729 | + /** @var EEH_Parse_Shortcodes $shortcode_helper */ |
|
730 | + $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
|
731 | + foreach ($answers as $answer) { |
|
732 | + if ($answer instanceof EE_Answer) { |
|
733 | + //first see if the question is in our $questions array. If not then try to get from answer object. |
|
734 | + $question = isset($questions[$answer->ID()]) ? $questions[$answer->ID()] : null; |
|
735 | + $question = ! $question instanceof EE_Question ? $answer->question() : $question; |
|
736 | + if ( |
|
737 | + ! $question instanceof EE_Question |
|
738 | + || ( |
|
739 | + $question instanceof EE_Question |
|
740 | + && $question->admin_only() |
|
741 | + ) |
|
742 | + ) { |
|
743 | + continue; |
|
744 | + } |
|
745 | + $question_list .= $shortcode_helper->parse_question_list_template( |
|
746 | + $template, |
|
747 | + $answer, |
|
748 | + $valid_shortcodes, |
|
749 | + $extra_data |
|
750 | + ); |
|
751 | + } |
|
752 | + } |
|
753 | + |
|
754 | + return $question_list; |
|
755 | + } |
|
756 | 756 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function messages_autoload_paths($dir_ref) |
97 | 97 | { |
98 | - $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
|
98 | + $dir_ref[] = EE_CAF_LIBRARIES.'shortcodes/'; |
|
99 | 99 | |
100 | 100 | return $dir_ref; |
101 | 101 | } |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | //the template file name we're replacing contents for. |
219 | - $template_file_prefix = $field . '_' . $context; |
|
220 | - $msg_prefix = $messenger->name . '_' . $message_type->name . '_'; |
|
219 | + $template_file_prefix = $field.'_'.$context; |
|
220 | + $msg_prefix = $messenger->name.'_'.$message_type->name.'_'; |
|
221 | 221 | |
222 | - $base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/'; |
|
222 | + $base_path = EE_CAF_LIBRARIES.'messages/defaults/default/'; |
|
223 | 223 | |
224 | 224 | if ($messenger->name == 'email' && $message_type->name == 'registration') { |
225 | 225 | |
@@ -228,17 +228,17 @@ discard block |
||
228 | 228 | case 'question_list_admin' : |
229 | 229 | case 'question_list_attendee' : |
230 | 230 | case 'question_list_primary_attendee' : |
231 | - $path = $base_path . $msg_prefix . 'question_list.template.php'; |
|
231 | + $path = $base_path.$msg_prefix.'question_list.template.php'; |
|
232 | 232 | $contents = EEH_Template::display_template($path, array(), true); |
233 | 233 | break; |
234 | 234 | |
235 | 235 | case 'attendee_list_primary_attendee' : |
236 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
236 | + $path = $base_path.$msg_prefix.'attendee_list.template.php'; |
|
237 | 237 | $contents = EEH_Template::display_template($path, array(), true); |
238 | 238 | break; |
239 | 239 | |
240 | 240 | case 'attendee_list_admin' : |
241 | - $path = $base_path . $msg_prefix . 'attendee_list_admin.template.php'; |
|
241 | + $path = $base_path.$msg_prefix.'attendee_list_admin.template.php'; |
|
242 | 242 | $contents = EEH_Template::display_template($path, |
243 | 243 | array(), true); |
244 | 244 | break; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | break; |
249 | 249 | |
250 | 250 | case 'event_list_attendee' : |
251 | - $path = $base_path . $msg_prefix . 'event_list_attendee.template.php'; |
|
251 | + $path = $base_path.$msg_prefix.'event_list_attendee.template.php'; |
|
252 | 252 | $contents = EEH_Template::display_template($path, array(), true); |
253 | 253 | break; |
254 | 254 | } |
@@ -256,24 +256,24 @@ discard block |
||
256 | 256 | switch ($template_file_prefix) { |
257 | 257 | |
258 | 258 | case 'content_attendee' : |
259 | - $path = $base_path . $msg_prefix . 'content.template.php'; |
|
259 | + $path = $base_path.$msg_prefix.'content.template.php'; |
|
260 | 260 | $contents = EEH_Template::display_template($path, array(), true); |
261 | 261 | break; |
262 | 262 | |
263 | 263 | case 'newsletter_content_attendee' : |
264 | - $path = $base_path . $msg_prefix . 'newsletter_content.template.php'; |
|
264 | + $path = $base_path.$msg_prefix.'newsletter_content.template.php'; |
|
265 | 265 | $contents = EEH_Template::display_template($path, array(), true); |
266 | 266 | break; |
267 | 267 | |
268 | 268 | case 'newsletter_subject_attendee' : |
269 | - $path = $base_path . $msg_prefix . 'subject.template.php'; |
|
269 | + $path = $base_path.$msg_prefix.'subject.template.php'; |
|
270 | 270 | $contents = EEH_Template::display_template($path, array(), true); |
271 | 271 | break; |
272 | 272 | } |
273 | 273 | } elseif ($messenger->name == 'html' && $message_type->name == 'receipt') { |
274 | 274 | switch ($template_file_prefix) { |
275 | 275 | case 'attendee_list_purchaser' : |
276 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
276 | + $path = $base_path.$msg_prefix.'attendee_list.template.php'; |
|
277 | 277 | $contents = EEH_Template::display_template($path, array(), true); |
278 | 278 | break; |
279 | 279 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | //if $extra_data does not have a 'data' key then let's make sure we add it and set the EE_Messages_Addressee |
507 | 507 | //object on it. |
508 | - if ( ! isset( $extra_data['data'] ) ) { |
|
508 | + if ( ! isset($extra_data['data'])) { |
|
509 | 509 | $extra_data['data'] = $recipient; |
510 | 510 | } |
511 | 511 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration) { |
570 | 570 | return ''; |
571 | 571 | } |
572 | - $registration = $recipient->primary_reg_obj; |
|
572 | + $registration = $recipient->primary_reg_obj; |
|
573 | 573 | $answers = isset($recipient->registrations[$registration->ID()]['ans_objs']) |
574 | 574 | ? $recipient->registrations[$registration->ID()]['ans_objs'] |
575 | 575 | : array(); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | $questions = isset($recipient->questions) ? $recipient->questions : array(); |
583 | 583 | //if $extra_data does not have a 'data' key then let's make sure we add it and set the EE_Messages_Addressee |
584 | 584 | //object on it. |
585 | - if ( ! isset( $extra_data['data'] ) ){ |
|
585 | + if ( ! isset($extra_data['data'])) { |
|
586 | 586 | $extra_data['data'] = $recipient; |
587 | 587 | } |
588 | 588 | return $this->_parse_question_list_for_primary_or_recipient_registration( |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | $setup_args = array( |
616 | 616 | 'mtfilename' => 'EE_Newsletter_message_type.class.php', |
617 | 617 | 'autoloadpaths' => array( |
618 | - EE_CAF_LIBRARIES . 'messages/message_type/newsletter/' |
|
618 | + EE_CAF_LIBRARIES.'messages/message_type/newsletter/' |
|
619 | 619 | ), |
620 | 620 | 'messengers_to_activate_with' => array('email'), |
621 | 621 | 'messengers_to_validate_with' => array('email'), |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | //register payment reminder message type |
627 | 627 | $setup_args = array( |
628 | 628 | 'mtfilename' => 'EE_Payment_Reminder_message_type.class.php', |
629 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/'), |
|
629 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_reminder/'), |
|
630 | 630 | 'messengers_to_activate_with' => array('email'), |
631 | 631 | 'messengers_to_validate_with' => array('email'), |
632 | 632 | 'messengers_supporting_default_template_pack_with' => array('email') |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | //register payment declined message type |
637 | 637 | $setup_args = array( |
638 | 638 | 'mtfilename' => 'EE_Payment_Declined_message_type.class.php', |
639 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/'), |
|
639 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_declined/'), |
|
640 | 640 | 'messengers_to_activate_with' => array('email'), |
641 | 641 | 'messengers_to_validate_with' => array('email'), |
642 | 642 | 'messengers_supporting_default_template_pack_with' => array('email') |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | //register registration declined message type |
647 | 647 | $setup_args = array( |
648 | 648 | 'mtfilename' => 'EE_Declined_Registration_message_type.class.php', |
649 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/'), |
|
649 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/declined_registration/'), |
|
650 | 650 | 'messengers_to_activate_with' => array('email'), |
651 | 651 | 'messengers_to_validate_with' => array('email'), |
652 | 652 | 'messengers_supporting_default_template_pack_with' => array('email') |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | //register registration cancelled message type |
657 | 657 | $setup_args = array( |
658 | 658 | 'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php', |
659 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/'), |
|
659 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/cancelled_registration/'), |
|
660 | 660 | 'messengers_to_activate_with' => array('email'), |
661 | 661 | 'messengers_to_validate_with' => array('email'), |
662 | 662 | 'messengers_supporting_default_template_pack_with' => array('email') |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | //register payment failed message type |
668 | 668 | $setup_args = array( |
669 | 669 | 'mtfilename' => 'EE_Payment_Failed_message_type.class.php', |
670 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/'), |
|
670 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_failed/'), |
|
671 | 671 | 'messengers_to_activate_with' => array('email'), |
672 | 672 | 'messengers_to_validate_with' => array('email'), |
673 | 673 | 'messengers_supporting_default_template_pack_with' => array('email') |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | //register payment declined message type |
678 | 678 | $setup_args = array( |
679 | 679 | 'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php', |
680 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/'), |
|
680 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_cancelled/'), |
|
681 | 681 | 'messengers_to_activate_with' => array('email'), |
682 | 682 | 'messengers_to_validate_with' => array('email'), |
683 | 683 | 'messengers_supporting_default_template_pack_with' => array('email') |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | { |
698 | 698 | $setup_args = array( |
699 | 699 | 'autoloadpaths' => array( |
700 | - EE_CAF_LIBRARIES . 'shortcodes/' |
|
700 | + EE_CAF_LIBRARIES.'shortcodes/' |
|
701 | 701 | ), |
702 | 702 | 'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'), |
703 | 703 | 'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'), |