@@ -1,1 +1,1 @@ |
||
1 | -<?php printf( __('Message from %s', 'event_espresso'), EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) ); ?> |
|
1 | +<?php printf(__('Message from %s', 'event_espresso'), EE_Registry::instance()->CFG->organization->get_pretty('name')); ?> |
@@ -80,7 +80,7 @@ |
||
80 | 80 | //remove unwanted transaction shortcode |
81 | 81 | foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
82 | 82 | if( ($key = array_search('transaction', $shortcodes) ) !== false) { |
83 | - unset($this->_valid_shortcodes[$context][$key]); |
|
83 | + unset($this->_valid_shortcodes[$context][$key]); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | parent::_set_valid_shortcodes(); |
79 | 79 | |
80 | 80 | //remove unwanted transaction shortcode |
81 | - foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
82 | - if( ($key = array_search('transaction', $shortcodes) ) !== false) { |
|
81 | + foreach ($this->_valid_shortcodes as $context => $shortcodes) { |
|
82 | + if (($key = array_search('transaction', $shortcodes)) !== false) { |
|
83 | 83 | unset($this->_valid_shortcodes[$context][$key]); |
84 | 84 | } |
85 | 85 | } |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage helpers |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * This prepares data for message types that send messages for multiple contacts and handles |
@@ -30,8 +32,9 @@ discard block |
||
30 | 32 | |
31 | 33 | //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. |
32 | 34 | $ctc_chk = reset( $data ); |
33 | - if ( ! $ctc_chk instanceof EE_Attendee ) |
|
34 | - throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
35 | + if ( ! $ctc_chk instanceof EE_Attendee ) { |
|
36 | + throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
37 | + } |
|
35 | 38 | |
36 | 39 | parent::__construct( $data ); |
37 | 40 | } |
@@ -19,101 +19,101 @@ |
||
19 | 19 | class EE_Messages_Contacts_incoming_data extends EE_Messages_incoming_data { |
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * Constructor. |
|
24 | - * |
|
25 | - * @since 4.3.0 |
|
26 | - * @param EE_Attendee[] $data expecting an array of EE_Attendee objects. |
|
27 | - * @throws EE_Error |
|
28 | - * @access protected |
|
29 | - */ |
|
30 | - public function __construct( $data = array() ) { |
|
31 | - |
|
32 | - //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. |
|
33 | - $ctc_chk = reset( $data ); |
|
34 | - if ( ! $ctc_chk instanceof EE_Attendee ) |
|
35 | - throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
36 | - |
|
37 | - parent::__construct( $data ); |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * @see parent class for phpdocs. |
|
43 | - * @param array $attendees |
|
44 | - * @return array |
|
45 | - */ |
|
46 | - public static function convert_data_for_persistent_storage( $attendees ) { |
|
47 | - $attendee_ids = array_filter ( array_map( |
|
48 | - function( $attendee ) { |
|
49 | - if ( $attendee instanceof EE_Attendee ) { |
|
50 | - return $attendee->ID(); |
|
51 | - } |
|
52 | - }, |
|
53 | - $attendees |
|
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 | - $attendee_ids = (array) $attendee_ids; |
|
68 | - $attendees = EEM_Attendee::instance()->get_all( |
|
69 | - array( |
|
70 | - array( 'ATT_ID' => array( 'IN', $attendee_ids ) ) |
|
71 | - ) |
|
72 | - ); |
|
73 | - return $attendees; |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * setup the data. |
|
81 | - * |
|
82 | - * Sets up the expected data object for the messages prep using incoming registration objects. |
|
83 | - * |
|
84 | - * @since 4.3.0 |
|
85 | - * |
|
86 | - * @return void |
|
87 | - * @access protected |
|
88 | - */ |
|
89 | - protected function _setup_data() { |
|
90 | - |
|
91 | - //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). |
|
92 | - $this->txn = NULL; |
|
93 | - $this->taxes = NULL; |
|
94 | - $this->grand_total_price_object = ''; |
|
95 | - $this->user_id = $this->ip_address = $this->user_agent = $this->init_access = ''; |
|
96 | - $this->payment = NULL; |
|
97 | - $this->billing = array(); |
|
98 | - $this->reg_objs = array(); |
|
99 | - $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
100 | - $this->total_ticket_count = 0; |
|
101 | - $this->primary_attendee_data = array( |
|
102 | - 'registration_id' => 0, |
|
103 | - 'att_obj' => NULL, |
|
104 | - 'reg_obj' => NULL, |
|
105 | - 'primary_att_obj' => NULL, |
|
106 | - 'primary_reg_obj' => NULL |
|
107 | - ); |
|
108 | - |
|
109 | - foreach ( $this->_data as $contact ) { |
|
110 | - $id = $contact->ID(); |
|
111 | - $reg = $contact->get_first_related('Registration'); |
|
112 | - $this->attendees[$id]['att_obj'] = $contact; |
|
113 | - $this->attendees[$id]['reg_objs'][$reg->ID()] = $reg; |
|
114 | - $this->attendees[$id]['attendee_email'] = $contact->email(); |
|
115 | - $this->attendees[$id]['tkt_objs'] = array(); |
|
116 | - $this->attendees[$id]['evt_objs'] = array(); |
|
117 | - } |
|
118 | - } |
|
22 | + /** |
|
23 | + * Constructor. |
|
24 | + * |
|
25 | + * @since 4.3.0 |
|
26 | + * @param EE_Attendee[] $data expecting an array of EE_Attendee objects. |
|
27 | + * @throws EE_Error |
|
28 | + * @access protected |
|
29 | + */ |
|
30 | + public function __construct( $data = array() ) { |
|
31 | + |
|
32 | + //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. |
|
33 | + $ctc_chk = reset( $data ); |
|
34 | + if ( ! $ctc_chk instanceof EE_Attendee ) |
|
35 | + throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
36 | + |
|
37 | + parent::__construct( $data ); |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * @see parent class for phpdocs. |
|
43 | + * @param array $attendees |
|
44 | + * @return array |
|
45 | + */ |
|
46 | + public static function convert_data_for_persistent_storage( $attendees ) { |
|
47 | + $attendee_ids = array_filter ( array_map( |
|
48 | + function( $attendee ) { |
|
49 | + if ( $attendee instanceof EE_Attendee ) { |
|
50 | + return $attendee->ID(); |
|
51 | + } |
|
52 | + }, |
|
53 | + $attendees |
|
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 | + $attendee_ids = (array) $attendee_ids; |
|
68 | + $attendees = EEM_Attendee::instance()->get_all( |
|
69 | + array( |
|
70 | + array( 'ATT_ID' => array( 'IN', $attendee_ids ) ) |
|
71 | + ) |
|
72 | + ); |
|
73 | + return $attendees; |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * setup the data. |
|
81 | + * |
|
82 | + * Sets up the expected data object for the messages prep using incoming registration objects. |
|
83 | + * |
|
84 | + * @since 4.3.0 |
|
85 | + * |
|
86 | + * @return void |
|
87 | + * @access protected |
|
88 | + */ |
|
89 | + protected function _setup_data() { |
|
90 | + |
|
91 | + //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). |
|
92 | + $this->txn = NULL; |
|
93 | + $this->taxes = NULL; |
|
94 | + $this->grand_total_price_object = ''; |
|
95 | + $this->user_id = $this->ip_address = $this->user_agent = $this->init_access = ''; |
|
96 | + $this->payment = NULL; |
|
97 | + $this->billing = array(); |
|
98 | + $this->reg_objs = array(); |
|
99 | + $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
100 | + $this->total_ticket_count = 0; |
|
101 | + $this->primary_attendee_data = array( |
|
102 | + 'registration_id' => 0, |
|
103 | + 'att_obj' => NULL, |
|
104 | + 'reg_obj' => NULL, |
|
105 | + 'primary_att_obj' => NULL, |
|
106 | + 'primary_reg_obj' => NULL |
|
107 | + ); |
|
108 | + |
|
109 | + foreach ( $this->_data as $contact ) { |
|
110 | + $id = $contact->ID(); |
|
111 | + $reg = $contact->get_first_related('Registration'); |
|
112 | + $this->attendees[$id]['att_obj'] = $contact; |
|
113 | + $this->attendees[$id]['reg_objs'][$reg->ID()] = $reg; |
|
114 | + $this->attendees[$id]['attendee_email'] = $contact->email(); |
|
115 | + $this->attendees[$id]['tkt_objs'] = array(); |
|
116 | + $this->attendees[$id]['evt_objs'] = array(); |
|
117 | + } |
|
118 | + } |
|
119 | 119 | } |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * @throws EE_Error |
28 | 28 | * @access protected |
29 | 29 | */ |
30 | - public function __construct( $data = array() ) { |
|
30 | + public function __construct($data = array()) { |
|
31 | 31 | |
32 | 32 | //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. |
33 | - $ctc_chk = reset( $data ); |
|
34 | - if ( ! $ctc_chk instanceof EE_Attendee ) |
|
35 | - throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
33 | + $ctc_chk = reset($data); |
|
34 | + if ( ! $ctc_chk instanceof EE_Attendee) |
|
35 | + throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso')); |
|
36 | 36 | |
37 | - parent::__construct( $data ); |
|
37 | + parent::__construct($data); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | * @param array $attendees |
44 | 44 | * @return array |
45 | 45 | */ |
46 | - public static function convert_data_for_persistent_storage( $attendees ) { |
|
47 | - $attendee_ids = array_filter ( array_map( |
|
48 | - function( $attendee ) { |
|
49 | - if ( $attendee instanceof EE_Attendee ) { |
|
46 | + public static function convert_data_for_persistent_storage($attendees) { |
|
47 | + $attendee_ids = array_filter(array_map( |
|
48 | + function($attendee) { |
|
49 | + if ($attendee instanceof EE_Attendee) { |
|
50 | 50 | return $attendee->ID(); |
51 | 51 | } |
52 | 52 | }, |
53 | 53 | $attendees |
54 | - ) ); |
|
54 | + )); |
|
55 | 55 | return $attendee_ids; |
56 | 56 | } |
57 | 57 | |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | * @param array $attendee_ids |
64 | 64 | * @return EE_Attendee[] |
65 | 65 | */ |
66 | - public static function convert_data_from_persistent_storage( $attendee_ids ) { |
|
66 | + public static function convert_data_from_persistent_storage($attendee_ids) { |
|
67 | 67 | $attendee_ids = (array) $attendee_ids; |
68 | 68 | $attendees = EEM_Attendee::instance()->get_all( |
69 | 69 | array( |
70 | - array( 'ATT_ID' => array( 'IN', $attendee_ids ) ) |
|
70 | + array('ATT_ID' => array('IN', $attendee_ids)) |
|
71 | 71 | ) |
72 | 72 | ); |
73 | 73 | return $attendees; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->payment = NULL; |
97 | 97 | $this->billing = array(); |
98 | 98 | $this->reg_objs = array(); |
99 | - $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
99 | + $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
100 | 100 | $this->total_ticket_count = 0; |
101 | 101 | $this->primary_attendee_data = array( |
102 | 102 | 'registration_id' => 0, |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | 'primary_reg_obj' => NULL |
107 | 107 | ); |
108 | 108 | |
109 | - foreach ( $this->_data as $contact ) { |
|
109 | + foreach ($this->_data as $contact) { |
|
110 | 110 | $id = $contact->ID(); |
111 | 111 | $reg = $contact->get_first_related('Registration'); |
112 | 112 | $this->attendees[$id]['att_obj'] = $contact; |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file contains the EE_Messages_Email_Newsletter_Validator class. |
|
4 | - * @package Event Espresso |
|
5 | - * @subpackage helpers |
|
6 | - * @since 4.3.0 |
|
7 | - */ |
|
3 | + * This file contains the EE_Messages_Email_Newsletter_Validator class. |
|
4 | + * @package Event Espresso |
|
5 | + * @subpackage helpers |
|
6 | + * @since 4.3.0 |
|
7 | + */ |
|
8 | 8 | if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
9 | 9 | |
10 | 10 | /** |
@@ -18,27 +18,27 @@ discard block |
||
18 | 18 | * @author Darren Ethier |
19 | 19 | */ |
20 | 20 | class EE_Messages_Email_Newsletter_Validator extends EE_Messages_Validator { |
21 | - public function __construct( $fields, $context ) { |
|
22 | - $this->_m_name = 'email'; |
|
23 | - $this->_mt_name = 'newsletter'; |
|
21 | + public function __construct( $fields, $context ) { |
|
22 | + $this->_m_name = 'email'; |
|
23 | + $this->_mt_name = 'newsletter'; |
|
24 | 24 | |
25 | - parent::__construct( $fields, $context ); |
|
26 | - } |
|
25 | + parent::__construct( $fields, $context ); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * custom validator (restricting what was originally set by the messenger) |
|
30 | - */ |
|
31 | - protected function _modify_validator() { |
|
32 | - if ( $this->_context == 'attendee' ) |
|
33 | - $this->_valid_shortcodes_modifier[$this->_context]['from'] = array('recipient_details', 'email', 'organization'); |
|
28 | + /** |
|
29 | + * custom validator (restricting what was originally set by the messenger) |
|
30 | + */ |
|
31 | + protected function _modify_validator() { |
|
32 | + if ( $this->_context == 'attendee' ) |
|
33 | + $this->_valid_shortcodes_modifier[$this->_context]['from'] = array('recipient_details', 'email', 'organization'); |
|
34 | 34 | |
35 | - //excluded shortcodes |
|
36 | - $fields = array('to','from','subject','content','newsletter_content'); |
|
37 | - foreach ( $fields as $field ) { |
|
38 | - $this->_specific_shortcode_excludes[$field] = array('[RECIPIENT_REGISTRATION_CODE]', '[RECIPIENT_EDIT_REGISTRATION_LINK]', '[EVENT_AUTHOR_FORMATTED_EMAIL]', '[EVENT_AUTHOR_EMAIL]'); |
|
39 | - } |
|
40 | - $add_excludes = array( '[RECIPIENT_FNAME]', '[RECIPIENT_LNAME]', '[RECIPIENT_EMAIL]', '[COMPANY]', '[CO_ADD1]','[CO_ADD2]', '[CO_CITY]', '[CO_STATE]','[CO_ZIP]','[CO_LOGO]','[CO_PHONE]','[CO_LOGO_URL]','[CO_FACEBOOK_URL]','[CO_TWITTER_URL]','[CO_PINTEREST_URL]','[CO_GOOGLE_URL]','[CO_LINKEDIN_URL]','[CO_INSTAGRAM_URL]'); |
|
41 | - $this->_specific_shortcode_excludes['from'] = array_merge($this->_specific_shortcode_excludes['from'], $add_excludes); |
|
42 | - $this->_specific_shortcode_excludes['content'] = array_merge( $this->_specific_shortcode_excludes['content'], array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]') ); |
|
43 | - } |
|
35 | + //excluded shortcodes |
|
36 | + $fields = array('to','from','subject','content','newsletter_content'); |
|
37 | + foreach ( $fields as $field ) { |
|
38 | + $this->_specific_shortcode_excludes[$field] = array('[RECIPIENT_REGISTRATION_CODE]', '[RECIPIENT_EDIT_REGISTRATION_LINK]', '[EVENT_AUTHOR_FORMATTED_EMAIL]', '[EVENT_AUTHOR_EMAIL]'); |
|
39 | + } |
|
40 | + $add_excludes = array( '[RECIPIENT_FNAME]', '[RECIPIENT_LNAME]', '[RECIPIENT_EMAIL]', '[COMPANY]', '[CO_ADD1]','[CO_ADD2]', '[CO_CITY]', '[CO_STATE]','[CO_ZIP]','[CO_LOGO]','[CO_PHONE]','[CO_LOGO_URL]','[CO_FACEBOOK_URL]','[CO_TWITTER_URL]','[CO_PINTEREST_URL]','[CO_GOOGLE_URL]','[CO_LINKEDIN_URL]','[CO_INSTAGRAM_URL]'); |
|
41 | + $this->_specific_shortcode_excludes['from'] = array_merge($this->_specific_shortcode_excludes['from'], $add_excludes); |
|
42 | + $this->_specific_shortcode_excludes['content'] = array_merge( $this->_specific_shortcode_excludes['content'], array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]') ); |
|
43 | + } |
|
44 | 44 | } |
@@ -18,27 +18,27 @@ |
||
18 | 18 | * @author Darren Ethier |
19 | 19 | */ |
20 | 20 | class EE_Messages_Email_Newsletter_Validator extends EE_Messages_Validator { |
21 | - public function __construct( $fields, $context ) { |
|
21 | + public function __construct($fields, $context) { |
|
22 | 22 | $this->_m_name = 'email'; |
23 | 23 | $this->_mt_name = 'newsletter'; |
24 | 24 | |
25 | - parent::__construct( $fields, $context ); |
|
25 | + parent::__construct($fields, $context); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * custom validator (restricting what was originally set by the messenger) |
30 | 30 | */ |
31 | 31 | protected function _modify_validator() { |
32 | - if ( $this->_context == 'attendee' ) |
|
32 | + if ($this->_context == 'attendee') |
|
33 | 33 | $this->_valid_shortcodes_modifier[$this->_context]['from'] = array('recipient_details', 'email', 'organization'); |
34 | 34 | |
35 | 35 | //excluded shortcodes |
36 | - $fields = array('to','from','subject','content','newsletter_content'); |
|
37 | - foreach ( $fields as $field ) { |
|
36 | + $fields = array('to', 'from', 'subject', 'content', 'newsletter_content'); |
|
37 | + foreach ($fields as $field) { |
|
38 | 38 | $this->_specific_shortcode_excludes[$field] = array('[RECIPIENT_REGISTRATION_CODE]', '[RECIPIENT_EDIT_REGISTRATION_LINK]', '[EVENT_AUTHOR_FORMATTED_EMAIL]', '[EVENT_AUTHOR_EMAIL]'); |
39 | 39 | } |
40 | - $add_excludes = array( '[RECIPIENT_FNAME]', '[RECIPIENT_LNAME]', '[RECIPIENT_EMAIL]', '[COMPANY]', '[CO_ADD1]','[CO_ADD2]', '[CO_CITY]', '[CO_STATE]','[CO_ZIP]','[CO_LOGO]','[CO_PHONE]','[CO_LOGO_URL]','[CO_FACEBOOK_URL]','[CO_TWITTER_URL]','[CO_PINTEREST_URL]','[CO_GOOGLE_URL]','[CO_LINKEDIN_URL]','[CO_INSTAGRAM_URL]'); |
|
40 | + $add_excludes = array('[RECIPIENT_FNAME]', '[RECIPIENT_LNAME]', '[RECIPIENT_EMAIL]', '[COMPANY]', '[CO_ADD1]', '[CO_ADD2]', '[CO_CITY]', '[CO_STATE]', '[CO_ZIP]', '[CO_LOGO]', '[CO_PHONE]', '[CO_LOGO_URL]', '[CO_FACEBOOK_URL]', '[CO_TWITTER_URL]', '[CO_PINTEREST_URL]', '[CO_GOOGLE_URL]', '[CO_LINKEDIN_URL]', '[CO_INSTAGRAM_URL]'); |
|
41 | 41 | $this->_specific_shortcode_excludes['from'] = array_merge($this->_specific_shortcode_excludes['from'], $add_excludes); |
42 | - $this->_specific_shortcode_excludes['content'] = array_merge( $this->_specific_shortcode_excludes['content'], array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]') ); |
|
42 | + $this->_specific_shortcode_excludes['content'] = array_merge($this->_specific_shortcode_excludes['content'], array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]')); |
|
43 | 43 | } |
44 | 44 | } |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage helpers |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * Holds any special validation rules for template fields with Email messenger and Newsletter |
@@ -29,8 +31,9 @@ discard block |
||
29 | 31 | * custom validator (restricting what was originally set by the messenger) |
30 | 32 | */ |
31 | 33 | protected function _modify_validator() { |
32 | - if ( $this->_context == 'attendee' ) |
|
33 | - $this->_valid_shortcodes_modifier[$this->_context]['from'] = array('recipient_details', 'email', 'organization'); |
|
34 | + if ( $this->_context == 'attendee' ) { |
|
35 | + $this->_valid_shortcodes_modifier[$this->_context]['from'] = array('recipient_details', 'email', 'organization'); |
|
36 | + } |
|
34 | 37 | |
35 | 38 | //excluded shortcodes |
36 | 39 | $fields = array('to','from','subject','content','newsletter_content'); |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file contains the EE_Newsletter_message_type class. |
|
4 | - * @package Event Espresso |
|
5 | - * @subpackage helpers |
|
6 | - * @since 4.3.0 |
|
7 | - */ |
|
3 | + * This file contains the EE_Newsletter_message_type class. |
|
4 | + * @package Event Espresso |
|
5 | + * @subpackage helpers |
|
6 | + * @since 4.3.0 |
|
7 | + */ |
|
8 | 8 | if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
9 | 9 | |
10 | 10 | /** |
@@ -20,94 +20,94 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class EE_Newsletter_message_type extends EE_message_type { |
22 | 22 | |
23 | - public function __construct() { |
|
24 | - $this->name = 'newsletter'; |
|
25 | - $this->description = __('Newsletter message types are triggered manually by the admin for sending mass email to select groups of registrants.', 'event_espresso'); |
|
26 | - $this->label = array( |
|
27 | - 'singular' => __('newsletter', 'event_espresso'), |
|
28 | - 'plural' => __('newsletters', 'event_espresso') |
|
29 | - ); |
|
30 | - $this->_master_templates = array( |
|
31 | - 'email' => 'registration' |
|
32 | - ); |
|
33 | - parent::__construct(); |
|
34 | - } |
|
23 | + public function __construct() { |
|
24 | + $this->name = 'newsletter'; |
|
25 | + $this->description = __('Newsletter message types are triggered manually by the admin for sending mass email to select groups of registrants.', 'event_espresso'); |
|
26 | + $this->label = array( |
|
27 | + 'singular' => __('newsletter', 'event_espresso'), |
|
28 | + 'plural' => __('newsletters', 'event_espresso') |
|
29 | + ); |
|
30 | + $this->_master_templates = array( |
|
31 | + 'email' => 'registration' |
|
32 | + ); |
|
33 | + parent::__construct(); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | - protected function _set_admin_pages() { |
|
39 | - $this->admin_registered_pages = array(); //no admin pages to register this with. |
|
40 | - } |
|
38 | + protected function _set_admin_pages() { |
|
39 | + $this->admin_registered_pages = array(); //no admin pages to register this with. |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | 43 | |
44 | - protected function _set_data_handler() { |
|
45 | - $this->_data_handler = 'Contacts'; |
|
46 | - $this->_single_message = $this->_data instanceof EE_Registration ? TRUE : FALSE; |
|
47 | - } |
|
44 | + protected function _set_data_handler() { |
|
45 | + $this->_data_handler = 'Contacts'; |
|
46 | + $this->_single_message = $this->_data instanceof EE_Registration ? TRUE : FALSE; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
52 | - //newsletter message type data handler is 'Contacts' and it expects an array of EE_Attendee objects. |
|
53 | - $contact = $registration->attendee(); |
|
54 | - if ( $contact instanceof EE_Attendee ) { |
|
55 | - return array( $contact ); |
|
56 | - } |
|
57 | - return array(); |
|
58 | - } |
|
51 | + protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
52 | + //newsletter message type data handler is 'Contacts' and it expects an array of EE_Attendee objects. |
|
53 | + $contact = $registration->attendee(); |
|
54 | + if ( $contact instanceof EE_Attendee ) { |
|
55 | + return array( $contact ); |
|
56 | + } |
|
57 | + return array(); |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | 61 | |
62 | - protected function _set_admin_settings_fields() { |
|
63 | - $this->_admin_settings_fields = array(); |
|
64 | - } |
|
62 | + protected function _set_admin_settings_fields() { |
|
63 | + $this->_admin_settings_fields = array(); |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | 67 | |
68 | - protected function _set_contexts() { |
|
69 | - $this->_context_label = array( |
|
70 | - 'label' => __('recipient', 'event_espresso'), |
|
71 | - 'plural' => __('recipients', 'event_espresso'), |
|
72 | - 'description' => __('Recipient\'s are who will receive the message.', 'event_espresso') |
|
73 | - ); |
|
68 | + protected function _set_contexts() { |
|
69 | + $this->_context_label = array( |
|
70 | + 'label' => __('recipient', 'event_espresso'), |
|
71 | + 'plural' => __('recipients', 'event_espresso'), |
|
72 | + 'description' => __('Recipient\'s are who will receive the message.', 'event_espresso') |
|
73 | + ); |
|
74 | 74 | |
75 | - $this->_contexts = array( |
|
76 | - 'attendee' => array( |
|
77 | - 'label' => __('Registrant', 'event_espresso'), |
|
78 | - 'description' => __('This template goes to selected registrants.', 'event_espresso') |
|
79 | - ) |
|
80 | - ); |
|
81 | - } |
|
75 | + $this->_contexts = array( |
|
76 | + 'attendee' => array( |
|
77 | + 'label' => __('Registrant', 'event_espresso'), |
|
78 | + 'description' => __('This template goes to selected registrants.', 'event_espresso') |
|
79 | + ) |
|
80 | + ); |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * used to set the valid shortcodes. |
|
88 | - * |
|
89 | - * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and organization. That's it! |
|
90 | - * |
|
91 | - * @since 4.3.0 |
|
92 | - * |
|
93 | - * @return void |
|
94 | - */ |
|
95 | - protected function _set_valid_shortcodes() { |
|
96 | - parent::_set_valid_shortcodes(); |
|
86 | + /** |
|
87 | + * used to set the valid shortcodes. |
|
88 | + * |
|
89 | + * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and organization. That's it! |
|
90 | + * |
|
91 | + * @since 4.3.0 |
|
92 | + * |
|
93 | + * @return void |
|
94 | + */ |
|
95 | + protected function _set_valid_shortcodes() { |
|
96 | + parent::_set_valid_shortcodes(); |
|
97 | 97 | |
98 | - $included_shortcodes = array( |
|
99 | - 'recipient_details', 'organization', 'newsletter' |
|
100 | - ); |
|
98 | + $included_shortcodes = array( |
|
99 | + 'recipient_details', 'organization', 'newsletter' |
|
100 | + ); |
|
101 | 101 | |
102 | - foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
103 | - foreach ( $shortcodes as $key => $shortcode ) { |
|
104 | - if ( !in_array( $shortcode, $included_shortcodes ) ) |
|
105 | - unset( $this->_valid_shortcodes[$context][$key] ); |
|
106 | - } |
|
107 | - $this->_valid_shortcodes[$context][] = 'newsletter'; |
|
108 | - } |
|
102 | + foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
103 | + foreach ( $shortcodes as $key => $shortcode ) { |
|
104 | + if ( !in_array( $shortcode, $included_shortcodes ) ) |
|
105 | + unset( $this->_valid_shortcodes[$context][$key] ); |
|
106 | + } |
|
107 | + $this->_valid_shortcodes[$context][] = 'newsletter'; |
|
108 | + } |
|
109 | 109 | |
110 | - } |
|
110 | + } |
|
111 | 111 | |
112 | 112 | |
113 | 113 | } |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
51 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) { |
|
52 | 52 | //newsletter message type data handler is 'Contacts' and it expects an array of EE_Attendee objects. |
53 | 53 | $contact = $registration->attendee(); |
54 | - if ( $contact instanceof EE_Attendee ) { |
|
55 | - return array( $contact ); |
|
54 | + if ($contact instanceof EE_Attendee) { |
|
55 | + return array($contact); |
|
56 | 56 | } |
57 | 57 | return array(); |
58 | 58 | } |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | 'recipient_details', 'organization', 'newsletter' |
100 | 100 | ); |
101 | 101 | |
102 | - foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
103 | - foreach ( $shortcodes as $key => $shortcode ) { |
|
104 | - if ( !in_array( $shortcode, $included_shortcodes ) ) |
|
105 | - unset( $this->_valid_shortcodes[$context][$key] ); |
|
102 | + foreach ($this->_valid_shortcodes as $context => $shortcodes) { |
|
103 | + foreach ($shortcodes as $key => $shortcode) { |
|
104 | + if ( ! in_array($shortcode, $included_shortcodes)) |
|
105 | + unset($this->_valid_shortcodes[$context][$key]); |
|
106 | 106 | } |
107 | 107 | $this->_valid_shortcodes[$context][] = 'newsletter'; |
108 | 108 | } |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage helpers |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * The message type for newsletter type of messages. |
@@ -101,8 +103,9 @@ discard block |
||
101 | 103 | |
102 | 104 | foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
103 | 105 | foreach ( $shortcodes as $key => $shortcode ) { |
104 | - if ( !in_array( $shortcode, $included_shortcodes ) ) |
|
105 | - unset( $this->_valid_shortcodes[$context][$key] ); |
|
106 | + if ( !in_array( $shortcode, $included_shortcodes ) ) { |
|
107 | + unset( $this->_valid_shortcodes[$context][$key] ); |
|
108 | + } |
|
106 | 109 | } |
107 | 110 | $this->_valid_shortcodes[$context][] = 'newsletter'; |
108 | 111 | } |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage helpers |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * This is the library class for the "newsletter" group shortcodes. |
@@ -54,8 +56,9 @@ discard block |
||
54 | 56 | * @return array new validator config. |
55 | 57 | */ |
56 | 58 | public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) { |
57 | - if ( $messenger->name !== 'email' ) |
|
58 | - return $validator_config; |
|
59 | + if ( $messenger->name !== 'email' ) { |
|
60 | + return $validator_config; |
|
61 | + } |
|
59 | 62 | |
60 | 63 | $validator_config['content']['shortcodes'][] = 'newsletter'; |
61 | 64 | $validator_config['newsletter_content'] = array( |
@@ -82,8 +85,9 @@ discard block |
||
82 | 85 | * @return array new/modified template fields array. |
83 | 86 | */ |
84 | 87 | public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) { |
85 | - if ( $messenger->name !== 'email' ) |
|
86 | - return $template_fields; |
|
88 | + if ( $messenger->name !== 'email' ) { |
|
89 | + return $template_fields; |
|
90 | + } |
|
87 | 91 | |
88 | 92 | $template_fields['extra']['content']['newsletter_content'] = array( |
89 | 93 | 'input' => 'wp_editor', |
@@ -20,82 +20,82 @@ |
||
20 | 20 | */ |
21 | 21 | class EE_Newsletter_Shortcodes extends EE_Shortcodes { |
22 | 22 | |
23 | - protected function _init_props() { |
|
24 | - $this->label = __("Newsletter Shortcodes", 'event_espresso'); |
|
25 | - $this->description = __('All shortcodes used for the newsletter message type', 'event_espresso'); |
|
26 | - $this->_shortcodes = array( |
|
27 | - '[NEWSLETTER_CONTENT]' => __('This will parse to whatever is found in the related [newsletter_content] field. Note that when triggering a newsletter message, whatever is added for the custom message will be inserted where this shortcode is placed', 'event_espresso') |
|
28 | - ); |
|
29 | - } |
|
23 | + protected function _init_props() { |
|
24 | + $this->label = __("Newsletter Shortcodes", 'event_espresso'); |
|
25 | + $this->description = __('All shortcodes used for the newsletter message type', 'event_espresso'); |
|
26 | + $this->_shortcodes = array( |
|
27 | + '[NEWSLETTER_CONTENT]' => __('This will parse to whatever is found in the related [newsletter_content] field. Note that when triggering a newsletter message, whatever is added for the custom message will be inserted where this shortcode is placed', 'event_espresso') |
|
28 | + ); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | - protected function _parser( $shortcode ) { |
|
34 | - if ( $shortcode == '[NEWSLETTER_CONTENT]' ) { |
|
35 | - $this->_validate_list_requirements(); |
|
36 | - $this->_set_shortcode_helper(); |
|
37 | - $valid_shortcodes = array('recipient_details', 'organization'); |
|
38 | - $template = $this->_data['template']['newsletter_content']; |
|
39 | - $data = $this->_data; |
|
40 | - return $this->_shortcode_helper->parse_message_template( $template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
41 | - } |
|
42 | - } |
|
33 | + protected function _parser( $shortcode ) { |
|
34 | + if ( $shortcode == '[NEWSLETTER_CONTENT]' ) { |
|
35 | + $this->_validate_list_requirements(); |
|
36 | + $this->_set_shortcode_helper(); |
|
37 | + $valid_shortcodes = array('recipient_details', 'organization'); |
|
38 | + $template = $this->_data['template']['newsletter_content']; |
|
39 | + $data = $this->_data; |
|
40 | + return $this->_shortcode_helper->parse_message_template( $template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
41 | + } |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * Callback set in args for EE_Register_Messages_Shortcode_Library::register for 'msgr_validator_callback'. |
|
47 | - * |
|
48 | - * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
49 | - * 'FHEE__EE_messenger__get_validator_config' filter. |
|
50 | - * |
|
51 | - * @since 4.3.0 |
|
52 | - * @param array $validator_config current validator configuration array |
|
53 | - * @param EE_messenger $messenger |
|
54 | - * @return array new validator config. |
|
55 | - */ |
|
56 | - public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) { |
|
57 | - if ( $messenger->name !== 'email' ) |
|
58 | - return $validator_config; |
|
45 | + /** |
|
46 | + * Callback set in args for EE_Register_Messages_Shortcode_Library::register for 'msgr_validator_callback'. |
|
47 | + * |
|
48 | + * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
49 | + * 'FHEE__EE_messenger__get_validator_config' filter. |
|
50 | + * |
|
51 | + * @since 4.3.0 |
|
52 | + * @param array $validator_config current validator configuration array |
|
53 | + * @param EE_messenger $messenger |
|
54 | + * @return array new validator config. |
|
55 | + */ |
|
56 | + public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) { |
|
57 | + if ( $messenger->name !== 'email' ) |
|
58 | + return $validator_config; |
|
59 | 59 | |
60 | - $validator_config['content']['shortcodes'][] = 'newsletter'; |
|
61 | - $validator_config['newsletter_content'] = array( |
|
62 | - 'shortcodes' => array('recipient_details', 'organization'), |
|
63 | - 'required' => array('[NEWSLETTER_CONTENT]') |
|
64 | - ); |
|
65 | - return $validator_config; |
|
66 | - } |
|
60 | + $validator_config['content']['shortcodes'][] = 'newsletter'; |
|
61 | + $validator_config['newsletter_content'] = array( |
|
62 | + 'shortcodes' => array('recipient_details', 'organization'), |
|
63 | + 'required' => array('[NEWSLETTER_CONTENT]') |
|
64 | + ); |
|
65 | + return $validator_config; |
|
66 | + } |
|
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | - /** |
|
72 | - * Callback set in args for EE_Register_Messages_Shortcode_Library::register for |
|
73 | - * 'msgr_template_fields_callback'. |
|
74 | - * |
|
75 | - * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
76 | - * FHEE__EE_messenger__get_template_fields filter. |
|
77 | - * |
|
78 | - * @since 4.3.0 |
|
79 | - * |
|
80 | - * @param array $template_fields current template fields setup array. |
|
81 | - * @param EE_messenger $messenger |
|
82 | - * @return array new/modified template fields array. |
|
83 | - */ |
|
84 | - public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) { |
|
85 | - if ( $messenger->name !== 'email' ) |
|
86 | - return $template_fields; |
|
71 | + /** |
|
72 | + * Callback set in args for EE_Register_Messages_Shortcode_Library::register for |
|
73 | + * 'msgr_template_fields_callback'. |
|
74 | + * |
|
75 | + * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
76 | + * FHEE__EE_messenger__get_template_fields filter. |
|
77 | + * |
|
78 | + * @since 4.3.0 |
|
79 | + * |
|
80 | + * @param array $template_fields current template fields setup array. |
|
81 | + * @param EE_messenger $messenger |
|
82 | + * @return array new/modified template fields array. |
|
83 | + */ |
|
84 | + public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) { |
|
85 | + if ( $messenger->name !== 'email' ) |
|
86 | + return $template_fields; |
|
87 | 87 | |
88 | - $template_fields['extra']['content']['newsletter_content'] = array( |
|
89 | - 'input' => 'wp_editor', |
|
90 | - 'label' => '[NEWSLETTER_CONTENT]', |
|
91 | - 'type' => 'string', |
|
92 | - 'required' => TRUE, |
|
93 | - 'validation' => TRUE, |
|
94 | - 'format' => '%s', |
|
95 | - 'rows' => '15', |
|
96 | - 'shortcodes_required' => array('[NEWSLETTER_CONTENT]') |
|
97 | - ); |
|
98 | - return $template_fields; |
|
99 | - } |
|
88 | + $template_fields['extra']['content']['newsletter_content'] = array( |
|
89 | + 'input' => 'wp_editor', |
|
90 | + 'label' => '[NEWSLETTER_CONTENT]', |
|
91 | + 'type' => 'string', |
|
92 | + 'required' => TRUE, |
|
93 | + 'validation' => TRUE, |
|
94 | + 'format' => '%s', |
|
95 | + 'rows' => '15', |
|
96 | + 'shortcodes_required' => array('[NEWSLETTER_CONTENT]') |
|
97 | + ); |
|
98 | + return $template_fields; |
|
99 | + } |
|
100 | 100 | |
101 | 101 | } //end class EE_Newsletter_Shortcodes |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | - protected function _parser( $shortcode ) { |
|
34 | - if ( $shortcode == '[NEWSLETTER_CONTENT]' ) { |
|
33 | + protected function _parser($shortcode) { |
|
34 | + if ($shortcode == '[NEWSLETTER_CONTENT]') { |
|
35 | 35 | $this->_validate_list_requirements(); |
36 | 36 | $this->_set_shortcode_helper(); |
37 | 37 | $valid_shortcodes = array('recipient_details', 'organization'); |
38 | 38 | $template = $this->_data['template']['newsletter_content']; |
39 | 39 | $data = $this->_data; |
40 | - return $this->_shortcode_helper->parse_message_template( $template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
40 | + return $this->_shortcode_helper->parse_message_template($template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @param EE_messenger $messenger |
54 | 54 | * @return array new validator config. |
55 | 55 | */ |
56 | - public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) { |
|
57 | - if ( $messenger->name !== 'email' ) |
|
56 | + public static function messenger_validator_config($validator_config, EE_messenger $messenger) { |
|
57 | + if ($messenger->name !== 'email') |
|
58 | 58 | return $validator_config; |
59 | 59 | |
60 | 60 | $validator_config['content']['shortcodes'][] = 'newsletter'; |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * @param EE_messenger $messenger |
82 | 82 | * @return array new/modified template fields array. |
83 | 83 | */ |
84 | - public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) { |
|
85 | - if ( $messenger->name !== 'email' ) |
|
84 | + public static function messenger_template_fields($template_fields, EE_messenger $messenger) { |
|
85 | + if ($messenger->name !== 'email') |
|
86 | 86 | return $template_fields; |
87 | 87 | |
88 | 88 | $template_fields['extra']['content']['newsletter_content'] = array( |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | - protected function _parser( $shortcode ) { |
|
50 | + protected function _parser($shortcode) { |
|
51 | 51 | |
52 | 52 | |
53 | - switch ( $shortcode ) { |
|
53 | + switch ($shortcode) { |
|
54 | 54 | case '[QUESTION_LIST]' : |
55 | 55 | return $this->_get_question_list(); |
56 | 56 | break; |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | $this->_set_shortcode_helper(); |
66 | 66 | |
67 | 67 | //for when [QUESTION_LIST] is used in the [attendee_list] field. |
68 | - if ( $this->_data['data'] instanceof EE_Registration ) { |
|
68 | + if ($this->_data['data'] instanceof EE_Registration) { |
|
69 | 69 | return $this->_get_question_answer_list_for_attendee(); |
70 | 70 | } |
71 | 71 | //for when [QUESTION_LIST] is used in the main content field. |
72 | - else if ( $this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration ) { |
|
73 | - return $this->_get_question_answer_list_for_attendee( $this->_data['data']->reg_obj ); |
|
72 | + else if ($this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration) { |
|
73 | + return $this->_get_question_answer_list_for_attendee($this->_data['data']->reg_obj); |
|
74 | 74 | } else { |
75 | 75 | return ''; |
76 | 76 | } |
@@ -82,18 +82,18 @@ discard block |
||
82 | 82 | * Note when we parse the "[question_list]" shortcode for attendees we're actually going to retrieve the list of answers for that attendee since that is what we really need (we can derive the questions from the answers); |
83 | 83 | * @return string parsed template. |
84 | 84 | */ |
85 | - private function _get_question_answer_list_for_attendee( $reg_obj = null ) { |
|
85 | + private function _get_question_answer_list_for_attendee($reg_obj = null) { |
|
86 | 86 | $valid_shortcodes = array('question'); |
87 | 87 | $reg_obj = $reg_obj instanceof EE_Registration ? $reg_obj : $this->_data['data']; |
88 | - $template = is_array( $this->_data['template'] ) && isset($this->_data['template']['question_list']) ? $this->_data['template']['question_list'] : $this->_extra_data['template']['question_list']; |
|
88 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['question_list']) ? $this->_data['template']['question_list'] : $this->_extra_data['template']['question_list']; |
|
89 | 89 | $ans_result = ''; |
90 | 90 | $answers = ! empty($this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs']) ? $this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs'] : array(); |
91 | - foreach ( $answers as $answer ) { |
|
91 | + foreach ($answers as $answer) { |
|
92 | 92 | $question = $answer->question(); |
93 | - if ( $question instanceof EE_Question and $question->admin_only() ) { |
|
93 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
94 | 94 | continue; |
95 | 95 | } |
96 | - $ans_result .= $this->_shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $this->_extra_data); |
|
96 | + $ans_result .= $this->_shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $this->_extra_data); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $ans_result; |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -57,39 +57,39 @@ discard block |
||
57 | 57 | * @param string $shortcode the shortcode to be parsed. |
58 | 58 | * @return string parsed shortcode |
59 | 59 | */ |
60 | - protected function _parser( $shortcode ) { |
|
60 | + protected function _parser($shortcode) { |
|
61 | 61 | |
62 | - if ( ! $this->_data instanceof EE_Answer || ! isset( $this->_extra_data['data'] ) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee ) { |
|
62 | + if ( ! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
63 | 63 | return ''; |
64 | 64 | } |
65 | 65 | |
66 | - switch ( $shortcode ) { |
|
66 | + switch ($shortcode) { |
|
67 | 67 | |
68 | 68 | case '[QUESTION]' : |
69 | - $question = isset( $this->_extra_data['data']->questions[$this->_data->ID()] ) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
70 | - if ( ! $question instanceof EE_Question ) { |
|
69 | + $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
70 | + if ( ! $question instanceof EE_Question) { |
|
71 | 71 | return ''; //get out because we can't figure out what the question is. |
72 | 72 | } |
73 | - return $question->get_pretty( 'QST_display_text', 'no_wpautop' ); |
|
73 | + return $question->get_pretty('QST_display_text', 'no_wpautop'); |
|
74 | 74 | break; |
75 | 75 | |
76 | 76 | case '[ANSWER]' : |
77 | 77 | //need to get the question to determine the type of question (some questions require translation of the answer). |
78 | - $question = isset( $this->_extra_data['data']->questions[$this->_data->ID()] ) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
79 | - if ( ! $question instanceof EE_Question ) { |
|
78 | + $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
79 | + if ( ! $question instanceof EE_Question) { |
|
80 | 80 | return ''; //get out cause we can't figure out what the question type is! |
81 | 81 | } |
82 | 82 | |
83 | 83 | //what we show for the answer depends on the question type! |
84 | - switch ( $question->get( 'QST_type' ) ) { |
|
84 | + switch ($question->get('QST_type')) { |
|
85 | 85 | |
86 | 86 | case 'STATE' : |
87 | - $state = EEM_State::instance()->get_one_by_ID( $this->_data->get('ANS_value') ); |
|
87 | + $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
88 | 88 | $answer = $state instanceof EE_State ? $state->name() : ''; |
89 | 89 | break; |
90 | 90 | |
91 | 91 | case 'COUNTRY' : |
92 | - $country = EEM_Country::instance()->get_one_by_ID( $this->_data->get( 'ANS_value') ); |
|
92 | + $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
93 | 93 | $answer = $country instanceof EE_Country ? $country->name() : ''; |
94 | 94 | break; |
95 | 95 |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Event_Single_Caff |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * @return void |
51 | 51 | */ |
52 | 52 | public static function set_hooks_admin() { |
53 | - define( 'EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
54 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Event_Single_Caff', 'template_settings_form' ), 10 ); |
|
55 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Event_Single_Caff', 'update_template_settings' ), 10, 2 ); |
|
53 | + define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
54 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Event_Single_Caff', 'template_settings_form'), 10); |
|
55 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Event_Single_Caff', 'update_template_settings'), 10, 2); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public static function template_settings_form() { |
71 | 71 | $EE = EE_Registry::instance(); |
72 | - $EE->CFG->template_settings->EED_Event_Single = isset( $EE->CFG->template_settings->EED_Event_Single ) ? $EE->CFG->template_settings->EED_Event_Single : new EE_Event_Single_Config(); |
|
73 | - $EE->CFG->template_settings->EED_Event_Single = apply_filters( 'FHEE__EED_Event_Single__template_settings_form__event_list_config', $EE->CFG->template_settings->EED_Event_Single ); |
|
74 | - EEH_Template::display_template( EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', $EE->CFG->template_settings->EED_Event_Single ); |
|
72 | + $EE->CFG->template_settings->EED_Event_Single = isset($EE->CFG->template_settings->EED_Event_Single) ? $EE->CFG->template_settings->EED_Event_Single : new EE_Event_Single_Config(); |
|
73 | + $EE->CFG->template_settings->EED_Event_Single = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $EE->CFG->template_settings->EED_Event_Single); |
|
74 | + EEH_Template::display_template(EVENT_SINGLE_CAFF_TEMPLATES_PATH.'admin-event-single-settings.template.php', $EE->CFG->template_settings->EED_Event_Single); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | * @param $REQ |
85 | 85 | * @return void |
86 | 86 | */ |
87 | - public static function update_template_settings( $CFG, $REQ ) { |
|
87 | + public static function update_template_settings($CFG, $REQ) { |
|
88 | 88 | $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
89 | - $CFG->EED_Event_Single->display_status_banner_single = !empty( $REQ['display_status_banner_single'] ) && $REQ['display_status_banner_single'] ? TRUE : FALSE; |
|
90 | - $CFG->EED_Event_Single->display_venue = !empty( $REQ['display_venue'] ) && $REQ['display_venue'] ? TRUE : FALSE; |
|
89 | + $CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single']) && $REQ['display_status_banner_single'] ? TRUE : FALSE; |
|
90 | + $CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue'] ? TRUE : FALSE; |
|
91 | 91 | return $CFG; |
92 | 92 | } |
93 | 93 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param WP $WP |
101 | 101 | * @return void |
102 | 102 | */ |
103 | - public function run( $WP ) { |
|
103 | + public function run($WP) { |
|
104 | 104 | } |
105 | 105 | |
106 | 106 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |