@@ -19,60 +19,60 @@ |
||
19 | 19 | */ |
20 | 20 | abstract class EventEditorData implements EventEditorDataInterface |
21 | 21 | { |
22 | - /** |
|
23 | - * @var EEM_Datetime $datetime_model |
|
24 | - */ |
|
25 | - protected $datetime_model; |
|
22 | + /** |
|
23 | + * @var EEM_Datetime $datetime_model |
|
24 | + */ |
|
25 | + protected $datetime_model; |
|
26 | 26 | |
27 | - /** |
|
28 | - * @var EEM_Event $event_model |
|
29 | - */ |
|
30 | - protected $event_model; |
|
27 | + /** |
|
28 | + * @var EEM_Event $event_model |
|
29 | + */ |
|
30 | + protected $event_model; |
|
31 | 31 | |
32 | - /** |
|
33 | - * @var EEM_Price $price_model |
|
34 | - */ |
|
35 | - protected $price_model; |
|
32 | + /** |
|
33 | + * @var EEM_Price $price_model |
|
34 | + */ |
|
35 | + protected $price_model; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @var EEM_Price_Type $price_type_model |
|
39 | - */ |
|
40 | - protected $price_type_model; |
|
37 | + /** |
|
38 | + * @var EEM_Price_Type $price_type_model |
|
39 | + */ |
|
40 | + protected $price_type_model; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @var EEM_Ticket $ticket_model |
|
44 | - */ |
|
45 | - protected $ticket_model; |
|
42 | + /** |
|
43 | + * @var EEM_Ticket $ticket_model |
|
44 | + */ |
|
45 | + protected $ticket_model; |
|
46 | 46 | |
47 | - /** |
|
48 | - * @var Utilities |
|
49 | - */ |
|
50 | - protected $utilities; |
|
47 | + /** |
|
48 | + * @var Utilities |
|
49 | + */ |
|
50 | + protected $utilities; |
|
51 | 51 | |
52 | 52 | |
53 | - /** |
|
54 | - * AdvancedEditorAdminForm constructor. |
|
55 | - * |
|
56 | - * @param EEM_Datetime $datetime_model |
|
57 | - * @param EEM_Event $event_model |
|
58 | - * @param EEM_Price $price_model |
|
59 | - * @param EEM_Price_Type $price_type_model |
|
60 | - * @param EEM_Ticket $ticket_model |
|
61 | - * @param Utilities $utilities |
|
62 | - */ |
|
63 | - public function __construct( |
|
64 | - EEM_Datetime $datetime_model, |
|
65 | - EEM_Event $event_model, |
|
66 | - EEM_Price $price_model, |
|
67 | - EEM_Price_Type $price_type_model, |
|
68 | - EEM_Ticket $ticket_model, |
|
69 | - Utilities $utilities |
|
70 | - ) { |
|
71 | - $this->datetime_model = $datetime_model; |
|
72 | - $this->event_model = $event_model; |
|
73 | - $this->price_model = $price_model; |
|
74 | - $this->price_type_model = $price_type_model; |
|
75 | - $this->ticket_model = $ticket_model; |
|
76 | - $this->utilities = $utilities; |
|
77 | - } |
|
53 | + /** |
|
54 | + * AdvancedEditorAdminForm constructor. |
|
55 | + * |
|
56 | + * @param EEM_Datetime $datetime_model |
|
57 | + * @param EEM_Event $event_model |
|
58 | + * @param EEM_Price $price_model |
|
59 | + * @param EEM_Price_Type $price_type_model |
|
60 | + * @param EEM_Ticket $ticket_model |
|
61 | + * @param Utilities $utilities |
|
62 | + */ |
|
63 | + public function __construct( |
|
64 | + EEM_Datetime $datetime_model, |
|
65 | + EEM_Event $event_model, |
|
66 | + EEM_Price $price_model, |
|
67 | + EEM_Price_Type $price_type_model, |
|
68 | + EEM_Ticket $ticket_model, |
|
69 | + Utilities $utilities |
|
70 | + ) { |
|
71 | + $this->datetime_model = $datetime_model; |
|
72 | + $this->event_model = $event_model; |
|
73 | + $this->price_model = $price_model; |
|
74 | + $this->price_type_model = $price_type_model; |
|
75 | + $this->ticket_model = $ticket_model; |
|
76 | + $this->utilities = $utilities; |
|
77 | + } |
|
78 | 78 | } |
@@ -15,74 +15,74 @@ |
||
15 | 15 | */ |
16 | 16 | class EraseAttendeeData implements PersonalDataEraserInterface |
17 | 17 | { |
18 | - /** |
|
19 | - * @var EEM_Attendee |
|
20 | - */ |
|
21 | - protected $attendee_model; |
|
18 | + /** |
|
19 | + * @var EEM_Attendee |
|
20 | + */ |
|
21 | + protected $attendee_model; |
|
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * EraseAttendeeData constructor. |
|
26 | - * |
|
27 | - * @param EEM_Attendee $attendee_model |
|
28 | - */ |
|
29 | - public function __construct(EEM_Attendee $attendee_model) |
|
30 | - { |
|
31 | - $this->attendee_model = $attendee_model; |
|
32 | - } |
|
24 | + /** |
|
25 | + * EraseAttendeeData constructor. |
|
26 | + * |
|
27 | + * @param EEM_Attendee $attendee_model |
|
28 | + */ |
|
29 | + public function __construct(EEM_Attendee $attendee_model) |
|
30 | + { |
|
31 | + $this->attendee_model = $attendee_model; |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * Gets a translated string name for the data eraser |
|
37 | - * |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public function name() |
|
41 | - { |
|
42 | - return esc_html__('Event Espresso Attendee Data', 'event_espresso'); |
|
43 | - } |
|
35 | + /** |
|
36 | + * Gets a translated string name for the data eraser |
|
37 | + * |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public function name() |
|
41 | + { |
|
42 | + return esc_html__('Event Espresso Attendee Data', 'event_espresso'); |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * Erases a "page" of personal user data |
|
48 | - * |
|
49 | - * @return array { |
|
50 | - * @type boolean $items_removed whether items were removed successfully or not |
|
51 | - * @type boolean $items_retained whether any items were skipped or not |
|
52 | - * @type array $messages values are messages to show |
|
53 | - * @type boolean $done whether this eraser is done or has more pages |
|
54 | - * } |
|
55 | - * @throws \EE_Error |
|
56 | - */ |
|
57 | - public function erase($email_address, $page = 1) |
|
58 | - { |
|
59 | - $rows_updated = $this->attendee_model->update( |
|
60 | - array( |
|
61 | - 'ATT_fname' => esc_html__('Anonymous', 'event_espresso'), |
|
62 | - 'ATT_lname' => '', |
|
63 | - 'ATT_email' => '', |
|
64 | - 'ATT_address' => '', |
|
65 | - 'ATT_address2' => '', |
|
66 | - 'ATT_city' => '', |
|
67 | - 'STA_ID' => 0, |
|
68 | - 'CNT_ISO' => '', |
|
69 | - 'ATT_zip' => '', |
|
70 | - 'ATT_phone' => '', |
|
71 | - ), |
|
72 | - array( |
|
73 | - array( |
|
74 | - 'ATT_email' => $email_address, |
|
75 | - ), |
|
76 | - ) |
|
77 | - ); |
|
46 | + /** |
|
47 | + * Erases a "page" of personal user data |
|
48 | + * |
|
49 | + * @return array { |
|
50 | + * @type boolean $items_removed whether items were removed successfully or not |
|
51 | + * @type boolean $items_retained whether any items were skipped or not |
|
52 | + * @type array $messages values are messages to show |
|
53 | + * @type boolean $done whether this eraser is done or has more pages |
|
54 | + * } |
|
55 | + * @throws \EE_Error |
|
56 | + */ |
|
57 | + public function erase($email_address, $page = 1) |
|
58 | + { |
|
59 | + $rows_updated = $this->attendee_model->update( |
|
60 | + array( |
|
61 | + 'ATT_fname' => esc_html__('Anonymous', 'event_espresso'), |
|
62 | + 'ATT_lname' => '', |
|
63 | + 'ATT_email' => '', |
|
64 | + 'ATT_address' => '', |
|
65 | + 'ATT_address2' => '', |
|
66 | + 'ATT_city' => '', |
|
67 | + 'STA_ID' => 0, |
|
68 | + 'CNT_ISO' => '', |
|
69 | + 'ATT_zip' => '', |
|
70 | + 'ATT_phone' => '', |
|
71 | + ), |
|
72 | + array( |
|
73 | + array( |
|
74 | + 'ATT_email' => $email_address, |
|
75 | + ), |
|
76 | + ) |
|
77 | + ); |
|
78 | 78 | |
79 | - return array( |
|
80 | - 'items_removed' => (bool) $rows_updated, |
|
81 | - 'items_retained' => false, // always false in this example |
|
82 | - 'messages' => array(), |
|
83 | - 'done' => true, |
|
84 | - ); |
|
85 | - } |
|
79 | + return array( |
|
80 | + 'items_removed' => (bool) $rows_updated, |
|
81 | + 'items_retained' => false, // always false in this example |
|
82 | + 'messages' => array(), |
|
83 | + 'done' => true, |
|
84 | + ); |
|
85 | + } |
|
86 | 86 | } |
87 | 87 | // End of file EraseAttendeeData.php |
88 | 88 | // Location: EventEspresso\core\domain\services\privacy\erasure/EraseAttendeeData.php |
@@ -27,112 +27,112 @@ |
||
27 | 27 | */ |
28 | 28 | class PrivacySettingsFormHandler extends FormHandler |
29 | 29 | { |
30 | - /** |
|
31 | - * @var EE_Config |
|
32 | - */ |
|
33 | - protected $config; |
|
30 | + /** |
|
31 | + * @var EE_Config |
|
32 | + */ |
|
33 | + protected $config; |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * PrivacySettingsFormHandler constructor. |
|
38 | - * |
|
39 | - * @param EE_Registry $registry |
|
40 | - * @param EE_Config $config |
|
41 | - */ |
|
42 | - public function __construct(EE_Registry $registry, EE_Config $config) |
|
43 | - { |
|
44 | - $this->config = $config; |
|
45 | - parent::__construct( |
|
46 | - esc_html__('Privacy Settings', 'event_espresso'), |
|
47 | - esc_html__('Privacy Settings', 'event_espresso'), |
|
48 | - 'privacy-settings', |
|
49 | - '', |
|
50 | - FormHandler::DO_NOT_SETUP_FORM, |
|
51 | - $registry |
|
52 | - ); |
|
53 | - } |
|
36 | + /** |
|
37 | + * PrivacySettingsFormHandler constructor. |
|
38 | + * |
|
39 | + * @param EE_Registry $registry |
|
40 | + * @param EE_Config $config |
|
41 | + */ |
|
42 | + public function __construct(EE_Registry $registry, EE_Config $config) |
|
43 | + { |
|
44 | + $this->config = $config; |
|
45 | + parent::__construct( |
|
46 | + esc_html__('Privacy Settings', 'event_espresso'), |
|
47 | + esc_html__('Privacy Settings', 'event_espresso'), |
|
48 | + 'privacy-settings', |
|
49 | + '', |
|
50 | + FormHandler::DO_NOT_SETUP_FORM, |
|
51 | + $registry |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * creates and returns the actual form |
|
58 | - * |
|
59 | - * @return EE_Form_Section_Proper |
|
60 | - */ |
|
61 | - public function generate() |
|
62 | - { |
|
63 | - // this form makes use of the session for passing around invalid form submission data, so make sure its enabled |
|
64 | - add_filter('FHEE__EE_Session___save_session_to_db__abort_session_save', '__return_false'); |
|
65 | - /** |
|
66 | - * @var $reg_config EE_Registration_Config |
|
67 | - */ |
|
68 | - $reg_config = $this->config->registration; |
|
69 | - return new EE_Form_Section_Proper( |
|
70 | - array( |
|
71 | - 'name' => 'privacy_consent_settings', |
|
72 | - 'subsections' => array( |
|
73 | - 'privacy_consent_form_hdr' => new EE_Form_Section_HTML( |
|
74 | - EEH_HTML::h2(esc_html__('Privacy Policy Consent Settings', 'event_espresso')) |
|
75 | - ), |
|
76 | - 'enable' => new EE_Select_Reveal_Input( |
|
77 | - array( |
|
78 | - 'enable-privacy-consent' => esc_html__('Enabled', 'event_espresso'), |
|
79 | - 'disable' => esc_html__('Disabled', 'event_espresso'), |
|
80 | - ), |
|
81 | - array( |
|
82 | - 'default' => $reg_config->isConsentCheckboxEnabled() |
|
83 | - ? 'enable-privacy-consent' |
|
84 | - : 'disable', |
|
85 | - 'html_label_text' => esc_html__('Privacy Consent Checkbox', 'event_espresso'), |
|
86 | - 'html_help_text' => esc_html__( |
|
87 | - 'When enabled, a checkbox appears in the registration form requiring users to consent to your site\'s privacy policy.', |
|
88 | - 'event_espresso' |
|
89 | - ), |
|
90 | - ) |
|
91 | - ), |
|
92 | - 'enable-privacy-consent' => new EE_Form_Section_Proper( |
|
93 | - array( |
|
94 | - 'subsections' => array( |
|
95 | - 'consent_assertion' => new EE_Text_Area_Input( |
|
96 | - array( |
|
97 | - 'default' => $reg_config->getConsentCheckboxLabelText(), |
|
98 | - 'html_label_text' => esc_html__('Consent Text', 'event_espresso'), |
|
99 | - 'html_help_text' => esc_html__( |
|
100 | - 'Text describing what the registrant is consenting to by submitting their personal data in the registration form. To reset to default value, remove all this text and save.', |
|
101 | - 'event_espresso' |
|
102 | - ), |
|
103 | - 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
104 | - ) |
|
105 | - ), |
|
106 | - ), |
|
107 | - ) |
|
108 | - ), |
|
109 | - ), |
|
110 | - ) |
|
111 | - ); |
|
112 | - } |
|
56 | + /** |
|
57 | + * creates and returns the actual form |
|
58 | + * |
|
59 | + * @return EE_Form_Section_Proper |
|
60 | + */ |
|
61 | + public function generate() |
|
62 | + { |
|
63 | + // this form makes use of the session for passing around invalid form submission data, so make sure its enabled |
|
64 | + add_filter('FHEE__EE_Session___save_session_to_db__abort_session_save', '__return_false'); |
|
65 | + /** |
|
66 | + * @var $reg_config EE_Registration_Config |
|
67 | + */ |
|
68 | + $reg_config = $this->config->registration; |
|
69 | + return new EE_Form_Section_Proper( |
|
70 | + array( |
|
71 | + 'name' => 'privacy_consent_settings', |
|
72 | + 'subsections' => array( |
|
73 | + 'privacy_consent_form_hdr' => new EE_Form_Section_HTML( |
|
74 | + EEH_HTML::h2(esc_html__('Privacy Policy Consent Settings', 'event_espresso')) |
|
75 | + ), |
|
76 | + 'enable' => new EE_Select_Reveal_Input( |
|
77 | + array( |
|
78 | + 'enable-privacy-consent' => esc_html__('Enabled', 'event_espresso'), |
|
79 | + 'disable' => esc_html__('Disabled', 'event_espresso'), |
|
80 | + ), |
|
81 | + array( |
|
82 | + 'default' => $reg_config->isConsentCheckboxEnabled() |
|
83 | + ? 'enable-privacy-consent' |
|
84 | + : 'disable', |
|
85 | + 'html_label_text' => esc_html__('Privacy Consent Checkbox', 'event_espresso'), |
|
86 | + 'html_help_text' => esc_html__( |
|
87 | + 'When enabled, a checkbox appears in the registration form requiring users to consent to your site\'s privacy policy.', |
|
88 | + 'event_espresso' |
|
89 | + ), |
|
90 | + ) |
|
91 | + ), |
|
92 | + 'enable-privacy-consent' => new EE_Form_Section_Proper( |
|
93 | + array( |
|
94 | + 'subsections' => array( |
|
95 | + 'consent_assertion' => new EE_Text_Area_Input( |
|
96 | + array( |
|
97 | + 'default' => $reg_config->getConsentCheckboxLabelText(), |
|
98 | + 'html_label_text' => esc_html__('Consent Text', 'event_espresso'), |
|
99 | + 'html_help_text' => esc_html__( |
|
100 | + 'Text describing what the registrant is consenting to by submitting their personal data in the registration form. To reset to default value, remove all this text and save.', |
|
101 | + 'event_espresso' |
|
102 | + ), |
|
103 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
104 | + ) |
|
105 | + ), |
|
106 | + ), |
|
107 | + ) |
|
108 | + ), |
|
109 | + ), |
|
110 | + ) |
|
111 | + ); |
|
112 | + } |
|
113 | 113 | |
114 | 114 | |
115 | - /** |
|
116 | - * After validating the form data, update the registration config |
|
117 | - * |
|
118 | - * @param array $submitted_form_data |
|
119 | - * @return bool |
|
120 | - */ |
|
121 | - public function process($submitted_form_data = array()) |
|
122 | - { |
|
123 | - try { |
|
124 | - $valid_data = parent::process($submitted_form_data); |
|
125 | - $reg_config = $this->config->registration; |
|
126 | - $reg_config->setConsentCheckboxEnabled($valid_data['enable'] === 'enable-privacy-consent'); |
|
127 | - $reg_config->setConsentCheckboxLabelText( |
|
128 | - $valid_data['enable-privacy-consent']['consent_assertion'] |
|
129 | - ); |
|
130 | - return $this->config->update_espresso_config(false, false); |
|
131 | - } catch (InvalidFormSubmissionException $e) { |
|
132 | - // the form was invalid, it should be re-displayed with errors |
|
133 | - return false; |
|
134 | - } |
|
135 | - } |
|
115 | + /** |
|
116 | + * After validating the form data, update the registration config |
|
117 | + * |
|
118 | + * @param array $submitted_form_data |
|
119 | + * @return bool |
|
120 | + */ |
|
121 | + public function process($submitted_form_data = array()) |
|
122 | + { |
|
123 | + try { |
|
124 | + $valid_data = parent::process($submitted_form_data); |
|
125 | + $reg_config = $this->config->registration; |
|
126 | + $reg_config->setConsentCheckboxEnabled($valid_data['enable'] === 'enable-privacy-consent'); |
|
127 | + $reg_config->setConsentCheckboxLabelText( |
|
128 | + $valid_data['enable-privacy-consent']['consent_assertion'] |
|
129 | + ); |
|
130 | + return $this->config->update_espresso_config(false, false); |
|
131 | + } catch (InvalidFormSubmissionException $e) { |
|
132 | + // the form was invalid, it should be re-displayed with errors |
|
133 | + return false; |
|
134 | + } |
|
135 | + } |
|
136 | 136 | } |
137 | 137 | // End of file PrivacySettingsFormHandler.php |
138 | 138 | // Location: EventEspresso\core\domain\services\admin\privacy\forms/PrivacySettingsFormHandler.php |
@@ -16,27 +16,27 @@ |
||
16 | 16 | */ |
17 | 17 | class EspressoEditor implements GQLDataDomainInterface |
18 | 18 | { |
19 | - /** |
|
20 | - * @param array $loaders The loaders accessible in the AppContext |
|
21 | - * @param AppContext $context The AppContext |
|
22 | - * @return array |
|
23 | - * @return array |
|
24 | - */ |
|
25 | - public function registerLoaders(array $loaders, AppContext $context): array |
|
26 | - { |
|
27 | - $newLoaders = [ |
|
28 | - 'espresso_attendee' => new Loaders\AttendeeLoader($context), |
|
29 | - 'espresso_country' => new Loaders\CountryLoader($context), |
|
30 | - 'espresso_datetime' => new Loaders\DatetimeLoader($context), |
|
31 | - 'espresso_price' => new Loaders\PriceLoader($context), |
|
32 | - 'espresso_priceType' => new Loaders\PriceTypeLoader($context), |
|
33 | - 'espresso_formSection' => new Loaders\FormSectionLoader($context), |
|
34 | - 'espresso_formElement' => new Loaders\FormElementLoader($context), |
|
35 | - 'espresso_state' => new Loaders\StateLoader($context), |
|
36 | - 'espresso_ticket' => new Loaders\TicketLoader($context), |
|
37 | - 'espresso_venue' => new Loaders\VenueLoader($context), |
|
38 | - ]; |
|
19 | + /** |
|
20 | + * @param array $loaders The loaders accessible in the AppContext |
|
21 | + * @param AppContext $context The AppContext |
|
22 | + * @return array |
|
23 | + * @return array |
|
24 | + */ |
|
25 | + public function registerLoaders(array $loaders, AppContext $context): array |
|
26 | + { |
|
27 | + $newLoaders = [ |
|
28 | + 'espresso_attendee' => new Loaders\AttendeeLoader($context), |
|
29 | + 'espresso_country' => new Loaders\CountryLoader($context), |
|
30 | + 'espresso_datetime' => new Loaders\DatetimeLoader($context), |
|
31 | + 'espresso_price' => new Loaders\PriceLoader($context), |
|
32 | + 'espresso_priceType' => new Loaders\PriceTypeLoader($context), |
|
33 | + 'espresso_formSection' => new Loaders\FormSectionLoader($context), |
|
34 | + 'espresso_formElement' => new Loaders\FormElementLoader($context), |
|
35 | + 'espresso_state' => new Loaders\StateLoader($context), |
|
36 | + 'espresso_ticket' => new Loaders\TicketLoader($context), |
|
37 | + 'espresso_venue' => new Loaders\VenueLoader($context), |
|
38 | + ]; |
|
39 | 39 | |
40 | - return array_merge($loaders, $newLoaders); |
|
41 | - } |
|
40 | + return array_merge($loaders, $newLoaders); |
|
41 | + } |
|
42 | 42 | } |
@@ -16,97 +16,97 @@ |
||
16 | 16 | */ |
17 | 17 | class RegisterCustomTaxonomies |
18 | 18 | { |
19 | - /** |
|
20 | - * @var CustomTaxonomyDefinitions $custom_taxonomies |
|
21 | - */ |
|
22 | - public $custom_taxonomies; |
|
19 | + /** |
|
20 | + * @var CustomTaxonomyDefinitions $custom_taxonomies |
|
21 | + */ |
|
22 | + public $custom_taxonomies; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * RegisterCustomTaxonomies constructor. |
|
27 | - * |
|
28 | - * @param CustomTaxonomyDefinitions $custom_taxonomies |
|
29 | - */ |
|
30 | - public function __construct(CustomTaxonomyDefinitions $custom_taxonomies) |
|
31 | - { |
|
32 | - $this->custom_taxonomies = $custom_taxonomies; |
|
33 | - } |
|
25 | + /** |
|
26 | + * RegisterCustomTaxonomies constructor. |
|
27 | + * |
|
28 | + * @param CustomTaxonomyDefinitions $custom_taxonomies |
|
29 | + */ |
|
30 | + public function __construct(CustomTaxonomyDefinitions $custom_taxonomies) |
|
31 | + { |
|
32 | + $this->custom_taxonomies = $custom_taxonomies; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * @return void |
|
38 | - * @throws DomainException |
|
39 | - */ |
|
40 | - public function registerCustomTaxonomies() |
|
41 | - { |
|
42 | - $custom_taxonomies = $this->custom_taxonomies->getCustomTaxonomyDefinitions(); |
|
43 | - foreach ($custom_taxonomies as $taxonomy => $tax) { |
|
44 | - $this->registerCustomTaxonomy( |
|
45 | - $taxonomy, |
|
46 | - $tax['singular_name'], |
|
47 | - $tax['plural_name'], |
|
48 | - $tax['args'] |
|
49 | - ); |
|
50 | - } |
|
51 | - } |
|
36 | + /** |
|
37 | + * @return void |
|
38 | + * @throws DomainException |
|
39 | + */ |
|
40 | + public function registerCustomTaxonomies() |
|
41 | + { |
|
42 | + $custom_taxonomies = $this->custom_taxonomies->getCustomTaxonomyDefinitions(); |
|
43 | + foreach ($custom_taxonomies as $taxonomy => $tax) { |
|
44 | + $this->registerCustomTaxonomy( |
|
45 | + $taxonomy, |
|
46 | + $tax['singular_name'], |
|
47 | + $tax['plural_name'], |
|
48 | + $tax['args'] |
|
49 | + ); |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * Registers a custom taxonomy. Should be called before registering custom post types, |
|
56 | - * otherwise you should link the taxonomy to the custom post type using 'register_taxonomy_for_object_type'. |
|
57 | - * |
|
58 | - * @param string $taxonomy_name , eg 'books' |
|
59 | - * @param string $singular_name internationalized singular name |
|
60 | - * @param string $plural_name internationalized plural name |
|
61 | - * @param array $override_arguments like $args on http://codex.wordpress.org/Function_Reference/register_taxonomy |
|
62 | - * @throws DomainException |
|
63 | - */ |
|
64 | - public function registerCustomTaxonomy($taxonomy_name, $singular_name, $plural_name, array $override_arguments) |
|
65 | - { |
|
66 | - $result = register_taxonomy( |
|
67 | - $taxonomy_name, |
|
68 | - null, |
|
69 | - $this->prepareArguments( |
|
70 | - $singular_name, |
|
71 | - $plural_name, |
|
72 | - $override_arguments |
|
73 | - ) |
|
74 | - ); |
|
75 | - if ($result instanceof WP_Error) { |
|
76 | - throw new DomainException($result->get_error_message()); |
|
77 | - } |
|
78 | - } |
|
54 | + /** |
|
55 | + * Registers a custom taxonomy. Should be called before registering custom post types, |
|
56 | + * otherwise you should link the taxonomy to the custom post type using 'register_taxonomy_for_object_type'. |
|
57 | + * |
|
58 | + * @param string $taxonomy_name , eg 'books' |
|
59 | + * @param string $singular_name internationalized singular name |
|
60 | + * @param string $plural_name internationalized plural name |
|
61 | + * @param array $override_arguments like $args on http://codex.wordpress.org/Function_Reference/register_taxonomy |
|
62 | + * @throws DomainException |
|
63 | + */ |
|
64 | + public function registerCustomTaxonomy($taxonomy_name, $singular_name, $plural_name, array $override_arguments) |
|
65 | + { |
|
66 | + $result = register_taxonomy( |
|
67 | + $taxonomy_name, |
|
68 | + null, |
|
69 | + $this->prepareArguments( |
|
70 | + $singular_name, |
|
71 | + $plural_name, |
|
72 | + $override_arguments |
|
73 | + ) |
|
74 | + ); |
|
75 | + if ($result instanceof WP_Error) { |
|
76 | + throw new DomainException($result->get_error_message()); |
|
77 | + } |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | - /** |
|
82 | - * @param string $singular_name |
|
83 | - * @param string $plural_name |
|
84 | - * @param array $override_arguments |
|
85 | - * @since 4.9.62.p |
|
86 | - * @return array |
|
87 | - */ |
|
88 | - protected function prepareArguments($singular_name, $plural_name, array $override_arguments) |
|
89 | - { |
|
90 | - $arguments = array( |
|
91 | - 'hierarchical' => true, |
|
92 | - 'labels' => array( |
|
93 | - 'name' => $plural_name, |
|
94 | - 'singular_name' => $singular_name, |
|
95 | - ), |
|
96 | - 'show_ui' => true, |
|
97 | - 'show_ee_ui' => true, |
|
98 | - 'show_admin_column' => true, |
|
99 | - 'query_var' => true, |
|
100 | - 'show_in_nav_menus' => false, |
|
101 | - 'map_meta_cap' => true, |
|
102 | - ); |
|
103 | - if ($override_arguments) { |
|
104 | - if (isset($override_args['labels'])) { |
|
105 | - $labels = array_merge($arguments['labels'], $override_arguments['labels']); |
|
106 | - $arguments['labels'] = $labels; |
|
107 | - } |
|
108 | - $arguments = array_merge($arguments, $override_arguments); |
|
109 | - } |
|
110 | - return $arguments; |
|
111 | - } |
|
81 | + /** |
|
82 | + * @param string $singular_name |
|
83 | + * @param string $plural_name |
|
84 | + * @param array $override_arguments |
|
85 | + * @since 4.9.62.p |
|
86 | + * @return array |
|
87 | + */ |
|
88 | + protected function prepareArguments($singular_name, $plural_name, array $override_arguments) |
|
89 | + { |
|
90 | + $arguments = array( |
|
91 | + 'hierarchical' => true, |
|
92 | + 'labels' => array( |
|
93 | + 'name' => $plural_name, |
|
94 | + 'singular_name' => $singular_name, |
|
95 | + ), |
|
96 | + 'show_ui' => true, |
|
97 | + 'show_ee_ui' => true, |
|
98 | + 'show_admin_column' => true, |
|
99 | + 'query_var' => true, |
|
100 | + 'show_in_nav_menus' => false, |
|
101 | + 'map_meta_cap' => true, |
|
102 | + ); |
|
103 | + if ($override_arguments) { |
|
104 | + if (isset($override_args['labels'])) { |
|
105 | + $labels = array_merge($arguments['labels'], $override_arguments['labels']); |
|
106 | + $arguments['labels'] = $labels; |
|
107 | + } |
|
108 | + $arguments = array_merge($arguments, $override_arguments); |
|
109 | + } |
|
110 | + return $arguments; |
|
111 | + } |
|
112 | 112 | } |
@@ -25,84 +25,84 @@ |
||
25 | 25 | */ |
26 | 26 | class AttendeeContactDetailsMetaboxFormHandler extends FormHandler |
27 | 27 | { |
28 | - protected $attendee; |
|
28 | + protected $attendee; |
|
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * AttendeeContactDetailsMetaboxFormHandler constructor. |
|
33 | - * |
|
34 | - * @param EE_Attendee $attendee |
|
35 | - * @param EE_Registry $registry |
|
36 | - * @throws DomainException |
|
37 | - * @throws InvalidDataTypeException |
|
38 | - * @throws InvalidArgumentException |
|
39 | - */ |
|
40 | - public function __construct(EE_Attendee $attendee, EE_Registry $registry) |
|
41 | - { |
|
42 | - $this->attendee = $attendee; |
|
43 | - $label = esc_html__('Contact Details', 'event_espresso'); |
|
44 | - parent::__construct( |
|
45 | - $label, |
|
46 | - $label, |
|
47 | - 'attendee_contact_details', |
|
48 | - '', |
|
49 | - FormHandler::DO_NOT_SETUP_FORM, |
|
50 | - $registry |
|
51 | - ); |
|
52 | - } |
|
31 | + /** |
|
32 | + * AttendeeContactDetailsMetaboxFormHandler constructor. |
|
33 | + * |
|
34 | + * @param EE_Attendee $attendee |
|
35 | + * @param EE_Registry $registry |
|
36 | + * @throws DomainException |
|
37 | + * @throws InvalidDataTypeException |
|
38 | + * @throws InvalidArgumentException |
|
39 | + */ |
|
40 | + public function __construct(EE_Attendee $attendee, EE_Registry $registry) |
|
41 | + { |
|
42 | + $this->attendee = $attendee; |
|
43 | + $label = esc_html__('Contact Details', 'event_espresso'); |
|
44 | + parent::__construct( |
|
45 | + $label, |
|
46 | + $label, |
|
47 | + 'attendee_contact_details', |
|
48 | + '', |
|
49 | + FormHandler::DO_NOT_SETUP_FORM, |
|
50 | + $registry |
|
51 | + ); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * creates and returns the actual form |
|
56 | - * |
|
57 | - * @return EE_Form_Section_Proper |
|
58 | - * @throws EE_Error |
|
59 | - */ |
|
60 | - public function generate() |
|
61 | - { |
|
62 | - return new EE_Form_Section_Proper( |
|
63 | - array( |
|
64 | - 'name' => 'attendee_contact_details', |
|
65 | - 'html_id' => 'attendee-contact-details', |
|
66 | - 'html_class' => 'form-table', |
|
67 | - 'layout_strategy' => new EE_Admin_One_Column_Layout(), |
|
68 | - 'subsections' => array( |
|
69 | - 'ATT_email' => new EE_Email_Input( |
|
70 | - array( |
|
71 | - 'default' => $this->attendee->email(), |
|
72 | - 'html_label_text' => esc_html__('Email Address', 'event_espresso'), |
|
73 | - 'required' => true, |
|
74 | - ) |
|
75 | - ), |
|
76 | - 'ATT_phone' => new EE_Text_Input( |
|
77 | - array( |
|
78 | - 'default' => $this->attendee->phone(), |
|
79 | - 'html_label_text' => esc_html__('Phone Number', 'event_espresso'), |
|
80 | - ) |
|
81 | - ), |
|
82 | - ), |
|
83 | - ) |
|
84 | - ); |
|
85 | - } |
|
54 | + /** |
|
55 | + * creates and returns the actual form |
|
56 | + * |
|
57 | + * @return EE_Form_Section_Proper |
|
58 | + * @throws EE_Error |
|
59 | + */ |
|
60 | + public function generate() |
|
61 | + { |
|
62 | + return new EE_Form_Section_Proper( |
|
63 | + array( |
|
64 | + 'name' => 'attendee_contact_details', |
|
65 | + 'html_id' => 'attendee-contact-details', |
|
66 | + 'html_class' => 'form-table', |
|
67 | + 'layout_strategy' => new EE_Admin_One_Column_Layout(), |
|
68 | + 'subsections' => array( |
|
69 | + 'ATT_email' => new EE_Email_Input( |
|
70 | + array( |
|
71 | + 'default' => $this->attendee->email(), |
|
72 | + 'html_label_text' => esc_html__('Email Address', 'event_espresso'), |
|
73 | + 'required' => true, |
|
74 | + ) |
|
75 | + ), |
|
76 | + 'ATT_phone' => new EE_Text_Input( |
|
77 | + array( |
|
78 | + 'default' => $this->attendee->phone(), |
|
79 | + 'html_label_text' => esc_html__('Phone Number', 'event_espresso'), |
|
80 | + ) |
|
81 | + ), |
|
82 | + ), |
|
83 | + ) |
|
84 | + ); |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | - /** |
|
89 | - * Process form data. |
|
90 | - * |
|
91 | - * @param array $form_data |
|
92 | - * @return bool |
|
93 | - * @throws EE_Error |
|
94 | - * @throws InvalidFormSubmissionException |
|
95 | - * @throws LogicException |
|
96 | - */ |
|
97 | - public function process($form_data = array()) |
|
98 | - { |
|
99 | - $valid_data = (array) parent::process($form_data); |
|
100 | - if (empty($valid_data)) { |
|
101 | - return false; |
|
102 | - } |
|
103 | - $this->attendee->set_email($valid_data['ATT_email']); |
|
104 | - $this->attendee->set_phone($valid_data['ATT_phone']); |
|
105 | - $updated = $this->attendee->save(); |
|
106 | - return $updated !== false; |
|
107 | - } |
|
88 | + /** |
|
89 | + * Process form data. |
|
90 | + * |
|
91 | + * @param array $form_data |
|
92 | + * @return bool |
|
93 | + * @throws EE_Error |
|
94 | + * @throws InvalidFormSubmissionException |
|
95 | + * @throws LogicException |
|
96 | + */ |
|
97 | + public function process($form_data = array()) |
|
98 | + { |
|
99 | + $valid_data = (array) parent::process($form_data); |
|
100 | + if (empty($valid_data)) { |
|
101 | + return false; |
|
102 | + } |
|
103 | + $this->attendee->set_email($valid_data['ATT_email']); |
|
104 | + $this->attendee->set_phone($valid_data['ATT_phone']); |
|
105 | + $updated = $this->attendee->save(); |
|
106 | + return $updated !== false; |
|
107 | + } |
|
108 | 108 | } |
@@ -14,9 +14,9 @@ |
||
14 | 14 | */ |
15 | 15 | interface RequestTypeContextFactoryInterface |
16 | 16 | { |
17 | - /** |
|
18 | - * @param string $slug |
|
19 | - * @return RequestTypeContext |
|
20 | - */ |
|
21 | - public function create($slug); |
|
17 | + /** |
|
18 | + * @param string $slug |
|
19 | + * @return RequestTypeContext |
|
20 | + */ |
|
21 | + public function create($slug); |
|
22 | 22 | } |
@@ -12,151 +12,151 @@ |
||
12 | 12 | */ |
13 | 13 | interface RequestTypeContextCheckerInterface |
14 | 14 | { |
15 | - /** |
|
16 | - * true if the current request involves some form of activation |
|
17 | - * |
|
18 | - * @return bool |
|
19 | - */ |
|
20 | - public function isActivation(); |
|
15 | + /** |
|
16 | + * true if the current request involves some form of activation |
|
17 | + * |
|
18 | + * @return bool |
|
19 | + */ |
|
20 | + public function isActivation(); |
|
21 | 21 | |
22 | 22 | |
23 | - /** |
|
24 | - * @param $is_activation |
|
25 | - */ |
|
26 | - public function setIsActivation($is_activation); |
|
23 | + /** |
|
24 | + * @param $is_activation |
|
25 | + */ |
|
26 | + public function setIsActivation($is_activation); |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * true if the current request is for the admin and is not being made via AJAX |
|
31 | - * |
|
32 | - * @return bool |
|
33 | - */ |
|
34 | - public function isAdmin(); |
|
29 | + /** |
|
30 | + * true if the current request is for the admin and is not being made via AJAX |
|
31 | + * |
|
32 | + * @return bool |
|
33 | + */ |
|
34 | + public function isAdmin(); |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * true if the current request is for the admin AND is being made via AJAX |
|
39 | - * and the ajax request contains the request parameter "ee_admin_ajax" |
|
40 | - * |
|
41 | - * @return bool |
|
42 | - */ |
|
43 | - public function isAdminAjax(); |
|
37 | + /** |
|
38 | + * true if the current request is for the admin AND is being made via AJAX |
|
39 | + * and the ajax request contains the request parameter "ee_admin_ajax" |
|
40 | + * |
|
41 | + * @return bool |
|
42 | + */ |
|
43 | + public function isAdminAjax(); |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * true if the current request is being made via AJAX... any AJAX |
|
48 | - * |
|
49 | - * @return bool |
|
50 | - */ |
|
51 | - public function isAjax(); |
|
46 | + /** |
|
47 | + * true if the current request is being made via AJAX... any AJAX |
|
48 | + * |
|
49 | + * @return bool |
|
50 | + */ |
|
51 | + public function isAjax(); |
|
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * true if the current request is for the EE REST API |
|
56 | - * |
|
57 | - * @return bool |
|
58 | - */ |
|
59 | - public function isApi(); |
|
54 | + /** |
|
55 | + * true if the current request is for the EE REST API |
|
56 | + * |
|
57 | + * @return bool |
|
58 | + */ |
|
59 | + public function isApi(); |
|
60 | 60 | |
61 | 61 | |
62 | - /** |
|
63 | - * true if the current request is from the command line |
|
64 | - * |
|
65 | - * @return bool |
|
66 | - */ |
|
67 | - public function isCli(); |
|
62 | + /** |
|
63 | + * true if the current request is from the command line |
|
64 | + * |
|
65 | + * @return bool |
|
66 | + */ |
|
67 | + public function isCli(); |
|
68 | 68 | |
69 | 69 | |
70 | - /** |
|
71 | - * true if the current request is for a WP_Cron |
|
72 | - * |
|
73 | - * @return bool |
|
74 | - */ |
|
75 | - public function isCron(); |
|
70 | + /** |
|
71 | + * true if the current request is for a WP_Cron |
|
72 | + * |
|
73 | + * @return bool |
|
74 | + */ |
|
75 | + public function isCron(); |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * true if the current request is for either the EE admin or EE frontend AND is being made via AJAX |
|
80 | - * |
|
81 | - * @return bool |
|
82 | - */ |
|
83 | - public function isEeAjax(); |
|
78 | + /** |
|
79 | + * true if the current request is for either the EE admin or EE frontend AND is being made via AJAX |
|
80 | + * |
|
81 | + * @return bool |
|
82 | + */ |
|
83 | + public function isEeAjax(); |
|
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * true if the current request is for a feed (ie: RSS) |
|
88 | - * |
|
89 | - * @return bool |
|
90 | - */ |
|
91 | - public function isFeed(); |
|
86 | + /** |
|
87 | + * true if the current request is for a feed (ie: RSS) |
|
88 | + * |
|
89 | + * @return bool |
|
90 | + */ |
|
91 | + public function isFeed(); |
|
92 | 92 | |
93 | 93 | |
94 | - /** |
|
95 | - * true if the current request is for the frontend and is not being made via AJAX |
|
96 | - * |
|
97 | - * @return bool |
|
98 | - */ |
|
99 | - public function isFrontend(); |
|
94 | + /** |
|
95 | + * true if the current request is for the frontend and is not being made via AJAX |
|
96 | + * |
|
97 | + * @return bool |
|
98 | + */ |
|
99 | + public function isFrontend(); |
|
100 | 100 | |
101 | 101 | |
102 | - /** |
|
103 | - * @return bool |
|
104 | - */ |
|
105 | - public function isFrontAjax(); |
|
102 | + /** |
|
103 | + * @return bool |
|
104 | + */ |
|
105 | + public function isFrontAjax(); |
|
106 | 106 | |
107 | - /** |
|
108 | - * @return bool |
|
109 | - */ |
|
110 | - public function isGQL(); |
|
107 | + /** |
|
108 | + * @return bool |
|
109 | + */ |
|
110 | + public function isGQL(); |
|
111 | 111 | |
112 | 112 | |
113 | - /** |
|
114 | - * @return bool |
|
115 | - */ |
|
116 | - public function isIframe(); |
|
113 | + /** |
|
114 | + * @return bool |
|
115 | + */ |
|
116 | + public function isIframe(); |
|
117 | 117 | |
118 | 118 | |
119 | - /** |
|
120 | - * true if the current request is being made via AJAX but is NOT for EE related logic |
|
121 | - * |
|
122 | - * @return bool |
|
123 | - */ |
|
124 | - public function isOtherAjax(); |
|
119 | + /** |
|
120 | + * true if the current request is being made via AJAX but is NOT for EE related logic |
|
121 | + * |
|
122 | + * @return bool |
|
123 | + */ |
|
124 | + public function isOtherAjax(); |
|
125 | 125 | |
126 | 126 | |
127 | - /** |
|
128 | - * true if the current request is occurring while unit testing |
|
129 | - * |
|
130 | - * @return bool |
|
131 | - */ |
|
132 | - public function isUnitTesting(); |
|
127 | + /** |
|
128 | + * true if the current request is occurring while unit testing |
|
129 | + * |
|
130 | + * @return bool |
|
131 | + */ |
|
132 | + public function isUnitTesting(); |
|
133 | 133 | |
134 | - /** |
|
135 | - * true if the current request is for the WP REST API |
|
136 | - * |
|
137 | - * @return bool |
|
138 | - */ |
|
139 | - public function isWordPressApi(); |
|
134 | + /** |
|
135 | + * true if the current request is for the WP REST API |
|
136 | + * |
|
137 | + * @return bool |
|
138 | + */ |
|
139 | + public function isWordPressApi(); |
|
140 | 140 | |
141 | 141 | |
142 | - /** |
|
143 | - * true if the current request is being made via AJAX for the WP Heartbeat |
|
144 | - * |
|
145 | - * @return bool |
|
146 | - */ |
|
147 | - public function isWordPressHeartbeat(); |
|
142 | + /** |
|
143 | + * true if the current request is being made via AJAX for the WP Heartbeat |
|
144 | + * |
|
145 | + * @return bool |
|
146 | + */ |
|
147 | + public function isWordPressHeartbeat(); |
|
148 | 148 | |
149 | 149 | |
150 | - /** |
|
151 | - * true if the current request is a loopback sent from WP core to test for errors |
|
152 | - * |
|
153 | - * @return bool |
|
154 | - */ |
|
155 | - public function isWordPressScrape(); |
|
150 | + /** |
|
151 | + * true if the current request is a loopback sent from WP core to test for errors |
|
152 | + * |
|
153 | + * @return bool |
|
154 | + */ |
|
155 | + public function isWordPressScrape(); |
|
156 | 156 | |
157 | 157 | |
158 | - /** |
|
159 | - * @return string |
|
160 | - */ |
|
161 | - public function slug(); |
|
158 | + /** |
|
159 | + * @return string |
|
160 | + */ |
|
161 | + public function slug(); |
|
162 | 162 | } |
@@ -16,128 +16,128 @@ |
||
16 | 16 | */ |
17 | 17 | class RequestTypeContextFactory implements RequestTypeContextFactoryInterface |
18 | 18 | { |
19 | - /** |
|
20 | - * @var LoaderInterface $loader |
|
21 | - */ |
|
22 | - private $loader; |
|
19 | + /** |
|
20 | + * @var LoaderInterface $loader |
|
21 | + */ |
|
22 | + private $loader; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * RequestTypeContextFactory constructor. |
|
27 | - * |
|
28 | - * @param LoaderInterface $loader |
|
29 | - */ |
|
30 | - public function __construct(LoaderInterface $loader) |
|
31 | - { |
|
32 | - $this->loader = $loader; |
|
33 | - } |
|
25 | + /** |
|
26 | + * RequestTypeContextFactory constructor. |
|
27 | + * |
|
28 | + * @param LoaderInterface $loader |
|
29 | + */ |
|
30 | + public function __construct(LoaderInterface $loader) |
|
31 | + { |
|
32 | + $this->loader = $loader; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * @param string $slug |
|
38 | - * @return RequestTypeContext |
|
39 | - */ |
|
40 | - public function create($slug) |
|
41 | - { |
|
42 | - switch ($slug) { |
|
43 | - case RequestTypeContext::ACTIVATION: |
|
44 | - $description = esc_html__( |
|
45 | - 'The current request is for some form of activation', |
|
46 | - 'event_espresso' |
|
47 | - ); |
|
48 | - break; |
|
49 | - case RequestTypeContext::API: |
|
50 | - $description = esc_html__( |
|
51 | - 'The current request is for the EE REST API', |
|
52 | - 'event_espresso' |
|
53 | - ); |
|
54 | - break; |
|
55 | - case RequestTypeContext::AJAX_FRONT: |
|
56 | - $description = esc_html__( |
|
57 | - 'The current request is for the frontend via AJAX', |
|
58 | - 'event_espresso' |
|
59 | - ); |
|
60 | - break; |
|
61 | - case RequestTypeContext::AJAX_ADMIN: |
|
62 | - $description = esc_html__( |
|
63 | - 'The current request is for the admin via AJAX', |
|
64 | - 'event_espresso' |
|
65 | - ); |
|
66 | - break; |
|
67 | - case RequestTypeContext::AJAX_HEARTBEAT: |
|
68 | - $description = esc_html__( |
|
69 | - 'The current request is for the WP Heartbeat', |
|
70 | - 'event_espresso' |
|
71 | - ); |
|
72 | - break; |
|
73 | - case RequestTypeContext::AJAX_OTHER: |
|
74 | - $description = esc_html__( |
|
75 | - 'The current request is for non-EE related code via AJAX', |
|
76 | - 'event_espresso' |
|
77 | - ); |
|
78 | - break; |
|
79 | - case RequestTypeContext::CRON: |
|
80 | - $description = esc_html__( |
|
81 | - 'The current request is for a WP_Cron', |
|
82 | - 'event_espresso' |
|
83 | - ); |
|
84 | - break; |
|
85 | - case RequestTypeContext::CLI: |
|
86 | - $description = esc_html__( |
|
87 | - 'The current request is from the command line', |
|
88 | - 'event_espresso' |
|
89 | - ); |
|
90 | - break; |
|
91 | - case RequestTypeContext::ADMIN: |
|
92 | - $description = esc_html__( |
|
93 | - 'The current request is for the admin', |
|
94 | - 'event_espresso' |
|
95 | - ); |
|
96 | - break; |
|
97 | - case RequestTypeContext::IFRAME: |
|
98 | - $description = esc_html__( |
|
99 | - 'The current request is for an iframe', |
|
100 | - 'event_espresso' |
|
101 | - ); |
|
102 | - break; |
|
103 | - case RequestTypeContext::FEED: |
|
104 | - $description = esc_html__( |
|
105 | - 'The current request is for a feed (ie: RSS)', |
|
106 | - 'event_espresso' |
|
107 | - ); |
|
108 | - break; |
|
109 | - case RequestTypeContext::GQL: |
|
110 | - $description = esc_html__( |
|
111 | - 'The current request is for the EE GraphQL Manager', |
|
112 | - 'event_espresso' |
|
113 | - ); |
|
114 | - break; |
|
115 | - case RequestTypeContext::WP_API: |
|
116 | - $description = esc_html__( |
|
117 | - 'The current request is for the WordPress REST API', |
|
118 | - 'event_espresso' |
|
119 | - ); |
|
120 | - break; |
|
121 | - case RequestTypeContext::WP_SCRAPE: |
|
122 | - $description = esc_html__( |
|
123 | - 'The current request is for a WordPress loopback scrape', |
|
124 | - 'event_espresso' |
|
125 | - ); |
|
126 | - break; |
|
127 | - case RequestTypeContext::FRONTEND: |
|
128 | - default: |
|
129 | - $description = esc_html__( |
|
130 | - 'The current request is for the frontend', |
|
131 | - 'event_espresso' |
|
132 | - ); |
|
133 | - break; |
|
134 | - } |
|
135 | - // we're using the Loader with sharing turned on, |
|
136 | - // so that the generated RequestTypeContext object is accessible anywhere |
|
137 | - // by simply requesting it again from the loader |
|
138 | - return $this->loader->getShared( |
|
139 | - 'EventEspresso\core\domain\entities\contexts\RequestTypeContext', |
|
140 | - array($slug, $description) |
|
141 | - ); |
|
142 | - } |
|
36 | + /** |
|
37 | + * @param string $slug |
|
38 | + * @return RequestTypeContext |
|
39 | + */ |
|
40 | + public function create($slug) |
|
41 | + { |
|
42 | + switch ($slug) { |
|
43 | + case RequestTypeContext::ACTIVATION: |
|
44 | + $description = esc_html__( |
|
45 | + 'The current request is for some form of activation', |
|
46 | + 'event_espresso' |
|
47 | + ); |
|
48 | + break; |
|
49 | + case RequestTypeContext::API: |
|
50 | + $description = esc_html__( |
|
51 | + 'The current request is for the EE REST API', |
|
52 | + 'event_espresso' |
|
53 | + ); |
|
54 | + break; |
|
55 | + case RequestTypeContext::AJAX_FRONT: |
|
56 | + $description = esc_html__( |
|
57 | + 'The current request is for the frontend via AJAX', |
|
58 | + 'event_espresso' |
|
59 | + ); |
|
60 | + break; |
|
61 | + case RequestTypeContext::AJAX_ADMIN: |
|
62 | + $description = esc_html__( |
|
63 | + 'The current request is for the admin via AJAX', |
|
64 | + 'event_espresso' |
|
65 | + ); |
|
66 | + break; |
|
67 | + case RequestTypeContext::AJAX_HEARTBEAT: |
|
68 | + $description = esc_html__( |
|
69 | + 'The current request is for the WP Heartbeat', |
|
70 | + 'event_espresso' |
|
71 | + ); |
|
72 | + break; |
|
73 | + case RequestTypeContext::AJAX_OTHER: |
|
74 | + $description = esc_html__( |
|
75 | + 'The current request is for non-EE related code via AJAX', |
|
76 | + 'event_espresso' |
|
77 | + ); |
|
78 | + break; |
|
79 | + case RequestTypeContext::CRON: |
|
80 | + $description = esc_html__( |
|
81 | + 'The current request is for a WP_Cron', |
|
82 | + 'event_espresso' |
|
83 | + ); |
|
84 | + break; |
|
85 | + case RequestTypeContext::CLI: |
|
86 | + $description = esc_html__( |
|
87 | + 'The current request is from the command line', |
|
88 | + 'event_espresso' |
|
89 | + ); |
|
90 | + break; |
|
91 | + case RequestTypeContext::ADMIN: |
|
92 | + $description = esc_html__( |
|
93 | + 'The current request is for the admin', |
|
94 | + 'event_espresso' |
|
95 | + ); |
|
96 | + break; |
|
97 | + case RequestTypeContext::IFRAME: |
|
98 | + $description = esc_html__( |
|
99 | + 'The current request is for an iframe', |
|
100 | + 'event_espresso' |
|
101 | + ); |
|
102 | + break; |
|
103 | + case RequestTypeContext::FEED: |
|
104 | + $description = esc_html__( |
|
105 | + 'The current request is for a feed (ie: RSS)', |
|
106 | + 'event_espresso' |
|
107 | + ); |
|
108 | + break; |
|
109 | + case RequestTypeContext::GQL: |
|
110 | + $description = esc_html__( |
|
111 | + 'The current request is for the EE GraphQL Manager', |
|
112 | + 'event_espresso' |
|
113 | + ); |
|
114 | + break; |
|
115 | + case RequestTypeContext::WP_API: |
|
116 | + $description = esc_html__( |
|
117 | + 'The current request is for the WordPress REST API', |
|
118 | + 'event_espresso' |
|
119 | + ); |
|
120 | + break; |
|
121 | + case RequestTypeContext::WP_SCRAPE: |
|
122 | + $description = esc_html__( |
|
123 | + 'The current request is for a WordPress loopback scrape', |
|
124 | + 'event_espresso' |
|
125 | + ); |
|
126 | + break; |
|
127 | + case RequestTypeContext::FRONTEND: |
|
128 | + default: |
|
129 | + $description = esc_html__( |
|
130 | + 'The current request is for the frontend', |
|
131 | + 'event_espresso' |
|
132 | + ); |
|
133 | + break; |
|
134 | + } |
|
135 | + // we're using the Loader with sharing turned on, |
|
136 | + // so that the generated RequestTypeContext object is accessible anywhere |
|
137 | + // by simply requesting it again from the loader |
|
138 | + return $this->loader->getShared( |
|
139 | + 'EventEspresso\core\domain\entities\contexts\RequestTypeContext', |
|
140 | + array($slug, $description) |
|
141 | + ); |
|
142 | + } |
|
143 | 143 | } |