@@ -18,38 +18,38 @@ |
||
18 | 18 | */ |
19 | 19 | class Api extends JsonDataNode |
20 | 20 | { |
21 | - const NODE_NAME = 'api'; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * @param JsonDataNodeValidator $validator |
|
26 | - */ |
|
27 | - public function __construct(JsonDataNodeValidator $validator) |
|
28 | - { |
|
29 | - parent::__construct($validator); |
|
30 | - $this->setNodeName(Api::NODE_NAME); |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * @throws DomainException |
|
36 | - * @since $VID:$ |
|
37 | - */ |
|
38 | - public function initialize() |
|
39 | - { |
|
40 | - $this->addData('restApiNonce', wp_create_nonce('wp_rest')); |
|
41 | - $this->addData('restApiBaseUrl', rest_url()); |
|
42 | - $this->addData('restApiRouteUrl', rest_url('ee/v4.8.36/')); |
|
43 | - $this->addData('restApiCollectionEndpoints', EED_Core_Rest_Api::getCollectionRoutesIndexedByModelName()); |
|
44 | - $this->addData('restApiPrimaryKeys', EED_Core_Rest_Api::getPrimaryKeyNamesIndexedByModelName()); |
|
45 | - |
|
46 | - // route can be something like 'graphql' |
|
47 | - $route = trim(Router::$route, '/'); |
|
48 | - // make sure we are dealing with sane folks |
|
49 | - $has_pretty_permalinks = (bool) get_option('permalink_structure'); |
|
50 | - // if pretty permalinks, use '/graphql' otherwise '?graphql=1' |
|
51 | - $graphqlEndpoint = $has_pretty_permalinks ? site_url($route) : add_query_arg($route, 1, site_url()); |
|
52 | - $this->addData('graphqlEndpoint', esc_url($graphqlEndpoint)); |
|
53 | - $this->setInitialized(true); |
|
54 | - } |
|
21 | + const NODE_NAME = 'api'; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * @param JsonDataNodeValidator $validator |
|
26 | + */ |
|
27 | + public function __construct(JsonDataNodeValidator $validator) |
|
28 | + { |
|
29 | + parent::__construct($validator); |
|
30 | + $this->setNodeName(Api::NODE_NAME); |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * @throws DomainException |
|
36 | + * @since $VID:$ |
|
37 | + */ |
|
38 | + public function initialize() |
|
39 | + { |
|
40 | + $this->addData('restApiNonce', wp_create_nonce('wp_rest')); |
|
41 | + $this->addData('restApiBaseUrl', rest_url()); |
|
42 | + $this->addData('restApiRouteUrl', rest_url('ee/v4.8.36/')); |
|
43 | + $this->addData('restApiCollectionEndpoints', EED_Core_Rest_Api::getCollectionRoutesIndexedByModelName()); |
|
44 | + $this->addData('restApiPrimaryKeys', EED_Core_Rest_Api::getPrimaryKeyNamesIndexedByModelName()); |
|
45 | + |
|
46 | + // route can be something like 'graphql' |
|
47 | + $route = trim(Router::$route, '/'); |
|
48 | + // make sure we are dealing with sane folks |
|
49 | + $has_pretty_permalinks = (bool) get_option('permalink_structure'); |
|
50 | + // if pretty permalinks, use '/graphql' otherwise '?graphql=1' |
|
51 | + $graphqlEndpoint = $has_pretty_permalinks ? site_url($route) : add_query_arg($route, 1, site_url()); |
|
52 | + $this->addData('graphqlEndpoint', esc_url($graphqlEndpoint)); |
|
53 | + $this->setInitialized(true); |
|
54 | + } |
|
55 | 55 | } |
@@ -19,248 +19,248 @@ |
||
19 | 19 | class RequestTypeContextDetector |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * @var RequestTypeContextFactoryInterface $factory |
|
24 | - */ |
|
25 | - private $factory; |
|
22 | + /** |
|
23 | + * @var RequestTypeContextFactoryInterface $factory |
|
24 | + */ |
|
25 | + private $factory; |
|
26 | 26 | |
27 | - /** |
|
28 | - * @var RequestInterface $request |
|
29 | - */ |
|
30 | - private $request; |
|
27 | + /** |
|
28 | + * @var RequestInterface $request |
|
29 | + */ |
|
30 | + private $request; |
|
31 | 31 | |
32 | - /** |
|
33 | - * @var array $globalRouteConditions |
|
34 | - */ |
|
35 | - private $globalRouteConditions; |
|
32 | + /** |
|
33 | + * @var array $globalRouteConditions |
|
34 | + */ |
|
35 | + private $globalRouteConditions; |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * RequestTypeContextDetector constructor. |
|
40 | - * |
|
41 | - * @param RequestInterface $request |
|
42 | - * @param RequestTypeContextFactoryInterface $factory |
|
43 | - * @param array $globalRouteConditions an array for injecting values that would |
|
44 | - * otherwise be defined as global constants |
|
45 | - * or other global variables for the current |
|
46 | - * request route such as DOING_AJAX |
|
47 | - */ |
|
48 | - public function __construct( |
|
49 | - RequestInterface $request, |
|
50 | - RequestTypeContextFactoryInterface $factory, |
|
51 | - array $globalRouteConditions = [] |
|
52 | - ) { |
|
53 | - $this->request = $request; |
|
54 | - $this->factory = $factory; |
|
55 | - $this->globalRouteConditions = $globalRouteConditions; |
|
56 | - } |
|
38 | + /** |
|
39 | + * RequestTypeContextDetector constructor. |
|
40 | + * |
|
41 | + * @param RequestInterface $request |
|
42 | + * @param RequestTypeContextFactoryInterface $factory |
|
43 | + * @param array $globalRouteConditions an array for injecting values that would |
|
44 | + * otherwise be defined as global constants |
|
45 | + * or other global variables for the current |
|
46 | + * request route such as DOING_AJAX |
|
47 | + */ |
|
48 | + public function __construct( |
|
49 | + RequestInterface $request, |
|
50 | + RequestTypeContextFactoryInterface $factory, |
|
51 | + array $globalRouteConditions = [] |
|
52 | + ) { |
|
53 | + $this->request = $request; |
|
54 | + $this->factory = $factory; |
|
55 | + $this->globalRouteConditions = $globalRouteConditions; |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * @param string $globalRouteCondition |
|
61 | - * @param mixed $default |
|
62 | - * @return mixed |
|
63 | - */ |
|
64 | - private function getGlobalRouteCondition($globalRouteCondition, $default) |
|
65 | - { |
|
66 | - return isset($this->globalRouteConditions[ $globalRouteCondition ]) |
|
67 | - ? $this->globalRouteConditions[ $globalRouteCondition ] |
|
68 | - : $default; |
|
69 | - } |
|
59 | + /** |
|
60 | + * @param string $globalRouteCondition |
|
61 | + * @param mixed $default |
|
62 | + * @return mixed |
|
63 | + */ |
|
64 | + private function getGlobalRouteCondition($globalRouteCondition, $default) |
|
65 | + { |
|
66 | + return isset($this->globalRouteConditions[ $globalRouteCondition ]) |
|
67 | + ? $this->globalRouteConditions[ $globalRouteCondition ] |
|
68 | + : $default; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * @return RequestTypeContext |
|
74 | - * @throws InvalidArgumentException |
|
75 | - */ |
|
76 | - public function detectRequestTypeContext() |
|
77 | - { |
|
78 | - // Detect error scrapes |
|
79 | - if ($this->isWordPressErrorScrape()) { |
|
80 | - return $this->factory->create(RequestTypeContext::WP_SCRAPE); |
|
81 | - } |
|
82 | - // Detect activations |
|
83 | - if ($this->isWordPressActivationRequest()) { |
|
84 | - return $this->factory->create(RequestTypeContext::ACTIVATION); |
|
85 | - } |
|
86 | - // Detect EE REST API |
|
87 | - if ($this->isEspressoRestApiRequest()) { |
|
88 | - return $this->factory->create(RequestTypeContext::API); |
|
89 | - } |
|
90 | - // Detect WP REST API |
|
91 | - if ($this->isWordPressRestApiRequest()) { |
|
92 | - return $this->factory->create(RequestTypeContext::WP_API); |
|
93 | - } |
|
94 | - // Detect EE GraphQL |
|
95 | - if ($this->isEspressoGraphQLRequest()) { |
|
96 | - return $this->factory->create(RequestTypeContext::GQL); |
|
97 | - } |
|
98 | - // Detect AJAX |
|
99 | - if ($this->getGlobalRouteCondition('DOING_AJAX', false)) { |
|
100 | - if (filter_var($this->request->getRequestParam('ee_front_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
101 | - return $this->factory->create(RequestTypeContext::AJAX_FRONT); |
|
102 | - } |
|
103 | - if (filter_var($this->request->getRequestParam('ee_admin_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
104 | - return $this->factory->create(RequestTypeContext::AJAX_ADMIN); |
|
105 | - } |
|
106 | - if ($this->request->getRequestParam('action') === 'heartbeat') { |
|
107 | - return $this->factory->create(RequestTypeContext::AJAX_HEARTBEAT); |
|
108 | - } |
|
109 | - return $this->factory->create(RequestTypeContext::AJAX_OTHER); |
|
110 | - } |
|
111 | - // Detect WP_Cron |
|
112 | - if ($this->isCronRequest()) { |
|
113 | - return $this->factory->create(RequestTypeContext::CRON); |
|
114 | - } |
|
115 | - // Detect command line requests |
|
116 | - if ($this->getGlobalRouteCondition('WP_CLI', false)) { |
|
117 | - return $this->factory->create(RequestTypeContext::CLI); |
|
118 | - } |
|
119 | - // detect WordPress admin (ie: "Dashboard") |
|
120 | - if ($this->getGlobalRouteCondition('is_admin', false)) { |
|
121 | - return $this->factory->create(RequestTypeContext::ADMIN); |
|
122 | - } |
|
123 | - // Detect iFrames |
|
124 | - if ($this->isIframeRoute()) { |
|
125 | - return $this->factory->create(RequestTypeContext::IFRAME); |
|
126 | - } |
|
127 | - // Detect Feeds |
|
128 | - if ($this->isFeedRequest()) { |
|
129 | - return $this->factory->create(RequestTypeContext::FEED); |
|
130 | - } |
|
131 | - // and by process of elimination... |
|
132 | - return $this->factory->create(RequestTypeContext::FRONTEND); |
|
133 | - } |
|
72 | + /** |
|
73 | + * @return RequestTypeContext |
|
74 | + * @throws InvalidArgumentException |
|
75 | + */ |
|
76 | + public function detectRequestTypeContext() |
|
77 | + { |
|
78 | + // Detect error scrapes |
|
79 | + if ($this->isWordPressErrorScrape()) { |
|
80 | + return $this->factory->create(RequestTypeContext::WP_SCRAPE); |
|
81 | + } |
|
82 | + // Detect activations |
|
83 | + if ($this->isWordPressActivationRequest()) { |
|
84 | + return $this->factory->create(RequestTypeContext::ACTIVATION); |
|
85 | + } |
|
86 | + // Detect EE REST API |
|
87 | + if ($this->isEspressoRestApiRequest()) { |
|
88 | + return $this->factory->create(RequestTypeContext::API); |
|
89 | + } |
|
90 | + // Detect WP REST API |
|
91 | + if ($this->isWordPressRestApiRequest()) { |
|
92 | + return $this->factory->create(RequestTypeContext::WP_API); |
|
93 | + } |
|
94 | + // Detect EE GraphQL |
|
95 | + if ($this->isEspressoGraphQLRequest()) { |
|
96 | + return $this->factory->create(RequestTypeContext::GQL); |
|
97 | + } |
|
98 | + // Detect AJAX |
|
99 | + if ($this->getGlobalRouteCondition('DOING_AJAX', false)) { |
|
100 | + if (filter_var($this->request->getRequestParam('ee_front_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
101 | + return $this->factory->create(RequestTypeContext::AJAX_FRONT); |
|
102 | + } |
|
103 | + if (filter_var($this->request->getRequestParam('ee_admin_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
104 | + return $this->factory->create(RequestTypeContext::AJAX_ADMIN); |
|
105 | + } |
|
106 | + if ($this->request->getRequestParam('action') === 'heartbeat') { |
|
107 | + return $this->factory->create(RequestTypeContext::AJAX_HEARTBEAT); |
|
108 | + } |
|
109 | + return $this->factory->create(RequestTypeContext::AJAX_OTHER); |
|
110 | + } |
|
111 | + // Detect WP_Cron |
|
112 | + if ($this->isCronRequest()) { |
|
113 | + return $this->factory->create(RequestTypeContext::CRON); |
|
114 | + } |
|
115 | + // Detect command line requests |
|
116 | + if ($this->getGlobalRouteCondition('WP_CLI', false)) { |
|
117 | + return $this->factory->create(RequestTypeContext::CLI); |
|
118 | + } |
|
119 | + // detect WordPress admin (ie: "Dashboard") |
|
120 | + if ($this->getGlobalRouteCondition('is_admin', false)) { |
|
121 | + return $this->factory->create(RequestTypeContext::ADMIN); |
|
122 | + } |
|
123 | + // Detect iFrames |
|
124 | + if ($this->isIframeRoute()) { |
|
125 | + return $this->factory->create(RequestTypeContext::IFRAME); |
|
126 | + } |
|
127 | + // Detect Feeds |
|
128 | + if ($this->isFeedRequest()) { |
|
129 | + return $this->factory->create(RequestTypeContext::FEED); |
|
130 | + } |
|
131 | + // and by process of elimination... |
|
132 | + return $this->factory->create(RequestTypeContext::FRONTEND); |
|
133 | + } |
|
134 | 134 | |
135 | 135 | |
136 | - /** |
|
137 | - * @return bool |
|
138 | - */ |
|
139 | - private function isWordPressErrorScrape() |
|
140 | - { |
|
141 | - return ( |
|
142 | - $this->request->getRequestParam('wp_scrape_key') !== null |
|
143 | - && $this->request->getRequestParam('wp_scrape_nonce') !== null |
|
144 | - ) |
|
145 | - || ( |
|
146 | - $this->request->getRequestParam('action') === 'error_scrape' |
|
147 | - && $this->request->getRequestParam('_wpnonce') !== null |
|
148 | - ); |
|
149 | - } |
|
136 | + /** |
|
137 | + * @return bool |
|
138 | + */ |
|
139 | + private function isWordPressErrorScrape() |
|
140 | + { |
|
141 | + return ( |
|
142 | + $this->request->getRequestParam('wp_scrape_key') !== null |
|
143 | + && $this->request->getRequestParam('wp_scrape_nonce') !== null |
|
144 | + ) |
|
145 | + || ( |
|
146 | + $this->request->getRequestParam('action') === 'error_scrape' |
|
147 | + && $this->request->getRequestParam('_wpnonce') !== null |
|
148 | + ); |
|
149 | + } |
|
150 | 150 | |
151 | 151 | |
152 | - /** |
|
153 | - * @return bool |
|
154 | - */ |
|
155 | - private function isWordPressActivationRequest() |
|
156 | - { |
|
157 | - $action = $this->request->getRequestParam('action'); |
|
158 | - $plugins_page_actions = [ |
|
159 | - 'activate', |
|
160 | - 'activate-multi', |
|
161 | - 'activate-selected', |
|
162 | - 'deactivate', |
|
163 | - 'deactivate-multi', |
|
164 | - 'deactivate-selected', |
|
165 | - 'delete-selected', |
|
166 | - 'disable-auto-update-selected', |
|
167 | - 'enable-auto-update-selected', |
|
168 | - 'update-selected', |
|
169 | - ]; |
|
170 | - return $this->uriPathMatches('wp-admin/plugins.php') |
|
171 | - && ($action === 'true' || in_array($action, $plugins_page_actions, true)); |
|
172 | - } |
|
152 | + /** |
|
153 | + * @return bool |
|
154 | + */ |
|
155 | + private function isWordPressActivationRequest() |
|
156 | + { |
|
157 | + $action = $this->request->getRequestParam('action'); |
|
158 | + $plugins_page_actions = [ |
|
159 | + 'activate', |
|
160 | + 'activate-multi', |
|
161 | + 'activate-selected', |
|
162 | + 'deactivate', |
|
163 | + 'deactivate-multi', |
|
164 | + 'deactivate-selected', |
|
165 | + 'delete-selected', |
|
166 | + 'disable-auto-update-selected', |
|
167 | + 'enable-auto-update-selected', |
|
168 | + 'update-selected', |
|
169 | + ]; |
|
170 | + return $this->uriPathMatches('wp-admin/plugins.php') |
|
171 | + && ($action === 'true' || in_array($action, $plugins_page_actions, true)); |
|
172 | + } |
|
173 | 173 | |
174 | 174 | |
175 | - /** |
|
176 | - * @return bool |
|
177 | - */ |
|
178 | - private function isEspressoRestApiRequest() |
|
179 | - { |
|
180 | - // Check for URLs like http://mysite.com/?rest_route=/ee... and http://mysite.com/wp-json/ee/... |
|
181 | - return strpos( |
|
182 | - $this->request->getRequestParam('rest_route', false), |
|
183 | - '/' . Domain::API_NAMESPACE |
|
184 | - ) === 0 |
|
185 | - || $this->uriPathMatches(trim(rest_get_url_prefix(), '/') . '/' . Domain::API_NAMESPACE); |
|
186 | - } |
|
175 | + /** |
|
176 | + * @return bool |
|
177 | + */ |
|
178 | + private function isEspressoRestApiRequest() |
|
179 | + { |
|
180 | + // Check for URLs like http://mysite.com/?rest_route=/ee... and http://mysite.com/wp-json/ee/... |
|
181 | + return strpos( |
|
182 | + $this->request->getRequestParam('rest_route', false), |
|
183 | + '/' . Domain::API_NAMESPACE |
|
184 | + ) === 0 |
|
185 | + || $this->uriPathMatches(trim(rest_get_url_prefix(), '/') . '/' . Domain::API_NAMESPACE); |
|
186 | + } |
|
187 | 187 | |
188 | 188 | |
189 | - /** |
|
190 | - * Checks for URLs like https://mysite.com/graphql |
|
191 | - * |
|
192 | - * @return bool |
|
193 | - */ |
|
194 | - private function isEspressoGraphQLRequest() |
|
195 | - { |
|
196 | - try { |
|
197 | - require_once EE_THIRD_PARTY . 'wp-graphql/access-functions.php'; |
|
198 | - $endpoint = get_graphql_setting( |
|
199 | - 'graphql_endpoint', |
|
200 | - apply_filters('graphql_endpoint', RequestTypeContext::GQL) |
|
201 | - ); |
|
202 | - $is_gql_request = $this->uriPathMatches($endpoint); |
|
203 | - } catch (Throwable $t) { |
|
204 | - $is_gql_request = false; |
|
205 | - } |
|
206 | - return $is_gql_request; |
|
207 | - } |
|
189 | + /** |
|
190 | + * Checks for URLs like https://mysite.com/graphql |
|
191 | + * |
|
192 | + * @return bool |
|
193 | + */ |
|
194 | + private function isEspressoGraphQLRequest() |
|
195 | + { |
|
196 | + try { |
|
197 | + require_once EE_THIRD_PARTY . 'wp-graphql/access-functions.php'; |
|
198 | + $endpoint = get_graphql_setting( |
|
199 | + 'graphql_endpoint', |
|
200 | + apply_filters('graphql_endpoint', RequestTypeContext::GQL) |
|
201 | + ); |
|
202 | + $is_gql_request = $this->uriPathMatches($endpoint); |
|
203 | + } catch (Throwable $t) { |
|
204 | + $is_gql_request = false; |
|
205 | + } |
|
206 | + return $is_gql_request; |
|
207 | + } |
|
208 | 208 | |
209 | 209 | |
210 | - /** |
|
211 | - * @return bool |
|
212 | - */ |
|
213 | - private function isWordPressRestApiRequest() |
|
214 | - { |
|
215 | - // Check for URLs like http://mysite.com/?rest_route=/.. and http://mysite.com/wp-json/... |
|
216 | - return $this->request->getRequestParam('rest_route', false) |
|
217 | - || $this->uriPathMatches(trim(rest_get_url_prefix(), '/')); |
|
218 | - } |
|
210 | + /** |
|
211 | + * @return bool |
|
212 | + */ |
|
213 | + private function isWordPressRestApiRequest() |
|
214 | + { |
|
215 | + // Check for URLs like http://mysite.com/?rest_route=/.. and http://mysite.com/wp-json/... |
|
216 | + return $this->request->getRequestParam('rest_route', false) |
|
217 | + || $this->uriPathMatches(trim(rest_get_url_prefix(), '/')); |
|
218 | + } |
|
219 | 219 | |
220 | 220 | |
221 | - /** |
|
222 | - * @return bool |
|
223 | - */ |
|
224 | - private function isCronRequest() |
|
225 | - { |
|
226 | - return $this->uriPathMatches('wp-cron.php'); |
|
227 | - } |
|
221 | + /** |
|
222 | + * @return bool |
|
223 | + */ |
|
224 | + private function isCronRequest() |
|
225 | + { |
|
226 | + return $this->uriPathMatches('wp-cron.php'); |
|
227 | + } |
|
228 | 228 | |
229 | 229 | |
230 | - /** |
|
231 | - * @return bool |
|
232 | - */ |
|
233 | - private function isFeedRequest() |
|
234 | - { |
|
235 | - return $this->uriPathMatches('feed'); |
|
236 | - } |
|
230 | + /** |
|
231 | + * @return bool |
|
232 | + */ |
|
233 | + private function isFeedRequest() |
|
234 | + { |
|
235 | + return $this->uriPathMatches('feed'); |
|
236 | + } |
|
237 | 237 | |
238 | 238 | |
239 | - /** |
|
240 | - * @param string $component |
|
241 | - * @return bool |
|
242 | - */ |
|
243 | - private function uriPathMatches($component) |
|
244 | - { |
|
245 | - $request_uri = $this->request->requestUri(true); |
|
246 | - $parts = explode('?', $request_uri); |
|
247 | - $path = trim(reset($parts), '/'); |
|
248 | - return strpos($path, $component) === 0; |
|
249 | - } |
|
239 | + /** |
|
240 | + * @param string $component |
|
241 | + * @return bool |
|
242 | + */ |
|
243 | + private function uriPathMatches($component) |
|
244 | + { |
|
245 | + $request_uri = $this->request->requestUri(true); |
|
246 | + $parts = explode('?', $request_uri); |
|
247 | + $path = trim(reset($parts), '/'); |
|
248 | + return strpos($path, $component) === 0; |
|
249 | + } |
|
250 | 250 | |
251 | 251 | |
252 | - /** |
|
253 | - * @return bool |
|
254 | - */ |
|
255 | - private function isIframeRoute() |
|
256 | - { |
|
257 | - $is_iframe_route = apply_filters( |
|
258 | - 'FHEE__EventEspresso_core_domain_services_contexts_RequestTypeContextDetector__isIframeRoute', |
|
259 | - $this->request->getRequestParam('event_list', '') === 'iframe' |
|
260 | - || $this->request->getRequestParam('ticket_selector', '') === 'iframe' |
|
261 | - || $this->request->getRequestParam('calendar', '') === 'iframe', |
|
262 | - $this |
|
263 | - ); |
|
264 | - return filter_var($is_iframe_route, FILTER_VALIDATE_BOOLEAN); |
|
265 | - } |
|
252 | + /** |
|
253 | + * @return bool |
|
254 | + */ |
|
255 | + private function isIframeRoute() |
|
256 | + { |
|
257 | + $is_iframe_route = apply_filters( |
|
258 | + 'FHEE__EventEspresso_core_domain_services_contexts_RequestTypeContextDetector__isIframeRoute', |
|
259 | + $this->request->getRequestParam('event_list', '') === 'iframe' |
|
260 | + || $this->request->getRequestParam('ticket_selector', '') === 'iframe' |
|
261 | + || $this->request->getRequestParam('calendar', '') === 'iframe', |
|
262 | + $this |
|
263 | + ); |
|
264 | + return filter_var($is_iframe_route, FILTER_VALIDATE_BOOLEAN); |
|
265 | + } |
|
266 | 266 | } |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | */ |
64 | 64 | private function getGlobalRouteCondition($globalRouteCondition, $default) |
65 | 65 | { |
66 | - return isset($this->globalRouteConditions[ $globalRouteCondition ]) |
|
67 | - ? $this->globalRouteConditions[ $globalRouteCondition ] |
|
66 | + return isset($this->globalRouteConditions[$globalRouteCondition]) |
|
67 | + ? $this->globalRouteConditions[$globalRouteCondition] |
|
68 | 68 | : $default; |
69 | 69 | } |
70 | 70 | |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | // Check for URLs like http://mysite.com/?rest_route=/ee... and http://mysite.com/wp-json/ee/... |
181 | 181 | return strpos( |
182 | 182 | $this->request->getRequestParam('rest_route', false), |
183 | - '/' . Domain::API_NAMESPACE |
|
183 | + '/'.Domain::API_NAMESPACE |
|
184 | 184 | ) === 0 |
185 | - || $this->uriPathMatches(trim(rest_get_url_prefix(), '/') . '/' . Domain::API_NAMESPACE); |
|
185 | + || $this->uriPathMatches(trim(rest_get_url_prefix(), '/').'/'.Domain::API_NAMESPACE); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | private function isEspressoGraphQLRequest() |
195 | 195 | { |
196 | 196 | try { |
197 | - require_once EE_THIRD_PARTY . 'wp-graphql/access-functions.php'; |
|
197 | + require_once EE_THIRD_PARTY.'wp-graphql/access-functions.php'; |
|
198 | 198 | $endpoint = get_graphql_setting( |
199 | 199 | 'graphql_endpoint', |
200 | 200 | apply_filters('graphql_endpoint', RequestTypeContext::GQL) |