@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use EventEspresso\core\services\container\exceptions\InstantiationException; |
7 | 7 | |
8 | 8 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
9 | - exit('No direct script access allowed'); |
|
9 | + exit('No direct script access allowed'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | |
@@ -23,165 +23,165 @@ discard block |
||
23 | 23 | abstract class CoffeeMaker implements CoffeeMakerInterface |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * Indicates that CoffeeMaker should construct a NEW entity instance from the provided arguments (if given) |
|
28 | - */ |
|
29 | - const BREW_NEW = 'new'; |
|
30 | - |
|
31 | - /** |
|
32 | - * Indicates that CoffeeMaker should always return a SHARED instance |
|
33 | - */ |
|
34 | - const BREW_SHARED = 'shared'; |
|
35 | - |
|
36 | - /** |
|
37 | - * Indicates that CoffeeMaker should only load the file/class/interface but NOT instantiate |
|
38 | - */ |
|
39 | - const BREW_LOAD_ONLY = 'load_only'; |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * @var CoffeePotInterface $coffee_pot |
|
44 | - */ |
|
45 | - private $coffee_pot; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var DependencyInjector $injector |
|
49 | - */ |
|
50 | - private $injector; |
|
51 | - |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * @return array |
|
56 | - */ |
|
57 | - public static function getTypes() |
|
58 | - { |
|
59 | - return (array)apply_filters( |
|
60 | - 'FHEE__EventEspresso\core\services\container\CoffeeMaker__getTypes', |
|
61 | - array( |
|
62 | - CoffeeMaker::BREW_NEW, |
|
63 | - CoffeeMaker::BREW_SHARED, |
|
64 | - CoffeeMaker::BREW_LOAD_ONLY, |
|
65 | - ) |
|
66 | - ); |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * @param $type |
|
73 | - * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
|
74 | - */ |
|
75 | - public static function validateType($type) |
|
76 | - { |
|
77 | - $types = CoffeeMaker::getTypes(); |
|
78 | - if ( ! in_array($type, $types, true)) { |
|
79 | - throw new InvalidIdentifierException( |
|
80 | - is_object($type) ? get_class($type) : gettype($type), |
|
81 | - __( |
|
82 | - 'recipe type (one of the class constants on \EventEspresso\core\services\container\CoffeeMaker)', |
|
83 | - 'event_espresso' |
|
84 | - ) |
|
85 | - ); |
|
86 | - } |
|
87 | - return $type; |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * CoffeeMaker constructor. |
|
94 | - * |
|
95 | - * @param CoffeePotInterface $coffee_pot |
|
96 | - * @param InjectorInterface $injector |
|
97 | - */ |
|
98 | - public function __construct(CoffeePotInterface $coffee_pot, InjectorInterface $injector) |
|
99 | - { |
|
100 | - $this->coffee_pot = $coffee_pot; |
|
101 | - $this->injector = $injector; |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * @return \EventEspresso\core\services\container\CoffeePotInterface |
|
108 | - */ |
|
109 | - protected function coffeePot() |
|
110 | - { |
|
111 | - return $this->coffee_pot; |
|
112 | - } |
|
113 | - |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * @return \EventEspresso\core\services\container\DependencyInjector |
|
118 | - */ |
|
119 | - protected function injector() |
|
120 | - { |
|
121 | - return $this->injector; |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * Examines the constructor to determine which method should be used for instantiation |
|
128 | - * |
|
129 | - * @param \ReflectionClass $reflector |
|
130 | - * @return mixed |
|
131 | - * @throws InstantiationException |
|
132 | - */ |
|
133 | - protected function resolveInstantiationMethod(\ReflectionClass $reflector) |
|
134 | - { |
|
135 | - if ($reflector->getConstructor() === null) { |
|
136 | - return 'NewInstance'; |
|
137 | - } |
|
138 | - if ($reflector->isInstantiable()) { |
|
139 | - return 'NewInstanceArgs'; |
|
140 | - } |
|
141 | - if (method_exists($reflector->getName(), 'instance')) { |
|
142 | - return 'instance'; |
|
143 | - } |
|
144 | - if (method_exists($reflector->getName(), 'new_instance')) { |
|
145 | - return 'new_instance'; |
|
146 | - } |
|
147 | - if (method_exists($reflector->getName(), 'new_instance_from_db')) { |
|
148 | - return 'new_instance_from_db'; |
|
149 | - } |
|
150 | - throw new InstantiationException($reflector->getName()); |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - |
|
155 | - /** |
|
156 | - * Ensures files for classes that are not PSR-4 compatible are loaded |
|
157 | - * and then verifies that classes exist where applicable |
|
158 | - * |
|
159 | - * @param RecipeInterface $recipe |
|
160 | - * @return bool |
|
161 | - * @throws InvalidClassException |
|
162 | - */ |
|
163 | - protected function resolveClassAndFilepath(RecipeInterface $recipe) |
|
164 | - { |
|
165 | - $paths = $recipe->paths(); |
|
166 | - if ( ! empty($paths)) { |
|
167 | - foreach ($paths as $path) { |
|
168 | - if (strpos($path, '*') === false && is_readable($path)) { |
|
169 | - require_once($path); |
|
170 | - } |
|
171 | - } |
|
172 | - } |
|
173 | - // re: using "false" for class_exists() second param: |
|
174 | - // if a class name is not already known to PHP, then class_exists() will run through |
|
175 | - // all of the registered spl_autoload functions until it either finds the class, |
|
176 | - // or gets to the end of the registered spl_autoload functions. |
|
177 | - // When the second parameter is true, it will also attempt to load the class file, |
|
178 | - // but it will also trigger an error if the class can not be loaded. |
|
179 | - // We don't want that extra error in the mix, so we have set the second param to "false" |
|
180 | - if ($recipe->type() !== CoffeeMaker::BREW_LOAD_ONLY && ! class_exists($recipe->fqcn(), false)) { |
|
181 | - throw new InvalidClassException($recipe->identifier()); |
|
182 | - } |
|
183 | - return true; |
|
184 | - } |
|
26 | + /** |
|
27 | + * Indicates that CoffeeMaker should construct a NEW entity instance from the provided arguments (if given) |
|
28 | + */ |
|
29 | + const BREW_NEW = 'new'; |
|
30 | + |
|
31 | + /** |
|
32 | + * Indicates that CoffeeMaker should always return a SHARED instance |
|
33 | + */ |
|
34 | + const BREW_SHARED = 'shared'; |
|
35 | + |
|
36 | + /** |
|
37 | + * Indicates that CoffeeMaker should only load the file/class/interface but NOT instantiate |
|
38 | + */ |
|
39 | + const BREW_LOAD_ONLY = 'load_only'; |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * @var CoffeePotInterface $coffee_pot |
|
44 | + */ |
|
45 | + private $coffee_pot; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var DependencyInjector $injector |
|
49 | + */ |
|
50 | + private $injector; |
|
51 | + |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * @return array |
|
56 | + */ |
|
57 | + public static function getTypes() |
|
58 | + { |
|
59 | + return (array)apply_filters( |
|
60 | + 'FHEE__EventEspresso\core\services\container\CoffeeMaker__getTypes', |
|
61 | + array( |
|
62 | + CoffeeMaker::BREW_NEW, |
|
63 | + CoffeeMaker::BREW_SHARED, |
|
64 | + CoffeeMaker::BREW_LOAD_ONLY, |
|
65 | + ) |
|
66 | + ); |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * @param $type |
|
73 | + * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
|
74 | + */ |
|
75 | + public static function validateType($type) |
|
76 | + { |
|
77 | + $types = CoffeeMaker::getTypes(); |
|
78 | + if ( ! in_array($type, $types, true)) { |
|
79 | + throw new InvalidIdentifierException( |
|
80 | + is_object($type) ? get_class($type) : gettype($type), |
|
81 | + __( |
|
82 | + 'recipe type (one of the class constants on \EventEspresso\core\services\container\CoffeeMaker)', |
|
83 | + 'event_espresso' |
|
84 | + ) |
|
85 | + ); |
|
86 | + } |
|
87 | + return $type; |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * CoffeeMaker constructor. |
|
94 | + * |
|
95 | + * @param CoffeePotInterface $coffee_pot |
|
96 | + * @param InjectorInterface $injector |
|
97 | + */ |
|
98 | + public function __construct(CoffeePotInterface $coffee_pot, InjectorInterface $injector) |
|
99 | + { |
|
100 | + $this->coffee_pot = $coffee_pot; |
|
101 | + $this->injector = $injector; |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * @return \EventEspresso\core\services\container\CoffeePotInterface |
|
108 | + */ |
|
109 | + protected function coffeePot() |
|
110 | + { |
|
111 | + return $this->coffee_pot; |
|
112 | + } |
|
113 | + |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * @return \EventEspresso\core\services\container\DependencyInjector |
|
118 | + */ |
|
119 | + protected function injector() |
|
120 | + { |
|
121 | + return $this->injector; |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * Examines the constructor to determine which method should be used for instantiation |
|
128 | + * |
|
129 | + * @param \ReflectionClass $reflector |
|
130 | + * @return mixed |
|
131 | + * @throws InstantiationException |
|
132 | + */ |
|
133 | + protected function resolveInstantiationMethod(\ReflectionClass $reflector) |
|
134 | + { |
|
135 | + if ($reflector->getConstructor() === null) { |
|
136 | + return 'NewInstance'; |
|
137 | + } |
|
138 | + if ($reflector->isInstantiable()) { |
|
139 | + return 'NewInstanceArgs'; |
|
140 | + } |
|
141 | + if (method_exists($reflector->getName(), 'instance')) { |
|
142 | + return 'instance'; |
|
143 | + } |
|
144 | + if (method_exists($reflector->getName(), 'new_instance')) { |
|
145 | + return 'new_instance'; |
|
146 | + } |
|
147 | + if (method_exists($reflector->getName(), 'new_instance_from_db')) { |
|
148 | + return 'new_instance_from_db'; |
|
149 | + } |
|
150 | + throw new InstantiationException($reflector->getName()); |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + |
|
155 | + /** |
|
156 | + * Ensures files for classes that are not PSR-4 compatible are loaded |
|
157 | + * and then verifies that classes exist where applicable |
|
158 | + * |
|
159 | + * @param RecipeInterface $recipe |
|
160 | + * @return bool |
|
161 | + * @throws InvalidClassException |
|
162 | + */ |
|
163 | + protected function resolveClassAndFilepath(RecipeInterface $recipe) |
|
164 | + { |
|
165 | + $paths = $recipe->paths(); |
|
166 | + if ( ! empty($paths)) { |
|
167 | + foreach ($paths as $path) { |
|
168 | + if (strpos($path, '*') === false && is_readable($path)) { |
|
169 | + require_once($path); |
|
170 | + } |
|
171 | + } |
|
172 | + } |
|
173 | + // re: using "false" for class_exists() second param: |
|
174 | + // if a class name is not already known to PHP, then class_exists() will run through |
|
175 | + // all of the registered spl_autoload functions until it either finds the class, |
|
176 | + // or gets to the end of the registered spl_autoload functions. |
|
177 | + // When the second parameter is true, it will also attempt to load the class file, |
|
178 | + // but it will also trigger an error if the class can not be loaded. |
|
179 | + // We don't want that extra error in the mix, so we have set the second param to "false" |
|
180 | + if ($recipe->type() !== CoffeeMaker::BREW_LOAD_ONLY && ! class_exists($recipe->fqcn(), false)) { |
|
181 | + throw new InvalidClassException($recipe->identifier()); |
|
182 | + } |
|
183 | + return true; |
|
184 | + } |
|
185 | 185 | |
186 | 186 | |
187 | 187 |
@@ -83,7 +83,7 @@ |
||
83 | 83 | { |
84 | 84 | espresso_load_required( |
85 | 85 | 'EE_Request', |
86 | - EE_CORE . 'request_stack' . DS . 'EE_Request.core.php' |
|
86 | + EE_CORE.'request_stack'.DS.'EE_Request.core.php' |
|
87 | 87 | ); |
88 | 88 | $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
89 | 89 | $this->legacy_request->setRequest($this->request); |
@@ -29,81 +29,81 @@ |
||
29 | 29 | class BootstrapRequestResponseObjects |
30 | 30 | { |
31 | 31 | |
32 | - /** |
|
33 | - * @type LegacyRequestInterface $legacy_request |
|
34 | - */ |
|
35 | - protected $legacy_request; |
|
36 | - |
|
37 | - /** |
|
38 | - * @type LoaderInterface $loader |
|
39 | - */ |
|
40 | - protected $loader; |
|
41 | - |
|
42 | - /** |
|
43 | - * @var RequestInterface $request |
|
44 | - */ |
|
45 | - protected $request; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var ResponseInterface $response |
|
49 | - */ |
|
50 | - protected $response; |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * BootstrapRequestResponseObjects constructor. |
|
55 | - * |
|
56 | - * @param LoaderInterface $loader |
|
57 | - */ |
|
58 | - public function __construct(LoaderInterface $loader) |
|
59 | - { |
|
60 | - $this->loader = $loader; |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * @return void |
|
66 | - */ |
|
67 | - public function buildRequestResponse() |
|
68 | - { |
|
69 | - // load our Request and Response objects |
|
70 | - $this->request = new Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
71 | - $this->response = new Response(); |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * @return void |
|
77 | - * @throws InvalidArgumentException |
|
78 | - */ |
|
79 | - public function shareRequestResponse() |
|
80 | - { |
|
81 | - $this->loader->share('EventEspresso\core\services\request\Request', $this->request); |
|
82 | - $this->loader->share('EventEspresso\core\services\request\Response', $this->response); |
|
83 | - EE_Dependency_Map::instance()->setRequest($this->request); |
|
84 | - EE_Dependency_Map::instance()->setResponse($this->response); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * @return void |
|
90 | - * @throws InvalidArgumentException |
|
91 | - * @throws EE_Error |
|
92 | - */ |
|
93 | - public function setupLegacyRequest() |
|
94 | - { |
|
95 | - espresso_load_required( |
|
96 | - 'EE_Request', |
|
97 | - EE_CORE . 'request_stack' . DS . 'EE_Request.core.php' |
|
98 | - ); |
|
99 | - $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
100 | - $this->legacy_request->setRequest($this->request); |
|
101 | - $this->legacy_request->admin = $this->request->isAdmin(); |
|
102 | - $this->legacy_request->ajax = $this->request->isAjax(); |
|
103 | - $this->legacy_request->front_ajax = $this->request->isFrontAjax(); |
|
104 | - EE_Dependency_Map::instance()->setLegacyRequest($this->legacy_request); |
|
105 | - $this->loader->share('EE_Request', $this->legacy_request); |
|
106 | - $this->loader->share('EventEspresso\core\services\request\LegacyRequestInterface', $this->legacy_request); |
|
107 | - } |
|
32 | + /** |
|
33 | + * @type LegacyRequestInterface $legacy_request |
|
34 | + */ |
|
35 | + protected $legacy_request; |
|
36 | + |
|
37 | + /** |
|
38 | + * @type LoaderInterface $loader |
|
39 | + */ |
|
40 | + protected $loader; |
|
41 | + |
|
42 | + /** |
|
43 | + * @var RequestInterface $request |
|
44 | + */ |
|
45 | + protected $request; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var ResponseInterface $response |
|
49 | + */ |
|
50 | + protected $response; |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * BootstrapRequestResponseObjects constructor. |
|
55 | + * |
|
56 | + * @param LoaderInterface $loader |
|
57 | + */ |
|
58 | + public function __construct(LoaderInterface $loader) |
|
59 | + { |
|
60 | + $this->loader = $loader; |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * @return void |
|
66 | + */ |
|
67 | + public function buildRequestResponse() |
|
68 | + { |
|
69 | + // load our Request and Response objects |
|
70 | + $this->request = new Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
71 | + $this->response = new Response(); |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * @return void |
|
77 | + * @throws InvalidArgumentException |
|
78 | + */ |
|
79 | + public function shareRequestResponse() |
|
80 | + { |
|
81 | + $this->loader->share('EventEspresso\core\services\request\Request', $this->request); |
|
82 | + $this->loader->share('EventEspresso\core\services\request\Response', $this->response); |
|
83 | + EE_Dependency_Map::instance()->setRequest($this->request); |
|
84 | + EE_Dependency_Map::instance()->setResponse($this->response); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * @return void |
|
90 | + * @throws InvalidArgumentException |
|
91 | + * @throws EE_Error |
|
92 | + */ |
|
93 | + public function setupLegacyRequest() |
|
94 | + { |
|
95 | + espresso_load_required( |
|
96 | + 'EE_Request', |
|
97 | + EE_CORE . 'request_stack' . DS . 'EE_Request.core.php' |
|
98 | + ); |
|
99 | + $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
100 | + $this->legacy_request->setRequest($this->request); |
|
101 | + $this->legacy_request->admin = $this->request->isAdmin(); |
|
102 | + $this->legacy_request->ajax = $this->request->isAjax(); |
|
103 | + $this->legacy_request->front_ajax = $this->request->isFrontAjax(); |
|
104 | + EE_Dependency_Map::instance()->setLegacyRequest($this->legacy_request); |
|
105 | + $this->loader->share('EE_Request', $this->legacy_request); |
|
106 | + $this->loader->share('EventEspresso\core\services\request\LegacyRequestInterface', $this->legacy_request); |
|
107 | + } |
|
108 | 108 | } |
109 | 109 |
@@ -67,13 +67,13 @@ |
||
67 | 67 | // EE_Dependency_Map: info about how to load classes required by other classes |
68 | 68 | espresso_load_required( |
69 | 69 | 'EE_Dependency_Map', |
70 | - EE_CORE . 'EE_Dependency_Map.core.php' |
|
70 | + EE_CORE.'EE_Dependency_Map.core.php' |
|
71 | 71 | ); |
72 | 72 | $this->dependency_map = EE_Dependency_Map::instance(); |
73 | 73 | // EE_Registry: central repository for classes (legacy) |
74 | 74 | espresso_load_required( |
75 | 75 | 'EE_Registry', |
76 | - EE_CORE . 'EE_Registry.core.php' |
|
76 | + EE_CORE.'EE_Registry.core.php' |
|
77 | 77 | ); |
78 | 78 | $this->registry = EE_Registry::instance($this->dependency_map); |
79 | 79 | } |
@@ -26,98 +26,98 @@ |
||
26 | 26 | class BootstrapDependencyInjectionContainer |
27 | 27 | { |
28 | 28 | |
29 | - /** |
|
30 | - * @var EE_Dependency_Map $dependency_map |
|
31 | - */ |
|
32 | - protected $dependency_map; |
|
33 | - |
|
34 | - /** |
|
35 | - * @type LoaderInterface $loader |
|
36 | - */ |
|
37 | - protected $loader; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var EE_Registry $registry |
|
41 | - */ |
|
42 | - protected $registry; |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * Can't use this just yet until we exorcise some more of our singleton usage from core |
|
47 | - */ |
|
48 | - public function buildDependencyInjectionContainer() |
|
49 | - { |
|
50 | - // build DI container |
|
51 | - // $OpenCoffeeShop = new EventEspresso\core\services\container\OpenCoffeeShop(); |
|
52 | - // $OpenCoffeeShop->addRecipes(); |
|
53 | - // $CoffeeShop = $OpenCoffeeShop->CoffeeShop(); |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * Setups EE_Registry and EE_Dependency_Map |
|
59 | - * |
|
60 | - * @throws EE_Error |
|
61 | - * @throws InvalidDataTypeException |
|
62 | - * @throws InvalidInterfaceException |
|
63 | - * @throws InvalidArgumentException |
|
64 | - */ |
|
65 | - public function buildLegacyDependencyInjectionContainer() |
|
66 | - { |
|
67 | - // EE_Dependency_Map: info about how to load classes required by other classes |
|
68 | - espresso_load_required( |
|
69 | - 'EE_Dependency_Map', |
|
70 | - EE_CORE . 'EE_Dependency_Map.core.php' |
|
71 | - ); |
|
72 | - $this->dependency_map = EE_Dependency_Map::instance(); |
|
73 | - // EE_Registry: central repository for classes (legacy) |
|
74 | - espresso_load_required( |
|
75 | - 'EE_Registry', |
|
76 | - EE_CORE . 'EE_Registry.core.php' |
|
77 | - ); |
|
78 | - $this->registry = EE_Registry::instance($this->dependency_map); |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - /** |
|
83 | - * Performs initial setup for the generic Loader |
|
84 | - * |
|
85 | - * @throws InvalidDataTypeException |
|
86 | - * @throws InvalidInterfaceException |
|
87 | - * @throws InvalidArgumentException |
|
88 | - */ |
|
89 | - public function buildLoader() |
|
90 | - { |
|
91 | - $this->loader = LoaderFactory::getLoader($this->registry); |
|
92 | - $this->dependency_map->setLoader($this->loader); |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * @return EE_Dependency_Map |
|
98 | - */ |
|
99 | - public function getDependencyMap() |
|
100 | - { |
|
101 | - return $this->dependency_map; |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * @return EE_Registry |
|
107 | - */ |
|
108 | - public function getRegistry() |
|
109 | - { |
|
110 | - return $this->registry; |
|
111 | - } |
|
112 | - |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * @return LoaderInterface |
|
117 | - */ |
|
118 | - public function getLoader() |
|
119 | - { |
|
120 | - return $this->loader; |
|
121 | - } |
|
29 | + /** |
|
30 | + * @var EE_Dependency_Map $dependency_map |
|
31 | + */ |
|
32 | + protected $dependency_map; |
|
33 | + |
|
34 | + /** |
|
35 | + * @type LoaderInterface $loader |
|
36 | + */ |
|
37 | + protected $loader; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var EE_Registry $registry |
|
41 | + */ |
|
42 | + protected $registry; |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * Can't use this just yet until we exorcise some more of our singleton usage from core |
|
47 | + */ |
|
48 | + public function buildDependencyInjectionContainer() |
|
49 | + { |
|
50 | + // build DI container |
|
51 | + // $OpenCoffeeShop = new EventEspresso\core\services\container\OpenCoffeeShop(); |
|
52 | + // $OpenCoffeeShop->addRecipes(); |
|
53 | + // $CoffeeShop = $OpenCoffeeShop->CoffeeShop(); |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * Setups EE_Registry and EE_Dependency_Map |
|
59 | + * |
|
60 | + * @throws EE_Error |
|
61 | + * @throws InvalidDataTypeException |
|
62 | + * @throws InvalidInterfaceException |
|
63 | + * @throws InvalidArgumentException |
|
64 | + */ |
|
65 | + public function buildLegacyDependencyInjectionContainer() |
|
66 | + { |
|
67 | + // EE_Dependency_Map: info about how to load classes required by other classes |
|
68 | + espresso_load_required( |
|
69 | + 'EE_Dependency_Map', |
|
70 | + EE_CORE . 'EE_Dependency_Map.core.php' |
|
71 | + ); |
|
72 | + $this->dependency_map = EE_Dependency_Map::instance(); |
|
73 | + // EE_Registry: central repository for classes (legacy) |
|
74 | + espresso_load_required( |
|
75 | + 'EE_Registry', |
|
76 | + EE_CORE . 'EE_Registry.core.php' |
|
77 | + ); |
|
78 | + $this->registry = EE_Registry::instance($this->dependency_map); |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + /** |
|
83 | + * Performs initial setup for the generic Loader |
|
84 | + * |
|
85 | + * @throws InvalidDataTypeException |
|
86 | + * @throws InvalidInterfaceException |
|
87 | + * @throws InvalidArgumentException |
|
88 | + */ |
|
89 | + public function buildLoader() |
|
90 | + { |
|
91 | + $this->loader = LoaderFactory::getLoader($this->registry); |
|
92 | + $this->dependency_map->setLoader($this->loader); |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * @return EE_Dependency_Map |
|
98 | + */ |
|
99 | + public function getDependencyMap() |
|
100 | + { |
|
101 | + return $this->dependency_map; |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * @return EE_Registry |
|
107 | + */ |
|
108 | + public function getRegistry() |
|
109 | + { |
|
110 | + return $this->registry; |
|
111 | + } |
|
112 | + |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * @return LoaderInterface |
|
117 | + */ |
|
118 | + public function getLoader() |
|
119 | + { |
|
120 | + return $this->loader; |
|
121 | + } |
|
122 | 122 | |
123 | 123 | } |
@@ -19,11 +19,11 @@ |
||
19 | 19 | * @param EE_Response $response |
20 | 20 | * @return EE_Response |
21 | 21 | */ |
22 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
22 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
23 | 23 | $this->_request = $request; |
24 | 24 | $this->_response = $response; |
25 | 25 | $this->display_alpha_banner_warning(); |
26 | - $this->_response = $this->process_request_stack( $this->_request, $this->_response ); |
|
26 | + $this->_response = $this->process_request_stack($this->_request, $this->_response); |
|
27 | 27 | return $this->_response; |
28 | 28 | } |
29 | 29 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
17 | - * @deprecated 4.9.53 |
|
17 | + * @deprecated 4.9.53 |
|
18 | 18 | * @param EE_Request $request |
19 | 19 | * @param EE_Response $response |
20 | 20 | * @return EE_Response |
@@ -30,71 +30,71 @@ discard block |
||
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
33 | - * @deprecated |
|
34 | - * @return string |
|
33 | + * @deprecated |
|
34 | + * @return string |
|
35 | 35 | */ |
36 | 36 | public function display_alpha_banner_warning() { |
37 | - EE_Error::doing_it_wrong( |
|
38 | - __METHOD__, |
|
39 | - sprintf( |
|
40 | - esc_html__( |
|
41 | - 'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
42 | - 'event_espresso' |
|
43 | - ), |
|
44 | - 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::displayPreProductionVersionWarning()', |
|
45 | - '\core\services\request', |
|
46 | - 'EventEspresso\core\services\request' |
|
47 | - ), |
|
48 | - '4.9.52', |
|
49 | - '4.10.0' |
|
50 | - ); |
|
51 | - } |
|
37 | + EE_Error::doing_it_wrong( |
|
38 | + __METHOD__, |
|
39 | + sprintf( |
|
40 | + esc_html__( |
|
41 | + 'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
42 | + 'event_espresso' |
|
43 | + ), |
|
44 | + 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::displayPreProductionVersionWarning()', |
|
45 | + '\core\services\request', |
|
46 | + 'EventEspresso\core\services\request' |
|
47 | + ), |
|
48 | + '4.9.52', |
|
49 | + '4.10.0' |
|
50 | + ); |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | 55 | /** |
56 | - * @deprecated |
|
57 | - * @return void |
|
56 | + * @deprecated |
|
57 | + * @return void |
|
58 | 58 | */ |
59 | 59 | public function alpha_banner_admin_notice() { |
60 | - EE_Error::doing_it_wrong( |
|
61 | - __METHOD__, |
|
62 | - sprintf( |
|
63 | - esc_html__( |
|
64 | - 'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
65 | - 'event_espresso' |
|
66 | - ), |
|
67 | - 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::preProductionVersionAdminNotice()', |
|
68 | - '\core\services\request', |
|
69 | - 'EventEspresso\core\services\request' |
|
70 | - ), |
|
71 | - '4.9.52', |
|
72 | - '4.10.0' |
|
73 | - ); |
|
74 | - } |
|
60 | + EE_Error::doing_it_wrong( |
|
61 | + __METHOD__, |
|
62 | + sprintf( |
|
63 | + esc_html__( |
|
64 | + 'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
65 | + 'event_espresso' |
|
66 | + ), |
|
67 | + 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::preProductionVersionAdminNotice()', |
|
68 | + '\core\services\request', |
|
69 | + 'EventEspresso\core\services\request' |
|
70 | + ), |
|
71 | + '4.9.52', |
|
72 | + '4.10.0' |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | 77 | |
78 | 78 | /** |
79 | - * @deprecated |
|
80 | - * @return void |
|
79 | + * @deprecated |
|
80 | + * @return void |
|
81 | 81 | */ |
82 | 82 | public function alpha_banner_warning_notice() { |
83 | - EE_Error::doing_it_wrong( |
|
84 | - __METHOD__, |
|
85 | - sprintf( |
|
86 | - esc_html__( |
|
87 | - 'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
88 | - 'event_espresso' |
|
89 | - ), |
|
90 | - 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::preProductionVersionWarningNotice()', |
|
91 | - '\core\services\request', |
|
92 | - 'EventEspresso\core\services\request' |
|
93 | - ), |
|
94 | - '4.9.52', |
|
95 | - '4.10.0' |
|
96 | - ); |
|
97 | - } |
|
83 | + EE_Error::doing_it_wrong( |
|
84 | + __METHOD__, |
|
85 | + sprintf( |
|
86 | + esc_html__( |
|
87 | + 'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
88 | + 'event_espresso' |
|
89 | + ), |
|
90 | + 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning::preProductionVersionWarningNotice()', |
|
91 | + '\core\services\request', |
|
92 | + 'EventEspresso\core\services\request' |
|
93 | + ), |
|
94 | + '4.9.52', |
|
95 | + '4.10.0' |
|
96 | + ); |
|
97 | + } |
|
98 | 98 | |
99 | 99 | |
100 | 100 | } |
@@ -69,7 +69,7 @@ |
||
69 | 69 | */ |
70 | 70 | private function request() |
71 | 71 | { |
72 | - if($this->request instanceof RequestInterface){ |
|
72 | + if ($this->request instanceof RequestInterface) { |
|
73 | 73 | return $this->request; |
74 | 74 | } |
75 | 75 | $loader = LoaderFactory::getLoader(); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @deprecated 4.9.53 |
183 | 183 | * @param $key |
184 | - * @param null $default |
|
184 | + * @param null|string $default |
|
185 | 185 | * @return mixed |
186 | 186 | * @throws InvalidArgumentException |
187 | 187 | * @throws InvalidDataTypeException |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | /** |
258 | 258 | * @deprecated 4.9.53 |
259 | - * @return mixed |
|
259 | + * @return boolean |
|
260 | 260 | * @throws InvalidArgumentException |
261 | 261 | * @throws InvalidDataTypeException |
262 | 262 | * @throws InvalidInterfaceException |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | |
270 | 270 | /** |
271 | 271 | * @deprecated 4.9.53 |
272 | - * @return mixed |
|
272 | + * @return boolean |
|
273 | 273 | * @throws InvalidArgumentException |
274 | 274 | * @throws InvalidDataTypeException |
275 | 275 | * @throws InvalidInterfaceException |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | /** |
284 | 284 | * @deprecated 4.9.53 |
285 | - * @return mixed|string |
|
285 | + * @return string |
|
286 | 286 | * @throws InvalidArgumentException |
287 | 287 | * @throws InvalidDataTypeException |
288 | 288 | * @throws InvalidInterfaceException |
@@ -22,331 +22,331 @@ |
||
22 | 22 | class EE_Request implements LegacyRequestInterface, InterminableInterface |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * @var RequestInterface $request |
|
27 | - */ |
|
28 | - private $request; |
|
29 | - |
|
30 | - /** |
|
31 | - * whether current request is for the admin but NOT via AJAX |
|
32 | - * |
|
33 | - * @var boolean $admin |
|
34 | - */ |
|
35 | - public $admin = false; |
|
36 | - |
|
37 | - /** |
|
38 | - * whether current request is via AJAX |
|
39 | - * |
|
40 | - * @var boolean $ajax |
|
41 | - */ |
|
42 | - public $ajax = false; |
|
43 | - |
|
44 | - /** |
|
45 | - * whether current request is via AJAX from the frontend of the site |
|
46 | - * |
|
47 | - * @var boolean $front_ajax |
|
48 | - */ |
|
49 | - public $front_ajax = false; |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * @deprecated 4.9.53 |
|
54 | - * @param array $get |
|
55 | - * @param array $post |
|
56 | - * @param array $cookie |
|
57 | - * @param array $server |
|
58 | - */ |
|
59 | - public function __construct( |
|
60 | - array $get = array(), |
|
61 | - array $post = array(), |
|
62 | - array $cookie = array(), |
|
63 | - array $server = array() |
|
64 | - ) { |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * @return RequestInterface |
|
70 | - * @throws InvalidArgumentException |
|
71 | - * @throws InvalidInterfaceException |
|
72 | - * @throws InvalidDataTypeException |
|
73 | - */ |
|
74 | - private function request() |
|
75 | - { |
|
76 | - if($this->request instanceof RequestInterface){ |
|
77 | - return $this->request; |
|
78 | - } |
|
79 | - $loader = LoaderFactory::getLoader(); |
|
80 | - $this->request = $loader->getShared('EventEspresso\core\services\request\RequestInterface'); |
|
81 | - return $this->request; |
|
82 | - } |
|
83 | - |
|
84 | - |
|
85 | - /** |
|
86 | - * @param RequestInterface $request |
|
87 | - */ |
|
88 | - public function setRequest(RequestInterface $request) |
|
89 | - { |
|
90 | - $this->request = $request; |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - |
|
95 | - /** |
|
96 | - * @deprecated 4.9.53 |
|
97 | - * @return array |
|
98 | - * @throws InvalidArgumentException |
|
99 | - * @throws InvalidDataTypeException |
|
100 | - * @throws InvalidInterfaceException |
|
101 | - */ |
|
102 | - public function get_params() |
|
103 | - { |
|
104 | - return $this->request()->getParams(); |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @deprecated 4.9.53 |
|
111 | - * @return array |
|
112 | - * @throws InvalidArgumentException |
|
113 | - * @throws InvalidDataTypeException |
|
114 | - * @throws InvalidInterfaceException |
|
115 | - */ |
|
116 | - public function post_params() |
|
117 | - { |
|
118 | - return $this->request()->postParams(); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - |
|
123 | - /** |
|
124 | - * @deprecated 4.9.53 |
|
125 | - * @return array |
|
126 | - * @throws InvalidArgumentException |
|
127 | - * @throws InvalidDataTypeException |
|
128 | - * @throws InvalidInterfaceException |
|
129 | - */ |
|
130 | - public function cookie_params() |
|
131 | - { |
|
132 | - return $this->request()->cookieParams(); |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * @deprecated 4.9.53 |
|
138 | - * @return array |
|
139 | - * @throws InvalidArgumentException |
|
140 | - * @throws InvalidDataTypeException |
|
141 | - * @throws InvalidInterfaceException |
|
142 | - */ |
|
143 | - public function server_params() |
|
144 | - { |
|
145 | - return $this->request()->serverParams(); |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * returns contents of $_REQUEST |
|
152 | - * |
|
153 | - * @deprecated 4.9.53 |
|
154 | - * @return array |
|
155 | - * @throws InvalidArgumentException |
|
156 | - * @throws InvalidDataTypeException |
|
157 | - * @throws InvalidInterfaceException |
|
158 | - */ |
|
159 | - public function params() |
|
160 | - { |
|
161 | - return $this->request()->requestParams(); |
|
162 | - } |
|
163 | - |
|
164 | - |
|
165 | - |
|
166 | - /** |
|
167 | - * @deprecated 4.9.53 |
|
168 | - * @param $key |
|
169 | - * @param $value |
|
170 | - * @param bool $override_ee |
|
171 | - * @return void |
|
172 | - * @throws InvalidArgumentException |
|
173 | - * @throws InvalidDataTypeException |
|
174 | - * @throws InvalidInterfaceException |
|
175 | - */ |
|
176 | - public function set($key, $value, $override_ee = false) |
|
177 | - { |
|
178 | - $this->request()->setRequestParam($key, $value, $override_ee); |
|
179 | - } |
|
180 | - |
|
181 | - |
|
182 | - |
|
183 | - /** |
|
184 | - * returns the value for a request param if the given key exists |
|
185 | - * |
|
186 | - * @deprecated 4.9.53 |
|
187 | - * @param $key |
|
188 | - * @param null $default |
|
189 | - * @return mixed |
|
190 | - * @throws InvalidArgumentException |
|
191 | - * @throws InvalidDataTypeException |
|
192 | - * @throws InvalidInterfaceException |
|
193 | - */ |
|
194 | - public function get($key, $default = null) |
|
195 | - { |
|
196 | - return $this->request()->getRequestParam($key, $default); |
|
197 | - } |
|
198 | - |
|
199 | - |
|
200 | - |
|
201 | - /** |
|
202 | - * check if param exists |
|
203 | - * |
|
204 | - * @deprecated 4.9.53 |
|
205 | - * @param $key |
|
206 | - * @return bool |
|
207 | - * @throws InvalidArgumentException |
|
208 | - * @throws InvalidDataTypeException |
|
209 | - * @throws InvalidInterfaceException |
|
210 | - */ |
|
211 | - public function is_set($key) |
|
212 | - { |
|
213 | - return $this->request()->requestParamIsSet($key); |
|
214 | - } |
|
215 | - |
|
216 | - |
|
217 | - |
|
218 | - /** |
|
219 | - * remove param |
|
220 | - * |
|
221 | - * @deprecated 4.9.53 |
|
222 | - * @param $key |
|
223 | - * @param bool $unset_from_global_too |
|
224 | - * @throws InvalidArgumentException |
|
225 | - * @throws InvalidDataTypeException |
|
226 | - * @throws InvalidInterfaceException |
|
227 | - */ |
|
228 | - public function un_set($key, $unset_from_global_too = false) |
|
229 | - { |
|
230 | - $this->request()->unSetRequestParam($key, $unset_from_global_too); |
|
231 | - } |
|
232 | - |
|
233 | - |
|
234 | - |
|
235 | - /** |
|
236 | - * @deprecated 4.9.53 |
|
237 | - * @return string |
|
238 | - * @throws InvalidArgumentException |
|
239 | - * @throws InvalidDataTypeException |
|
240 | - * @throws InvalidInterfaceException |
|
241 | - */ |
|
242 | - public function ip_address() |
|
243 | - { |
|
244 | - return $this->request()->ipAddress(); |
|
245 | - } |
|
246 | - |
|
247 | - |
|
248 | - /** |
|
249 | - * @deprecated 4.9.53 |
|
250 | - * @return bool |
|
251 | - * @throws InvalidArgumentException |
|
252 | - * @throws InvalidDataTypeException |
|
253 | - * @throws InvalidInterfaceException |
|
254 | - */ |
|
255 | - public function isAdmin() |
|
256 | - { |
|
257 | - return $this->request()->isAdmin(); |
|
258 | - } |
|
259 | - |
|
260 | - |
|
261 | - /** |
|
262 | - * @deprecated 4.9.53 |
|
263 | - * @return mixed |
|
264 | - * @throws InvalidArgumentException |
|
265 | - * @throws InvalidDataTypeException |
|
266 | - * @throws InvalidInterfaceException |
|
267 | - */ |
|
268 | - public function isAjax() |
|
269 | - { |
|
270 | - return $this->request()->isAjax(); |
|
271 | - } |
|
272 | - |
|
273 | - |
|
274 | - /** |
|
275 | - * @deprecated 4.9.53 |
|
276 | - * @return mixed |
|
277 | - * @throws InvalidArgumentException |
|
278 | - * @throws InvalidDataTypeException |
|
279 | - * @throws InvalidInterfaceException |
|
280 | - */ |
|
281 | - public function isFrontAjax() |
|
282 | - { |
|
283 | - return $this->request()->isFrontAjax(); |
|
284 | - } |
|
285 | - |
|
286 | - |
|
287 | - /** |
|
288 | - * @deprecated 4.9.53 |
|
289 | - * @return mixed|string |
|
290 | - * @throws InvalidArgumentException |
|
291 | - * @throws InvalidDataTypeException |
|
292 | - * @throws InvalidInterfaceException |
|
293 | - */ |
|
294 | - public function requestUri() |
|
295 | - { |
|
296 | - return $this->request()->requestUri(); |
|
297 | - } |
|
298 | - |
|
299 | - |
|
300 | - /** |
|
301 | - * @deprecated 4.9.53 |
|
302 | - * @return string |
|
303 | - * @throws InvalidArgumentException |
|
304 | - * @throws InvalidDataTypeException |
|
305 | - * @throws InvalidInterfaceException |
|
306 | - */ |
|
307 | - public function userAgent() |
|
308 | - { |
|
309 | - return $this->request()->userAgent(); |
|
310 | - } |
|
311 | - |
|
312 | - |
|
313 | - /** |
|
314 | - * @deprecated 4.9.53 |
|
315 | - * @param string $user_agent |
|
316 | - * @throws InvalidArgumentException |
|
317 | - * @throws InvalidDataTypeException |
|
318 | - * @throws InvalidInterfaceException |
|
319 | - */ |
|
320 | - public function setUserAgent($user_agent = '') |
|
321 | - { |
|
322 | - $this->request()->setUserAgent($user_agent); |
|
323 | - } |
|
324 | - |
|
325 | - |
|
326 | - /** |
|
327 | - * @deprecated 4.9.53 |
|
328 | - * @return bool |
|
329 | - * @throws InvalidArgumentException |
|
330 | - * @throws InvalidDataTypeException |
|
331 | - * @throws InvalidInterfaceException |
|
332 | - */ |
|
333 | - public function isBot() |
|
334 | - { |
|
335 | - return $this->request()->isBot(); |
|
336 | - } |
|
337 | - |
|
338 | - |
|
339 | - /** |
|
340 | - * @deprecated 4.9.53 |
|
341 | - * @param bool $is_bot |
|
342 | - * @throws InvalidArgumentException |
|
343 | - * @throws InvalidDataTypeException |
|
344 | - * @throws InvalidInterfaceException |
|
345 | - */ |
|
346 | - public function setIsBot($is_bot) |
|
347 | - { |
|
348 | - $this->request()->setIsBot($is_bot); |
|
349 | - } |
|
25 | + /** |
|
26 | + * @var RequestInterface $request |
|
27 | + */ |
|
28 | + private $request; |
|
29 | + |
|
30 | + /** |
|
31 | + * whether current request is for the admin but NOT via AJAX |
|
32 | + * |
|
33 | + * @var boolean $admin |
|
34 | + */ |
|
35 | + public $admin = false; |
|
36 | + |
|
37 | + /** |
|
38 | + * whether current request is via AJAX |
|
39 | + * |
|
40 | + * @var boolean $ajax |
|
41 | + */ |
|
42 | + public $ajax = false; |
|
43 | + |
|
44 | + /** |
|
45 | + * whether current request is via AJAX from the frontend of the site |
|
46 | + * |
|
47 | + * @var boolean $front_ajax |
|
48 | + */ |
|
49 | + public $front_ajax = false; |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * @deprecated 4.9.53 |
|
54 | + * @param array $get |
|
55 | + * @param array $post |
|
56 | + * @param array $cookie |
|
57 | + * @param array $server |
|
58 | + */ |
|
59 | + public function __construct( |
|
60 | + array $get = array(), |
|
61 | + array $post = array(), |
|
62 | + array $cookie = array(), |
|
63 | + array $server = array() |
|
64 | + ) { |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * @return RequestInterface |
|
70 | + * @throws InvalidArgumentException |
|
71 | + * @throws InvalidInterfaceException |
|
72 | + * @throws InvalidDataTypeException |
|
73 | + */ |
|
74 | + private function request() |
|
75 | + { |
|
76 | + if($this->request instanceof RequestInterface){ |
|
77 | + return $this->request; |
|
78 | + } |
|
79 | + $loader = LoaderFactory::getLoader(); |
|
80 | + $this->request = $loader->getShared('EventEspresso\core\services\request\RequestInterface'); |
|
81 | + return $this->request; |
|
82 | + } |
|
83 | + |
|
84 | + |
|
85 | + /** |
|
86 | + * @param RequestInterface $request |
|
87 | + */ |
|
88 | + public function setRequest(RequestInterface $request) |
|
89 | + { |
|
90 | + $this->request = $request; |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + |
|
95 | + /** |
|
96 | + * @deprecated 4.9.53 |
|
97 | + * @return array |
|
98 | + * @throws InvalidArgumentException |
|
99 | + * @throws InvalidDataTypeException |
|
100 | + * @throws InvalidInterfaceException |
|
101 | + */ |
|
102 | + public function get_params() |
|
103 | + { |
|
104 | + return $this->request()->getParams(); |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @deprecated 4.9.53 |
|
111 | + * @return array |
|
112 | + * @throws InvalidArgumentException |
|
113 | + * @throws InvalidDataTypeException |
|
114 | + * @throws InvalidInterfaceException |
|
115 | + */ |
|
116 | + public function post_params() |
|
117 | + { |
|
118 | + return $this->request()->postParams(); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + |
|
123 | + /** |
|
124 | + * @deprecated 4.9.53 |
|
125 | + * @return array |
|
126 | + * @throws InvalidArgumentException |
|
127 | + * @throws InvalidDataTypeException |
|
128 | + * @throws InvalidInterfaceException |
|
129 | + */ |
|
130 | + public function cookie_params() |
|
131 | + { |
|
132 | + return $this->request()->cookieParams(); |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * @deprecated 4.9.53 |
|
138 | + * @return array |
|
139 | + * @throws InvalidArgumentException |
|
140 | + * @throws InvalidDataTypeException |
|
141 | + * @throws InvalidInterfaceException |
|
142 | + */ |
|
143 | + public function server_params() |
|
144 | + { |
|
145 | + return $this->request()->serverParams(); |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * returns contents of $_REQUEST |
|
152 | + * |
|
153 | + * @deprecated 4.9.53 |
|
154 | + * @return array |
|
155 | + * @throws InvalidArgumentException |
|
156 | + * @throws InvalidDataTypeException |
|
157 | + * @throws InvalidInterfaceException |
|
158 | + */ |
|
159 | + public function params() |
|
160 | + { |
|
161 | + return $this->request()->requestParams(); |
|
162 | + } |
|
163 | + |
|
164 | + |
|
165 | + |
|
166 | + /** |
|
167 | + * @deprecated 4.9.53 |
|
168 | + * @param $key |
|
169 | + * @param $value |
|
170 | + * @param bool $override_ee |
|
171 | + * @return void |
|
172 | + * @throws InvalidArgumentException |
|
173 | + * @throws InvalidDataTypeException |
|
174 | + * @throws InvalidInterfaceException |
|
175 | + */ |
|
176 | + public function set($key, $value, $override_ee = false) |
|
177 | + { |
|
178 | + $this->request()->setRequestParam($key, $value, $override_ee); |
|
179 | + } |
|
180 | + |
|
181 | + |
|
182 | + |
|
183 | + /** |
|
184 | + * returns the value for a request param if the given key exists |
|
185 | + * |
|
186 | + * @deprecated 4.9.53 |
|
187 | + * @param $key |
|
188 | + * @param null $default |
|
189 | + * @return mixed |
|
190 | + * @throws InvalidArgumentException |
|
191 | + * @throws InvalidDataTypeException |
|
192 | + * @throws InvalidInterfaceException |
|
193 | + */ |
|
194 | + public function get($key, $default = null) |
|
195 | + { |
|
196 | + return $this->request()->getRequestParam($key, $default); |
|
197 | + } |
|
198 | + |
|
199 | + |
|
200 | + |
|
201 | + /** |
|
202 | + * check if param exists |
|
203 | + * |
|
204 | + * @deprecated 4.9.53 |
|
205 | + * @param $key |
|
206 | + * @return bool |
|
207 | + * @throws InvalidArgumentException |
|
208 | + * @throws InvalidDataTypeException |
|
209 | + * @throws InvalidInterfaceException |
|
210 | + */ |
|
211 | + public function is_set($key) |
|
212 | + { |
|
213 | + return $this->request()->requestParamIsSet($key); |
|
214 | + } |
|
215 | + |
|
216 | + |
|
217 | + |
|
218 | + /** |
|
219 | + * remove param |
|
220 | + * |
|
221 | + * @deprecated 4.9.53 |
|
222 | + * @param $key |
|
223 | + * @param bool $unset_from_global_too |
|
224 | + * @throws InvalidArgumentException |
|
225 | + * @throws InvalidDataTypeException |
|
226 | + * @throws InvalidInterfaceException |
|
227 | + */ |
|
228 | + public function un_set($key, $unset_from_global_too = false) |
|
229 | + { |
|
230 | + $this->request()->unSetRequestParam($key, $unset_from_global_too); |
|
231 | + } |
|
232 | + |
|
233 | + |
|
234 | + |
|
235 | + /** |
|
236 | + * @deprecated 4.9.53 |
|
237 | + * @return string |
|
238 | + * @throws InvalidArgumentException |
|
239 | + * @throws InvalidDataTypeException |
|
240 | + * @throws InvalidInterfaceException |
|
241 | + */ |
|
242 | + public function ip_address() |
|
243 | + { |
|
244 | + return $this->request()->ipAddress(); |
|
245 | + } |
|
246 | + |
|
247 | + |
|
248 | + /** |
|
249 | + * @deprecated 4.9.53 |
|
250 | + * @return bool |
|
251 | + * @throws InvalidArgumentException |
|
252 | + * @throws InvalidDataTypeException |
|
253 | + * @throws InvalidInterfaceException |
|
254 | + */ |
|
255 | + public function isAdmin() |
|
256 | + { |
|
257 | + return $this->request()->isAdmin(); |
|
258 | + } |
|
259 | + |
|
260 | + |
|
261 | + /** |
|
262 | + * @deprecated 4.9.53 |
|
263 | + * @return mixed |
|
264 | + * @throws InvalidArgumentException |
|
265 | + * @throws InvalidDataTypeException |
|
266 | + * @throws InvalidInterfaceException |
|
267 | + */ |
|
268 | + public function isAjax() |
|
269 | + { |
|
270 | + return $this->request()->isAjax(); |
|
271 | + } |
|
272 | + |
|
273 | + |
|
274 | + /** |
|
275 | + * @deprecated 4.9.53 |
|
276 | + * @return mixed |
|
277 | + * @throws InvalidArgumentException |
|
278 | + * @throws InvalidDataTypeException |
|
279 | + * @throws InvalidInterfaceException |
|
280 | + */ |
|
281 | + public function isFrontAjax() |
|
282 | + { |
|
283 | + return $this->request()->isFrontAjax(); |
|
284 | + } |
|
285 | + |
|
286 | + |
|
287 | + /** |
|
288 | + * @deprecated 4.9.53 |
|
289 | + * @return mixed|string |
|
290 | + * @throws InvalidArgumentException |
|
291 | + * @throws InvalidDataTypeException |
|
292 | + * @throws InvalidInterfaceException |
|
293 | + */ |
|
294 | + public function requestUri() |
|
295 | + { |
|
296 | + return $this->request()->requestUri(); |
|
297 | + } |
|
298 | + |
|
299 | + |
|
300 | + /** |
|
301 | + * @deprecated 4.9.53 |
|
302 | + * @return string |
|
303 | + * @throws InvalidArgumentException |
|
304 | + * @throws InvalidDataTypeException |
|
305 | + * @throws InvalidInterfaceException |
|
306 | + */ |
|
307 | + public function userAgent() |
|
308 | + { |
|
309 | + return $this->request()->userAgent(); |
|
310 | + } |
|
311 | + |
|
312 | + |
|
313 | + /** |
|
314 | + * @deprecated 4.9.53 |
|
315 | + * @param string $user_agent |
|
316 | + * @throws InvalidArgumentException |
|
317 | + * @throws InvalidDataTypeException |
|
318 | + * @throws InvalidInterfaceException |
|
319 | + */ |
|
320 | + public function setUserAgent($user_agent = '') |
|
321 | + { |
|
322 | + $this->request()->setUserAgent($user_agent); |
|
323 | + } |
|
324 | + |
|
325 | + |
|
326 | + /** |
|
327 | + * @deprecated 4.9.53 |
|
328 | + * @return bool |
|
329 | + * @throws InvalidArgumentException |
|
330 | + * @throws InvalidDataTypeException |
|
331 | + * @throws InvalidInterfaceException |
|
332 | + */ |
|
333 | + public function isBot() |
|
334 | + { |
|
335 | + return $this->request()->isBot(); |
|
336 | + } |
|
337 | + |
|
338 | + |
|
339 | + /** |
|
340 | + * @deprecated 4.9.53 |
|
341 | + * @param bool $is_bot |
|
342 | + * @throws InvalidArgumentException |
|
343 | + * @throws InvalidDataTypeException |
|
344 | + * @throws InvalidInterfaceException |
|
345 | + */ |
|
346 | + public function setIsBot($is_bot) |
|
347 | + { |
|
348 | + $this->request()->setIsBot($is_bot); |
|
349 | + } |
|
350 | 350 | |
351 | 351 | |
352 | 352 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | /** |
50 | 50 | * @deprecated 4.9.53 |
51 | 51 | */ |
52 | - public function resolve( EEI_Request_Decorator $application ) { |
|
52 | + public function resolve(EEI_Request_Decorator $application) { |
|
53 | 53 | } |
54 | 54 | |
55 | 55 |
@@ -15,45 +15,45 @@ |
||
15 | 15 | */ |
16 | 16 | class EE_Request_Stack_Builder { |
17 | 17 | |
18 | - /** |
|
19 | - * EE_Request_Stack_Builder |
|
20 | - */ |
|
21 | - public function __construct() |
|
22 | - { |
|
23 | - EE_Error::doing_it_wrong( |
|
24 | - __METHOD__, |
|
25 | - sprintf( |
|
26 | - esc_html__( |
|
27 | - 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
28 | - 'event_espresso' |
|
29 | - ), |
|
30 | - 'EventEspresso\core\services\request\RequestStackBuilder', |
|
31 | - '\core\services\request', |
|
32 | - 'EventEspresso\core\services\request' |
|
33 | - ), |
|
34 | - '4.9.53' |
|
35 | - ); |
|
36 | - } |
|
18 | + /** |
|
19 | + * EE_Request_Stack_Builder |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + EE_Error::doing_it_wrong( |
|
24 | + __METHOD__, |
|
25 | + sprintf( |
|
26 | + esc_html__( |
|
27 | + 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
28 | + 'event_espresso' |
|
29 | + ), |
|
30 | + 'EventEspresso\core\services\request\RequestStackBuilder', |
|
31 | + '\core\services\request', |
|
32 | + 'EventEspresso\core\services\request' |
|
33 | + ), |
|
34 | + '4.9.53' |
|
35 | + ); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * @deprecated 4.9.53 |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @deprecated 4.9.53 |
|
40 | + */ |
|
41 | 41 | public function unshift( /*$class_name, $args*/ ) { |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * @deprecated 4.9.53 |
|
48 | - */ |
|
46 | + /** |
|
47 | + * @deprecated 4.9.53 |
|
48 | + */ |
|
49 | 49 | public function push( /*$class_name, $args...*/ ) { |
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * @deprecated 4.9.53 |
|
56 | - */ |
|
54 | + /** |
|
55 | + * @deprecated 4.9.53 |
|
56 | + */ |
|
57 | 57 | public function resolve( EEI_Request_Decorator $application ) { |
58 | 58 | } |
59 | 59 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | 4 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function set_notice($key, $value) |
74 | 74 | { |
75 | - $this->_notice[ $key ] = $value; |
|
75 | + $this->_notice[$key] = $value; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function get_notice($key) |
86 | 86 | { |
87 | - return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null; |
|
87 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : null; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function add_output($string, $append = true) |
109 | 109 | { |
110 | - $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
110 | + $this->_output = $append ? $this->_output.$string : $string.$this->_output; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -17,158 +17,158 @@ discard block |
||
17 | 17 | class EE_Response |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @access protected |
|
22 | - * @type array $_notice |
|
23 | - */ |
|
24 | - protected $_notice = array(); |
|
25 | - |
|
26 | - /** |
|
27 | - * rendered output to be returned to WP |
|
28 | - * |
|
29 | - * @access protected |
|
30 | - * @type string |
|
31 | - */ |
|
32 | - protected $_output = ''; |
|
33 | - |
|
34 | - /** |
|
35 | - * @access protected |
|
36 | - * @type bool |
|
37 | - */ |
|
38 | - protected $request_terminated = false; |
|
39 | - |
|
40 | - /** |
|
41 | - * @access protected |
|
42 | - * @type bool |
|
43 | - */ |
|
44 | - protected $deactivate_plugin = false; |
|
45 | - |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * @deprecated 4.9.53 |
|
50 | - * @return \EE_Response |
|
51 | - */ |
|
52 | - public function __construct() |
|
53 | - { |
|
54 | - $this->terminate_request(false); |
|
55 | - EE_Error::doing_it_wrong( |
|
56 | - __METHOD__, |
|
57 | - sprintf( |
|
58 | - esc_html__( |
|
59 | - 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
60 | - 'event_espresso' |
|
61 | - ), |
|
62 | - 'EventEspresso\core\services\request\Response', |
|
63 | - '\core\services\request', |
|
64 | - 'EventEspresso\core\services\request' |
|
65 | - ), |
|
66 | - '4.9.53' |
|
67 | - ); |
|
68 | - } |
|
69 | - |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * @deprecated 4.9.53 |
|
74 | - * @param $key |
|
75 | - * @param $value |
|
76 | - * @return void |
|
77 | - */ |
|
78 | - public function set_notice($key, $value) |
|
79 | - { |
|
80 | - $this->_notice[ $key ] = $value; |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - |
|
85 | - /** |
|
86 | - * @deprecated 4.9.53 |
|
87 | - * @param $key |
|
88 | - * @return mixed |
|
89 | - */ |
|
90 | - public function get_notice($key) |
|
91 | - { |
|
92 | - return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null; |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @deprecated 4.9.53 |
|
99 | - * @return array |
|
100 | - */ |
|
101 | - public function get_notices() |
|
102 | - { |
|
103 | - return $this->_notice; |
|
104 | - } |
|
105 | - |
|
106 | - |
|
107 | - |
|
108 | - /** |
|
109 | - * @deprecated 4.9.53 |
|
110 | - * @param $string |
|
111 | - * @param bool $append |
|
112 | - */ |
|
113 | - public function add_output($string, $append = true) |
|
114 | - { |
|
115 | - $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - |
|
120 | - /** |
|
121 | - * @deprecated 4.9.53 |
|
122 | - * @return string |
|
123 | - */ |
|
124 | - public function get_output() |
|
125 | - { |
|
126 | - return $this->_output; |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * @deprecated 4.9.53 |
|
133 | - * @return boolean |
|
134 | - */ |
|
135 | - public function request_terminated() |
|
136 | - { |
|
137 | - return $this->request_terminated; |
|
138 | - } |
|
139 | - |
|
140 | - |
|
141 | - |
|
142 | - /** |
|
143 | - * @deprecated 4.9.53 |
|
144 | - * @param boolean $request_terminated |
|
145 | - */ |
|
146 | - public function terminate_request($request_terminated = true) |
|
147 | - { |
|
148 | - $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
149 | - } |
|
150 | - |
|
151 | - |
|
152 | - |
|
153 | - /** |
|
154 | - * @deprecated 4.9.53 |
|
155 | - * @return boolean |
|
156 | - */ |
|
157 | - public function plugin_deactivated() |
|
158 | - { |
|
159 | - return $this->deactivate_plugin; |
|
160 | - } |
|
20 | + /** |
|
21 | + * @access protected |
|
22 | + * @type array $_notice |
|
23 | + */ |
|
24 | + protected $_notice = array(); |
|
25 | + |
|
26 | + /** |
|
27 | + * rendered output to be returned to WP |
|
28 | + * |
|
29 | + * @access protected |
|
30 | + * @type string |
|
31 | + */ |
|
32 | + protected $_output = ''; |
|
33 | + |
|
34 | + /** |
|
35 | + * @access protected |
|
36 | + * @type bool |
|
37 | + */ |
|
38 | + protected $request_terminated = false; |
|
39 | + |
|
40 | + /** |
|
41 | + * @access protected |
|
42 | + * @type bool |
|
43 | + */ |
|
44 | + protected $deactivate_plugin = false; |
|
45 | + |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * @deprecated 4.9.53 |
|
50 | + * @return \EE_Response |
|
51 | + */ |
|
52 | + public function __construct() |
|
53 | + { |
|
54 | + $this->terminate_request(false); |
|
55 | + EE_Error::doing_it_wrong( |
|
56 | + __METHOD__, |
|
57 | + sprintf( |
|
58 | + esc_html__( |
|
59 | + 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
60 | + 'event_espresso' |
|
61 | + ), |
|
62 | + 'EventEspresso\core\services\request\Response', |
|
63 | + '\core\services\request', |
|
64 | + 'EventEspresso\core\services\request' |
|
65 | + ), |
|
66 | + '4.9.53' |
|
67 | + ); |
|
68 | + } |
|
69 | + |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * @deprecated 4.9.53 |
|
74 | + * @param $key |
|
75 | + * @param $value |
|
76 | + * @return void |
|
77 | + */ |
|
78 | + public function set_notice($key, $value) |
|
79 | + { |
|
80 | + $this->_notice[ $key ] = $value; |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + |
|
85 | + /** |
|
86 | + * @deprecated 4.9.53 |
|
87 | + * @param $key |
|
88 | + * @return mixed |
|
89 | + */ |
|
90 | + public function get_notice($key) |
|
91 | + { |
|
92 | + return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null; |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @deprecated 4.9.53 |
|
99 | + * @return array |
|
100 | + */ |
|
101 | + public function get_notices() |
|
102 | + { |
|
103 | + return $this->_notice; |
|
104 | + } |
|
105 | + |
|
106 | + |
|
107 | + |
|
108 | + /** |
|
109 | + * @deprecated 4.9.53 |
|
110 | + * @param $string |
|
111 | + * @param bool $append |
|
112 | + */ |
|
113 | + public function add_output($string, $append = true) |
|
114 | + { |
|
115 | + $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + |
|
120 | + /** |
|
121 | + * @deprecated 4.9.53 |
|
122 | + * @return string |
|
123 | + */ |
|
124 | + public function get_output() |
|
125 | + { |
|
126 | + return $this->_output; |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * @deprecated 4.9.53 |
|
133 | + * @return boolean |
|
134 | + */ |
|
135 | + public function request_terminated() |
|
136 | + { |
|
137 | + return $this->request_terminated; |
|
138 | + } |
|
139 | + |
|
140 | + |
|
141 | + |
|
142 | + /** |
|
143 | + * @deprecated 4.9.53 |
|
144 | + * @param boolean $request_terminated |
|
145 | + */ |
|
146 | + public function terminate_request($request_terminated = true) |
|
147 | + { |
|
148 | + $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
149 | + } |
|
150 | + |
|
151 | + |
|
152 | + |
|
153 | + /** |
|
154 | + * @deprecated 4.9.53 |
|
155 | + * @return boolean |
|
156 | + */ |
|
157 | + public function plugin_deactivated() |
|
158 | + { |
|
159 | + return $this->deactivate_plugin; |
|
160 | + } |
|
161 | 161 | |
162 | 162 | |
163 | 163 | |
164 | - /** |
|
165 | - * @deprecated 4.9.53 |
|
166 | - * sets $deactivate_plugin to true |
|
167 | - */ |
|
168 | - public function deactivate_plugin() |
|
169 | - { |
|
170 | - $this->deactivate_plugin = true; |
|
171 | - } |
|
164 | + /** |
|
165 | + * @deprecated 4.9.53 |
|
166 | + * sets $deactivate_plugin to true |
|
167 | + */ |
|
168 | + public function deactivate_plugin() |
|
169 | + { |
|
170 | + $this->deactivate_plugin = true; |
|
171 | + } |
|
172 | 172 | |
173 | 173 | |
174 | 174 | } |
@@ -97,7 +97,7 @@ |
||
97 | 97 | $ee_rest_url_prefix = RecommendedVersions::compareWordPressVersion('4.4.0') |
98 | 98 | ? trim(rest_get_url_prefix(), '/') |
99 | 99 | : 'wp-json'; |
100 | - $ee_rest_url_prefix .= '/' . Domain::API_NAMESPACE; |
|
100 | + $ee_rest_url_prefix .= '/'.Domain::API_NAMESPACE; |
|
101 | 101 | return $this->uriPathMatches($ee_rest_url_prefix); |
102 | 102 | } |
103 | 103 |
@@ -23,133 +23,133 @@ |
||
23 | 23 | class RequestTypeContextDetector |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var RequestTypeContextFactory $factory |
|
28 | - */ |
|
29 | - private $factory; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var RequestInterface $request |
|
33 | - */ |
|
34 | - private $request; |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * RequestTypeContextDetector constructor. |
|
39 | - * |
|
40 | - * @param RequestInterface $request |
|
41 | - * @param RequestTypeContextFactory $factory |
|
42 | - */ |
|
43 | - public function __construct(RequestInterface $request, RequestTypeContextFactory $factory) |
|
44 | - { |
|
45 | - $this->request = $request; |
|
46 | - $this->factory = $factory; |
|
47 | - } |
|
48 | - |
|
49 | - |
|
50 | - /** |
|
51 | - * @return RequestTypeContext |
|
52 | - * @throws InvalidArgumentException |
|
53 | - */ |
|
54 | - public function detectRequestTypeContext() |
|
55 | - { |
|
56 | - // Detect EE REST API |
|
57 | - if ($this->isEspressoRestApiRequest()) { |
|
58 | - return $this->factory->create(RequestTypeContext::API); |
|
59 | - } |
|
60 | - // Detect AJAX |
|
61 | - if (defined('DOING_AJAX') && DOING_AJAX) { |
|
62 | - if (filter_var($this->request->getRequestParam('ee_front_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
63 | - return $this->factory->create(RequestTypeContext::AJAX_FRONT); |
|
64 | - } |
|
65 | - if (filter_var($this->request->getRequestParam('ee_admin_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
66 | - return $this->factory->create(RequestTypeContext::AJAX_ADMIN); |
|
67 | - } |
|
68 | - return $this->factory->create(RequestTypeContext::AJAX_OTHER); |
|
69 | - } |
|
70 | - // Detect WP_Cron |
|
71 | - if ($this->isCronRequest()) { |
|
72 | - return $this->factory->create(RequestTypeContext::CRON); |
|
73 | - } |
|
74 | - // Detect command line requests |
|
75 | - if (defined('WP_CLI') && WP_CLI) { |
|
76 | - return $this->factory->create(RequestTypeContext::CLI); |
|
77 | - } |
|
78 | - // detect WordPress admin (ie: "Dashboard") |
|
79 | - if (is_admin()) { |
|
80 | - return $this->factory->create(RequestTypeContext::ADMIN); |
|
81 | - } |
|
82 | - // Detect iFrames |
|
83 | - if ($this->isIframeRoute()) { |
|
84 | - return $this->factory->create(RequestTypeContext::IFRAME); |
|
85 | - } |
|
86 | - // Detect Feeds |
|
87 | - if ($this->isFeedRequest()) { |
|
88 | - return $this->factory->create(RequestTypeContext::FEED); |
|
89 | - } |
|
90 | - // and by process of elimination... |
|
91 | - return $this->factory->create(RequestTypeContext::FRONTEND); |
|
92 | - } |
|
93 | - |
|
94 | - |
|
95 | - /** |
|
96 | - * @return bool |
|
97 | - */ |
|
98 | - private function isEspressoRestApiRequest() |
|
99 | - { |
|
100 | - $ee_rest_url_prefix = RecommendedVersions::compareWordPressVersion('4.4.0') |
|
101 | - ? trim(rest_get_url_prefix(), '/') |
|
102 | - : 'wp-json'; |
|
103 | - $ee_rest_url_prefix .= '/' . Domain::API_NAMESPACE; |
|
104 | - return $this->uriPathMatches($ee_rest_url_prefix); |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - /** |
|
109 | - * @return bool |
|
110 | - */ |
|
111 | - private function isCronRequest() |
|
112 | - { |
|
113 | - return $this->uriPathMatches('wp-cron.php'); |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * @return bool |
|
119 | - */ |
|
120 | - private function isFeedRequest() |
|
121 | - { |
|
122 | - return $this->uriPathMatches('feed'); |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * @param string $component |
|
128 | - * @return bool |
|
129 | - */ |
|
130 | - private function uriPathMatches($component) |
|
131 | - { |
|
132 | - $request_uri = $this->request->requestUri(); |
|
133 | - $parts = explode('?', $request_uri); |
|
134 | - $path = trim(reset($parts), '/'); |
|
135 | - return strpos($path, $component) === 0; |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * @return bool |
|
141 | - */ |
|
142 | - private function isIframeRoute() |
|
143 | - { |
|
144 | - $is_iframe_route = apply_filters( |
|
145 | - 'FHEE__EventEspresso_core_domain_services_contexts_RequestTypeContextDetector__isIframeRoute', |
|
146 | - $this->request->getRequestParam('event_list', '') === 'iframe' |
|
147 | - || $this->request->getRequestParam('ticket_selector', '') === 'iframe' |
|
148 | - || $this->request->getRequestParam('calendar', '') === 'iframe', |
|
149 | - $this |
|
150 | - ); |
|
151 | - return filter_var($is_iframe_route, FILTER_VALIDATE_BOOLEAN); |
|
152 | - } |
|
26 | + /** |
|
27 | + * @var RequestTypeContextFactory $factory |
|
28 | + */ |
|
29 | + private $factory; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var RequestInterface $request |
|
33 | + */ |
|
34 | + private $request; |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * RequestTypeContextDetector constructor. |
|
39 | + * |
|
40 | + * @param RequestInterface $request |
|
41 | + * @param RequestTypeContextFactory $factory |
|
42 | + */ |
|
43 | + public function __construct(RequestInterface $request, RequestTypeContextFactory $factory) |
|
44 | + { |
|
45 | + $this->request = $request; |
|
46 | + $this->factory = $factory; |
|
47 | + } |
|
48 | + |
|
49 | + |
|
50 | + /** |
|
51 | + * @return RequestTypeContext |
|
52 | + * @throws InvalidArgumentException |
|
53 | + */ |
|
54 | + public function detectRequestTypeContext() |
|
55 | + { |
|
56 | + // Detect EE REST API |
|
57 | + if ($this->isEspressoRestApiRequest()) { |
|
58 | + return $this->factory->create(RequestTypeContext::API); |
|
59 | + } |
|
60 | + // Detect AJAX |
|
61 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
62 | + if (filter_var($this->request->getRequestParam('ee_front_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
63 | + return $this->factory->create(RequestTypeContext::AJAX_FRONT); |
|
64 | + } |
|
65 | + if (filter_var($this->request->getRequestParam('ee_admin_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
66 | + return $this->factory->create(RequestTypeContext::AJAX_ADMIN); |
|
67 | + } |
|
68 | + return $this->factory->create(RequestTypeContext::AJAX_OTHER); |
|
69 | + } |
|
70 | + // Detect WP_Cron |
|
71 | + if ($this->isCronRequest()) { |
|
72 | + return $this->factory->create(RequestTypeContext::CRON); |
|
73 | + } |
|
74 | + // Detect command line requests |
|
75 | + if (defined('WP_CLI') && WP_CLI) { |
|
76 | + return $this->factory->create(RequestTypeContext::CLI); |
|
77 | + } |
|
78 | + // detect WordPress admin (ie: "Dashboard") |
|
79 | + if (is_admin()) { |
|
80 | + return $this->factory->create(RequestTypeContext::ADMIN); |
|
81 | + } |
|
82 | + // Detect iFrames |
|
83 | + if ($this->isIframeRoute()) { |
|
84 | + return $this->factory->create(RequestTypeContext::IFRAME); |
|
85 | + } |
|
86 | + // Detect Feeds |
|
87 | + if ($this->isFeedRequest()) { |
|
88 | + return $this->factory->create(RequestTypeContext::FEED); |
|
89 | + } |
|
90 | + // and by process of elimination... |
|
91 | + return $this->factory->create(RequestTypeContext::FRONTEND); |
|
92 | + } |
|
93 | + |
|
94 | + |
|
95 | + /** |
|
96 | + * @return bool |
|
97 | + */ |
|
98 | + private function isEspressoRestApiRequest() |
|
99 | + { |
|
100 | + $ee_rest_url_prefix = RecommendedVersions::compareWordPressVersion('4.4.0') |
|
101 | + ? trim(rest_get_url_prefix(), '/') |
|
102 | + : 'wp-json'; |
|
103 | + $ee_rest_url_prefix .= '/' . Domain::API_NAMESPACE; |
|
104 | + return $this->uriPathMatches($ee_rest_url_prefix); |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + /** |
|
109 | + * @return bool |
|
110 | + */ |
|
111 | + private function isCronRequest() |
|
112 | + { |
|
113 | + return $this->uriPathMatches('wp-cron.php'); |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * @return bool |
|
119 | + */ |
|
120 | + private function isFeedRequest() |
|
121 | + { |
|
122 | + return $this->uriPathMatches('feed'); |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * @param string $component |
|
128 | + * @return bool |
|
129 | + */ |
|
130 | + private function uriPathMatches($component) |
|
131 | + { |
|
132 | + $request_uri = $this->request->requestUri(); |
|
133 | + $parts = explode('?', $request_uri); |
|
134 | + $path = trim(reset($parts), '/'); |
|
135 | + return strpos($path, $component) === 0; |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * @return bool |
|
141 | + */ |
|
142 | + private function isIframeRoute() |
|
143 | + { |
|
144 | + $is_iframe_route = apply_filters( |
|
145 | + 'FHEE__EventEspresso_core_domain_services_contexts_RequestTypeContextDetector__isIframeRoute', |
|
146 | + $this->request->getRequestParam('event_list', '') === 'iframe' |
|
147 | + || $this->request->getRequestParam('ticket_selector', '') === 'iframe' |
|
148 | + || $this->request->getRequestParam('calendar', '') === 'iframe', |
|
149 | + $this |
|
150 | + ); |
|
151 | + return filter_var($is_iframe_route, FILTER_VALIDATE_BOOLEAN); |
|
152 | + } |
|
153 | 153 | |
154 | 154 | } |
155 | 155 | // Location: RequestTypeContextDetector.php |
@@ -20,186 +20,186 @@ |
||
20 | 20 | class RequestTypeContextChecker extends ContextChecker implements RequestTypeContextCheckerInterface |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @var RequestTypeContext $request_type |
|
25 | - */ |
|
26 | - private $request_type; |
|
27 | - |
|
28 | - |
|
29 | - /** |
|
30 | - * RequestTypeContextChecker constructor. |
|
31 | - * |
|
32 | - * @param RequestTypeContext $request_type |
|
33 | - */ |
|
34 | - public function __construct(RequestTypeContext $request_type) |
|
35 | - { |
|
36 | - $this->request_type = $request_type; |
|
37 | - parent::__construct( |
|
38 | - 'RequestTypeContextChecker', |
|
39 | - $this->request_type->validRequestTypes() |
|
40 | - ); |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - /** |
|
45 | - * true if the current request involves some form of activation |
|
46 | - * |
|
47 | - * @return bool |
|
48 | - */ |
|
49 | - public function isActivation() |
|
50 | - { |
|
51 | - return $this->request_type->isActivation(); |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * @param $is_activation |
|
57 | - * @return bool |
|
58 | - */ |
|
59 | - public function setIsActivation($is_activation) |
|
60 | - { |
|
61 | - return $this->request_type->setIsActivation($is_activation); |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * true if the current request is for the admin and is not being made via AJAX |
|
67 | - * |
|
68 | - * @return bool |
|
69 | - */ |
|
70 | - public function isAdmin() |
|
71 | - { |
|
72 | - return $this->request_type->slug() === RequestTypeContext::ADMIN; |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * true if the current request is for the admin AND is being made via AJAX |
|
78 | - * |
|
79 | - * @return bool |
|
80 | - */ |
|
81 | - public function isAdminAjax() |
|
82 | - { |
|
83 | - return $this->request_type->slug() === RequestTypeContext::AJAX_ADMIN; |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * true if the current request is being made via AJAX... any AJAX |
|
89 | - * |
|
90 | - * @return bool |
|
91 | - */ |
|
92 | - public function isAjax() |
|
93 | - { |
|
94 | - return $this->isEeAjax() || $this->isOtherAjax(); |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * true if the current request is for either the EE admin or EE frontend AND is being made via AJAX |
|
100 | - * |
|
101 | - * @return bool |
|
102 | - */ |
|
103 | - public function isEeAjax() |
|
104 | - { |
|
105 | - return $this->isAdminAjax() || $this->isFrontAjax(); |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * true if the current request is being made via AJAX but is NOT for EE related logic |
|
111 | - * |
|
112 | - * @return bool |
|
113 | - */ |
|
114 | - public function isOtherAjax() |
|
115 | - { |
|
116 | - return $this->request_type->slug() === RequestTypeContext::AJAX_OTHER; |
|
117 | - } |
|
118 | - |
|
119 | - /** |
|
120 | - * true if the current request is for the EE REST API |
|
121 | - * |
|
122 | - * @return bool |
|
123 | - */ |
|
124 | - public function isApi() |
|
125 | - { |
|
126 | - return $this->request_type->slug() === RequestTypeContext::API; |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - /** |
|
131 | - * true if the current request is from the command line |
|
132 | - * |
|
133 | - * @return bool |
|
134 | - */ |
|
135 | - public function isCli() |
|
136 | - { |
|
137 | - return $this->request_type->slug() === RequestTypeContext::CLI; |
|
138 | - } |
|
139 | - |
|
140 | - |
|
141 | - /** |
|
142 | - * true if the current request is for a WP_Cron |
|
143 | - * |
|
144 | - * @return bool |
|
145 | - */ |
|
146 | - public function isCron() |
|
147 | - { |
|
148 | - return $this->request_type->slug() === RequestTypeContext::CRON; |
|
149 | - } |
|
150 | - |
|
151 | - |
|
152 | - /** |
|
153 | - * true if the current request is for a feed (ie: RSS) |
|
154 | - * |
|
155 | - * @return bool |
|
156 | - */ |
|
157 | - public function isFeed() |
|
158 | - { |
|
159 | - return $this->request_type->slug() === RequestTypeContext::FEED; |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - /** |
|
164 | - * true if the current request is for the frontend and is not being made via AJAX |
|
165 | - * |
|
166 | - * @return bool |
|
167 | - */ |
|
168 | - public function isFrontend() |
|
169 | - { |
|
170 | - return $this->request_type->slug() === RequestTypeContext::FRONTEND; |
|
171 | - } |
|
172 | - |
|
173 | - |
|
174 | - /** |
|
175 | - * true if the current request is for the frontend AND is being made via AJAX |
|
176 | - * |
|
177 | - * @return bool |
|
178 | - */ |
|
179 | - public function isFrontAjax() |
|
180 | - { |
|
181 | - return $this->request_type->slug() === RequestTypeContext::AJAX_FRONT; |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - /** |
|
186 | - * true if the current request is for content that is to be displayed within an iframe |
|
187 | - * |
|
188 | - * @return bool |
|
189 | - */ |
|
190 | - public function isIframe() |
|
191 | - { |
|
192 | - return $this->request_type->slug() === RequestTypeContext::IFRAME; |
|
193 | - } |
|
194 | - |
|
195 | - |
|
196 | - /** |
|
197 | - * @return string |
|
198 | - */ |
|
199 | - public function slug() |
|
200 | - { |
|
201 | - return $this->request_type->slug(); |
|
202 | - } |
|
23 | + /** |
|
24 | + * @var RequestTypeContext $request_type |
|
25 | + */ |
|
26 | + private $request_type; |
|
27 | + |
|
28 | + |
|
29 | + /** |
|
30 | + * RequestTypeContextChecker constructor. |
|
31 | + * |
|
32 | + * @param RequestTypeContext $request_type |
|
33 | + */ |
|
34 | + public function __construct(RequestTypeContext $request_type) |
|
35 | + { |
|
36 | + $this->request_type = $request_type; |
|
37 | + parent::__construct( |
|
38 | + 'RequestTypeContextChecker', |
|
39 | + $this->request_type->validRequestTypes() |
|
40 | + ); |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + /** |
|
45 | + * true if the current request involves some form of activation |
|
46 | + * |
|
47 | + * @return bool |
|
48 | + */ |
|
49 | + public function isActivation() |
|
50 | + { |
|
51 | + return $this->request_type->isActivation(); |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * @param $is_activation |
|
57 | + * @return bool |
|
58 | + */ |
|
59 | + public function setIsActivation($is_activation) |
|
60 | + { |
|
61 | + return $this->request_type->setIsActivation($is_activation); |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * true if the current request is for the admin and is not being made via AJAX |
|
67 | + * |
|
68 | + * @return bool |
|
69 | + */ |
|
70 | + public function isAdmin() |
|
71 | + { |
|
72 | + return $this->request_type->slug() === RequestTypeContext::ADMIN; |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * true if the current request is for the admin AND is being made via AJAX |
|
78 | + * |
|
79 | + * @return bool |
|
80 | + */ |
|
81 | + public function isAdminAjax() |
|
82 | + { |
|
83 | + return $this->request_type->slug() === RequestTypeContext::AJAX_ADMIN; |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * true if the current request is being made via AJAX... any AJAX |
|
89 | + * |
|
90 | + * @return bool |
|
91 | + */ |
|
92 | + public function isAjax() |
|
93 | + { |
|
94 | + return $this->isEeAjax() || $this->isOtherAjax(); |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * true if the current request is for either the EE admin or EE frontend AND is being made via AJAX |
|
100 | + * |
|
101 | + * @return bool |
|
102 | + */ |
|
103 | + public function isEeAjax() |
|
104 | + { |
|
105 | + return $this->isAdminAjax() || $this->isFrontAjax(); |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * true if the current request is being made via AJAX but is NOT for EE related logic |
|
111 | + * |
|
112 | + * @return bool |
|
113 | + */ |
|
114 | + public function isOtherAjax() |
|
115 | + { |
|
116 | + return $this->request_type->slug() === RequestTypeContext::AJAX_OTHER; |
|
117 | + } |
|
118 | + |
|
119 | + /** |
|
120 | + * true if the current request is for the EE REST API |
|
121 | + * |
|
122 | + * @return bool |
|
123 | + */ |
|
124 | + public function isApi() |
|
125 | + { |
|
126 | + return $this->request_type->slug() === RequestTypeContext::API; |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + /** |
|
131 | + * true if the current request is from the command line |
|
132 | + * |
|
133 | + * @return bool |
|
134 | + */ |
|
135 | + public function isCli() |
|
136 | + { |
|
137 | + return $this->request_type->slug() === RequestTypeContext::CLI; |
|
138 | + } |
|
139 | + |
|
140 | + |
|
141 | + /** |
|
142 | + * true if the current request is for a WP_Cron |
|
143 | + * |
|
144 | + * @return bool |
|
145 | + */ |
|
146 | + public function isCron() |
|
147 | + { |
|
148 | + return $this->request_type->slug() === RequestTypeContext::CRON; |
|
149 | + } |
|
150 | + |
|
151 | + |
|
152 | + /** |
|
153 | + * true if the current request is for a feed (ie: RSS) |
|
154 | + * |
|
155 | + * @return bool |
|
156 | + */ |
|
157 | + public function isFeed() |
|
158 | + { |
|
159 | + return $this->request_type->slug() === RequestTypeContext::FEED; |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + /** |
|
164 | + * true if the current request is for the frontend and is not being made via AJAX |
|
165 | + * |
|
166 | + * @return bool |
|
167 | + */ |
|
168 | + public function isFrontend() |
|
169 | + { |
|
170 | + return $this->request_type->slug() === RequestTypeContext::FRONTEND; |
|
171 | + } |
|
172 | + |
|
173 | + |
|
174 | + /** |
|
175 | + * true if the current request is for the frontend AND is being made via AJAX |
|
176 | + * |
|
177 | + * @return bool |
|
178 | + */ |
|
179 | + public function isFrontAjax() |
|
180 | + { |
|
181 | + return $this->request_type->slug() === RequestTypeContext::AJAX_FRONT; |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + /** |
|
186 | + * true if the current request is for content that is to be displayed within an iframe |
|
187 | + * |
|
188 | + * @return bool |
|
189 | + */ |
|
190 | + public function isIframe() |
|
191 | + { |
|
192 | + return $this->request_type->slug() === RequestTypeContext::IFRAME; |
|
193 | + } |
|
194 | + |
|
195 | + |
|
196 | + /** |
|
197 | + * @return string |
|
198 | + */ |
|
199 | + public function slug() |
|
200 | + { |
|
201 | + return $this->request_type->slug(); |
|
202 | + } |
|
203 | 203 | |
204 | 204 | } |
205 | 205 | // Location: RequestTypeContextChecker.php |