@@ -4,9 +4,9 @@ |
||
4 | 4 | </ul> |
5 | 5 | <div id="espresso_event_type-all" class="tabs-panel"> |
6 | 6 | <?php |
7 | - $name = 'tax_input[espresso_event_type]'; |
|
8 | - echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. |
|
9 | - ?> |
|
7 | + $name = 'tax_input[espresso_event_type]'; |
|
8 | + echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. |
|
9 | + ?> |
|
10 | 10 | <ul id="espresso_event_typechecklist" data-wp-lists="list:espresso_event_type" |
11 | 11 | class="categorychecklist form-no-clear"> |
12 | 12 | <?php echo $radio_list; ?> |
@@ -3,17 +3,17 @@ |
||
3 | 3 | assert($question_group instanceof EE_Question_Group); |
4 | 4 | assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));// list of unused questions |
5 | 5 | foreach ($all_questions as $question_option) { |
6 | - assert($question_option); |
|
7 | - assert($question_option instanceof EE_Question); |
|
6 | + assert($question_option); |
|
7 | + assert($question_option instanceof EE_Question); |
|
8 | 8 | } |
9 | 9 | ?> |
10 | 10 | <h4><?php _e('Check off all questions that you wish to appear in this group.', 'event_espresso'); ?></h4> |
11 | 11 | <ul> |
12 | 12 | <?php |
13 | - foreach ($all_questions as $question_ID => $question) { |
|
14 | - /*@var $question EE_Question*/ |
|
15 | - $checked = array_key_exists($question_ID, $question_group->questions()) ? ' checked="checked"' : ''; |
|
16 | - ?> |
|
13 | + foreach ($all_questions as $question_ID => $question) { |
|
14 | + /*@var $question EE_Question*/ |
|
15 | + $checked = array_key_exists($question_ID, $question_group->questions()) ? ' checked="checked"' : ''; |
|
16 | + ?> |
|
17 | 17 | <li> |
18 | 18 | <label for="question-<?php echo $question_ID ?>"> |
19 | 19 | <input type="checkbox" name="questions[<?php echo $question_ID; ?>]" |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | // required variables for template: |
3 | 3 | assert($question_group instanceof EE_Question_Group); |
4 | -assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));// list of unused questions |
|
4 | +assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions))); // list of unused questions |
|
5 | 5 | foreach ($all_questions as $question_option) { |
6 | 6 | assert($question_option); |
7 | 7 | assert($question_option instanceof EE_Question); |
@@ -6,11 +6,11 @@ |
||
6 | 6 | <li class="ticket-registration"> |
7 | 7 | <table class="registration-details"> |
8 | 8 | <tr class="odd"> |
9 | - <th><?php _e('Attendee', 'event_espresso');?></th> |
|
9 | + <th><?php _e('Attendee', 'event_espresso'); ?></th> |
|
10 | 10 | <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td> |
11 | 11 | </tr> |
12 | 12 | <tr> |
13 | - <th><?php _e("Registration Code:", "event_espresso");?></th> |
|
13 | + <th><?php _e("Registration Code:", "event_espresso"); ?></th> |
|
14 | 14 | <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td> |
15 | 15 | </tr> |
16 | 16 | <tr> |
@@ -15,49 +15,49 @@ |
||
15 | 15 | class EE_Payment_Declined_message_type extends EE_Payment_Base_message_type |
16 | 16 | { |
17 | 17 | |
18 | - public function __construct() |
|
19 | - { |
|
20 | - |
|
21 | - // setup type details for reference |
|
22 | - $this->name = 'payment_declined'; |
|
23 | - $this->description = __('This message type is used for all declined payment notification messages that go out including any manual payments entered by an event administrator.', 'event_espresso'); |
|
24 | - $this->label = array( |
|
25 | - 'singular' => __('payment declined', 'event_espresso'), |
|
26 | - 'plural' => __('payments declined', 'event_espresso') |
|
27 | - ); |
|
28 | - |
|
29 | - $this->_master_templates = array( |
|
30 | - 'email' => 'payment' |
|
31 | - ); |
|
32 | - |
|
33 | - parent::__construct(); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * _set_contexts |
|
39 | - * This sets up the contexts associated with the message_type |
|
40 | - * |
|
41 | - * @access protected |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - protected function _set_contexts() |
|
45 | - { |
|
46 | - $this->_context_label = array( |
|
47 | - 'label' => __('recipient', 'event_espresso'), |
|
48 | - 'plural' => __('recipients', 'event_espresso'), |
|
49 | - 'description' => __('Recipient\'s are who will receive the template. You may want different payment details sent out depending on who the recipient is', 'event_espresso') |
|
50 | - ); |
|
51 | - |
|
52 | - $this->_contexts = array( |
|
53 | - 'admin' => array( |
|
54 | - 'label' => __('Event Admin', 'event_espresso'), |
|
55 | - 'description' => __('This template is what event administrators will receive when payment is declined', 'event_espresso') |
|
56 | - ), |
|
57 | - 'primary_attendee' => array( |
|
58 | - 'label' => __('Primary Registrant', 'event_espresso'), |
|
59 | - 'description' => __('This template is what the primary registrant (the person who made the main registration) will receive when the payment is declined', 'event_espresso') |
|
60 | - ) |
|
61 | - ); |
|
62 | - } |
|
18 | + public function __construct() |
|
19 | + { |
|
20 | + |
|
21 | + // setup type details for reference |
|
22 | + $this->name = 'payment_declined'; |
|
23 | + $this->description = __('This message type is used for all declined payment notification messages that go out including any manual payments entered by an event administrator.', 'event_espresso'); |
|
24 | + $this->label = array( |
|
25 | + 'singular' => __('payment declined', 'event_espresso'), |
|
26 | + 'plural' => __('payments declined', 'event_espresso') |
|
27 | + ); |
|
28 | + |
|
29 | + $this->_master_templates = array( |
|
30 | + 'email' => 'payment' |
|
31 | + ); |
|
32 | + |
|
33 | + parent::__construct(); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * _set_contexts |
|
39 | + * This sets up the contexts associated with the message_type |
|
40 | + * |
|
41 | + * @access protected |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + protected function _set_contexts() |
|
45 | + { |
|
46 | + $this->_context_label = array( |
|
47 | + 'label' => __('recipient', 'event_espresso'), |
|
48 | + 'plural' => __('recipients', 'event_espresso'), |
|
49 | + 'description' => __('Recipient\'s are who will receive the template. You may want different payment details sent out depending on who the recipient is', 'event_espresso') |
|
50 | + ); |
|
51 | + |
|
52 | + $this->_contexts = array( |
|
53 | + 'admin' => array( |
|
54 | + 'label' => __('Event Admin', 'event_espresso'), |
|
55 | + 'description' => __('This template is what event administrators will receive when payment is declined', 'event_espresso') |
|
56 | + ), |
|
57 | + 'primary_attendee' => array( |
|
58 | + 'label' => __('Primary Registrant', 'event_espresso'), |
|
59 | + 'description' => __('This template is what the primary registrant (the person who made the main registration) will receive when the payment is declined', 'event_espresso') |
|
60 | + ) |
|
61 | + ); |
|
62 | + } |
|
63 | 63 | } |
@@ -15,37 +15,37 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - public function __construct($fields, $context) |
|
19 | - { |
|
20 | - $this->_m_name = 'email'; |
|
21 | - $this->_mt_name = 'payment_declined'; |
|
22 | - |
|
23 | - parent::__construct($fields, $context); |
|
24 | - } |
|
25 | - |
|
26 | - /** |
|
27 | - * at this point no custom validation needed for this messenger/message_type combo. |
|
28 | - */ |
|
29 | - protected function _modify_validator() |
|
30 | - { |
|
31 | - $new_config = $this->_messenger->get_validator_config(); |
|
32 | - |
|
33 | - // modify just event_list |
|
34 | - $new_config['event_list'] = array( |
|
35 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
36 | - ); |
|
37 | - $new_config['ticket_list'] = array( |
|
38 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
39 | - ); |
|
40 | - $new_config['content'] = array( |
|
41 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
42 | - ); |
|
43 | - $this->_messenger->set_validator_config($new_config); |
|
44 | - |
|
45 | - if ($this->_context != 'admin') { |
|
46 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
47 | - } |
|
48 | - |
|
49 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
50 | - } |
|
18 | + public function __construct($fields, $context) |
|
19 | + { |
|
20 | + $this->_m_name = 'email'; |
|
21 | + $this->_mt_name = 'payment_declined'; |
|
22 | + |
|
23 | + parent::__construct($fields, $context); |
|
24 | + } |
|
25 | + |
|
26 | + /** |
|
27 | + * at this point no custom validation needed for this messenger/message_type combo. |
|
28 | + */ |
|
29 | + protected function _modify_validator() |
|
30 | + { |
|
31 | + $new_config = $this->_messenger->get_validator_config(); |
|
32 | + |
|
33 | + // modify just event_list |
|
34 | + $new_config['event_list'] = array( |
|
35 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
36 | + ); |
|
37 | + $new_config['ticket_list'] = array( |
|
38 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
39 | + ); |
|
40 | + $new_config['content'] = array( |
|
41 | + 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
42 | + ); |
|
43 | + $this->_messenger->set_validator_config($new_config); |
|
44 | + |
|
45 | + if ($this->_context != 'admin') { |
|
46 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
47 | + } |
|
48 | + |
|
49 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
50 | + } |
|
51 | 51 | } |
@@ -32,18 +32,18 @@ |
||
32 | 32 | |
33 | 33 | // modify just event_list |
34 | 34 | $new_config['event_list'] = array( |
35 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
35 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
36 | 36 | ); |
37 | 37 | $new_config['ticket_list'] = array( |
38 | 38 | 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
39 | 39 | ); |
40 | 40 | $new_config['content'] = array( |
41 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
41 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
42 | 42 | ); |
43 | 43 | $this->_messenger->set_validator_config($new_config); |
44 | 44 | |
45 | 45 | if ($this->_context != 'admin') { |
46 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
46 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -11,72 +11,72 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Messages_Email_Newsletter_Validator extends EE_Messages_Validator |
13 | 13 | { |
14 | - /** |
|
15 | - * EE_Messages_Email_Newsletter_Validator constructor. |
|
16 | - * |
|
17 | - * @param array $fields |
|
18 | - * @param string $context |
|
19 | - * @throws EE_Error |
|
20 | - * @throws ReflectionException |
|
21 | - */ |
|
22 | - public function __construct(array $fields, $context) |
|
23 | - { |
|
24 | - $this->_m_name = 'email'; |
|
25 | - $this->_mt_name = 'newsletter'; |
|
14 | + /** |
|
15 | + * EE_Messages_Email_Newsletter_Validator constructor. |
|
16 | + * |
|
17 | + * @param array $fields |
|
18 | + * @param string $context |
|
19 | + * @throws EE_Error |
|
20 | + * @throws ReflectionException |
|
21 | + */ |
|
22 | + public function __construct(array $fields, $context) |
|
23 | + { |
|
24 | + $this->_m_name = 'email'; |
|
25 | + $this->_mt_name = 'newsletter'; |
|
26 | 26 | |
27 | - parent::__construct($fields, $context); |
|
28 | - } |
|
27 | + parent::__construct($fields, $context); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * custom validator (restricting what was originally set by the messenger) |
|
32 | - */ |
|
33 | - protected function _modify_validator() |
|
34 | - { |
|
35 | - if ($this->_context === 'attendee') { |
|
36 | - $this->_valid_shortcodes_modifier[ $this->_context ]['from'] = array( |
|
37 | - 'recipient_details', |
|
38 | - 'email', |
|
39 | - 'organization', |
|
40 | - ); |
|
41 | - } |
|
30 | + /** |
|
31 | + * custom validator (restricting what was originally set by the messenger) |
|
32 | + */ |
|
33 | + protected function _modify_validator() |
|
34 | + { |
|
35 | + if ($this->_context === 'attendee') { |
|
36 | + $this->_valid_shortcodes_modifier[ $this->_context ]['from'] = array( |
|
37 | + 'recipient_details', |
|
38 | + 'email', |
|
39 | + 'organization', |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | - // excluded shortcodes |
|
44 | - $fields = array('to', 'from', 'subject', 'content', 'newsletter_content'); |
|
45 | - foreach ($fields as $field) { |
|
46 | - $this->_specific_shortcode_excludes[ $field ] = array( |
|
47 | - '[RECIPIENT_REGISTRATION_CODE]', |
|
48 | - '[EVENT_AUTHOR_FORMATTED_EMAIL]', |
|
49 | - '[EVENT_AUTHOR_EMAIL]', |
|
50 | - ); |
|
51 | - } |
|
52 | - $add_excludes = array( |
|
53 | - '[RECIPIENT_FNAME]', |
|
54 | - '[RECIPIENT_LNAME]', |
|
55 | - '[RECIPIENT_EMAIL]', |
|
56 | - '[COMPANY]', |
|
57 | - '[CO_ADD1]', |
|
58 | - '[CO_ADD2]', |
|
59 | - '[CO_CITY]', |
|
60 | - '[CO_STATE]', |
|
61 | - '[CO_ZIP]', |
|
62 | - '[CO_LOGO]', |
|
63 | - '[CO_PHONE]', |
|
64 | - '[CO_LOGO_URL]', |
|
65 | - '[CO_FACEBOOK_URL]', |
|
66 | - '[CO_TWITTER_URL]', |
|
67 | - '[CO_PINTEREST_URL]', |
|
68 | - '[CO_GOOGLE_URL]', |
|
69 | - '[CO_LINKEDIN_URL]', |
|
70 | - '[CO_INSTAGRAM_URL]', |
|
71 | - ); |
|
72 | - $this->_specific_shortcode_excludes['from'] = |
|
73 | - array_merge( |
|
74 | - $this->_specific_shortcode_excludes['from'], |
|
75 | - $add_excludes |
|
76 | - ); |
|
77 | - $this->_specific_shortcode_excludes['content'] = array_merge( |
|
78 | - $this->_specific_shortcode_excludes['content'], |
|
79 | - array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]') |
|
80 | - ); |
|
81 | - } |
|
43 | + // excluded shortcodes |
|
44 | + $fields = array('to', 'from', 'subject', 'content', 'newsletter_content'); |
|
45 | + foreach ($fields as $field) { |
|
46 | + $this->_specific_shortcode_excludes[ $field ] = array( |
|
47 | + '[RECIPIENT_REGISTRATION_CODE]', |
|
48 | + '[EVENT_AUTHOR_FORMATTED_EMAIL]', |
|
49 | + '[EVENT_AUTHOR_EMAIL]', |
|
50 | + ); |
|
51 | + } |
|
52 | + $add_excludes = array( |
|
53 | + '[RECIPIENT_FNAME]', |
|
54 | + '[RECIPIENT_LNAME]', |
|
55 | + '[RECIPIENT_EMAIL]', |
|
56 | + '[COMPANY]', |
|
57 | + '[CO_ADD1]', |
|
58 | + '[CO_ADD2]', |
|
59 | + '[CO_CITY]', |
|
60 | + '[CO_STATE]', |
|
61 | + '[CO_ZIP]', |
|
62 | + '[CO_LOGO]', |
|
63 | + '[CO_PHONE]', |
|
64 | + '[CO_LOGO_URL]', |
|
65 | + '[CO_FACEBOOK_URL]', |
|
66 | + '[CO_TWITTER_URL]', |
|
67 | + '[CO_PINTEREST_URL]', |
|
68 | + '[CO_GOOGLE_URL]', |
|
69 | + '[CO_LINKEDIN_URL]', |
|
70 | + '[CO_INSTAGRAM_URL]', |
|
71 | + ); |
|
72 | + $this->_specific_shortcode_excludes['from'] = |
|
73 | + array_merge( |
|
74 | + $this->_specific_shortcode_excludes['from'], |
|
75 | + $add_excludes |
|
76 | + ); |
|
77 | + $this->_specific_shortcode_excludes['content'] = array_merge( |
|
78 | + $this->_specific_shortcode_excludes['content'], |
|
79 | + array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]') |
|
80 | + ); |
|
81 | + } |
|
82 | 82 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | protected function _modify_validator() |
34 | 34 | { |
35 | 35 | if ($this->_context === 'attendee') { |
36 | - $this->_valid_shortcodes_modifier[ $this->_context ]['from'] = array( |
|
36 | + $this->_valid_shortcodes_modifier[$this->_context]['from'] = array( |
|
37 | 37 | 'recipient_details', |
38 | 38 | 'email', |
39 | 39 | 'organization', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | // excluded shortcodes |
44 | 44 | $fields = array('to', 'from', 'subject', 'content', 'newsletter_content'); |
45 | 45 | foreach ($fields as $field) { |
46 | - $this->_specific_shortcode_excludes[ $field ] = array( |
|
46 | + $this->_specific_shortcode_excludes[$field] = array( |
|
47 | 47 | '[RECIPIENT_REGISTRATION_CODE]', |
48 | 48 | '[EVENT_AUTHOR_FORMATTED_EMAIL]', |
49 | 49 | '[EVENT_AUTHOR_EMAIL]', |
@@ -13,194 +13,194 @@ |
||
13 | 13 | class EE_Newsletter_message_type extends EE_message_type |
14 | 14 | { |
15 | 15 | |
16 | - public function __construct() |
|
17 | - { |
|
18 | - $this->name = 'newsletter'; |
|
19 | - $this->description = esc_html__( |
|
20 | - 'Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.', |
|
21 | - 'event_espresso' |
|
22 | - ); |
|
23 | - $this->label = array( |
|
24 | - 'singular' => esc_html__('batch', 'event_espresso'), |
|
25 | - 'plural' => esc_html__('batches', 'event_espresso'), |
|
26 | - ); |
|
27 | - $this->_master_templates = array( |
|
28 | - 'email' => 'registration', |
|
29 | - ); |
|
30 | - |
|
31 | - parent::__construct(); |
|
32 | - } |
|
33 | - |
|
34 | - |
|
35 | - /** |
|
36 | - * Sets admin_registered_pages property |
|
37 | - */ |
|
38 | - protected function _set_admin_pages() |
|
39 | - { |
|
40 | - $this->admin_registered_pages = array(); // no admin pages to register this with. |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - /** |
|
45 | - * Sets property related to data handler. |
|
46 | - */ |
|
47 | - protected function _set_data_handler() |
|
48 | - { |
|
49 | - $this->_data_handler = 'Registrations'; |
|
50 | - $this->_single_message = $this->_data instanceof EE_Registration; |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * Returns the data for the given context for this message type. |
|
56 | - * @param string $context |
|
57 | - * @param EE_Registration $registration |
|
58 | - * @param int $id |
|
59 | - * @return array|mixed |
|
60 | - */ |
|
61 | - protected function _get_data_for_context($context, EE_Registration $registration, $id) |
|
62 | - { |
|
63 | - // newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects. |
|
64 | - return array($registration); |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * Sets the admin settings fields property for this message type. |
|
70 | - */ |
|
71 | - protected function _set_admin_settings_fields() |
|
72 | - { |
|
73 | - $this->_admin_settings_fields = array(); |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * Sets the contexts for this message type. |
|
79 | - */ |
|
80 | - protected function _set_contexts() |
|
81 | - { |
|
82 | - $this->_context_label = array( |
|
83 | - 'label' => esc_html__('recipient', 'event_espresso'), |
|
84 | - 'plural' => esc_html__('recipients', 'event_espresso'), |
|
85 | - 'description' => esc_html__('Recipient\'s are who will receive the message.', 'event_espresso'), |
|
86 | - ); |
|
87 | - |
|
88 | - $this->_contexts = array( |
|
89 | - 'attendee' => array( |
|
90 | - 'label' => esc_html__('Registrant', 'event_espresso'), |
|
91 | - 'description' => esc_html__('This template goes to selected registrants.', 'event_espresso'), |
|
92 | - ), |
|
93 | - ); |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * used to set the valid shortcodes. |
|
99 | - * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and |
|
100 | - * organization. That's it! |
|
101 | - * |
|
102 | - * @since 4.3.0 |
|
103 | - * @return void |
|
104 | - */ |
|
105 | - protected function _set_valid_shortcodes() |
|
106 | - { |
|
107 | - parent::_set_valid_shortcodes(); |
|
108 | - |
|
109 | - $included_shortcodes = array( |
|
110 | - 'recipient_details', |
|
111 | - 'organization', |
|
112 | - 'newsletter', |
|
113 | - ); |
|
114 | - |
|
115 | - foreach ($this->_valid_shortcodes as $context => $shortcodes) { |
|
116 | - foreach ($shortcodes as $key => $shortcode) { |
|
117 | - if (! in_array($shortcode, $included_shortcodes, true)) { |
|
118 | - unset($this->_valid_shortcodes[ $context ][ $key ]); |
|
119 | - } |
|
120 | - } |
|
121 | - $this->_valid_shortcodes[ $context ][] = 'newsletter'; |
|
122 | - } |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * Override default _attendee_addressees in EE_message_type because we want to loop through the registrations |
|
128 | - * for EE_message_type. |
|
129 | - * |
|
130 | - * @return array |
|
131 | - * @throws EE_Error |
|
132 | - * @throws InvalidArgumentException |
|
133 | - * @throws ReflectionException |
|
134 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
135 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
136 | - */ |
|
137 | - protected function _attendee_addressees() |
|
138 | - { |
|
139 | - $addressee = array(); |
|
140 | - |
|
141 | - // looping through registrations |
|
142 | - foreach ($this->_data->registrations as $reg_id => $details) { |
|
143 | - // set $attendee array to blank on each loop |
|
144 | - $aee = array(); |
|
145 | - |
|
146 | - // need to get the attendee from this registration. |
|
147 | - $attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee |
|
148 | - ? $details['att_obj'] |
|
149 | - : null; |
|
150 | - |
|
151 | - if (! $attendee instanceof EE_Attendee) { |
|
152 | - continue; |
|
153 | - } |
|
154 | - |
|
155 | - // set $aee from attendee object |
|
156 | - $aee['att_obj'] = $attendee; |
|
157 | - $aee['reg_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['reg_objs']) |
|
158 | - ? $this->_data->attendees[ $attendee->ID() ]['reg_objs'] |
|
159 | - : array(); |
|
160 | - $aee['attendee_email'] = $attendee->email(); |
|
161 | - $aee['tkt_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['tkt_objs']) |
|
162 | - ? $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] |
|
163 | - : array(); |
|
164 | - |
|
165 | - if (isset($this->_data->attendees[ $attendee->ID() ]['evt_objs'])) { |
|
166 | - $aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
167 | - $aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
168 | - } else { |
|
169 | - $aee['evt_objs'] = $aee['events'] = array(); |
|
170 | - } |
|
171 | - |
|
172 | - $aee['reg_obj'] = isset($details['reg_obj']) |
|
173 | - ? $details['reg_obj'] |
|
174 | - : null; |
|
175 | - $aee['attendees'] = $this->_data->attendees; |
|
176 | - |
|
177 | - // merge in the primary attendee data |
|
178 | - $aee = array_merge($this->_default_addressee_data, $aee); |
|
179 | - |
|
180 | - // make sure txn is set |
|
181 | - if (empty($aee['txn']) && $aee['reg_obj'] instanceof EE_Registration) { |
|
182 | - $aee['txn'] = $aee['reg_obj']->transaction(); |
|
183 | - } |
|
184 | - |
|
185 | - $addressee[] = new EE_Messages_Addressee($aee); |
|
186 | - } |
|
187 | - return $addressee; |
|
188 | - } |
|
189 | - |
|
190 | - /** |
|
191 | - * Allows a message type to specifically exclude template fields for the provided messenger. |
|
192 | - * Filtered so this can be programmatically altered as well. |
|
193 | - * |
|
194 | - * @param string $messenger_name name of messenger |
|
195 | - * @return array |
|
196 | - */ |
|
197 | - public function excludedFieldsForMessenger($messenger_name) |
|
198 | - { |
|
199 | - $excluded_fields = array( |
|
200 | - 'email' => array('cc') |
|
201 | - ); |
|
202 | - return isset($excluded_fields[ $messenger_name ]) |
|
203 | - ? $excluded_fields[ $messenger_name ] |
|
204 | - : parent::excludedFieldsForMessenger($messenger_name); |
|
205 | - } |
|
16 | + public function __construct() |
|
17 | + { |
|
18 | + $this->name = 'newsletter'; |
|
19 | + $this->description = esc_html__( |
|
20 | + 'Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.', |
|
21 | + 'event_espresso' |
|
22 | + ); |
|
23 | + $this->label = array( |
|
24 | + 'singular' => esc_html__('batch', 'event_espresso'), |
|
25 | + 'plural' => esc_html__('batches', 'event_espresso'), |
|
26 | + ); |
|
27 | + $this->_master_templates = array( |
|
28 | + 'email' => 'registration', |
|
29 | + ); |
|
30 | + |
|
31 | + parent::__construct(); |
|
32 | + } |
|
33 | + |
|
34 | + |
|
35 | + /** |
|
36 | + * Sets admin_registered_pages property |
|
37 | + */ |
|
38 | + protected function _set_admin_pages() |
|
39 | + { |
|
40 | + $this->admin_registered_pages = array(); // no admin pages to register this with. |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + /** |
|
45 | + * Sets property related to data handler. |
|
46 | + */ |
|
47 | + protected function _set_data_handler() |
|
48 | + { |
|
49 | + $this->_data_handler = 'Registrations'; |
|
50 | + $this->_single_message = $this->_data instanceof EE_Registration; |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * Returns the data for the given context for this message type. |
|
56 | + * @param string $context |
|
57 | + * @param EE_Registration $registration |
|
58 | + * @param int $id |
|
59 | + * @return array|mixed |
|
60 | + */ |
|
61 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) |
|
62 | + { |
|
63 | + // newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects. |
|
64 | + return array($registration); |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * Sets the admin settings fields property for this message type. |
|
70 | + */ |
|
71 | + protected function _set_admin_settings_fields() |
|
72 | + { |
|
73 | + $this->_admin_settings_fields = array(); |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * Sets the contexts for this message type. |
|
79 | + */ |
|
80 | + protected function _set_contexts() |
|
81 | + { |
|
82 | + $this->_context_label = array( |
|
83 | + 'label' => esc_html__('recipient', 'event_espresso'), |
|
84 | + 'plural' => esc_html__('recipients', 'event_espresso'), |
|
85 | + 'description' => esc_html__('Recipient\'s are who will receive the message.', 'event_espresso'), |
|
86 | + ); |
|
87 | + |
|
88 | + $this->_contexts = array( |
|
89 | + 'attendee' => array( |
|
90 | + 'label' => esc_html__('Registrant', 'event_espresso'), |
|
91 | + 'description' => esc_html__('This template goes to selected registrants.', 'event_espresso'), |
|
92 | + ), |
|
93 | + ); |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * used to set the valid shortcodes. |
|
99 | + * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and |
|
100 | + * organization. That's it! |
|
101 | + * |
|
102 | + * @since 4.3.0 |
|
103 | + * @return void |
|
104 | + */ |
|
105 | + protected function _set_valid_shortcodes() |
|
106 | + { |
|
107 | + parent::_set_valid_shortcodes(); |
|
108 | + |
|
109 | + $included_shortcodes = array( |
|
110 | + 'recipient_details', |
|
111 | + 'organization', |
|
112 | + 'newsletter', |
|
113 | + ); |
|
114 | + |
|
115 | + foreach ($this->_valid_shortcodes as $context => $shortcodes) { |
|
116 | + foreach ($shortcodes as $key => $shortcode) { |
|
117 | + if (! in_array($shortcode, $included_shortcodes, true)) { |
|
118 | + unset($this->_valid_shortcodes[ $context ][ $key ]); |
|
119 | + } |
|
120 | + } |
|
121 | + $this->_valid_shortcodes[ $context ][] = 'newsletter'; |
|
122 | + } |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * Override default _attendee_addressees in EE_message_type because we want to loop through the registrations |
|
128 | + * for EE_message_type. |
|
129 | + * |
|
130 | + * @return array |
|
131 | + * @throws EE_Error |
|
132 | + * @throws InvalidArgumentException |
|
133 | + * @throws ReflectionException |
|
134 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
135 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
136 | + */ |
|
137 | + protected function _attendee_addressees() |
|
138 | + { |
|
139 | + $addressee = array(); |
|
140 | + |
|
141 | + // looping through registrations |
|
142 | + foreach ($this->_data->registrations as $reg_id => $details) { |
|
143 | + // set $attendee array to blank on each loop |
|
144 | + $aee = array(); |
|
145 | + |
|
146 | + // need to get the attendee from this registration. |
|
147 | + $attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee |
|
148 | + ? $details['att_obj'] |
|
149 | + : null; |
|
150 | + |
|
151 | + if (! $attendee instanceof EE_Attendee) { |
|
152 | + continue; |
|
153 | + } |
|
154 | + |
|
155 | + // set $aee from attendee object |
|
156 | + $aee['att_obj'] = $attendee; |
|
157 | + $aee['reg_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['reg_objs']) |
|
158 | + ? $this->_data->attendees[ $attendee->ID() ]['reg_objs'] |
|
159 | + : array(); |
|
160 | + $aee['attendee_email'] = $attendee->email(); |
|
161 | + $aee['tkt_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['tkt_objs']) |
|
162 | + ? $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] |
|
163 | + : array(); |
|
164 | + |
|
165 | + if (isset($this->_data->attendees[ $attendee->ID() ]['evt_objs'])) { |
|
166 | + $aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
167 | + $aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
168 | + } else { |
|
169 | + $aee['evt_objs'] = $aee['events'] = array(); |
|
170 | + } |
|
171 | + |
|
172 | + $aee['reg_obj'] = isset($details['reg_obj']) |
|
173 | + ? $details['reg_obj'] |
|
174 | + : null; |
|
175 | + $aee['attendees'] = $this->_data->attendees; |
|
176 | + |
|
177 | + // merge in the primary attendee data |
|
178 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
179 | + |
|
180 | + // make sure txn is set |
|
181 | + if (empty($aee['txn']) && $aee['reg_obj'] instanceof EE_Registration) { |
|
182 | + $aee['txn'] = $aee['reg_obj']->transaction(); |
|
183 | + } |
|
184 | + |
|
185 | + $addressee[] = new EE_Messages_Addressee($aee); |
|
186 | + } |
|
187 | + return $addressee; |
|
188 | + } |
|
189 | + |
|
190 | + /** |
|
191 | + * Allows a message type to specifically exclude template fields for the provided messenger. |
|
192 | + * Filtered so this can be programmatically altered as well. |
|
193 | + * |
|
194 | + * @param string $messenger_name name of messenger |
|
195 | + * @return array |
|
196 | + */ |
|
197 | + public function excludedFieldsForMessenger($messenger_name) |
|
198 | + { |
|
199 | + $excluded_fields = array( |
|
200 | + 'email' => array('cc') |
|
201 | + ); |
|
202 | + return isset($excluded_fields[ $messenger_name ]) |
|
203 | + ? $excluded_fields[ $messenger_name ] |
|
204 | + : parent::excludedFieldsForMessenger($messenger_name); |
|
205 | + } |
|
206 | 206 | } |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | |
115 | 115 | foreach ($this->_valid_shortcodes as $context => $shortcodes) { |
116 | 116 | foreach ($shortcodes as $key => $shortcode) { |
117 | - if (! in_array($shortcode, $included_shortcodes, true)) { |
|
118 | - unset($this->_valid_shortcodes[ $context ][ $key ]); |
|
117 | + if ( ! in_array($shortcode, $included_shortcodes, true)) { |
|
118 | + unset($this->_valid_shortcodes[$context][$key]); |
|
119 | 119 | } |
120 | 120 | } |
121 | - $this->_valid_shortcodes[ $context ][] = 'newsletter'; |
|
121 | + $this->_valid_shortcodes[$context][] = 'newsletter'; |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
@@ -148,23 +148,23 @@ discard block |
||
148 | 148 | ? $details['att_obj'] |
149 | 149 | : null; |
150 | 150 | |
151 | - if (! $attendee instanceof EE_Attendee) { |
|
151 | + if ( ! $attendee instanceof EE_Attendee) { |
|
152 | 152 | continue; |
153 | 153 | } |
154 | 154 | |
155 | 155 | // set $aee from attendee object |
156 | 156 | $aee['att_obj'] = $attendee; |
157 | - $aee['reg_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['reg_objs']) |
|
158 | - ? $this->_data->attendees[ $attendee->ID() ]['reg_objs'] |
|
157 | + $aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs']) |
|
158 | + ? $this->_data->attendees[$attendee->ID()]['reg_objs'] |
|
159 | 159 | : array(); |
160 | 160 | $aee['attendee_email'] = $attendee->email(); |
161 | - $aee['tkt_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['tkt_objs']) |
|
162 | - ? $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] |
|
161 | + $aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs']) |
|
162 | + ? $this->_data->attendees[$attendee->ID()]['tkt_objs'] |
|
163 | 163 | : array(); |
164 | 164 | |
165 | - if (isset($this->_data->attendees[ $attendee->ID() ]['evt_objs'])) { |
|
166 | - $aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
167 | - $aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs']; |
|
165 | + if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) { |
|
166 | + $aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs']; |
|
167 | + $aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs']; |
|
168 | 168 | } else { |
169 | 169 | $aee['evt_objs'] = $aee['events'] = array(); |
170 | 170 | } |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | $excluded_fields = array( |
200 | 200 | 'email' => array('cc') |
201 | 201 | ); |
202 | - return isset($excluded_fields[ $messenger_name ]) |
|
203 | - ? $excluded_fields[ $messenger_name ] |
|
202 | + return isset($excluded_fields[$messenger_name]) |
|
203 | + ? $excluded_fields[$messenger_name] |
|
204 | 204 | : parent::excludedFieldsForMessenger($messenger_name); |
205 | 205 | } |
206 | 206 | } |
@@ -13,109 +13,109 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * Constructor. |
|
18 | - * |
|
19 | - * @since 4.3.0 |
|
20 | - * @param EE_Attendee[] $data expecting an array of EE_Attendee objects. |
|
21 | - * @throws EE_Error |
|
22 | - * @access protected |
|
23 | - */ |
|
24 | - public function __construct($data = array()) |
|
25 | - { |
|
26 | - |
|
27 | - // validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
|
28 | - $ctc_chk = reset($data); |
|
29 | - if (! $ctc_chk instanceof EE_Attendee) { |
|
30 | - throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso')); |
|
31 | - } |
|
32 | - |
|
33 | - parent::__construct($data); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * @see parent class for phpdocs. |
|
39 | - * @param array $attendees |
|
40 | - * @return array |
|
41 | - */ |
|
42 | - public static function convert_data_for_persistent_storage($attendees) |
|
43 | - { |
|
44 | - $attendee_ids = array_filter( |
|
45 | - array_map( |
|
46 | - function ($attendee) { |
|
47 | - if ($attendee instanceof EE_Attendee) { |
|
48 | - return $attendee->ID(); |
|
49 | - } |
|
50 | - return false; |
|
51 | - }, |
|
52 | - $attendees |
|
53 | - ) |
|
54 | - ); |
|
55 | - return $attendee_ids; |
|
56 | - } |
|
57 | - |
|
58 | - |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * @see parent class for phpdocs |
|
63 | - * @param array $attendee_ids |
|
64 | - * @return EE_Attendee[] |
|
65 | - */ |
|
66 | - public static function convert_data_from_persistent_storage($attendee_ids) |
|
67 | - { |
|
68 | - $attendee_ids = (array) $attendee_ids; |
|
69 | - $attendees = EEM_Attendee::instance()->get_all( |
|
70 | - array( |
|
71 | - array( 'ATT_ID' => array( 'IN', $attendee_ids ) ) |
|
72 | - ) |
|
73 | - ); |
|
74 | - return $attendees; |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * setup the data. |
|
82 | - * |
|
83 | - * Sets up the expected data object for the messages prep using incoming registration objects. |
|
84 | - * |
|
85 | - * @since 4.3.0 |
|
86 | - * |
|
87 | - * @return void |
|
88 | - * @access protected |
|
89 | - */ |
|
90 | - protected function _setup_data() |
|
91 | - { |
|
92 | - |
|
93 | - // we'll loop through each contact and setup the data needed. Note that many properties will just be set as empty because the contacts data handler is for a very specific set of data (i.e. just what's related to the contact). |
|
94 | - $this->txn = null; |
|
95 | - $this->taxes = null; |
|
96 | - $this->grand_total_price_object = ''; |
|
97 | - $this->user_id = $this->ip_address = $this->user_agent = $this->init_access = ''; |
|
98 | - $this->payment = null; |
|
99 | - $this->billing = array(); |
|
100 | - $this->reg_objs = array(); |
|
101 | - $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
102 | - $this->total_ticket_count = 0; |
|
103 | - $this->primary_attendee_data = array( |
|
104 | - 'registration_id' => 0, |
|
105 | - 'att_obj' => null, |
|
106 | - 'reg_obj' => null, |
|
107 | - 'primary_att_obj' => null, |
|
108 | - 'primary_reg_obj' => null |
|
109 | - ); |
|
110 | - |
|
111 | - foreach ($this->_data as $contact) { |
|
112 | - $id = $contact->ID(); |
|
113 | - $reg = $contact->get_first_related('Registration'); |
|
114 | - $this->attendees[ $id ]['att_obj'] = $contact; |
|
115 | - $this->attendees[ $id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
116 | - $this->attendees[ $id ]['attendee_email'] = $contact->email(); |
|
117 | - $this->attendees[ $id ]['tkt_objs'] = array(); |
|
118 | - $this->attendees[ $id ]['evt_objs'] = array(); |
|
119 | - } |
|
120 | - } |
|
16 | + /** |
|
17 | + * Constructor. |
|
18 | + * |
|
19 | + * @since 4.3.0 |
|
20 | + * @param EE_Attendee[] $data expecting an array of EE_Attendee objects. |
|
21 | + * @throws EE_Error |
|
22 | + * @access protected |
|
23 | + */ |
|
24 | + public function __construct($data = array()) |
|
25 | + { |
|
26 | + |
|
27 | + // validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
|
28 | + $ctc_chk = reset($data); |
|
29 | + if (! $ctc_chk instanceof EE_Attendee) { |
|
30 | + throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso')); |
|
31 | + } |
|
32 | + |
|
33 | + parent::__construct($data); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * @see parent class for phpdocs. |
|
39 | + * @param array $attendees |
|
40 | + * @return array |
|
41 | + */ |
|
42 | + public static function convert_data_for_persistent_storage($attendees) |
|
43 | + { |
|
44 | + $attendee_ids = array_filter( |
|
45 | + array_map( |
|
46 | + function ($attendee) { |
|
47 | + if ($attendee instanceof EE_Attendee) { |
|
48 | + return $attendee->ID(); |
|
49 | + } |
|
50 | + return false; |
|
51 | + }, |
|
52 | + $attendees |
|
53 | + ) |
|
54 | + ); |
|
55 | + return $attendee_ids; |
|
56 | + } |
|
57 | + |
|
58 | + |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * @see parent class for phpdocs |
|
63 | + * @param array $attendee_ids |
|
64 | + * @return EE_Attendee[] |
|
65 | + */ |
|
66 | + public static function convert_data_from_persistent_storage($attendee_ids) |
|
67 | + { |
|
68 | + $attendee_ids = (array) $attendee_ids; |
|
69 | + $attendees = EEM_Attendee::instance()->get_all( |
|
70 | + array( |
|
71 | + array( 'ATT_ID' => array( 'IN', $attendee_ids ) ) |
|
72 | + ) |
|
73 | + ); |
|
74 | + return $attendees; |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * setup the data. |
|
82 | + * |
|
83 | + * Sets up the expected data object for the messages prep using incoming registration objects. |
|
84 | + * |
|
85 | + * @since 4.3.0 |
|
86 | + * |
|
87 | + * @return void |
|
88 | + * @access protected |
|
89 | + */ |
|
90 | + protected function _setup_data() |
|
91 | + { |
|
92 | + |
|
93 | + // we'll loop through each contact and setup the data needed. Note that many properties will just be set as empty because the contacts data handler is for a very specific set of data (i.e. just what's related to the contact). |
|
94 | + $this->txn = null; |
|
95 | + $this->taxes = null; |
|
96 | + $this->grand_total_price_object = ''; |
|
97 | + $this->user_id = $this->ip_address = $this->user_agent = $this->init_access = ''; |
|
98 | + $this->payment = null; |
|
99 | + $this->billing = array(); |
|
100 | + $this->reg_objs = array(); |
|
101 | + $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
102 | + $this->total_ticket_count = 0; |
|
103 | + $this->primary_attendee_data = array( |
|
104 | + 'registration_id' => 0, |
|
105 | + 'att_obj' => null, |
|
106 | + 'reg_obj' => null, |
|
107 | + 'primary_att_obj' => null, |
|
108 | + 'primary_reg_obj' => null |
|
109 | + ); |
|
110 | + |
|
111 | + foreach ($this->_data as $contact) { |
|
112 | + $id = $contact->ID(); |
|
113 | + $reg = $contact->get_first_related('Registration'); |
|
114 | + $this->attendees[ $id ]['att_obj'] = $contact; |
|
115 | + $this->attendees[ $id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
116 | + $this->attendees[ $id ]['attendee_email'] = $contact->email(); |
|
117 | + $this->attendees[ $id ]['tkt_objs'] = array(); |
|
118 | + $this->attendees[ $id ]['evt_objs'] = array(); |
|
119 | + } |
|
120 | + } |
|
121 | 121 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | // validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
28 | 28 | $ctc_chk = reset($data); |
29 | - if (! $ctc_chk instanceof EE_Attendee) { |
|
29 | + if ( ! $ctc_chk instanceof EE_Attendee) { |
|
30 | 30 | throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso')); |
31 | 31 | } |
32 | 32 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $attendee_ids = array_filter( |
45 | 45 | array_map( |
46 | - function ($attendee) { |
|
46 | + function($attendee) { |
|
47 | 47 | if ($attendee instanceof EE_Attendee) { |
48 | 48 | return $attendee->ID(); |
49 | 49 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $attendee_ids = (array) $attendee_ids; |
69 | 69 | $attendees = EEM_Attendee::instance()->get_all( |
70 | 70 | array( |
71 | - array( 'ATT_ID' => array( 'IN', $attendee_ids ) ) |
|
71 | + array('ATT_ID' => array('IN', $attendee_ids)) |
|
72 | 72 | ) |
73 | 73 | ); |
74 | 74 | return $attendees; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->payment = null; |
99 | 99 | $this->billing = array(); |
100 | 100 | $this->reg_objs = array(); |
101 | - $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
101 | + $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
102 | 102 | $this->total_ticket_count = 0; |
103 | 103 | $this->primary_attendee_data = array( |
104 | 104 | 'registration_id' => 0, |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | foreach ($this->_data as $contact) { |
112 | 112 | $id = $contact->ID(); |
113 | 113 | $reg = $contact->get_first_related('Registration'); |
114 | - $this->attendees[ $id ]['att_obj'] = $contact; |
|
115 | - $this->attendees[ $id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
116 | - $this->attendees[ $id ]['attendee_email'] = $contact->email(); |
|
117 | - $this->attendees[ $id ]['tkt_objs'] = array(); |
|
118 | - $this->attendees[ $id ]['evt_objs'] = array(); |
|
114 | + $this->attendees[$id]['att_obj'] = $contact; |
|
115 | + $this->attendees[$id]['reg_objs'][$reg->ID()] = $reg; |
|
116 | + $this->attendees[$id]['attendee_email'] = $contact->email(); |
|
117 | + $this->attendees[$id]['tkt_objs'] = array(); |
|
118 | + $this->attendees[$id]['evt_objs'] = array(); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -14,49 +14,49 @@ |
||
14 | 14 | class EE_Payment_Failed_message_type extends EE_Payment_Base_message_type |
15 | 15 | { |
16 | 16 | |
17 | - public function __construct() |
|
18 | - { |
|
19 | - |
|
20 | - // setup type details for reference |
|
21 | - $this->name = 'payment_failed'; |
|
22 | - $this->description = __('This message type is used for all failed payment notification messages that go out including any manual payments entered by an event administrator.', 'event_espresso'); |
|
23 | - $this->label = array( |
|
24 | - 'singular' => __('payment failed', 'event_espresso'), |
|
25 | - 'plural' => __('payments failed', 'event_espresso') |
|
26 | - ); |
|
27 | - |
|
28 | - $this->_master_templates = array( |
|
29 | - 'email' => 'payment' |
|
30 | - ); |
|
31 | - |
|
32 | - parent::__construct(); |
|
33 | - } |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * _set_contexts |
|
38 | - * This sets up the contexts associated with the message_type |
|
39 | - * |
|
40 | - * @access protected |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - protected function _set_contexts() |
|
44 | - { |
|
45 | - $this->_context_label = array( |
|
46 | - 'label' => __('recipient', 'event_espresso'), |
|
47 | - 'plural' => __('recipients', 'event_espresso'), |
|
48 | - 'description' => __('Recipient\'s are who will receive the template. You may want different payment details sent out depending on who the recipient is', 'event_espresso') |
|
49 | - ); |
|
50 | - |
|
51 | - $this->_contexts = array( |
|
52 | - 'admin' => array( |
|
53 | - 'label' => __('Event Admin', 'event_espresso'), |
|
54 | - 'description' => __('This template is what event administrators will receive when payment fails.', 'event_espresso') |
|
55 | - ), |
|
56 | - 'primary_attendee' => array( |
|
57 | - 'label' => __('Primary Registrant', 'event_espresso'), |
|
58 | - 'description' => __('This template is what the primary registrant (the person who made the main registration) will receive when the payment fails.', 'event_espresso') |
|
59 | - ) |
|
60 | - ); |
|
61 | - } |
|
17 | + public function __construct() |
|
18 | + { |
|
19 | + |
|
20 | + // setup type details for reference |
|
21 | + $this->name = 'payment_failed'; |
|
22 | + $this->description = __('This message type is used for all failed payment notification messages that go out including any manual payments entered by an event administrator.', 'event_espresso'); |
|
23 | + $this->label = array( |
|
24 | + 'singular' => __('payment failed', 'event_espresso'), |
|
25 | + 'plural' => __('payments failed', 'event_espresso') |
|
26 | + ); |
|
27 | + |
|
28 | + $this->_master_templates = array( |
|
29 | + 'email' => 'payment' |
|
30 | + ); |
|
31 | + |
|
32 | + parent::__construct(); |
|
33 | + } |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * _set_contexts |
|
38 | + * This sets up the contexts associated with the message_type |
|
39 | + * |
|
40 | + * @access protected |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + protected function _set_contexts() |
|
44 | + { |
|
45 | + $this->_context_label = array( |
|
46 | + 'label' => __('recipient', 'event_espresso'), |
|
47 | + 'plural' => __('recipients', 'event_espresso'), |
|
48 | + 'description' => __('Recipient\'s are who will receive the template. You may want different payment details sent out depending on who the recipient is', 'event_espresso') |
|
49 | + ); |
|
50 | + |
|
51 | + $this->_contexts = array( |
|
52 | + 'admin' => array( |
|
53 | + 'label' => __('Event Admin', 'event_espresso'), |
|
54 | + 'description' => __('This template is what event administrators will receive when payment fails.', 'event_espresso') |
|
55 | + ), |
|
56 | + 'primary_attendee' => array( |
|
57 | + 'label' => __('Primary Registrant', 'event_espresso'), |
|
58 | + 'description' => __('This template is what the primary registrant (the person who made the main registration) will receive when the payment fails.', 'event_espresso') |
|
59 | + ) |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | } |