@@ -16,65 +16,65 @@ |
||
16 | 16 | class EmailValidationService implements EmailValidatorInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var EE_Registration_Config $registration_config |
|
21 | - */ |
|
22 | - protected $registration_config; |
|
19 | + /** |
|
20 | + * @var EE_Registration_Config $registration_config |
|
21 | + */ |
|
22 | + protected $registration_config; |
|
23 | 23 | |
24 | - /** |
|
25 | - * @var Loader $loader |
|
26 | - */ |
|
27 | - protected $loader; |
|
24 | + /** |
|
25 | + * @var Loader $loader |
|
26 | + */ |
|
27 | + protected $loader; |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * EmailValidationService constructor. |
|
32 | - * Accepts an \EE_Config as an argument. |
|
33 | - * |
|
34 | - * @param EE_Registration_Config $config |
|
35 | - * @param Loader $loader |
|
36 | - */ |
|
37 | - public function __construct(EE_Registration_Config $config, Loader $loader) |
|
38 | - { |
|
39 | - $this->registration_config = $config; |
|
40 | - $this->loader = $loader; |
|
41 | - } |
|
30 | + /** |
|
31 | + * EmailValidationService constructor. |
|
32 | + * Accepts an \EE_Config as an argument. |
|
33 | + * |
|
34 | + * @param EE_Registration_Config $config |
|
35 | + * @param Loader $loader |
|
36 | + */ |
|
37 | + public function __construct(EE_Registration_Config $config, Loader $loader) |
|
38 | + { |
|
39 | + $this->registration_config = $config; |
|
40 | + $this->loader = $loader; |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * Validates the email address. If it's invalid, an EmailValidationException |
|
46 | - * is thrown that describes why its invalid. |
|
47 | - * |
|
48 | - * @param string $email_address |
|
49 | - * @return boolean |
|
50 | - * @throws EmailValidationException |
|
51 | - */ |
|
52 | - public function validate($email_address) |
|
53 | - { |
|
54 | - // pick the correct validator according to the config |
|
55 | - switch ($this->registration_config->email_validation_level) { |
|
56 | - case 'basic': |
|
57 | - $validator = $this->loader->getShared( |
|
58 | - 'EventEspresso\core\domain\services\validation\email\strategies\Basic' |
|
59 | - ); |
|
60 | - break; |
|
61 | - case 'i18n': |
|
62 | - $validator = $this->loader->getShared( |
|
63 | - 'EventEspresso\core\domain\services\validation\email\strategies\International' |
|
64 | - ); |
|
65 | - break; |
|
66 | - case 'i18n_dns': |
|
67 | - $validator = $this->loader->getShared( |
|
68 | - 'EventEspresso\core\domain\services\validation\email\strategies\InternationalDNS' |
|
69 | - ); |
|
70 | - break; |
|
71 | - case 'wp_default': |
|
72 | - default: |
|
73 | - $validator = $this->loader->getShared( |
|
74 | - 'EventEspresso\core\domain\services\validation\email\strategies\WordPress' |
|
75 | - ); |
|
76 | - break; |
|
77 | - } |
|
78 | - return $validator->validate($email_address); |
|
79 | - } |
|
44 | + /** |
|
45 | + * Validates the email address. If it's invalid, an EmailValidationException |
|
46 | + * is thrown that describes why its invalid. |
|
47 | + * |
|
48 | + * @param string $email_address |
|
49 | + * @return boolean |
|
50 | + * @throws EmailValidationException |
|
51 | + */ |
|
52 | + public function validate($email_address) |
|
53 | + { |
|
54 | + // pick the correct validator according to the config |
|
55 | + switch ($this->registration_config->email_validation_level) { |
|
56 | + case 'basic': |
|
57 | + $validator = $this->loader->getShared( |
|
58 | + 'EventEspresso\core\domain\services\validation\email\strategies\Basic' |
|
59 | + ); |
|
60 | + break; |
|
61 | + case 'i18n': |
|
62 | + $validator = $this->loader->getShared( |
|
63 | + 'EventEspresso\core\domain\services\validation\email\strategies\International' |
|
64 | + ); |
|
65 | + break; |
|
66 | + case 'i18n_dns': |
|
67 | + $validator = $this->loader->getShared( |
|
68 | + 'EventEspresso\core\domain\services\validation\email\strategies\InternationalDNS' |
|
69 | + ); |
|
70 | + break; |
|
71 | + case 'wp_default': |
|
72 | + default: |
|
73 | + $validator = $this->loader->getShared( |
|
74 | + 'EventEspresso\core\domain\services\validation\email\strategies\WordPress' |
|
75 | + ); |
|
76 | + break; |
|
77 | + } |
|
78 | + return $validator->validate($email_address); |
|
79 | + } |
|
80 | 80 | } |
@@ -16,184 +16,184 @@ |
||
16 | 16 | class RequestTypeContextChecker extends ContextChecker implements RequestTypeContextCheckerInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var RequestTypeContext $request_type |
|
21 | - */ |
|
22 | - private $request_type; |
|
23 | - |
|
24 | - |
|
25 | - /** |
|
26 | - * RequestTypeContextChecker constructor. |
|
27 | - * |
|
28 | - * @param RequestTypeContext $request_type |
|
29 | - */ |
|
30 | - public function __construct(RequestTypeContext $request_type) |
|
31 | - { |
|
32 | - $this->request_type = $request_type; |
|
33 | - parent::__construct( |
|
34 | - 'RequestTypeContextChecker', |
|
35 | - $this->request_type->validRequestTypes() |
|
36 | - ); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * true if the current request involves some form of activation |
|
42 | - * |
|
43 | - * @return bool |
|
44 | - */ |
|
45 | - public function isActivation() |
|
46 | - { |
|
47 | - return $this->request_type->isActivation(); |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * @param $is_activation |
|
53 | - * @return bool |
|
54 | - */ |
|
55 | - public function setIsActivation($is_activation) |
|
56 | - { |
|
57 | - return $this->request_type->setIsActivation($is_activation); |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * true if the current request is for the admin and is not being made via AJAX |
|
63 | - * |
|
64 | - * @return bool |
|
65 | - */ |
|
66 | - public function isAdmin() |
|
67 | - { |
|
68 | - return $this->request_type->slug() === RequestTypeContext::ADMIN; |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * true if the current request is for the admin AND is being made via AJAX |
|
74 | - * |
|
75 | - * @return bool |
|
76 | - */ |
|
77 | - public function isAdminAjax() |
|
78 | - { |
|
79 | - return $this->request_type->slug() === RequestTypeContext::AJAX_ADMIN; |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * true if the current request is being made via AJAX... any AJAX |
|
85 | - * |
|
86 | - * @return bool |
|
87 | - */ |
|
88 | - public function isAjax() |
|
89 | - { |
|
90 | - return $this->isEeAjax() || $this->isOtherAjax(); |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * true if the current request is for either the EE admin or EE frontend AND is being made via AJAX |
|
96 | - * |
|
97 | - * @return bool |
|
98 | - */ |
|
99 | - public function isEeAjax() |
|
100 | - { |
|
101 | - return $this->isAdminAjax() || $this->isFrontAjax(); |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * true if the current request is being made via AJAX but is NOT for EE related logic |
|
107 | - * |
|
108 | - * @return bool |
|
109 | - */ |
|
110 | - public function isOtherAjax() |
|
111 | - { |
|
112 | - return $this->request_type->slug() === RequestTypeContext::AJAX_OTHER; |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * true if the current request is for the EE REST API |
|
117 | - * |
|
118 | - * @return bool |
|
119 | - */ |
|
120 | - public function isApi() |
|
121 | - { |
|
122 | - return $this->request_type->slug() === RequestTypeContext::API; |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * true if the current request is from the command line |
|
128 | - * |
|
129 | - * @return bool |
|
130 | - */ |
|
131 | - public function isCli() |
|
132 | - { |
|
133 | - return $this->request_type->slug() === RequestTypeContext::CLI; |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * true if the current request is for a WP_Cron |
|
139 | - * |
|
140 | - * @return bool |
|
141 | - */ |
|
142 | - public function isCron() |
|
143 | - { |
|
144 | - return $this->request_type->slug() === RequestTypeContext::CRON; |
|
145 | - } |
|
146 | - |
|
147 | - |
|
148 | - /** |
|
149 | - * true if the current request is for a feed (ie: RSS) |
|
150 | - * |
|
151 | - * @return bool |
|
152 | - */ |
|
153 | - public function isFeed() |
|
154 | - { |
|
155 | - return $this->request_type->slug() === RequestTypeContext::FEED; |
|
156 | - } |
|
157 | - |
|
158 | - |
|
159 | - /** |
|
160 | - * true if the current request is for the frontend and is not being made via AJAX |
|
161 | - * |
|
162 | - * @return bool |
|
163 | - */ |
|
164 | - public function isFrontend() |
|
165 | - { |
|
166 | - return $this->request_type->slug() === RequestTypeContext::FRONTEND; |
|
167 | - } |
|
168 | - |
|
169 | - |
|
170 | - /** |
|
171 | - * true if the current request is for the frontend AND is being made via AJAX |
|
172 | - * |
|
173 | - * @return bool |
|
174 | - */ |
|
175 | - public function isFrontAjax() |
|
176 | - { |
|
177 | - return $this->request_type->slug() === RequestTypeContext::AJAX_FRONT; |
|
178 | - } |
|
179 | - |
|
180 | - |
|
181 | - /** |
|
182 | - * true if the current request is for content that is to be displayed within an iframe |
|
183 | - * |
|
184 | - * @return bool |
|
185 | - */ |
|
186 | - public function isIframe() |
|
187 | - { |
|
188 | - return $this->request_type->slug() === RequestTypeContext::IFRAME; |
|
189 | - } |
|
190 | - |
|
191 | - |
|
192 | - /** |
|
193 | - * @return string |
|
194 | - */ |
|
195 | - public function slug() |
|
196 | - { |
|
197 | - return $this->request_type->slug(); |
|
198 | - } |
|
19 | + /** |
|
20 | + * @var RequestTypeContext $request_type |
|
21 | + */ |
|
22 | + private $request_type; |
|
23 | + |
|
24 | + |
|
25 | + /** |
|
26 | + * RequestTypeContextChecker constructor. |
|
27 | + * |
|
28 | + * @param RequestTypeContext $request_type |
|
29 | + */ |
|
30 | + public function __construct(RequestTypeContext $request_type) |
|
31 | + { |
|
32 | + $this->request_type = $request_type; |
|
33 | + parent::__construct( |
|
34 | + 'RequestTypeContextChecker', |
|
35 | + $this->request_type->validRequestTypes() |
|
36 | + ); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * true if the current request involves some form of activation |
|
42 | + * |
|
43 | + * @return bool |
|
44 | + */ |
|
45 | + public function isActivation() |
|
46 | + { |
|
47 | + return $this->request_type->isActivation(); |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * @param $is_activation |
|
53 | + * @return bool |
|
54 | + */ |
|
55 | + public function setIsActivation($is_activation) |
|
56 | + { |
|
57 | + return $this->request_type->setIsActivation($is_activation); |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * true if the current request is for the admin and is not being made via AJAX |
|
63 | + * |
|
64 | + * @return bool |
|
65 | + */ |
|
66 | + public function isAdmin() |
|
67 | + { |
|
68 | + return $this->request_type->slug() === RequestTypeContext::ADMIN; |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * true if the current request is for the admin AND is being made via AJAX |
|
74 | + * |
|
75 | + * @return bool |
|
76 | + */ |
|
77 | + public function isAdminAjax() |
|
78 | + { |
|
79 | + return $this->request_type->slug() === RequestTypeContext::AJAX_ADMIN; |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * true if the current request is being made via AJAX... any AJAX |
|
85 | + * |
|
86 | + * @return bool |
|
87 | + */ |
|
88 | + public function isAjax() |
|
89 | + { |
|
90 | + return $this->isEeAjax() || $this->isOtherAjax(); |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * true if the current request is for either the EE admin or EE frontend AND is being made via AJAX |
|
96 | + * |
|
97 | + * @return bool |
|
98 | + */ |
|
99 | + public function isEeAjax() |
|
100 | + { |
|
101 | + return $this->isAdminAjax() || $this->isFrontAjax(); |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * true if the current request is being made via AJAX but is NOT for EE related logic |
|
107 | + * |
|
108 | + * @return bool |
|
109 | + */ |
|
110 | + public function isOtherAjax() |
|
111 | + { |
|
112 | + return $this->request_type->slug() === RequestTypeContext::AJAX_OTHER; |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * true if the current request is for the EE REST API |
|
117 | + * |
|
118 | + * @return bool |
|
119 | + */ |
|
120 | + public function isApi() |
|
121 | + { |
|
122 | + return $this->request_type->slug() === RequestTypeContext::API; |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * true if the current request is from the command line |
|
128 | + * |
|
129 | + * @return bool |
|
130 | + */ |
|
131 | + public function isCli() |
|
132 | + { |
|
133 | + return $this->request_type->slug() === RequestTypeContext::CLI; |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * true if the current request is for a WP_Cron |
|
139 | + * |
|
140 | + * @return bool |
|
141 | + */ |
|
142 | + public function isCron() |
|
143 | + { |
|
144 | + return $this->request_type->slug() === RequestTypeContext::CRON; |
|
145 | + } |
|
146 | + |
|
147 | + |
|
148 | + /** |
|
149 | + * true if the current request is for a feed (ie: RSS) |
|
150 | + * |
|
151 | + * @return bool |
|
152 | + */ |
|
153 | + public function isFeed() |
|
154 | + { |
|
155 | + return $this->request_type->slug() === RequestTypeContext::FEED; |
|
156 | + } |
|
157 | + |
|
158 | + |
|
159 | + /** |
|
160 | + * true if the current request is for the frontend and is not being made via AJAX |
|
161 | + * |
|
162 | + * @return bool |
|
163 | + */ |
|
164 | + public function isFrontend() |
|
165 | + { |
|
166 | + return $this->request_type->slug() === RequestTypeContext::FRONTEND; |
|
167 | + } |
|
168 | + |
|
169 | + |
|
170 | + /** |
|
171 | + * true if the current request is for the frontend AND is being made via AJAX |
|
172 | + * |
|
173 | + * @return bool |
|
174 | + */ |
|
175 | + public function isFrontAjax() |
|
176 | + { |
|
177 | + return $this->request_type->slug() === RequestTypeContext::AJAX_FRONT; |
|
178 | + } |
|
179 | + |
|
180 | + |
|
181 | + /** |
|
182 | + * true if the current request is for content that is to be displayed within an iframe |
|
183 | + * |
|
184 | + * @return bool |
|
185 | + */ |
|
186 | + public function isIframe() |
|
187 | + { |
|
188 | + return $this->request_type->slug() === RequestTypeContext::IFRAME; |
|
189 | + } |
|
190 | + |
|
191 | + |
|
192 | + /** |
|
193 | + * @return string |
|
194 | + */ |
|
195 | + public function slug() |
|
196 | + { |
|
197 | + return $this->request_type->slug(); |
|
198 | + } |
|
199 | 199 | } |
@@ -19,131 +19,131 @@ |
||
19 | 19 | class RequestTypeContextDetector |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * @var RequestTypeContextFactory $factory |
|
24 | - */ |
|
25 | - private $factory; |
|
26 | - |
|
27 | - /** |
|
28 | - * @var RequestInterface $request |
|
29 | - */ |
|
30 | - private $request; |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * RequestTypeContextDetector constructor. |
|
35 | - * |
|
36 | - * @param RequestInterface $request |
|
37 | - * @param RequestTypeContextFactory $factory |
|
38 | - */ |
|
39 | - public function __construct(RequestInterface $request, RequestTypeContextFactory $factory) |
|
40 | - { |
|
41 | - $this->request = $request; |
|
42 | - $this->factory = $factory; |
|
43 | - } |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * @return RequestTypeContext |
|
48 | - * @throws InvalidArgumentException |
|
49 | - */ |
|
50 | - public function detectRequestTypeContext() |
|
51 | - { |
|
52 | - // Detect EE REST API |
|
53 | - if ($this->isEspressoRestApiRequest()) { |
|
54 | - return $this->factory->create(RequestTypeContext::API); |
|
55 | - } |
|
56 | - // Detect AJAX |
|
57 | - if (defined('DOING_AJAX') && DOING_AJAX) { |
|
58 | - if (filter_var($this->request->getRequestParam('ee_front_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
59 | - return $this->factory->create(RequestTypeContext::AJAX_FRONT); |
|
60 | - } |
|
61 | - if (filter_var($this->request->getRequestParam('ee_admin_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
62 | - return $this->factory->create(RequestTypeContext::AJAX_ADMIN); |
|
63 | - } |
|
64 | - return $this->factory->create(RequestTypeContext::AJAX_OTHER); |
|
65 | - } |
|
66 | - // Detect WP_Cron |
|
67 | - if ($this->isCronRequest()) { |
|
68 | - return $this->factory->create(RequestTypeContext::CRON); |
|
69 | - } |
|
70 | - // Detect command line requests |
|
71 | - if (defined('WP_CLI') && WP_CLI) { |
|
72 | - return $this->factory->create(RequestTypeContext::CLI); |
|
73 | - } |
|
74 | - // detect WordPress admin (ie: "Dashboard") |
|
75 | - if (is_admin()) { |
|
76 | - return $this->factory->create(RequestTypeContext::ADMIN); |
|
77 | - } |
|
78 | - // Detect iFrames |
|
79 | - if ($this->isIframeRoute()) { |
|
80 | - return $this->factory->create(RequestTypeContext::IFRAME); |
|
81 | - } |
|
82 | - // Detect Feeds |
|
83 | - if ($this->isFeedRequest()) { |
|
84 | - return $this->factory->create(RequestTypeContext::FEED); |
|
85 | - } |
|
86 | - // and by process of elimination... |
|
87 | - return $this->factory->create(RequestTypeContext::FRONTEND); |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * @return bool |
|
93 | - */ |
|
94 | - private function isEspressoRestApiRequest() |
|
95 | - { |
|
96 | - $ee_rest_url_prefix = RecommendedVersions::compareWordPressVersion('4.4.0') |
|
97 | - ? trim(rest_get_url_prefix(), '/') |
|
98 | - : 'wp-json'; |
|
99 | - $ee_rest_url_prefix .= '/' . Domain::API_NAMESPACE; |
|
100 | - return $this->uriPathMatches($ee_rest_url_prefix); |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - /** |
|
105 | - * @return bool |
|
106 | - */ |
|
107 | - private function isCronRequest() |
|
108 | - { |
|
109 | - return $this->uriPathMatches('wp-cron.php'); |
|
110 | - } |
|
111 | - |
|
112 | - |
|
113 | - /** |
|
114 | - * @return bool |
|
115 | - */ |
|
116 | - private function isFeedRequest() |
|
117 | - { |
|
118 | - return $this->uriPathMatches('feed'); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @param string $component |
|
124 | - * @return bool |
|
125 | - */ |
|
126 | - private function uriPathMatches($component) |
|
127 | - { |
|
128 | - $request_uri = $this->request->requestUri(); |
|
129 | - $parts = explode('?', $request_uri); |
|
130 | - $path = trim(reset($parts), '/'); |
|
131 | - return strpos($path, $component) === 0; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * @return bool |
|
137 | - */ |
|
138 | - private function isIframeRoute() |
|
139 | - { |
|
140 | - $is_iframe_route = apply_filters( |
|
141 | - 'FHEE__EventEspresso_core_domain_services_contexts_RequestTypeContextDetector__isIframeRoute', |
|
142 | - $this->request->getRequestParam('event_list', '') === 'iframe' |
|
143 | - || $this->request->getRequestParam('ticket_selector', '') === 'iframe' |
|
144 | - || $this->request->getRequestParam('calendar', '') === 'iframe', |
|
145 | - $this |
|
146 | - ); |
|
147 | - return filter_var($is_iframe_route, FILTER_VALIDATE_BOOLEAN); |
|
148 | - } |
|
22 | + /** |
|
23 | + * @var RequestTypeContextFactory $factory |
|
24 | + */ |
|
25 | + private $factory; |
|
26 | + |
|
27 | + /** |
|
28 | + * @var RequestInterface $request |
|
29 | + */ |
|
30 | + private $request; |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * RequestTypeContextDetector constructor. |
|
35 | + * |
|
36 | + * @param RequestInterface $request |
|
37 | + * @param RequestTypeContextFactory $factory |
|
38 | + */ |
|
39 | + public function __construct(RequestInterface $request, RequestTypeContextFactory $factory) |
|
40 | + { |
|
41 | + $this->request = $request; |
|
42 | + $this->factory = $factory; |
|
43 | + } |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * @return RequestTypeContext |
|
48 | + * @throws InvalidArgumentException |
|
49 | + */ |
|
50 | + public function detectRequestTypeContext() |
|
51 | + { |
|
52 | + // Detect EE REST API |
|
53 | + if ($this->isEspressoRestApiRequest()) { |
|
54 | + return $this->factory->create(RequestTypeContext::API); |
|
55 | + } |
|
56 | + // Detect AJAX |
|
57 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
58 | + if (filter_var($this->request->getRequestParam('ee_front_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
59 | + return $this->factory->create(RequestTypeContext::AJAX_FRONT); |
|
60 | + } |
|
61 | + if (filter_var($this->request->getRequestParam('ee_admin_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
62 | + return $this->factory->create(RequestTypeContext::AJAX_ADMIN); |
|
63 | + } |
|
64 | + return $this->factory->create(RequestTypeContext::AJAX_OTHER); |
|
65 | + } |
|
66 | + // Detect WP_Cron |
|
67 | + if ($this->isCronRequest()) { |
|
68 | + return $this->factory->create(RequestTypeContext::CRON); |
|
69 | + } |
|
70 | + // Detect command line requests |
|
71 | + if (defined('WP_CLI') && WP_CLI) { |
|
72 | + return $this->factory->create(RequestTypeContext::CLI); |
|
73 | + } |
|
74 | + // detect WordPress admin (ie: "Dashboard") |
|
75 | + if (is_admin()) { |
|
76 | + return $this->factory->create(RequestTypeContext::ADMIN); |
|
77 | + } |
|
78 | + // Detect iFrames |
|
79 | + if ($this->isIframeRoute()) { |
|
80 | + return $this->factory->create(RequestTypeContext::IFRAME); |
|
81 | + } |
|
82 | + // Detect Feeds |
|
83 | + if ($this->isFeedRequest()) { |
|
84 | + return $this->factory->create(RequestTypeContext::FEED); |
|
85 | + } |
|
86 | + // and by process of elimination... |
|
87 | + return $this->factory->create(RequestTypeContext::FRONTEND); |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * @return bool |
|
93 | + */ |
|
94 | + private function isEspressoRestApiRequest() |
|
95 | + { |
|
96 | + $ee_rest_url_prefix = RecommendedVersions::compareWordPressVersion('4.4.0') |
|
97 | + ? trim(rest_get_url_prefix(), '/') |
|
98 | + : 'wp-json'; |
|
99 | + $ee_rest_url_prefix .= '/' . Domain::API_NAMESPACE; |
|
100 | + return $this->uriPathMatches($ee_rest_url_prefix); |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + /** |
|
105 | + * @return bool |
|
106 | + */ |
|
107 | + private function isCronRequest() |
|
108 | + { |
|
109 | + return $this->uriPathMatches('wp-cron.php'); |
|
110 | + } |
|
111 | + |
|
112 | + |
|
113 | + /** |
|
114 | + * @return bool |
|
115 | + */ |
|
116 | + private function isFeedRequest() |
|
117 | + { |
|
118 | + return $this->uriPathMatches('feed'); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @param string $component |
|
124 | + * @return bool |
|
125 | + */ |
|
126 | + private function uriPathMatches($component) |
|
127 | + { |
|
128 | + $request_uri = $this->request->requestUri(); |
|
129 | + $parts = explode('?', $request_uri); |
|
130 | + $path = trim(reset($parts), '/'); |
|
131 | + return strpos($path, $component) === 0; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * @return bool |
|
137 | + */ |
|
138 | + private function isIframeRoute() |
|
139 | + { |
|
140 | + $is_iframe_route = apply_filters( |
|
141 | + 'FHEE__EventEspresso_core_domain_services_contexts_RequestTypeContextDetector__isIframeRoute', |
|
142 | + $this->request->getRequestParam('event_list', '') === 'iframe' |
|
143 | + || $this->request->getRequestParam('ticket_selector', '') === 'iframe' |
|
144 | + || $this->request->getRequestParam('calendar', '') === 'iframe', |
|
145 | + $this |
|
146 | + ); |
|
147 | + return filter_var($is_iframe_route, FILTER_VALIDATE_BOOLEAN); |
|
148 | + } |
|
149 | 149 | } |
@@ -96,7 +96,7 @@ |
||
96 | 96 | $ee_rest_url_prefix = RecommendedVersions::compareWordPressVersion('4.4.0') |
97 | 97 | ? trim(rest_get_url_prefix(), '/') |
98 | 98 | : 'wp-json'; |
99 | - $ee_rest_url_prefix .= '/' . Domain::API_NAMESPACE; |
|
99 | + $ee_rest_url_prefix .= '/'.Domain::API_NAMESPACE; |
|
100 | 100 | return $this->uriPathMatches($ee_rest_url_prefix); |
101 | 101 | } |
102 | 102 |
@@ -17,104 +17,104 @@ |
||
17 | 17 | class RequestTypeContextFactory |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var LoaderInterface $loader |
|
22 | - */ |
|
23 | - private $loader; |
|
20 | + /** |
|
21 | + * @var LoaderInterface $loader |
|
22 | + */ |
|
23 | + private $loader; |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * RequestTypeContextFactory constructor. |
|
28 | - * |
|
29 | - * @param LoaderInterface $loader |
|
30 | - */ |
|
31 | - public function __construct(LoaderInterface $loader) |
|
32 | - { |
|
33 | - $this->loader = $loader; |
|
34 | - } |
|
26 | + /** |
|
27 | + * RequestTypeContextFactory constructor. |
|
28 | + * |
|
29 | + * @param LoaderInterface $loader |
|
30 | + */ |
|
31 | + public function __construct(LoaderInterface $loader) |
|
32 | + { |
|
33 | + $this->loader = $loader; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @param string $slug |
|
39 | - * @return RequestTypeContext |
|
40 | - */ |
|
41 | - public function create($slug) |
|
42 | - { |
|
43 | - switch ($slug) { |
|
44 | - case RequestTypeContext::ACTIVATION: |
|
45 | - $description = esc_html__( |
|
46 | - 'The current request is for some form of activation', |
|
47 | - 'event_espresso' |
|
48 | - ); |
|
49 | - break; |
|
50 | - case RequestTypeContext::API: |
|
51 | - $description = esc_html__( |
|
52 | - 'The current request is for the REST API', |
|
53 | - 'event_espresso' |
|
54 | - ); |
|
55 | - break; |
|
56 | - case RequestTypeContext::AJAX_FRONT: |
|
57 | - $description = esc_html__( |
|
58 | - 'The current request is for the frontend via AJAX', |
|
59 | - 'event_espresso' |
|
60 | - ); |
|
61 | - break; |
|
62 | - case RequestTypeContext::AJAX_ADMIN: |
|
63 | - $description = esc_html__( |
|
64 | - 'The current request is for the admin via AJAX', |
|
65 | - 'event_espresso' |
|
66 | - ); |
|
67 | - break; |
|
68 | - case RequestTypeContext::AJAX_OTHER: |
|
69 | - $description = esc_html__( |
|
70 | - 'The current request is for non-EE related code via AJAX', |
|
71 | - 'event_espresso' |
|
72 | - ); |
|
73 | - break; |
|
74 | - case RequestTypeContext::CRON: |
|
75 | - $description = esc_html__( |
|
76 | - 'The current request is for a WP_Cron', |
|
77 | - 'event_espresso' |
|
78 | - ); |
|
79 | - break; |
|
80 | - case RequestTypeContext::CLI: |
|
81 | - $description = esc_html__( |
|
82 | - 'The current request is from the command line', |
|
83 | - 'event_espresso' |
|
84 | - ); |
|
85 | - break; |
|
86 | - case RequestTypeContext::ADMIN: |
|
87 | - $description = esc_html__( |
|
88 | - 'The current request is for the admin', |
|
89 | - 'event_espresso' |
|
90 | - ); |
|
91 | - break; |
|
92 | - case RequestTypeContext::IFRAME: |
|
93 | - $description = esc_html__( |
|
94 | - 'The current request is for an iframe', |
|
95 | - 'event_espresso' |
|
96 | - ); |
|
97 | - break; |
|
98 | - case RequestTypeContext::FEED: |
|
99 | - $description = esc_html__( |
|
100 | - 'The current request is for a feed (ie: RSS)', |
|
101 | - 'event_espresso' |
|
102 | - ); |
|
103 | - break; |
|
104 | - case RequestTypeContext::FRONTEND: |
|
105 | - default: |
|
106 | - $description = esc_html__( |
|
107 | - 'The current request is for the frontend', |
|
108 | - 'event_espresso' |
|
109 | - ); |
|
110 | - break; |
|
111 | - } |
|
112 | - // we're using the Loader with sharing turned on, |
|
113 | - // so that the generated RequestTypeContext object is accessible anywhere |
|
114 | - // by simply requesting it again from the loader |
|
115 | - return $this->loader->getShared( |
|
116 | - 'EventEspresso\core\domain\entities\contexts\RequestTypeContext', |
|
117 | - array($slug, $description) |
|
118 | - ); |
|
119 | - } |
|
37 | + /** |
|
38 | + * @param string $slug |
|
39 | + * @return RequestTypeContext |
|
40 | + */ |
|
41 | + public function create($slug) |
|
42 | + { |
|
43 | + switch ($slug) { |
|
44 | + case RequestTypeContext::ACTIVATION: |
|
45 | + $description = esc_html__( |
|
46 | + 'The current request is for some form of activation', |
|
47 | + 'event_espresso' |
|
48 | + ); |
|
49 | + break; |
|
50 | + case RequestTypeContext::API: |
|
51 | + $description = esc_html__( |
|
52 | + 'The current request is for the REST API', |
|
53 | + 'event_espresso' |
|
54 | + ); |
|
55 | + break; |
|
56 | + case RequestTypeContext::AJAX_FRONT: |
|
57 | + $description = esc_html__( |
|
58 | + 'The current request is for the frontend via AJAX', |
|
59 | + 'event_espresso' |
|
60 | + ); |
|
61 | + break; |
|
62 | + case RequestTypeContext::AJAX_ADMIN: |
|
63 | + $description = esc_html__( |
|
64 | + 'The current request is for the admin via AJAX', |
|
65 | + 'event_espresso' |
|
66 | + ); |
|
67 | + break; |
|
68 | + case RequestTypeContext::AJAX_OTHER: |
|
69 | + $description = esc_html__( |
|
70 | + 'The current request is for non-EE related code via AJAX', |
|
71 | + 'event_espresso' |
|
72 | + ); |
|
73 | + break; |
|
74 | + case RequestTypeContext::CRON: |
|
75 | + $description = esc_html__( |
|
76 | + 'The current request is for a WP_Cron', |
|
77 | + 'event_espresso' |
|
78 | + ); |
|
79 | + break; |
|
80 | + case RequestTypeContext::CLI: |
|
81 | + $description = esc_html__( |
|
82 | + 'The current request is from the command line', |
|
83 | + 'event_espresso' |
|
84 | + ); |
|
85 | + break; |
|
86 | + case RequestTypeContext::ADMIN: |
|
87 | + $description = esc_html__( |
|
88 | + 'The current request is for the admin', |
|
89 | + 'event_espresso' |
|
90 | + ); |
|
91 | + break; |
|
92 | + case RequestTypeContext::IFRAME: |
|
93 | + $description = esc_html__( |
|
94 | + 'The current request is for an iframe', |
|
95 | + 'event_espresso' |
|
96 | + ); |
|
97 | + break; |
|
98 | + case RequestTypeContext::FEED: |
|
99 | + $description = esc_html__( |
|
100 | + 'The current request is for a feed (ie: RSS)', |
|
101 | + 'event_espresso' |
|
102 | + ); |
|
103 | + break; |
|
104 | + case RequestTypeContext::FRONTEND: |
|
105 | + default: |
|
106 | + $description = esc_html__( |
|
107 | + 'The current request is for the frontend', |
|
108 | + 'event_espresso' |
|
109 | + ); |
|
110 | + break; |
|
111 | + } |
|
112 | + // we're using the Loader with sharing turned on, |
|
113 | + // so that the generated RequestTypeContext object is accessible anywhere |
|
114 | + // by simply requesting it again from the loader |
|
115 | + return $this->loader->getShared( |
|
116 | + 'EventEspresso\core\domain\entities\contexts\RequestTypeContext', |
|
117 | + array($slug, $description) |
|
118 | + ); |
|
119 | + } |
|
120 | 120 | } |
@@ -20,10 +20,10 @@ |
||
20 | 20 | abstract class DomainService implements DomainServiceInterface |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * DomainService constructor. |
|
25 | - */ |
|
26 | - public function __construct() |
|
27 | - { |
|
28 | - } |
|
23 | + /** |
|
24 | + * DomainService constructor. |
|
25 | + */ |
|
26 | + public function __construct() |
|
27 | + { |
|
28 | + } |
|
29 | 29 | } |
@@ -17,97 +17,97 @@ |
||
17 | 17 | class RegisterCustomTaxonomies |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var CustomTaxonomyDefinitions $custom_taxonomies |
|
22 | - */ |
|
23 | - public $custom_taxonomies; |
|
20 | + /** |
|
21 | + * @var CustomTaxonomyDefinitions $custom_taxonomies |
|
22 | + */ |
|
23 | + public $custom_taxonomies; |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * RegisterCustomTaxonomies constructor. |
|
28 | - * |
|
29 | - * @param CustomTaxonomyDefinitions $custom_taxonomies |
|
30 | - */ |
|
31 | - public function __construct(CustomTaxonomyDefinitions $custom_taxonomies) |
|
32 | - { |
|
33 | - $this->custom_taxonomies = $custom_taxonomies; |
|
34 | - } |
|
26 | + /** |
|
27 | + * RegisterCustomTaxonomies constructor. |
|
28 | + * |
|
29 | + * @param CustomTaxonomyDefinitions $custom_taxonomies |
|
30 | + */ |
|
31 | + public function __construct(CustomTaxonomyDefinitions $custom_taxonomies) |
|
32 | + { |
|
33 | + $this->custom_taxonomies = $custom_taxonomies; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @return void |
|
39 | - * @throws DomainException |
|
40 | - */ |
|
41 | - public function registerCustomTaxonomies() |
|
42 | - { |
|
43 | - $custom_taxonomies = $this->custom_taxonomies->getCustomTaxonomyDefinitions(); |
|
44 | - foreach ($custom_taxonomies as $taxonomy => $tax) { |
|
45 | - $this->registerCustomTaxonomy( |
|
46 | - $taxonomy, |
|
47 | - $tax['singular_name'], |
|
48 | - $tax['plural_name'], |
|
49 | - $tax['args'] |
|
50 | - ); |
|
51 | - } |
|
52 | - } |
|
37 | + /** |
|
38 | + * @return void |
|
39 | + * @throws DomainException |
|
40 | + */ |
|
41 | + public function registerCustomTaxonomies() |
|
42 | + { |
|
43 | + $custom_taxonomies = $this->custom_taxonomies->getCustomTaxonomyDefinitions(); |
|
44 | + foreach ($custom_taxonomies as $taxonomy => $tax) { |
|
45 | + $this->registerCustomTaxonomy( |
|
46 | + $taxonomy, |
|
47 | + $tax['singular_name'], |
|
48 | + $tax['plural_name'], |
|
49 | + $tax['args'] |
|
50 | + ); |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * Registers a custom taxonomy. Should be called before registering custom post types, |
|
57 | - * otherwise you should link the taxonomy to the custom post type using 'register_taxonomy_for_object_type'. |
|
58 | - * |
|
59 | - * @param string $taxonomy_name , eg 'books' |
|
60 | - * @param string $singular_name internationalized singular name |
|
61 | - * @param string $plural_name internationalized plural name |
|
62 | - * @param array $override_arguments like $args on http://codex.wordpress.org/Function_Reference/register_taxonomy |
|
63 | - * @throws DomainException |
|
64 | - */ |
|
65 | - public function registerCustomTaxonomy($taxonomy_name, $singular_name, $plural_name, array $override_arguments) |
|
66 | - { |
|
67 | - $result = register_taxonomy( |
|
68 | - $taxonomy_name, |
|
69 | - null, |
|
70 | - $this->prepareArguments( |
|
71 | - $singular_name, |
|
72 | - $plural_name, |
|
73 | - $override_arguments |
|
74 | - ) |
|
75 | - ); |
|
76 | - if ($result instanceof WP_Error) { |
|
77 | - throw new DomainException($result->get_error_message()); |
|
78 | - } |
|
79 | - } |
|
55 | + /** |
|
56 | + * Registers a custom taxonomy. Should be called before registering custom post types, |
|
57 | + * otherwise you should link the taxonomy to the custom post type using 'register_taxonomy_for_object_type'. |
|
58 | + * |
|
59 | + * @param string $taxonomy_name , eg 'books' |
|
60 | + * @param string $singular_name internationalized singular name |
|
61 | + * @param string $plural_name internationalized plural name |
|
62 | + * @param array $override_arguments like $args on http://codex.wordpress.org/Function_Reference/register_taxonomy |
|
63 | + * @throws DomainException |
|
64 | + */ |
|
65 | + public function registerCustomTaxonomy($taxonomy_name, $singular_name, $plural_name, array $override_arguments) |
|
66 | + { |
|
67 | + $result = register_taxonomy( |
|
68 | + $taxonomy_name, |
|
69 | + null, |
|
70 | + $this->prepareArguments( |
|
71 | + $singular_name, |
|
72 | + $plural_name, |
|
73 | + $override_arguments |
|
74 | + ) |
|
75 | + ); |
|
76 | + if ($result instanceof WP_Error) { |
|
77 | + throw new DomainException($result->get_error_message()); |
|
78 | + } |
|
79 | + } |
|
80 | 80 | |
81 | 81 | |
82 | - /** |
|
83 | - * @param string $singular_name |
|
84 | - * @param string $plural_name |
|
85 | - * @param array $override_arguments |
|
86 | - * @since $VID:$ |
|
87 | - * @return array |
|
88 | - */ |
|
89 | - protected function prepareArguments($singular_name, $plural_name, array $override_arguments) |
|
90 | - { |
|
91 | - $arguments = array( |
|
92 | - 'hierarchical' => true, |
|
93 | - 'labels' => array( |
|
94 | - 'name' => $plural_name, |
|
95 | - 'singular_name' => $singular_name, |
|
96 | - ), |
|
97 | - 'show_ui' => true, |
|
98 | - 'show_ee_ui' => true, |
|
99 | - 'show_admin_column' => true, |
|
100 | - 'query_var' => true, |
|
101 | - 'show_in_nav_menus' => false, |
|
102 | - 'map_meta_cap' => true, |
|
103 | - ); |
|
104 | - if ($override_arguments) { |
|
105 | - if (isset($override_args['labels'])) { |
|
106 | - $labels = array_merge($arguments['labels'], $override_arguments['labels']); |
|
107 | - $arguments['labels'] = $labels; |
|
108 | - } |
|
109 | - $arguments = array_merge($arguments, $override_arguments); |
|
110 | - } |
|
111 | - return $arguments; |
|
112 | - } |
|
82 | + /** |
|
83 | + * @param string $singular_name |
|
84 | + * @param string $plural_name |
|
85 | + * @param array $override_arguments |
|
86 | + * @since $VID:$ |
|
87 | + * @return array |
|
88 | + */ |
|
89 | + protected function prepareArguments($singular_name, $plural_name, array $override_arguments) |
|
90 | + { |
|
91 | + $arguments = array( |
|
92 | + 'hierarchical' => true, |
|
93 | + 'labels' => array( |
|
94 | + 'name' => $plural_name, |
|
95 | + 'singular_name' => $singular_name, |
|
96 | + ), |
|
97 | + 'show_ui' => true, |
|
98 | + 'show_ee_ui' => true, |
|
99 | + 'show_admin_column' => true, |
|
100 | + 'query_var' => true, |
|
101 | + 'show_in_nav_menus' => false, |
|
102 | + 'map_meta_cap' => true, |
|
103 | + ); |
|
104 | + if ($override_arguments) { |
|
105 | + if (isset($override_args['labels'])) { |
|
106 | + $labels = array_merge($arguments['labels'], $override_arguments['labels']); |
|
107 | + $arguments['labels'] = $labels; |
|
108 | + } |
|
109 | + $arguments = array_merge($arguments, $override_arguments); |
|
110 | + } |
|
111 | + return $arguments; |
|
112 | + } |
|
113 | 113 | } |
@@ -13,30 +13,30 @@ |
||
13 | 13 | class RewriteRules |
14 | 14 | { |
15 | 15 | |
16 | - const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules'; |
|
16 | + const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules'; |
|
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
21 | - * |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function flush() |
|
25 | - { |
|
26 | - update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true); |
|
27 | - } |
|
19 | + /** |
|
20 | + * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
21 | + * |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function flush() |
|
25 | + { |
|
26 | + update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
32 | - * |
|
33 | - * @return void |
|
34 | - */ |
|
35 | - public function flushRewriteRules() |
|
36 | - { |
|
37 | - if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) { |
|
38 | - flush_rewrite_rules(); |
|
39 | - update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false); |
|
40 | - } |
|
41 | - } |
|
30 | + /** |
|
31 | + * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
32 | + * |
|
33 | + * @return void |
|
34 | + */ |
|
35 | + public function flushRewriteRules() |
|
36 | + { |
|
37 | + if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) { |
|
38 | + flush_rewrite_rules(); |
|
39 | + update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false); |
|
40 | + } |
|
41 | + } |
|
42 | 42 | } |
@@ -16,25 +16,25 @@ |
||
16 | 16 | interface CapabilitiesCheckerInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * Verifies that the current user has ALL of the capabilities listed in the CapCheck DTO. |
|
21 | - * If any of the individual capability checks fails, then the command will NOT be executed. |
|
22 | - * |
|
23 | - * @param CapCheckInterface|CapCheckInterface[] $cap_check |
|
24 | - * @return bool |
|
25 | - * @throws InvalidClassException |
|
26 | - * @throws InsufficientPermissionsException |
|
27 | - */ |
|
28 | - public function processCapCheck($cap_check); |
|
19 | + /** |
|
20 | + * Verifies that the current user has ALL of the capabilities listed in the CapCheck DTO. |
|
21 | + * If any of the individual capability checks fails, then the command will NOT be executed. |
|
22 | + * |
|
23 | + * @param CapCheckInterface|CapCheckInterface[] $cap_check |
|
24 | + * @return bool |
|
25 | + * @throws InvalidClassException |
|
26 | + * @throws InsufficientPermissionsException |
|
27 | + */ |
|
28 | + public function processCapCheck($cap_check); |
|
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * @param string $capability - the capability to be checked, like: 'ee_edit_registrations' |
|
33 | - * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
34 | - * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
35 | - * @return bool |
|
36 | - * @throws InsufficientPermissionsException |
|
37 | - * @throws InvalidClassException |
|
38 | - */ |
|
39 | - public function process($capability, $context, $ID = 0); |
|
31 | + /** |
|
32 | + * @param string $capability - the capability to be checked, like: 'ee_edit_registrations' |
|
33 | + * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
34 | + * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
35 | + * @return bool |
|
36 | + * @throws InsufficientPermissionsException |
|
37 | + * @throws InvalidClassException |
|
38 | + */ |
|
39 | + public function process($capability, $context, $ID = 0); |
|
40 | 40 | } |
@@ -11,8 +11,8 @@ |
||
11 | 11 | interface RequiresCapCheckInterface |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @return CapCheckInterface |
|
16 | - */ |
|
17 | - public function getCapCheck(); |
|
14 | + /** |
|
15 | + * @return CapCheckInterface |
|
16 | + */ |
|
17 | + public function getCapCheck(); |
|
18 | 18 | } |