@@ -16,37 +16,37 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - public function __construct($fields, $context) |
|
20 | - { |
|
21 | - $this->_m_name = 'email'; |
|
22 | - $this->_mt_name = 'payment_cancelled'; |
|
23 | - |
|
24 | - parent::__construct($fields, $context); |
|
25 | - } |
|
26 | - |
|
27 | - /** |
|
28 | - * at this point no custom validation needed for this messenger/message_type combo. |
|
29 | - */ |
|
30 | - protected function _modify_validator() |
|
31 | - { |
|
32 | - $new_config = $this->_messenger->get_validator_config(); |
|
33 | - |
|
34 | - // modify just event_list |
|
35 | - $new_config['event_list'] = array( |
|
36 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
37 | - ); |
|
38 | - $new_config['ticket_list'] = array( |
|
39 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
40 | - ); |
|
41 | - $new_config['content'] = array( |
|
42 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
43 | - ); |
|
44 | - $this->_messenger->set_validator_config($new_config); |
|
45 | - |
|
46 | - if ($this->_context != 'admin') { |
|
47 | - $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'); |
|
48 | - } |
|
49 | - |
|
50 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
51 | - } |
|
19 | + public function __construct($fields, $context) |
|
20 | + { |
|
21 | + $this->_m_name = 'email'; |
|
22 | + $this->_mt_name = 'payment_cancelled'; |
|
23 | + |
|
24 | + parent::__construct($fields, $context); |
|
25 | + } |
|
26 | + |
|
27 | + /** |
|
28 | + * at this point no custom validation needed for this messenger/message_type combo. |
|
29 | + */ |
|
30 | + protected function _modify_validator() |
|
31 | + { |
|
32 | + $new_config = $this->_messenger->get_validator_config(); |
|
33 | + |
|
34 | + // modify just event_list |
|
35 | + $new_config['event_list'] = array( |
|
36 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
37 | + ); |
|
38 | + $new_config['ticket_list'] = array( |
|
39 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
40 | + ); |
|
41 | + $new_config['content'] = array( |
|
42 | + 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
43 | + ); |
|
44 | + $this->_messenger->set_validator_config($new_config); |
|
45 | + |
|
46 | + if ($this->_context != 'admin') { |
|
47 | + $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'); |
|
48 | + } |
|
49 | + |
|
50 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
51 | + } |
|
52 | 52 | } |
@@ -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]'); |
@@ -15,31 +15,31 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - public function __construct($fields, $context) |
|
19 | - { |
|
20 | - $this->_m_name = 'email'; |
|
21 | - $this->_mt_name = 'declined_registration'; |
|
18 | + public function __construct($fields, $context) |
|
19 | + { |
|
20 | + $this->_m_name = 'email'; |
|
21 | + $this->_mt_name = 'declined_registration'; |
|
22 | 22 | |
23 | - parent::__construct($fields, $context); |
|
24 | - } |
|
23 | + parent::__construct($fields, $context); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * custom validator (restricting what was originally set by the messenger) |
|
28 | - */ |
|
29 | - protected function _modify_validator() |
|
30 | - { |
|
31 | - $new_config = $this->_messenger->get_validator_config(); |
|
32 | - // modify just event_list |
|
33 | - $new_config['event_list'] = array( |
|
34 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
35 | - 'required' => array('[EVENT_LIST]') |
|
36 | - ); |
|
37 | - $this->_messenger->set_validator_config($new_config); |
|
26 | + /** |
|
27 | + * custom validator (restricting what was originally set by the messenger) |
|
28 | + */ |
|
29 | + protected function _modify_validator() |
|
30 | + { |
|
31 | + $new_config = $this->_messenger->get_validator_config(); |
|
32 | + // modify just event_list |
|
33 | + $new_config['event_list'] = array( |
|
34 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
35 | + 'required' => array('[EVENT_LIST]') |
|
36 | + ); |
|
37 | + $this->_messenger->set_validator_config($new_config); |
|
38 | 38 | |
39 | - if ($this->_context != 'admin') { |
|
40 | - $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'); |
|
41 | - } |
|
39 | + if ($this->_context != 'admin') { |
|
40 | + $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'); |
|
41 | + } |
|
42 | 42 | |
43 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
44 | - } |
|
43 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
44 | + } |
|
45 | 45 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $this->_messenger->set_validator_config($new_config); |
39 | 39 | |
40 | 40 | if ($this->_context != 'admin') { |
41 | - $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'); |
|
41 | + $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'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -15,47 +15,47 @@ |
||
15 | 15 | class EE_Declined_Registration_message_type extends EE_Registration_Base_message_type |
16 | 16 | { |
17 | 17 | |
18 | - public function __construct() |
|
19 | - { |
|
20 | - $this->name = 'declined_registration'; |
|
21 | - $this->description = __('This message type is for messages sent to registrants when their registration is declined.', 'event_espresso'); |
|
22 | - $this->label = array( |
|
23 | - 'singular' => __('registration declined', 'event_espresso'), |
|
24 | - 'plural' => __('registrations declined', 'event_espresso') |
|
25 | - ); |
|
26 | - $this->_master_templates = array( |
|
27 | - 'email' => 'not_approved_registration' |
|
28 | - ); |
|
29 | - parent::__construct(); |
|
30 | - } |
|
31 | - |
|
32 | - |
|
33 | - |
|
34 | - |
|
35 | - /** |
|
36 | - * _set_contexts |
|
37 | - * This sets up the contexts associated with the message_type |
|
38 | - * |
|
39 | - * @access protected |
|
40 | - * @return void |
|
41 | - */ |
|
42 | - protected function _set_contexts() |
|
43 | - { |
|
44 | - $this->_context_label = array( |
|
45 | - 'label' => __('recipient', 'event_espresso'), |
|
46 | - 'plural' => __('recipients', 'event_espresso'), |
|
47 | - 'description' => __('Recipient\'s are who will receive the template. You may want different registration details sent out depending on who the recipient is', 'event_espresso') |
|
48 | - ); |
|
49 | - |
|
50 | - $this->_contexts = array( |
|
51 | - 'admin' => array( |
|
52 | - 'label' => __('Event Admin', 'event_espresso'), |
|
53 | - 'description' => __('This template is what event administrators will receive with an declined registration', 'event_espresso') |
|
54 | - ), |
|
55 | - 'attendee' => array( |
|
56 | - 'label' => __('Registrant', 'event_espresso'), |
|
57 | - 'description' => __('This template is what each registrant for the event will receive when their registration is declined.', 'event_espresso') |
|
58 | - ) |
|
59 | - ); |
|
60 | - } |
|
18 | + public function __construct() |
|
19 | + { |
|
20 | + $this->name = 'declined_registration'; |
|
21 | + $this->description = __('This message type is for messages sent to registrants when their registration is declined.', 'event_espresso'); |
|
22 | + $this->label = array( |
|
23 | + 'singular' => __('registration declined', 'event_espresso'), |
|
24 | + 'plural' => __('registrations declined', 'event_espresso') |
|
25 | + ); |
|
26 | + $this->_master_templates = array( |
|
27 | + 'email' => 'not_approved_registration' |
|
28 | + ); |
|
29 | + parent::__construct(); |
|
30 | + } |
|
31 | + |
|
32 | + |
|
33 | + |
|
34 | + |
|
35 | + /** |
|
36 | + * _set_contexts |
|
37 | + * This sets up the contexts associated with the message_type |
|
38 | + * |
|
39 | + * @access protected |
|
40 | + * @return void |
|
41 | + */ |
|
42 | + protected function _set_contexts() |
|
43 | + { |
|
44 | + $this->_context_label = array( |
|
45 | + 'label' => __('recipient', 'event_espresso'), |
|
46 | + 'plural' => __('recipients', 'event_espresso'), |
|
47 | + 'description' => __('Recipient\'s are who will receive the template. You may want different registration details sent out depending on who the recipient is', 'event_espresso') |
|
48 | + ); |
|
49 | + |
|
50 | + $this->_contexts = array( |
|
51 | + 'admin' => array( |
|
52 | + 'label' => __('Event Admin', 'event_espresso'), |
|
53 | + 'description' => __('This template is what event administrators will receive with an declined registration', 'event_espresso') |
|
54 | + ), |
|
55 | + 'attendee' => array( |
|
56 | + 'label' => __('Registrant', 'event_espresso'), |
|
57 | + 'description' => __('This template is what each registrant for the event will receive when their registration is declined.', 'event_espresso') |
|
58 | + ) |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | } |
@@ -15,49 +15,49 @@ |
||
15 | 15 | class EE_Payment_Reminder_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_reminder'; |
|
23 | - $this->description = __('This message type is used for all payment reminder messages. These are triggered when an offline gateway registration is completed or when manually triggered via event administrators via the transaction admin page(s).', 'event_espresso'); |
|
24 | - $this->label = array( |
|
25 | - 'singular' => __('payment reminder', 'event_espresso'), |
|
26 | - 'plural' => __('payment reminders', 'event_espresso') |
|
27 | - ); |
|
28 | - $this->_master_templates = array( |
|
29 | - 'email' => 'payment' |
|
30 | - ); |
|
31 | - |
|
32 | - parent::__construct(); |
|
33 | - } |
|
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 on a successful payment', '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 on successful payment', 'event_espresso') |
|
60 | - ) |
|
61 | - ); |
|
62 | - } |
|
18 | + public function __construct() |
|
19 | + { |
|
20 | + |
|
21 | + // setup type details for reference |
|
22 | + $this->name = 'payment_reminder'; |
|
23 | + $this->description = __('This message type is used for all payment reminder messages. These are triggered when an offline gateway registration is completed or when manually triggered via event administrators via the transaction admin page(s).', 'event_espresso'); |
|
24 | + $this->label = array( |
|
25 | + 'singular' => __('payment reminder', 'event_espresso'), |
|
26 | + 'plural' => __('payment reminders', 'event_espresso') |
|
27 | + ); |
|
28 | + $this->_master_templates = array( |
|
29 | + 'email' => 'payment' |
|
30 | + ); |
|
31 | + |
|
32 | + parent::__construct(); |
|
33 | + } |
|
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 on a successful payment', '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 on successful payment', '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_reminder'; |
|
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_reminder'; |
|
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]'); |
@@ -19,80 +19,80 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * _init_props |
|
24 | - * |
|
25 | - * @access protected |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - protected function _init_props() |
|
29 | - { |
|
30 | - $this->label = __('Attendee Shortcodes', 'event_espresso'); |
|
31 | - $this->description = __('All shortcodes specific to attendee related data', 'event_espresso'); |
|
32 | - $this->_shortcodes = array( |
|
33 | - '[QUESTION]' => __('Will parse to a question.', 'event_espresso'), |
|
34 | - '[ANSWER]' => __('Will parse to the answer for a question', 'event_espresso'), |
|
35 | - ); |
|
36 | - } |
|
22 | + /** |
|
23 | + * _init_props |
|
24 | + * |
|
25 | + * @access protected |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + protected function _init_props() |
|
29 | + { |
|
30 | + $this->label = __('Attendee Shortcodes', 'event_espresso'); |
|
31 | + $this->description = __('All shortcodes specific to attendee related data', 'event_espresso'); |
|
32 | + $this->_shortcodes = array( |
|
33 | + '[QUESTION]' => __('Will parse to a question.', 'event_espresso'), |
|
34 | + '[ANSWER]' => __('Will parse to the answer for a question', 'event_espresso'), |
|
35 | + ); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * This method will give parsing instructions for each shortcode defined in the _shortcodes array. Child methods |
|
41 | - * will have to take care of handling. |
|
42 | - * |
|
43 | - * @access protected |
|
44 | - * |
|
45 | - * @param string $shortcode the shortcode to be parsed. |
|
46 | - * |
|
47 | - * @return string parsed shortcode |
|
48 | - */ |
|
49 | - protected function _parser($shortcode) |
|
50 | - { |
|
39 | + /** |
|
40 | + * This method will give parsing instructions for each shortcode defined in the _shortcodes array. Child methods |
|
41 | + * will have to take care of handling. |
|
42 | + * |
|
43 | + * @access protected |
|
44 | + * |
|
45 | + * @param string $shortcode the shortcode to be parsed. |
|
46 | + * |
|
47 | + * @return string parsed shortcode |
|
48 | + */ |
|
49 | + protected function _parser($shortcode) |
|
50 | + { |
|
51 | 51 | |
52 | - if (! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
53 | - return ''; |
|
54 | - } |
|
52 | + if (! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
53 | + return ''; |
|
54 | + } |
|
55 | 55 | |
56 | - switch ($shortcode) { |
|
57 | - case '[QUESTION]': |
|
58 | - $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
59 | - ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
60 | - if (! $question instanceof EE_Question) { |
|
61 | - return ''; // get out because we can't figure out what the question is. |
|
62 | - } |
|
56 | + switch ($shortcode) { |
|
57 | + case '[QUESTION]': |
|
58 | + $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
59 | + ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
60 | + if (! $question instanceof EE_Question) { |
|
61 | + return ''; // get out because we can't figure out what the question is. |
|
62 | + } |
|
63 | 63 | |
64 | - return $question->get('QST_display_text'); |
|
65 | - break; |
|
64 | + return $question->get('QST_display_text'); |
|
65 | + break; |
|
66 | 66 | |
67 | - case '[ANSWER]': |
|
68 | - // need to get the question to determine the type of question (some questions require translation of the answer). |
|
69 | - $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
70 | - ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
71 | - if (! $question instanceof EE_Question) { |
|
72 | - return ''; // get out cause we can't figure out what the question type is! |
|
73 | - } |
|
67 | + case '[ANSWER]': |
|
68 | + // need to get the question to determine the type of question (some questions require translation of the answer). |
|
69 | + $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
70 | + ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
71 | + if (! $question instanceof EE_Question) { |
|
72 | + return ''; // get out cause we can't figure out what the question type is! |
|
73 | + } |
|
74 | 74 | |
75 | - // what we show for the answer depends on the question type! |
|
76 | - switch ($question->get('QST_type')) { |
|
77 | - case 'STATE': |
|
78 | - $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
79 | - $answer = $state instanceof EE_State ? $state->name() : ''; |
|
80 | - break; |
|
75 | + // what we show for the answer depends on the question type! |
|
76 | + switch ($question->get('QST_type')) { |
|
77 | + case 'STATE': |
|
78 | + $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
79 | + $answer = $state instanceof EE_State ? $state->name() : ''; |
|
80 | + break; |
|
81 | 81 | |
82 | - case 'COUNTRY': |
|
83 | - $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
84 | - $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
85 | - break; |
|
82 | + case 'COUNTRY': |
|
83 | + $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
84 | + $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
85 | + break; |
|
86 | 86 | |
87 | - default: |
|
88 | - $answer = $this->_data->get_pretty('ANS_value', 'no_wpautop'); |
|
89 | - break; |
|
90 | - } |
|
87 | + default: |
|
88 | + $answer = $this->_data->get_pretty('ANS_value', 'no_wpautop'); |
|
89 | + break; |
|
90 | + } |
|
91 | 91 | |
92 | - return $answer; |
|
93 | - break; |
|
94 | - } |
|
92 | + return $answer; |
|
93 | + break; |
|
94 | + } |
|
95 | 95 | |
96 | - return ''; |
|
97 | - } |
|
96 | + return ''; |
|
97 | + } |
|
98 | 98 | } |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | protected function _parser($shortcode) |
50 | 50 | { |
51 | 51 | |
52 | - if (! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
52 | + if ( ! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
53 | 53 | return ''; |
54 | 54 | } |
55 | 55 | |
56 | 56 | switch ($shortcode) { |
57 | 57 | case '[QUESTION]': |
58 | - $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
59 | - ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
60 | - if (! $question instanceof EE_Question) { |
|
58 | + $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) |
|
59 | + ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
60 | + if ( ! $question instanceof EE_Question) { |
|
61 | 61 | return ''; // get out because we can't figure out what the question is. |
62 | 62 | } |
63 | 63 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | |
67 | 67 | case '[ANSWER]': |
68 | 68 | // need to get the question to determine the type of question (some questions require translation of the answer). |
69 | - $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
70 | - ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
71 | - if (! $question instanceof EE_Question) { |
|
69 | + $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) |
|
70 | + ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
71 | + if ( ! $question instanceof EE_Question) { |
|
72 | 72 | return ''; // get out cause we can't figure out what the question type is! |
73 | 73 | } |
74 | 74 |
@@ -14,93 +14,93 @@ |
||
14 | 14 | class EE_Newsletter_Shortcodes extends EE_Shortcodes |
15 | 15 | { |
16 | 16 | |
17 | - protected function _init_props() |
|
18 | - { |
|
19 | - $this->label = __("Batch Messages Shortcodes", 'event_espresso'); |
|
20 | - $this->description = __('All shortcodes used for the batch message type', 'event_espresso'); |
|
21 | - $this->_shortcodes = array( |
|
22 | - '[NEWSLETTER_CONTENT]' => __( |
|
23 | - 'This will parse to whatever is found in the related [newsletter_content] field. Note that when triggering a batch message, whatever is added for the custom message will be inserted where this shortcode is placed.', |
|
24 | - 'event_espresso' |
|
25 | - ), |
|
26 | - ); |
|
27 | - } |
|
17 | + protected function _init_props() |
|
18 | + { |
|
19 | + $this->label = __("Batch Messages Shortcodes", 'event_espresso'); |
|
20 | + $this->description = __('All shortcodes used for the batch message type', 'event_espresso'); |
|
21 | + $this->_shortcodes = array( |
|
22 | + '[NEWSLETTER_CONTENT]' => __( |
|
23 | + 'This will parse to whatever is found in the related [newsletter_content] field. Note that when triggering a batch message, whatever is added for the custom message will be inserted where this shortcode is placed.', |
|
24 | + 'event_espresso' |
|
25 | + ), |
|
26 | + ); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - protected function _parser($shortcode) |
|
31 | - { |
|
32 | - if ($shortcode == '[NEWSLETTER_CONTENT]') { |
|
33 | - $this->_validate_list_requirements(); |
|
34 | - $valid_shortcodes = array('recipient_details', 'organization'); |
|
35 | - $template = $this->_data['template']['newsletter_content']; |
|
36 | - $data = $this->_data; |
|
37 | - return $this->_shortcode_helper->parse_message_template( |
|
38 | - $template, |
|
39 | - $data['data'], |
|
40 | - $valid_shortcodes, |
|
41 | - $this->_message_type, |
|
42 | - $this->_messenger, |
|
43 | - $this->_message |
|
44 | - ); |
|
45 | - } |
|
46 | - } |
|
30 | + protected function _parser($shortcode) |
|
31 | + { |
|
32 | + if ($shortcode == '[NEWSLETTER_CONTENT]') { |
|
33 | + $this->_validate_list_requirements(); |
|
34 | + $valid_shortcodes = array('recipient_details', 'organization'); |
|
35 | + $template = $this->_data['template']['newsletter_content']; |
|
36 | + $data = $this->_data; |
|
37 | + return $this->_shortcode_helper->parse_message_template( |
|
38 | + $template, |
|
39 | + $data['data'], |
|
40 | + $valid_shortcodes, |
|
41 | + $this->_message_type, |
|
42 | + $this->_messenger, |
|
43 | + $this->_message |
|
44 | + ); |
|
45 | + } |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * Callback set in args for EE_Register_Messages_Shortcode_Library::register for 'msgr_validator_callback'. |
|
51 | - * |
|
52 | - * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
53 | - * 'FHEE__EE_messenger__get_validator_config' filter. |
|
54 | - * |
|
55 | - * @since 4.3.0 |
|
56 | - * @param array $validator_config current validator configuration array |
|
57 | - * @param EE_messenger $messenger |
|
58 | - * @return array new validator config. |
|
59 | - */ |
|
60 | - public static function messenger_validator_config($validator_config, EE_messenger $messenger) |
|
61 | - { |
|
62 | - if ($messenger->name !== 'email') { |
|
63 | - return $validator_config; |
|
64 | - } |
|
49 | + /** |
|
50 | + * Callback set in args for EE_Register_Messages_Shortcode_Library::register for 'msgr_validator_callback'. |
|
51 | + * |
|
52 | + * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
53 | + * 'FHEE__EE_messenger__get_validator_config' filter. |
|
54 | + * |
|
55 | + * @since 4.3.0 |
|
56 | + * @param array $validator_config current validator configuration array |
|
57 | + * @param EE_messenger $messenger |
|
58 | + * @return array new validator config. |
|
59 | + */ |
|
60 | + public static function messenger_validator_config($validator_config, EE_messenger $messenger) |
|
61 | + { |
|
62 | + if ($messenger->name !== 'email') { |
|
63 | + return $validator_config; |
|
64 | + } |
|
65 | 65 | |
66 | - $validator_config['content']['shortcodes'][] = 'newsletter'; |
|
67 | - $validator_config['newsletter_content'] = array( |
|
68 | - 'shortcodes' => array('recipient_details', 'organization'), |
|
69 | - 'required' => array('[NEWSLETTER_CONTENT]'), |
|
70 | - ); |
|
71 | - return $validator_config; |
|
72 | - } |
|
66 | + $validator_config['content']['shortcodes'][] = 'newsletter'; |
|
67 | + $validator_config['newsletter_content'] = array( |
|
68 | + 'shortcodes' => array('recipient_details', 'organization'), |
|
69 | + 'required' => array('[NEWSLETTER_CONTENT]'), |
|
70 | + ); |
|
71 | + return $validator_config; |
|
72 | + } |
|
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * Callback set in args for EE_Register_Messages_Shortcode_Library::register for |
|
77 | - * 'msgr_template_fields_callback'. |
|
78 | - * |
|
79 | - * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
80 | - * FHEE__EE_messenger__get_template_fields filter. |
|
81 | - * |
|
82 | - * @since 4.3.0 |
|
83 | - * |
|
84 | - * @param array $template_fields current template fields setup array. |
|
85 | - * @param EE_messenger $messenger |
|
86 | - * @return array new/modified template fields array. |
|
87 | - */ |
|
88 | - public static function messenger_template_fields($template_fields, EE_messenger $messenger) |
|
89 | - { |
|
90 | - if ($messenger->name !== 'email') { |
|
91 | - return $template_fields; |
|
92 | - } |
|
75 | + /** |
|
76 | + * Callback set in args for EE_Register_Messages_Shortcode_Library::register for |
|
77 | + * 'msgr_template_fields_callback'. |
|
78 | + * |
|
79 | + * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
80 | + * FHEE__EE_messenger__get_template_fields filter. |
|
81 | + * |
|
82 | + * @since 4.3.0 |
|
83 | + * |
|
84 | + * @param array $template_fields current template fields setup array. |
|
85 | + * @param EE_messenger $messenger |
|
86 | + * @return array new/modified template fields array. |
|
87 | + */ |
|
88 | + public static function messenger_template_fields($template_fields, EE_messenger $messenger) |
|
89 | + { |
|
90 | + if ($messenger->name !== 'email') { |
|
91 | + return $template_fields; |
|
92 | + } |
|
93 | 93 | |
94 | - $template_fields['extra']['content']['newsletter_content'] = array( |
|
95 | - 'input' => 'wp_editor', |
|
96 | - 'label' => '[NEWSLETTER_CONTENT]', |
|
97 | - 'type' => 'string', |
|
98 | - 'required' => true, |
|
99 | - 'validation' => true, |
|
100 | - 'format' => '%s', |
|
101 | - 'rows' => '15', |
|
102 | - 'shortcodes_required' => array('[NEWSLETTER_CONTENT]'), |
|
103 | - ); |
|
104 | - return $template_fields; |
|
105 | - } |
|
94 | + $template_fields['extra']['content']['newsletter_content'] = array( |
|
95 | + 'input' => 'wp_editor', |
|
96 | + 'label' => '[NEWSLETTER_CONTENT]', |
|
97 | + 'type' => 'string', |
|
98 | + 'required' => true, |
|
99 | + 'validation' => true, |
|
100 | + 'format' => '%s', |
|
101 | + 'rows' => '15', |
|
102 | + 'shortcodes_required' => array('[NEWSLETTER_CONTENT]'), |
|
103 | + ); |
|
104 | + return $template_fields; |
|
105 | + } |
|
106 | 106 | } |
@@ -19,88 +19,88 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - public function __construct() |
|
23 | - { |
|
24 | - parent::__construct(); |
|
25 | - } |
|
26 | - |
|
27 | - |
|
28 | - protected function _init_props() |
|
29 | - { |
|
30 | - $this->label = __('Questions and Answers Shortcodes', 'event_espresso'); |
|
31 | - $this->description = __('All shortcodes related to custom questions and answers', 'event_espresso'); |
|
32 | - $this->_shortcodes = array( |
|
33 | - '[QUESTION_LIST]' => __( |
|
34 | - 'This is used to indicate where you want the list of questions and answers to show for the registrant. You place this within the "[attendee_list]" field.', |
|
35 | - 'event_espresso' |
|
36 | - ), |
|
37 | - ); |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - protected function _parser($shortcode) |
|
42 | - { |
|
43 | - |
|
44 | - |
|
45 | - switch ($shortcode) { |
|
46 | - case '[QUESTION_LIST]': |
|
47 | - return $this->_get_question_list(); |
|
48 | - break; |
|
49 | - } |
|
50 | - |
|
51 | - return ''; |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - protected function _get_question_list() |
|
56 | - { |
|
57 | - $this->_validate_list_requirements(); |
|
58 | - |
|
59 | - // for when [QUESTION_LIST] is used in the [attendee_list] field. |
|
60 | - if ($this->_data['data'] instanceof EE_Registration) { |
|
61 | - return $this->_get_question_answer_list_for_attendee(); |
|
62 | - } //for when [QUESTION_LIST] is used in the main content field. |
|
63 | - elseif ($this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration) { |
|
64 | - return $this->_get_question_answer_list_for_attendee($this->_data['data']->reg_obj); |
|
65 | - } else { |
|
66 | - return ''; |
|
67 | - } |
|
68 | - } |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * Note when we parse the "[question_list]" shortcode for attendees we're actually going to retrieve the list of |
|
73 | - * answers for that attendee since that is what we really need (we can derive the questions from the answers); |
|
74 | - * |
|
75 | - * @return string parsed template. |
|
76 | - */ |
|
77 | - private function _get_question_answer_list_for_attendee($reg_obj = null) |
|
78 | - { |
|
79 | - $valid_shortcodes = array('question'); |
|
80 | - $reg_obj = $reg_obj instanceof EE_Registration ? $reg_obj : $this->_data['data']; |
|
81 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['question_list']) |
|
82 | - ? $this->_data['template']['question_list'] : ''; |
|
83 | - $template = empty($template) && isset($this->_extra_data['template']['question_list']) |
|
84 | - ? $this->_extra_data['template']['question_list'] : $template; |
|
85 | - $ans_result = ''; |
|
86 | - $answers = ! empty($this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs']) |
|
87 | - ? $this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs'] : array(); |
|
88 | - $questions = ! empty($this->_extra_data['data']->questions) ? $this->_extra_data['data']->questions : array(); |
|
89 | - foreach ($answers as $answer) { |
|
90 | - // first see if the question is in our $questions array. If not then try to get from answer object |
|
91 | - $question = isset($questions[ $answer->ID() ]) ? $questions[ $answer->ID() ] : null; |
|
92 | - $question = ! $question instanceof EE_Question ? $answer->question() : $question; |
|
93 | - if ($question instanceof EE_Question and $question->admin_only()) { |
|
94 | - continue; |
|
95 | - } |
|
96 | - $ans_result .= $this->_shortcode_helper->parse_question_list_template( |
|
97 | - $template, |
|
98 | - $answer, |
|
99 | - $valid_shortcodes, |
|
100 | - $this->_extra_data |
|
101 | - ); |
|
102 | - } |
|
103 | - |
|
104 | - return $ans_result; |
|
105 | - } |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | + |
|
27 | + |
|
28 | + protected function _init_props() |
|
29 | + { |
|
30 | + $this->label = __('Questions and Answers Shortcodes', 'event_espresso'); |
|
31 | + $this->description = __('All shortcodes related to custom questions and answers', 'event_espresso'); |
|
32 | + $this->_shortcodes = array( |
|
33 | + '[QUESTION_LIST]' => __( |
|
34 | + 'This is used to indicate where you want the list of questions and answers to show for the registrant. You place this within the "[attendee_list]" field.', |
|
35 | + 'event_espresso' |
|
36 | + ), |
|
37 | + ); |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + protected function _parser($shortcode) |
|
42 | + { |
|
43 | + |
|
44 | + |
|
45 | + switch ($shortcode) { |
|
46 | + case '[QUESTION_LIST]': |
|
47 | + return $this->_get_question_list(); |
|
48 | + break; |
|
49 | + } |
|
50 | + |
|
51 | + return ''; |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + protected function _get_question_list() |
|
56 | + { |
|
57 | + $this->_validate_list_requirements(); |
|
58 | + |
|
59 | + // for when [QUESTION_LIST] is used in the [attendee_list] field. |
|
60 | + if ($this->_data['data'] instanceof EE_Registration) { |
|
61 | + return $this->_get_question_answer_list_for_attendee(); |
|
62 | + } //for when [QUESTION_LIST] is used in the main content field. |
|
63 | + elseif ($this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration) { |
|
64 | + return $this->_get_question_answer_list_for_attendee($this->_data['data']->reg_obj); |
|
65 | + } else { |
|
66 | + return ''; |
|
67 | + } |
|
68 | + } |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * Note when we parse the "[question_list]" shortcode for attendees we're actually going to retrieve the list of |
|
73 | + * answers for that attendee since that is what we really need (we can derive the questions from the answers); |
|
74 | + * |
|
75 | + * @return string parsed template. |
|
76 | + */ |
|
77 | + private function _get_question_answer_list_for_attendee($reg_obj = null) |
|
78 | + { |
|
79 | + $valid_shortcodes = array('question'); |
|
80 | + $reg_obj = $reg_obj instanceof EE_Registration ? $reg_obj : $this->_data['data']; |
|
81 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['question_list']) |
|
82 | + ? $this->_data['template']['question_list'] : ''; |
|
83 | + $template = empty($template) && isset($this->_extra_data['template']['question_list']) |
|
84 | + ? $this->_extra_data['template']['question_list'] : $template; |
|
85 | + $ans_result = ''; |
|
86 | + $answers = ! empty($this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs']) |
|
87 | + ? $this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs'] : array(); |
|
88 | + $questions = ! empty($this->_extra_data['data']->questions) ? $this->_extra_data['data']->questions : array(); |
|
89 | + foreach ($answers as $answer) { |
|
90 | + // first see if the question is in our $questions array. If not then try to get from answer object |
|
91 | + $question = isset($questions[ $answer->ID() ]) ? $questions[ $answer->ID() ] : null; |
|
92 | + $question = ! $question instanceof EE_Question ? $answer->question() : $question; |
|
93 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
94 | + continue; |
|
95 | + } |
|
96 | + $ans_result .= $this->_shortcode_helper->parse_question_list_template( |
|
97 | + $template, |
|
98 | + $answer, |
|
99 | + $valid_shortcodes, |
|
100 | + $this->_extra_data |
|
101 | + ); |
|
102 | + } |
|
103 | + |
|
104 | + return $ans_result; |
|
105 | + } |
|
106 | 106 | } |
@@ -83,12 +83,12 @@ |
||
83 | 83 | $template = empty($template) && isset($this->_extra_data['template']['question_list']) |
84 | 84 | ? $this->_extra_data['template']['question_list'] : $template; |
85 | 85 | $ans_result = ''; |
86 | - $answers = ! empty($this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs']) |
|
87 | - ? $this->_extra_data['data']->registrations[ $reg_obj->ID() ]['ans_objs'] : array(); |
|
86 | + $answers = ! empty($this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs']) |
|
87 | + ? $this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs'] : array(); |
|
88 | 88 | $questions = ! empty($this->_extra_data['data']->questions) ? $this->_extra_data['data']->questions : array(); |
89 | 89 | foreach ($answers as $answer) { |
90 | 90 | // first see if the question is in our $questions array. If not then try to get from answer object |
91 | - $question = isset($questions[ $answer->ID() ]) ? $questions[ $answer->ID() ] : null; |
|
91 | + $question = isset($questions[$answer->ID()]) ? $questions[$answer->ID()] : null; |
|
92 | 92 | $question = ! $question instanceof EE_Question ? $answer->question() : $question; |
93 | 93 | if ($question instanceof EE_Question and $question->admin_only()) { |
94 | 94 | continue; |
@@ -17,325 +17,325 @@ |
||
17 | 17 | class EED_Recaptcha_Invisible extends EED_Module |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var EE_Registration_Config $config |
|
22 | - */ |
|
23 | - private static $config; |
|
24 | - |
|
25 | - |
|
26 | - /** |
|
27 | - * @return EED_Module|EED_Recaptcha |
|
28 | - */ |
|
29 | - public static function instance() |
|
30 | - { |
|
31 | - return parent::get_instance(__CLASS__); |
|
32 | - } |
|
33 | - |
|
34 | - |
|
35 | - /** |
|
36 | - * @return void |
|
37 | - * @throws InvalidInterfaceException |
|
38 | - * @throws InvalidDataTypeException |
|
39 | - * @throws InvalidArgumentException |
|
40 | - */ |
|
41 | - public static function set_hooks() |
|
42 | - { |
|
43 | - EED_Recaptcha_Invisible::setProperties(); |
|
44 | - if (EED_Recaptcha_Invisible::useInvisibleRecaptcha()) { |
|
45 | - if (EED_Recaptcha_Invisible::protectForm('ticket_selector')) { |
|
46 | - // ticket selection |
|
47 | - add_filter( |
|
48 | - 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
|
49 | - array('EED_Recaptcha_Invisible', 'ticketSelectorForm'), |
|
50 | - 10, |
|
51 | - 3 |
|
52 | - ); |
|
53 | - add_action( |
|
54 | - 'EED_Ticket_Selector__process_ticket_selections__before', |
|
55 | - array('EED_Recaptcha_Invisible', 'processTicketSelectorForm') |
|
56 | - ); |
|
57 | - } |
|
58 | - if (EED_Recaptcha_Invisible::protectForm('registration_form')) { |
|
59 | - // checkout |
|
60 | - add_action( |
|
61 | - 'AHEE__EE_SPCO_Reg_Step__display_reg_form__reg_form', |
|
62 | - array('EED_Recaptcha_Invisible', 'spcoRegStepForm') |
|
63 | - ); |
|
64 | - add_filter( |
|
65 | - 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', |
|
66 | - array('EED_Recaptcha_Invisible', 'receiveSpcoRegStepForm'), |
|
67 | - 10, |
|
68 | - 2 |
|
69 | - ); |
|
70 | - } |
|
71 | - add_action('loop_end', array('EED_Recaptcha_Invisible', 'localizeScriptVars')); |
|
72 | - } |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * @return void |
|
78 | - * @throws InvalidInterfaceException |
|
79 | - * @throws InvalidDataTypeException |
|
80 | - * @throws InvalidArgumentException |
|
81 | - */ |
|
82 | - public static function set_hooks_admin() |
|
83 | - { |
|
84 | - EED_Recaptcha_Invisible::setProperties(); |
|
85 | - if (EED_Recaptcha_Invisible::protectForm('ticket_selector')) { |
|
86 | - add_action( |
|
87 | - 'EED_Ticket_Selector__process_ticket_selections__before', |
|
88 | - array('EED_Recaptcha_Invisible', 'processTicketSelectorForm') |
|
89 | - ); |
|
90 | - } |
|
91 | - if (EED_Recaptcha_Invisible::protectForm('registration_form')) { |
|
92 | - add_filter( |
|
93 | - 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', |
|
94 | - array('EED_Recaptcha_Invisible', 'receiveSpcoRegStepForm'), |
|
95 | - 10, |
|
96 | - 2 |
|
97 | - ); |
|
98 | - } |
|
99 | - // admin settings |
|
100 | - add_action( |
|
101 | - 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
|
102 | - array('EED_Recaptcha_Invisible', 'adminSettings') |
|
103 | - ); |
|
104 | - add_filter( |
|
105 | - 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
|
106 | - array('EED_Recaptcha_Invisible', 'updateAdminSettings') |
|
107 | - ); |
|
108 | - } |
|
109 | - |
|
110 | - |
|
111 | - /** |
|
112 | - * @return void |
|
113 | - * @throws InvalidInterfaceException |
|
114 | - * @throws InvalidDataTypeException |
|
115 | - * @throws InvalidArgumentException |
|
116 | - */ |
|
117 | - public static function setProperties() |
|
118 | - { |
|
119 | - |
|
120 | - EED_Recaptcha_Invisible::$config = EE_Registry::instance()->CFG->registration; |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * @return boolean |
|
126 | - */ |
|
127 | - public static function useInvisibleRecaptcha() |
|
128 | - { |
|
129 | - return EED_Recaptcha_Invisible::$config->use_captcha |
|
130 | - && EED_Recaptcha_Invisible::$config->recaptcha_theme === 'invisible'; |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - /** |
|
135 | - * @param string $form |
|
136 | - * @return boolean |
|
137 | - */ |
|
138 | - public static function protectForm($form) |
|
139 | - { |
|
140 | - return is_array(EED_Recaptcha_Invisible::$config->recaptcha_protected_forms) |
|
141 | - && in_array($form, EED_Recaptcha_Invisible::$config->recaptcha_protected_forms, true); |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - /** |
|
146 | - * @return void |
|
147 | - * @throws InvalidInterfaceException |
|
148 | - * @throws InvalidDataTypeException |
|
149 | - * @throws InvalidArgumentException |
|
150 | - */ |
|
151 | - public static function localizeScriptVars() |
|
152 | - { |
|
153 | - wp_localize_script( |
|
154 | - EE_Invisible_Recaptcha_Input::SCRIPT_HANDLE_ESPRESSO_INVISIBLE_RECAPTCHA, |
|
155 | - 'eeRecaptcha', |
|
156 | - RecaptchaFactory::create()->getLocalizedVars() |
|
157 | - ); |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * @return string |
|
163 | - */ |
|
164 | - public static function assetsUrl() |
|
165 | - { |
|
166 | - return plugin_dir_url(__FILE__) . 'assets' . DS; |
|
167 | - } |
|
168 | - |
|
169 | - |
|
170 | - /** |
|
171 | - * @param \WP $WP |
|
172 | - */ |
|
173 | - public function run($WP) |
|
174 | - { |
|
175 | - } |
|
176 | - |
|
177 | - |
|
178 | - /** |
|
179 | - * @param EE_Request $request |
|
180 | - * @return bool |
|
181 | - * @throws InvalidArgumentException |
|
182 | - * @throws InvalidDataTypeException |
|
183 | - * @throws InvalidInterfaceException |
|
184 | - * @throws RuntimeException |
|
185 | - */ |
|
186 | - public static function verifyToken(EE_Request $request) |
|
187 | - { |
|
188 | - return RecaptchaFactory::create()->verifyToken($request); |
|
189 | - } |
|
190 | - |
|
191 | - |
|
192 | - /** |
|
193 | - * @param EE_Form_Section_Proper $reg_form |
|
194 | - * @return void |
|
195 | - * @throws EE_Error |
|
196 | - * @throws InvalidArgumentException |
|
197 | - * @throws InvalidDataTypeException |
|
198 | - * @throws InvalidInterfaceException |
|
199 | - * @throws DomainException |
|
200 | - */ |
|
201 | - public static function spcoRegStepForm(EE_Form_Section_Proper $reg_form) |
|
202 | - { |
|
203 | - // do nothing if form isn't for a reg step or test has already been passed |
|
204 | - if (! EED_Recaptcha_Invisible::processSpcoRegStepForm($reg_form)) { |
|
205 | - return; |
|
206 | - } |
|
207 | - $default_hidden_inputs = $reg_form->get_subsection('default_hidden_inputs'); |
|
208 | - if ($default_hidden_inputs instanceof EE_Form_Section_Proper) { |
|
209 | - $invisible_recaptcha = RecaptchaFactory::create(); |
|
210 | - $invisible_recaptcha->addToFormSection($default_hidden_inputs); |
|
211 | - } |
|
212 | - } |
|
213 | - |
|
214 | - |
|
215 | - /** |
|
216 | - * @param EE_Form_Section_Proper $reg_form |
|
217 | - * @return bool |
|
218 | - * @throws InvalidDataTypeException |
|
219 | - * @throws InvalidInterfaceException |
|
220 | - * @throws EE_Error |
|
221 | - * @throws InvalidArgumentException |
|
222 | - */ |
|
223 | - public static function processSpcoRegStepForm(EE_Form_Section_Proper $reg_form) |
|
224 | - { |
|
225 | - return strpos($reg_form->name(), 'reg-step-form') !== false |
|
226 | - && ! RecaptchaFactory::create()->recaptchaPassed(); |
|
227 | - } |
|
228 | - |
|
229 | - |
|
230 | - /** |
|
231 | - * @param array|null $req_data |
|
232 | - * @param EE_Form_Section_Proper $reg_form |
|
233 | - * @return array |
|
234 | - * @throws EE_Error |
|
235 | - * @throws InvalidArgumentException |
|
236 | - * @throws InvalidDataTypeException |
|
237 | - * @throws InvalidInterfaceException |
|
238 | - * @throws RuntimeException |
|
239 | - */ |
|
240 | - public static function receiveSpcoRegStepForm($req_data = array(), EE_Form_Section_Proper $reg_form) |
|
241 | - { |
|
242 | - // do nothing if form isn't for a reg step or test has already been passed |
|
243 | - if (! EED_Recaptcha_Invisible::processSpcoRegStepForm($reg_form)) { |
|
244 | - return $req_data; |
|
245 | - } |
|
246 | - /** @var EE_Request $request */ |
|
247 | - $request = LoaderFactory::getLoader()->getShared('EE_Request'); |
|
248 | - if (! EED_Recaptcha_Invisible::verifyToken($request)) { |
|
249 | - if ($request->isAjax()) { |
|
250 | - $json_response = new EE_SPCO_JSON_Response(); |
|
251 | - $json_response->echoAndExit(); |
|
252 | - } |
|
253 | - EEH_URL::safeRedirectAndExit( |
|
254 | - EE_Registry::instance()->CFG->core->reg_page_url() |
|
255 | - ); |
|
256 | - } |
|
257 | - return $req_data; |
|
258 | - } |
|
259 | - |
|
260 | - |
|
261 | - /** |
|
262 | - * @param string $html |
|
263 | - * @param EE_Event $event |
|
264 | - * @param bool $iframe |
|
265 | - * @return string |
|
266 | - * @throws EE_Error |
|
267 | - * @throws InvalidArgumentException |
|
268 | - * @throws InvalidDataTypeException |
|
269 | - * @throws InvalidInterfaceException |
|
270 | - * @throws ReflectionException |
|
271 | - * @throws DomainException |
|
272 | - */ |
|
273 | - public static function ticketSelectorForm($html = '', EE_Event $event, $iframe = false) |
|
274 | - { |
|
275 | - $recaptcha = RecaptchaFactory::create(); |
|
276 | - // do nothing if test has already been passed |
|
277 | - if ($recaptcha->recaptchaPassed()) { |
|
278 | - return $html; |
|
279 | - } |
|
280 | - $html .= $recaptcha->getInputHtml( |
|
281 | - array( |
|
282 | - 'recaptcha_id' => $event->ID(), |
|
283 | - 'iframe' => $iframe, |
|
284 | - 'localized_vars' => $recaptcha->getLocalizedVars(), |
|
285 | - ) |
|
286 | - ); |
|
287 | - return $html; |
|
288 | - } |
|
289 | - |
|
290 | - |
|
291 | - /** |
|
292 | - * @return void |
|
293 | - * @throws InvalidArgumentException |
|
294 | - * @throws InvalidInterfaceException |
|
295 | - * @throws InvalidDataTypeException |
|
296 | - * @throws RuntimeException |
|
297 | - */ |
|
298 | - public static function processTicketSelectorForm() |
|
299 | - { |
|
300 | - // do nothing if test has already been passed |
|
301 | - if (RecaptchaFactory::create()->recaptchaPassed()) { |
|
302 | - return; |
|
303 | - } |
|
304 | - /** @var EE_Request $request */ |
|
305 | - $request = LoaderFactory::getLoader()->getShared('EE_Request'); |
|
306 | - if (! EED_Recaptcha_Invisible::verifyToken($request)) { |
|
307 | - $event_id = $request->get('tkt-slctr-event-id'); |
|
308 | - $return_url = $request->is_set("tkt-slctr-return-url-{$event_id}") |
|
309 | - ? $request->get("tkt-slctr-return-url-{$event_id}") |
|
310 | - : get_permalink($event_id); |
|
311 | - EEH_URL::safeRedirectAndExit($return_url); |
|
312 | - } |
|
313 | - } |
|
314 | - |
|
315 | - |
|
316 | - /** |
|
317 | - * @throws EE_Error |
|
318 | - * @throws InvalidArgumentException |
|
319 | - * @throws InvalidDataTypeException |
|
320 | - * @throws InvalidInterfaceException |
|
321 | - */ |
|
322 | - public static function adminSettings() |
|
323 | - { |
|
324 | - RecaptchaFactory::getAdminModule()->adminSettings(); |
|
325 | - } |
|
326 | - |
|
327 | - |
|
328 | - /** |
|
329 | - * @param EE_Registration_Config $EE_Registration_Config |
|
330 | - * @return EE_Registration_Config |
|
331 | - * @throws EE_Error |
|
332 | - * @throws InvalidArgumentException |
|
333 | - * @throws InvalidDataTypeException |
|
334 | - * @throws InvalidInterfaceException |
|
335 | - * @throws ReflectionException |
|
336 | - */ |
|
337 | - public static function updateAdminSettings(EE_Registration_Config $EE_Registration_Config) |
|
338 | - { |
|
339 | - return RecaptchaFactory::getAdminModule()->updateAdminSettings($EE_Registration_Config); |
|
340 | - } |
|
20 | + /** |
|
21 | + * @var EE_Registration_Config $config |
|
22 | + */ |
|
23 | + private static $config; |
|
24 | + |
|
25 | + |
|
26 | + /** |
|
27 | + * @return EED_Module|EED_Recaptcha |
|
28 | + */ |
|
29 | + public static function instance() |
|
30 | + { |
|
31 | + return parent::get_instance(__CLASS__); |
|
32 | + } |
|
33 | + |
|
34 | + |
|
35 | + /** |
|
36 | + * @return void |
|
37 | + * @throws InvalidInterfaceException |
|
38 | + * @throws InvalidDataTypeException |
|
39 | + * @throws InvalidArgumentException |
|
40 | + */ |
|
41 | + public static function set_hooks() |
|
42 | + { |
|
43 | + EED_Recaptcha_Invisible::setProperties(); |
|
44 | + if (EED_Recaptcha_Invisible::useInvisibleRecaptcha()) { |
|
45 | + if (EED_Recaptcha_Invisible::protectForm('ticket_selector')) { |
|
46 | + // ticket selection |
|
47 | + add_filter( |
|
48 | + 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
|
49 | + array('EED_Recaptcha_Invisible', 'ticketSelectorForm'), |
|
50 | + 10, |
|
51 | + 3 |
|
52 | + ); |
|
53 | + add_action( |
|
54 | + 'EED_Ticket_Selector__process_ticket_selections__before', |
|
55 | + array('EED_Recaptcha_Invisible', 'processTicketSelectorForm') |
|
56 | + ); |
|
57 | + } |
|
58 | + if (EED_Recaptcha_Invisible::protectForm('registration_form')) { |
|
59 | + // checkout |
|
60 | + add_action( |
|
61 | + 'AHEE__EE_SPCO_Reg_Step__display_reg_form__reg_form', |
|
62 | + array('EED_Recaptcha_Invisible', 'spcoRegStepForm') |
|
63 | + ); |
|
64 | + add_filter( |
|
65 | + 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', |
|
66 | + array('EED_Recaptcha_Invisible', 'receiveSpcoRegStepForm'), |
|
67 | + 10, |
|
68 | + 2 |
|
69 | + ); |
|
70 | + } |
|
71 | + add_action('loop_end', array('EED_Recaptcha_Invisible', 'localizeScriptVars')); |
|
72 | + } |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * @return void |
|
78 | + * @throws InvalidInterfaceException |
|
79 | + * @throws InvalidDataTypeException |
|
80 | + * @throws InvalidArgumentException |
|
81 | + */ |
|
82 | + public static function set_hooks_admin() |
|
83 | + { |
|
84 | + EED_Recaptcha_Invisible::setProperties(); |
|
85 | + if (EED_Recaptcha_Invisible::protectForm('ticket_selector')) { |
|
86 | + add_action( |
|
87 | + 'EED_Ticket_Selector__process_ticket_selections__before', |
|
88 | + array('EED_Recaptcha_Invisible', 'processTicketSelectorForm') |
|
89 | + ); |
|
90 | + } |
|
91 | + if (EED_Recaptcha_Invisible::protectForm('registration_form')) { |
|
92 | + add_filter( |
|
93 | + 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', |
|
94 | + array('EED_Recaptcha_Invisible', 'receiveSpcoRegStepForm'), |
|
95 | + 10, |
|
96 | + 2 |
|
97 | + ); |
|
98 | + } |
|
99 | + // admin settings |
|
100 | + add_action( |
|
101 | + 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
|
102 | + array('EED_Recaptcha_Invisible', 'adminSettings') |
|
103 | + ); |
|
104 | + add_filter( |
|
105 | + 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
|
106 | + array('EED_Recaptcha_Invisible', 'updateAdminSettings') |
|
107 | + ); |
|
108 | + } |
|
109 | + |
|
110 | + |
|
111 | + /** |
|
112 | + * @return void |
|
113 | + * @throws InvalidInterfaceException |
|
114 | + * @throws InvalidDataTypeException |
|
115 | + * @throws InvalidArgumentException |
|
116 | + */ |
|
117 | + public static function setProperties() |
|
118 | + { |
|
119 | + |
|
120 | + EED_Recaptcha_Invisible::$config = EE_Registry::instance()->CFG->registration; |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * @return boolean |
|
126 | + */ |
|
127 | + public static function useInvisibleRecaptcha() |
|
128 | + { |
|
129 | + return EED_Recaptcha_Invisible::$config->use_captcha |
|
130 | + && EED_Recaptcha_Invisible::$config->recaptcha_theme === 'invisible'; |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + /** |
|
135 | + * @param string $form |
|
136 | + * @return boolean |
|
137 | + */ |
|
138 | + public static function protectForm($form) |
|
139 | + { |
|
140 | + return is_array(EED_Recaptcha_Invisible::$config->recaptcha_protected_forms) |
|
141 | + && in_array($form, EED_Recaptcha_Invisible::$config->recaptcha_protected_forms, true); |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + /** |
|
146 | + * @return void |
|
147 | + * @throws InvalidInterfaceException |
|
148 | + * @throws InvalidDataTypeException |
|
149 | + * @throws InvalidArgumentException |
|
150 | + */ |
|
151 | + public static function localizeScriptVars() |
|
152 | + { |
|
153 | + wp_localize_script( |
|
154 | + EE_Invisible_Recaptcha_Input::SCRIPT_HANDLE_ESPRESSO_INVISIBLE_RECAPTCHA, |
|
155 | + 'eeRecaptcha', |
|
156 | + RecaptchaFactory::create()->getLocalizedVars() |
|
157 | + ); |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * @return string |
|
163 | + */ |
|
164 | + public static function assetsUrl() |
|
165 | + { |
|
166 | + return plugin_dir_url(__FILE__) . 'assets' . DS; |
|
167 | + } |
|
168 | + |
|
169 | + |
|
170 | + /** |
|
171 | + * @param \WP $WP |
|
172 | + */ |
|
173 | + public function run($WP) |
|
174 | + { |
|
175 | + } |
|
176 | + |
|
177 | + |
|
178 | + /** |
|
179 | + * @param EE_Request $request |
|
180 | + * @return bool |
|
181 | + * @throws InvalidArgumentException |
|
182 | + * @throws InvalidDataTypeException |
|
183 | + * @throws InvalidInterfaceException |
|
184 | + * @throws RuntimeException |
|
185 | + */ |
|
186 | + public static function verifyToken(EE_Request $request) |
|
187 | + { |
|
188 | + return RecaptchaFactory::create()->verifyToken($request); |
|
189 | + } |
|
190 | + |
|
191 | + |
|
192 | + /** |
|
193 | + * @param EE_Form_Section_Proper $reg_form |
|
194 | + * @return void |
|
195 | + * @throws EE_Error |
|
196 | + * @throws InvalidArgumentException |
|
197 | + * @throws InvalidDataTypeException |
|
198 | + * @throws InvalidInterfaceException |
|
199 | + * @throws DomainException |
|
200 | + */ |
|
201 | + public static function spcoRegStepForm(EE_Form_Section_Proper $reg_form) |
|
202 | + { |
|
203 | + // do nothing if form isn't for a reg step or test has already been passed |
|
204 | + if (! EED_Recaptcha_Invisible::processSpcoRegStepForm($reg_form)) { |
|
205 | + return; |
|
206 | + } |
|
207 | + $default_hidden_inputs = $reg_form->get_subsection('default_hidden_inputs'); |
|
208 | + if ($default_hidden_inputs instanceof EE_Form_Section_Proper) { |
|
209 | + $invisible_recaptcha = RecaptchaFactory::create(); |
|
210 | + $invisible_recaptcha->addToFormSection($default_hidden_inputs); |
|
211 | + } |
|
212 | + } |
|
213 | + |
|
214 | + |
|
215 | + /** |
|
216 | + * @param EE_Form_Section_Proper $reg_form |
|
217 | + * @return bool |
|
218 | + * @throws InvalidDataTypeException |
|
219 | + * @throws InvalidInterfaceException |
|
220 | + * @throws EE_Error |
|
221 | + * @throws InvalidArgumentException |
|
222 | + */ |
|
223 | + public static function processSpcoRegStepForm(EE_Form_Section_Proper $reg_form) |
|
224 | + { |
|
225 | + return strpos($reg_form->name(), 'reg-step-form') !== false |
|
226 | + && ! RecaptchaFactory::create()->recaptchaPassed(); |
|
227 | + } |
|
228 | + |
|
229 | + |
|
230 | + /** |
|
231 | + * @param array|null $req_data |
|
232 | + * @param EE_Form_Section_Proper $reg_form |
|
233 | + * @return array |
|
234 | + * @throws EE_Error |
|
235 | + * @throws InvalidArgumentException |
|
236 | + * @throws InvalidDataTypeException |
|
237 | + * @throws InvalidInterfaceException |
|
238 | + * @throws RuntimeException |
|
239 | + */ |
|
240 | + public static function receiveSpcoRegStepForm($req_data = array(), EE_Form_Section_Proper $reg_form) |
|
241 | + { |
|
242 | + // do nothing if form isn't for a reg step or test has already been passed |
|
243 | + if (! EED_Recaptcha_Invisible::processSpcoRegStepForm($reg_form)) { |
|
244 | + return $req_data; |
|
245 | + } |
|
246 | + /** @var EE_Request $request */ |
|
247 | + $request = LoaderFactory::getLoader()->getShared('EE_Request'); |
|
248 | + if (! EED_Recaptcha_Invisible::verifyToken($request)) { |
|
249 | + if ($request->isAjax()) { |
|
250 | + $json_response = new EE_SPCO_JSON_Response(); |
|
251 | + $json_response->echoAndExit(); |
|
252 | + } |
|
253 | + EEH_URL::safeRedirectAndExit( |
|
254 | + EE_Registry::instance()->CFG->core->reg_page_url() |
|
255 | + ); |
|
256 | + } |
|
257 | + return $req_data; |
|
258 | + } |
|
259 | + |
|
260 | + |
|
261 | + /** |
|
262 | + * @param string $html |
|
263 | + * @param EE_Event $event |
|
264 | + * @param bool $iframe |
|
265 | + * @return string |
|
266 | + * @throws EE_Error |
|
267 | + * @throws InvalidArgumentException |
|
268 | + * @throws InvalidDataTypeException |
|
269 | + * @throws InvalidInterfaceException |
|
270 | + * @throws ReflectionException |
|
271 | + * @throws DomainException |
|
272 | + */ |
|
273 | + public static function ticketSelectorForm($html = '', EE_Event $event, $iframe = false) |
|
274 | + { |
|
275 | + $recaptcha = RecaptchaFactory::create(); |
|
276 | + // do nothing if test has already been passed |
|
277 | + if ($recaptcha->recaptchaPassed()) { |
|
278 | + return $html; |
|
279 | + } |
|
280 | + $html .= $recaptcha->getInputHtml( |
|
281 | + array( |
|
282 | + 'recaptcha_id' => $event->ID(), |
|
283 | + 'iframe' => $iframe, |
|
284 | + 'localized_vars' => $recaptcha->getLocalizedVars(), |
|
285 | + ) |
|
286 | + ); |
|
287 | + return $html; |
|
288 | + } |
|
289 | + |
|
290 | + |
|
291 | + /** |
|
292 | + * @return void |
|
293 | + * @throws InvalidArgumentException |
|
294 | + * @throws InvalidInterfaceException |
|
295 | + * @throws InvalidDataTypeException |
|
296 | + * @throws RuntimeException |
|
297 | + */ |
|
298 | + public static function processTicketSelectorForm() |
|
299 | + { |
|
300 | + // do nothing if test has already been passed |
|
301 | + if (RecaptchaFactory::create()->recaptchaPassed()) { |
|
302 | + return; |
|
303 | + } |
|
304 | + /** @var EE_Request $request */ |
|
305 | + $request = LoaderFactory::getLoader()->getShared('EE_Request'); |
|
306 | + if (! EED_Recaptcha_Invisible::verifyToken($request)) { |
|
307 | + $event_id = $request->get('tkt-slctr-event-id'); |
|
308 | + $return_url = $request->is_set("tkt-slctr-return-url-{$event_id}") |
|
309 | + ? $request->get("tkt-slctr-return-url-{$event_id}") |
|
310 | + : get_permalink($event_id); |
|
311 | + EEH_URL::safeRedirectAndExit($return_url); |
|
312 | + } |
|
313 | + } |
|
314 | + |
|
315 | + |
|
316 | + /** |
|
317 | + * @throws EE_Error |
|
318 | + * @throws InvalidArgumentException |
|
319 | + * @throws InvalidDataTypeException |
|
320 | + * @throws InvalidInterfaceException |
|
321 | + */ |
|
322 | + public static function adminSettings() |
|
323 | + { |
|
324 | + RecaptchaFactory::getAdminModule()->adminSettings(); |
|
325 | + } |
|
326 | + |
|
327 | + |
|
328 | + /** |
|
329 | + * @param EE_Registration_Config $EE_Registration_Config |
|
330 | + * @return EE_Registration_Config |
|
331 | + * @throws EE_Error |
|
332 | + * @throws InvalidArgumentException |
|
333 | + * @throws InvalidDataTypeException |
|
334 | + * @throws InvalidInterfaceException |
|
335 | + * @throws ReflectionException |
|
336 | + */ |
|
337 | + public static function updateAdminSettings(EE_Registration_Config $EE_Registration_Config) |
|
338 | + { |
|
339 | + return RecaptchaFactory::getAdminModule()->updateAdminSettings($EE_Registration_Config); |
|
340 | + } |
|
341 | 341 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public static function assetsUrl() |
165 | 165 | { |
166 | - return plugin_dir_url(__FILE__) . 'assets' . DS; |
|
166 | + return plugin_dir_url(__FILE__).'assets'.DS; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | public static function spcoRegStepForm(EE_Form_Section_Proper $reg_form) |
202 | 202 | { |
203 | 203 | // do nothing if form isn't for a reg step or test has already been passed |
204 | - if (! EED_Recaptcha_Invisible::processSpcoRegStepForm($reg_form)) { |
|
204 | + if ( ! EED_Recaptcha_Invisible::processSpcoRegStepForm($reg_form)) { |
|
205 | 205 | return; |
206 | 206 | } |
207 | 207 | $default_hidden_inputs = $reg_form->get_subsection('default_hidden_inputs'); |
@@ -240,12 +240,12 @@ discard block |
||
240 | 240 | public static function receiveSpcoRegStepForm($req_data = array(), EE_Form_Section_Proper $reg_form) |
241 | 241 | { |
242 | 242 | // do nothing if form isn't for a reg step or test has already been passed |
243 | - if (! EED_Recaptcha_Invisible::processSpcoRegStepForm($reg_form)) { |
|
243 | + if ( ! EED_Recaptcha_Invisible::processSpcoRegStepForm($reg_form)) { |
|
244 | 244 | return $req_data; |
245 | 245 | } |
246 | 246 | /** @var EE_Request $request */ |
247 | 247 | $request = LoaderFactory::getLoader()->getShared('EE_Request'); |
248 | - if (! EED_Recaptcha_Invisible::verifyToken($request)) { |
|
248 | + if ( ! EED_Recaptcha_Invisible::verifyToken($request)) { |
|
249 | 249 | if ($request->isAjax()) { |
250 | 250 | $json_response = new EE_SPCO_JSON_Response(); |
251 | 251 | $json_response->echoAndExit(); |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | /** @var EE_Request $request */ |
305 | 305 | $request = LoaderFactory::getLoader()->getShared('EE_Request'); |
306 | - if (! EED_Recaptcha_Invisible::verifyToken($request)) { |
|
306 | + if ( ! EED_Recaptcha_Invisible::verifyToken($request)) { |
|
307 | 307 | $event_id = $request->get('tkt-slctr-event-id'); |
308 | 308 | $return_url = $request->is_set("tkt-slctr-return-url-{$event_id}") |
309 | 309 | ? $request->get("tkt-slctr-return-url-{$event_id}") |