@@ -16,72 +16,72 @@ |
||
| 16 | 16 | class ShortcodeRequests extends Route |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * returns true if the current request matches this route |
|
| 21 | - * child classes can override and use Request directly to match route with request |
|
| 22 | - * or supply a RouteMatchSpecification class and just use the below |
|
| 23 | - * |
|
| 24 | - * @return bool |
|
| 25 | - * @since $VID:$ |
|
| 26 | - */ |
|
| 27 | - public function matchesCurrentRequest() |
|
| 28 | - { |
|
| 29 | - return $this->request->isFrontend() || $this->request->isIframe() || $this->request->isAjax(); |
|
| 30 | - } |
|
| 19 | + /** |
|
| 20 | + * returns true if the current request matches this route |
|
| 21 | + * child classes can override and use Request directly to match route with request |
|
| 22 | + * or supply a RouteMatchSpecification class and just use the below |
|
| 23 | + * |
|
| 24 | + * @return bool |
|
| 25 | + * @since $VID:$ |
|
| 26 | + */ |
|
| 27 | + public function matchesCurrentRequest() |
|
| 28 | + { |
|
| 29 | + return $this->request->isFrontend() || $this->request->isIframe() || $this->request->isAjax(); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @since $VID:$ |
|
| 35 | - */ |
|
| 36 | - protected function registerDependencies() |
|
| 37 | - { |
|
| 38 | - $this->dependency_map->registerDependencies( |
|
| 39 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled', |
|
| 40 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 41 | - ); |
|
| 42 | - $this->dependency_map->registerDependencies( |
|
| 43 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout', |
|
| 44 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 45 | - ); |
|
| 46 | - $this->dependency_map->registerDependencies( |
|
| 47 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees', |
|
| 48 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 49 | - ); |
|
| 50 | - $this->dependency_map->registerDependencies( |
|
| 51 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents', |
|
| 52 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 53 | - ); |
|
| 54 | - $this->dependency_map->registerDependencies( |
|
| 55 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou', |
|
| 56 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 57 | - ); |
|
| 58 | - $this->dependency_map->registerDependencies( |
|
| 59 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector', |
|
| 60 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 61 | - ); |
|
| 62 | - $this->dependency_map->registerDependencies( |
|
| 63 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage', |
|
| 64 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 65 | - ); |
|
| 66 | - } |
|
| 33 | + /** |
|
| 34 | + * @since $VID:$ |
|
| 35 | + */ |
|
| 36 | + protected function registerDependencies() |
|
| 37 | + { |
|
| 38 | + $this->dependency_map->registerDependencies( |
|
| 39 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled', |
|
| 40 | + [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 41 | + ); |
|
| 42 | + $this->dependency_map->registerDependencies( |
|
| 43 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout', |
|
| 44 | + [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 45 | + ); |
|
| 46 | + $this->dependency_map->registerDependencies( |
|
| 47 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees', |
|
| 48 | + [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 49 | + ); |
|
| 50 | + $this->dependency_map->registerDependencies( |
|
| 51 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents', |
|
| 52 | + [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 53 | + ); |
|
| 54 | + $this->dependency_map->registerDependencies( |
|
| 55 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou', |
|
| 56 | + [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 57 | + ); |
|
| 58 | + $this->dependency_map->registerDependencies( |
|
| 59 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector', |
|
| 60 | + [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 61 | + ); |
|
| 62 | + $this->dependency_map->registerDependencies( |
|
| 63 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage', |
|
| 64 | + [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 65 | + ); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * implements logic required to run during request |
|
| 71 | - * |
|
| 72 | - * @return bool |
|
| 73 | - * @since $VID:$ |
|
| 74 | - */ |
|
| 75 | - protected function requestHandler() |
|
| 76 | - { |
|
| 77 | - // load, register, and add shortcodes the new way |
|
| 78 | - $this->loader->getShared( |
|
| 79 | - 'EventEspresso\core\services\shortcodes\ShortcodesManager', |
|
| 80 | - [ |
|
| 81 | - // and the old way, but we'll put it under control of the new system |
|
| 82 | - EE_Config::getLegacyShortcodesManager(), |
|
| 83 | - ] |
|
| 84 | - ); |
|
| 85 | - return true; |
|
| 86 | - } |
|
| 69 | + /** |
|
| 70 | + * implements logic required to run during request |
|
| 71 | + * |
|
| 72 | + * @return bool |
|
| 73 | + * @since $VID:$ |
|
| 74 | + */ |
|
| 75 | + protected function requestHandler() |
|
| 76 | + { |
|
| 77 | + // load, register, and add shortcodes the new way |
|
| 78 | + $this->loader->getShared( |
|
| 79 | + 'EventEspresso\core\services\shortcodes\ShortcodesManager', |
|
| 80 | + [ |
|
| 81 | + // and the old way, but we'll put it under control of the new system |
|
| 82 | + EE_Config::getLegacyShortcodesManager(), |
|
| 83 | + ] |
|
| 84 | + ); |
|
| 85 | + return true; |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -37,31 +37,31 @@ |
||
| 37 | 37 | { |
| 38 | 38 | $this->dependency_map->registerDependencies( |
| 39 | 39 | 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled', |
| 40 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 40 | + ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache] |
|
| 41 | 41 | ); |
| 42 | 42 | $this->dependency_map->registerDependencies( |
| 43 | 43 | 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout', |
| 44 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 44 | + ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache] |
|
| 45 | 45 | ); |
| 46 | 46 | $this->dependency_map->registerDependencies( |
| 47 | 47 | 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees', |
| 48 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 48 | + ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache] |
|
| 49 | 49 | ); |
| 50 | 50 | $this->dependency_map->registerDependencies( |
| 51 | 51 | 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents', |
| 52 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 52 | + ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache] |
|
| 53 | 53 | ); |
| 54 | 54 | $this->dependency_map->registerDependencies( |
| 55 | 55 | 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou', |
| 56 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 56 | + ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache] |
|
| 57 | 57 | ); |
| 58 | 58 | $this->dependency_map->registerDependencies( |
| 59 | 59 | 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector', |
| 60 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 60 | + ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache] |
|
| 61 | 61 | ); |
| 62 | 62 | $this->dependency_map->registerDependencies( |
| 63 | 63 | 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage', |
| 64 | - [ 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache ] |
|
| 64 | + ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache] |
|
| 65 | 65 | ); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -19,135 +19,135 @@ |
||
| 19 | 19 | abstract class Route implements RouteInterface |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - // /** will most likely need this for routes so pencilled it in for now |
|
| 23 | - // * @type CommandBusInterface $command_bus |
|
| 24 | - // */ |
|
| 25 | - // protected $command_bus; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * @var EE_Dependency_Map $dependency_map |
|
| 29 | - */ |
|
| 30 | - protected $dependency_map; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * @var LoaderInterface $loader |
|
| 34 | - */ |
|
| 35 | - protected $loader; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @var RequestInterface $request |
|
| 39 | - */ |
|
| 40 | - protected $request; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @var RouteMatchSpecificationInterface $specification |
|
| 44 | - */ |
|
| 45 | - private $specification; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @var boolean $handled |
|
| 49 | - */ |
|
| 50 | - private $handled = false; |
|
| 51 | - |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Route constructor. |
|
| 55 | - * |
|
| 56 | - * @param EE_Dependency_Map $dependency_map |
|
| 57 | - * @param LoaderInterface $loader |
|
| 58 | - * @param RequestInterface $request |
|
| 59 | - * @param RouteMatchSpecificationInterface $specification |
|
| 60 | - */ |
|
| 61 | - public function __construct( |
|
| 62 | - EE_Dependency_Map $dependency_map, |
|
| 63 | - LoaderInterface $loader, |
|
| 64 | - RequestInterface $request, |
|
| 65 | - RouteMatchSpecificationInterface $specification = null |
|
| 66 | - ) { |
|
| 67 | - $this->dependency_map = $dependency_map; |
|
| 68 | - $this->loader = $loader; |
|
| 69 | - $this->request = $request; |
|
| 70 | - $this->specification = $specification; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * @since $VID:$ |
|
| 76 | - */ |
|
| 77 | - abstract protected function registerDependencies(); |
|
| 78 | - |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * implements logic required to run during request |
|
| 82 | - * |
|
| 83 | - * @return bool |
|
| 84 | - * @since $VID:$ |
|
| 85 | - */ |
|
| 86 | - abstract protected function requestHandler(); |
|
| 87 | - |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * returns true if the current request matches this route |
|
| 91 | - * child classes can override and use Request directly to match route with request |
|
| 92 | - * or supply a RouteMatchSpecification class and just use the below |
|
| 93 | - * |
|
| 94 | - * @return bool |
|
| 95 | - * @since $VID:$ |
|
| 96 | - */ |
|
| 97 | - public function matchesCurrentRequest() |
|
| 98 | - { |
|
| 99 | - // \EEH_Debug_Tools::printr(get_called_class(), __FUNCTION__, __FILE__, __LINE__); |
|
| 100 | - return $this->specification instanceof RouteMatchSpecificationInterface |
|
| 101 | - ? $this->specification->isMatchingRoute() |
|
| 102 | - : false; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * @return bool |
|
| 107 | - */ |
|
| 108 | - final public function isHandled() |
|
| 109 | - { |
|
| 110 | - return $this->handled; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * @param bool $handled |
|
| 116 | - */ |
|
| 117 | - private function setHandled($handled) |
|
| 118 | - { |
|
| 119 | - $this->handled = filter_var($handled, FILTER_VALIDATE_BOOLEAN); |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * runs route requestHandler() if |
|
| 126 | - * - route has not previously been handled |
|
| 127 | - * - route specification matches for current request |
|
| 128 | - * sets route handled property based on results returned by requestHandler() |
|
| 129 | - * |
|
| 130 | - * @return bool |
|
| 131 | - * @throws DomainException |
|
| 132 | - * @since $VID:$ |
|
| 133 | - */ |
|
| 134 | - final public function handleRequest() |
|
| 135 | - { |
|
| 136 | - if (! $this->isHandled() && $this->matchesCurrentRequest()) { |
|
| 137 | - // \EEH_Debug_Tools::printr(get_called_class(), __FUNCTION__, __FILE__, __LINE__); |
|
| 138 | - do_action('AHEE__EventEspresso_core_domain_entities_routes_handlers_Route__handleRequest', $this); |
|
| 139 | - $this->registerDependencies(); |
|
| 140 | - $handled = $this->requestHandler(); |
|
| 141 | - if (! is_bool($handled)) { |
|
| 142 | - throw new DomainException( |
|
| 143 | - esc_html__( |
|
| 144 | - 'Route::requestHandler() must return a boolean to indicate whether the request has been handled or not.', |
|
| 145 | - 'eventespresso' |
|
| 146 | - ) |
|
| 147 | - ); |
|
| 148 | - } |
|
| 149 | - $this->setHandled($handled); |
|
| 150 | - } |
|
| 151 | - return $this->handled; |
|
| 152 | - } |
|
| 22 | + // /** will most likely need this for routes so pencilled it in for now |
|
| 23 | + // * @type CommandBusInterface $command_bus |
|
| 24 | + // */ |
|
| 25 | + // protected $command_bus; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * @var EE_Dependency_Map $dependency_map |
|
| 29 | + */ |
|
| 30 | + protected $dependency_map; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @var LoaderInterface $loader |
|
| 34 | + */ |
|
| 35 | + protected $loader; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @var RequestInterface $request |
|
| 39 | + */ |
|
| 40 | + protected $request; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @var RouteMatchSpecificationInterface $specification |
|
| 44 | + */ |
|
| 45 | + private $specification; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @var boolean $handled |
|
| 49 | + */ |
|
| 50 | + private $handled = false; |
|
| 51 | + |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Route constructor. |
|
| 55 | + * |
|
| 56 | + * @param EE_Dependency_Map $dependency_map |
|
| 57 | + * @param LoaderInterface $loader |
|
| 58 | + * @param RequestInterface $request |
|
| 59 | + * @param RouteMatchSpecificationInterface $specification |
|
| 60 | + */ |
|
| 61 | + public function __construct( |
|
| 62 | + EE_Dependency_Map $dependency_map, |
|
| 63 | + LoaderInterface $loader, |
|
| 64 | + RequestInterface $request, |
|
| 65 | + RouteMatchSpecificationInterface $specification = null |
|
| 66 | + ) { |
|
| 67 | + $this->dependency_map = $dependency_map; |
|
| 68 | + $this->loader = $loader; |
|
| 69 | + $this->request = $request; |
|
| 70 | + $this->specification = $specification; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * @since $VID:$ |
|
| 76 | + */ |
|
| 77 | + abstract protected function registerDependencies(); |
|
| 78 | + |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * implements logic required to run during request |
|
| 82 | + * |
|
| 83 | + * @return bool |
|
| 84 | + * @since $VID:$ |
|
| 85 | + */ |
|
| 86 | + abstract protected function requestHandler(); |
|
| 87 | + |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * returns true if the current request matches this route |
|
| 91 | + * child classes can override and use Request directly to match route with request |
|
| 92 | + * or supply a RouteMatchSpecification class and just use the below |
|
| 93 | + * |
|
| 94 | + * @return bool |
|
| 95 | + * @since $VID:$ |
|
| 96 | + */ |
|
| 97 | + public function matchesCurrentRequest() |
|
| 98 | + { |
|
| 99 | + // \EEH_Debug_Tools::printr(get_called_class(), __FUNCTION__, __FILE__, __LINE__); |
|
| 100 | + return $this->specification instanceof RouteMatchSpecificationInterface |
|
| 101 | + ? $this->specification->isMatchingRoute() |
|
| 102 | + : false; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * @return bool |
|
| 107 | + */ |
|
| 108 | + final public function isHandled() |
|
| 109 | + { |
|
| 110 | + return $this->handled; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * @param bool $handled |
|
| 116 | + */ |
|
| 117 | + private function setHandled($handled) |
|
| 118 | + { |
|
| 119 | + $this->handled = filter_var($handled, FILTER_VALIDATE_BOOLEAN); |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * runs route requestHandler() if |
|
| 126 | + * - route has not previously been handled |
|
| 127 | + * - route specification matches for current request |
|
| 128 | + * sets route handled property based on results returned by requestHandler() |
|
| 129 | + * |
|
| 130 | + * @return bool |
|
| 131 | + * @throws DomainException |
|
| 132 | + * @since $VID:$ |
|
| 133 | + */ |
|
| 134 | + final public function handleRequest() |
|
| 135 | + { |
|
| 136 | + if (! $this->isHandled() && $this->matchesCurrentRequest()) { |
|
| 137 | + // \EEH_Debug_Tools::printr(get_called_class(), __FUNCTION__, __FILE__, __LINE__); |
|
| 138 | + do_action('AHEE__EventEspresso_core_domain_entities_routes_handlers_Route__handleRequest', $this); |
|
| 139 | + $this->registerDependencies(); |
|
| 140 | + $handled = $this->requestHandler(); |
|
| 141 | + if (! is_bool($handled)) { |
|
| 142 | + throw new DomainException( |
|
| 143 | + esc_html__( |
|
| 144 | + 'Route::requestHandler() must return a boolean to indicate whether the request has been handled or not.', |
|
| 145 | + 'eventespresso' |
|
| 146 | + ) |
|
| 147 | + ); |
|
| 148 | + } |
|
| 149 | + $this->setHandled($handled); |
|
| 150 | + } |
|
| 151 | + return $this->handled; |
|
| 152 | + } |
|
| 153 | 153 | } |
| 154 | 154 | \ No newline at end of file |
@@ -133,12 +133,12 @@ |
||
| 133 | 133 | */ |
| 134 | 134 | final public function handleRequest() |
| 135 | 135 | { |
| 136 | - if (! $this->isHandled() && $this->matchesCurrentRequest()) { |
|
| 136 | + if ( ! $this->isHandled() && $this->matchesCurrentRequest()) { |
|
| 137 | 137 | // \EEH_Debug_Tools::printr(get_called_class(), __FUNCTION__, __FILE__, __LINE__); |
| 138 | 138 | do_action('AHEE__EventEspresso_core_domain_entities_routes_handlers_Route__handleRequest', $this); |
| 139 | 139 | $this->registerDependencies(); |
| 140 | 140 | $handled = $this->requestHandler(); |
| 141 | - if (! is_bool($handled)) { |
|
| 141 | + if ( ! is_bool($handled)) { |
|
| 142 | 142 | throw new DomainException( |
| 143 | 143 | esc_html__( |
| 144 | 144 | 'Route::requestHandler() must return a boolean to indicate whether the request has been handled or not.', |
@@ -15,57 +15,57 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class RouteHandlersDependencyMap extends DependencyMapRegistrar |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * @return bool |
|
| 20 | - * @see EE_Dependency_Map::registerDependencies() |
|
| 21 | - * @since $VID:$ |
|
| 22 | - */ |
|
| 23 | - public function registerDependencies() |
|
| 24 | - { |
|
| 25 | - $default_dependencies = [ |
|
| 26 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 27 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 28 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 29 | - ]; |
|
| 30 | - $frontend_dependencies = [ |
|
| 31 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 32 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 33 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 34 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 35 | - ]; |
|
| 36 | - $routes = [ |
|
| 37 | - 'EventEspresso\core\domain\entities\routes\handlers\admin\EspressoEventEditor', |
|
| 38 | - 'EventEspresso\core\domain\entities\routes\handlers\admin\EspressoLegacyAdmin', |
|
| 39 | - 'EventEspresso\core\domain\entities\routes\handlers\admin\PueRequests', |
|
| 40 | - 'EventEspresso\core\domain\entities\routes\handlers\admin\WordPressPluginsPage', |
|
| 41 | - 'EventEspresso\core\domain\entities\routes\handlers\frontend\ShortcodeRequests', |
|
| 42 | - 'EventEspresso\core\domain\entities\routes\handlers\shared\AssetRequests', |
|
| 43 | - 'EventEspresso\core\domain\entities\routes\handlers\shared\GQLRequests', |
|
| 44 | - 'EventEspresso\core\domain\entities\routes\handlers\shared\RestApiRequests', |
|
| 45 | - 'EventEspresso\core\domain\entities\routes\handlers\shared\SessionRequests', |
|
| 46 | - 'EventEspresso\core\domain\entities\routes\handlers\shared\WordPressHeartbeat', |
|
| 47 | - ]; |
|
| 48 | - // set initially to true but toggled permanently to false if anything fails |
|
| 49 | - $registered = true; |
|
| 50 | - foreach ($routes as $route) { |
|
| 51 | - $registered = $this->dependency_map->registerDependencies($route, $default_dependencies ) |
|
| 52 | - ? $registered // keep previous value whether it is true or false |
|
| 53 | - : false; // toggle value to false |
|
| 54 | - } |
|
| 55 | - $registered = $this->dependency_map->registerDependencies( |
|
| 56 | - 'EventEspresso\core\domain\entities\routes\handlers\admin\PersonalDataRequests', |
|
| 57 | - $frontend_dependencies |
|
| 58 | - ) |
|
| 59 | - ? $registered // keep previous value whether it is true or false |
|
| 60 | - : false; // toggle value to false |
|
| 18 | + /** |
|
| 19 | + * @return bool |
|
| 20 | + * @see EE_Dependency_Map::registerDependencies() |
|
| 21 | + * @since $VID:$ |
|
| 22 | + */ |
|
| 23 | + public function registerDependencies() |
|
| 24 | + { |
|
| 25 | + $default_dependencies = [ |
|
| 26 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 27 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 28 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 29 | + ]; |
|
| 30 | + $frontend_dependencies = [ |
|
| 31 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 32 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 33 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 34 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 35 | + ]; |
|
| 36 | + $routes = [ |
|
| 37 | + 'EventEspresso\core\domain\entities\routes\handlers\admin\EspressoEventEditor', |
|
| 38 | + 'EventEspresso\core\domain\entities\routes\handlers\admin\EspressoLegacyAdmin', |
|
| 39 | + 'EventEspresso\core\domain\entities\routes\handlers\admin\PueRequests', |
|
| 40 | + 'EventEspresso\core\domain\entities\routes\handlers\admin\WordPressPluginsPage', |
|
| 41 | + 'EventEspresso\core\domain\entities\routes\handlers\frontend\ShortcodeRequests', |
|
| 42 | + 'EventEspresso\core\domain\entities\routes\handlers\shared\AssetRequests', |
|
| 43 | + 'EventEspresso\core\domain\entities\routes\handlers\shared\GQLRequests', |
|
| 44 | + 'EventEspresso\core\domain\entities\routes\handlers\shared\RestApiRequests', |
|
| 45 | + 'EventEspresso\core\domain\entities\routes\handlers\shared\SessionRequests', |
|
| 46 | + 'EventEspresso\core\domain\entities\routes\handlers\shared\WordPressHeartbeat', |
|
| 47 | + ]; |
|
| 48 | + // set initially to true but toggled permanently to false if anything fails |
|
| 49 | + $registered = true; |
|
| 50 | + foreach ($routes as $route) { |
|
| 51 | + $registered = $this->dependency_map->registerDependencies($route, $default_dependencies ) |
|
| 52 | + ? $registered // keep previous value whether it is true or false |
|
| 53 | + : false; // toggle value to false |
|
| 54 | + } |
|
| 55 | + $registered = $this->dependency_map->registerDependencies( |
|
| 56 | + 'EventEspresso\core\domain\entities\routes\handlers\admin\PersonalDataRequests', |
|
| 57 | + $frontend_dependencies |
|
| 58 | + ) |
|
| 59 | + ? $registered // keep previous value whether it is true or false |
|
| 60 | + : false; // toggle value to false |
|
| 61 | 61 | |
| 62 | - $registered = $this->dependency_map->registerDependencies( |
|
| 63 | - 'EventEspresso\core\domain\entities\routes\handlers\frontend\FrontendRequests', |
|
| 64 | - $frontend_dependencies |
|
| 65 | - ) |
|
| 66 | - ? $registered // keep previous value whether it is true or false |
|
| 67 | - : false; // toggle value to false |
|
| 62 | + $registered = $this->dependency_map->registerDependencies( |
|
| 63 | + 'EventEspresso\core\domain\entities\routes\handlers\frontend\FrontendRequests', |
|
| 64 | + $frontend_dependencies |
|
| 65 | + ) |
|
| 66 | + ? $registered // keep previous value whether it is true or false |
|
| 67 | + : false; // toggle value to false |
|
| 68 | 68 | |
| 69 | - return $registered; |
|
| 70 | - } |
|
| 69 | + return $registered; |
|
| 70 | + } |
|
| 71 | 71 | } |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | // set initially to true but toggled permanently to false if anything fails |
| 49 | 49 | $registered = true; |
| 50 | 50 | foreach ($routes as $route) { |
| 51 | - $registered = $this->dependency_map->registerDependencies($route, $default_dependencies ) |
|
| 51 | + $registered = $this->dependency_map->registerDependencies($route, $default_dependencies) |
|
| 52 | 52 | ? $registered // keep previous value whether it is true or false |
| 53 | 53 | : false; // toggle value to false |
| 54 | 54 | } |
@@ -15,49 +15,49 @@ |
||
| 15 | 15 | class WordPressHeartbeat extends Route |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * returns true if the current request matches this route |
|
| 20 | - * |
|
| 21 | - * @return bool |
|
| 22 | - * @since $VID:$ |
|
| 23 | - */ |
|
| 24 | - public function matchesCurrentRequest() |
|
| 25 | - { |
|
| 26 | - return $this->request->isWordPressHeartbeat(); |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @since $VID:$ |
|
| 32 | - */ |
|
| 33 | - protected function registerDependencies() |
|
| 34 | - { |
|
| 35 | - $this->dependency_map->registerDependencies( |
|
| 36 | - 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat', |
|
| 37 | - [ |
|
| 38 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 39 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 40 | - ] |
|
| 41 | - ); |
|
| 42 | - $this->dependency_map->registerDependencies( |
|
| 43 | - 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat', |
|
| 44 | - [ |
|
| 45 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 46 | - 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
| 47 | - ] |
|
| 48 | - ); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * implements logic required to run during request |
|
| 54 | - * |
|
| 55 | - * @return bool |
|
| 56 | - * @since $VID:$ |
|
| 57 | - */ |
|
| 58 | - protected function requestHandler() |
|
| 59 | - { |
|
| 60 | - $this->loader->getShared('EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat'); |
|
| 61 | - return true; |
|
| 62 | - } |
|
| 18 | + /** |
|
| 19 | + * returns true if the current request matches this route |
|
| 20 | + * |
|
| 21 | + * @return bool |
|
| 22 | + * @since $VID:$ |
|
| 23 | + */ |
|
| 24 | + public function matchesCurrentRequest() |
|
| 25 | + { |
|
| 26 | + return $this->request->isWordPressHeartbeat(); |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @since $VID:$ |
|
| 32 | + */ |
|
| 33 | + protected function registerDependencies() |
|
| 34 | + { |
|
| 35 | + $this->dependency_map->registerDependencies( |
|
| 36 | + 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat', |
|
| 37 | + [ |
|
| 38 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 39 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 40 | + ] |
|
| 41 | + ); |
|
| 42 | + $this->dependency_map->registerDependencies( |
|
| 43 | + 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat', |
|
| 44 | + [ |
|
| 45 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 46 | + 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
| 47 | + ] |
|
| 48 | + ); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * implements logic required to run during request |
|
| 54 | + * |
|
| 55 | + * @return bool |
|
| 56 | + * @since $VID:$ |
|
| 57 | + */ |
|
| 58 | + protected function requestHandler() |
|
| 59 | + { |
|
| 60 | + $this->loader->getShared('EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat'); |
|
| 61 | + return true; |
|
| 62 | + } |
|
| 63 | 63 | } |
| 64 | 64 | \ No newline at end of file |
@@ -16,52 +16,52 @@ |
||
| 16 | 16 | class SessionRequests extends Route |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @since $VID:$ |
|
| 21 | - */ |
|
| 22 | - protected function registerDependencies() |
|
| 23 | - { |
|
| 24 | - $this->dependency_map->registerDependencies( |
|
| 25 | - 'EE_Session', |
|
| 26 | - [ |
|
| 27 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 28 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 29 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 30 | - 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
| 31 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
| 32 | - ] |
|
| 33 | - ); |
|
| 34 | - $this->dependency_map->registerDependencies( |
|
| 35 | - 'EventEspresso\core\services\session\SessionStartHandler', |
|
| 36 | - [ 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache ] |
|
| 37 | - ); |
|
| 19 | + /** |
|
| 20 | + * @since $VID:$ |
|
| 21 | + */ |
|
| 22 | + protected function registerDependencies() |
|
| 23 | + { |
|
| 24 | + $this->dependency_map->registerDependencies( |
|
| 25 | + 'EE_Session', |
|
| 26 | + [ |
|
| 27 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 28 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 29 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 30 | + 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
| 31 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
| 32 | + ] |
|
| 33 | + ); |
|
| 34 | + $this->dependency_map->registerDependencies( |
|
| 35 | + 'EventEspresso\core\services\session\SessionStartHandler', |
|
| 36 | + [ 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache ] |
|
| 37 | + ); |
|
| 38 | 38 | |
| 39 | - } |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * implements logic required to run during request |
|
| 44 | - * |
|
| 45 | - * @return bool |
|
| 46 | - * @since $VID:$ |
|
| 47 | - */ |
|
| 48 | - protected function requestHandler() |
|
| 49 | - { |
|
| 50 | - $this->loader->getShared('EE_Session'); |
|
| 51 | - return true; |
|
| 52 | - } |
|
| 42 | + /** |
|
| 43 | + * implements logic required to run during request |
|
| 44 | + * |
|
| 45 | + * @return bool |
|
| 46 | + * @since $VID:$ |
|
| 47 | + */ |
|
| 48 | + protected function requestHandler() |
|
| 49 | + { |
|
| 50 | + $this->loader->getShared('EE_Session'); |
|
| 51 | + return true; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * returns true if the current request matches this route |
|
| 57 | - * child classes can override and use Request directly to match route with request |
|
| 58 | - * or supply a RouteMatchSpecification class and just use the below |
|
| 59 | - * |
|
| 60 | - * @return bool |
|
| 61 | - * @since $VID:$ |
|
| 62 | - */ |
|
| 63 | - public function matchesCurrentRequest() |
|
| 64 | - { |
|
| 65 | - return $this->request->isAdmin() || $this->request->isEeAjax() || $this->request->isFrontend(); |
|
| 66 | - } |
|
| 55 | + /** |
|
| 56 | + * returns true if the current request matches this route |
|
| 57 | + * child classes can override and use Request directly to match route with request |
|
| 58 | + * or supply a RouteMatchSpecification class and just use the below |
|
| 59 | + * |
|
| 60 | + * @return bool |
|
| 61 | + * @since $VID:$ |
|
| 62 | + */ |
|
| 63 | + public function matchesCurrentRequest() |
|
| 64 | + { |
|
| 65 | + return $this->request->isAdmin() || $this->request->isEeAjax() || $this->request->isFrontend(); |
|
| 66 | + } |
|
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | ); |
| 34 | 34 | $this->dependency_map->registerDependencies( |
| 35 | 35 | 'EventEspresso\core\services\session\SessionStartHandler', |
| 36 | - [ 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache ] |
|
| 36 | + ['EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache] |
|
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | 39 | } |
@@ -15,69 +15,69 @@ |
||
| 15 | 15 | class RestApiRequests extends Route |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @since $VID:$ |
|
| 20 | - */ |
|
| 21 | - protected function registerDependencies() |
|
| 22 | - { |
|
| 23 | - $this->dependency_map->registerDependencies( |
|
| 24 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields', |
|
| 25 | - [ |
|
| 26 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache |
|
| 27 | - ] |
|
| 28 | - ); |
|
| 29 | - $this->dependency_map->registerDependencies( |
|
| 30 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory', |
|
| 31 | - [ 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache ] |
|
| 32 | - ); |
|
| 33 | - $this->dependency_map->registerDependencies( |
|
| 34 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
|
| 35 | - [ 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache ] |
|
| 36 | - ); |
|
| 37 | - $this->dependency_map->registerDependencies( |
|
| 38 | - 'EventEspresso\core\libraries\rest_api\calculations\Datetime', |
|
| 39 | - [ |
|
| 40 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 41 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 42 | - ] |
|
| 43 | - ); |
|
| 44 | - $this->dependency_map->registerDependencies( |
|
| 45 | - 'EventEspresso\core\libraries\rest_api\calculations\Event', |
|
| 46 | - [ |
|
| 47 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 48 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 49 | - ] |
|
| 50 | - ); |
|
| 51 | - $this->dependency_map->registerDependencies( |
|
| 52 | - 'EventEspresso\core\libraries\rest_api\calculations\Registration', |
|
| 53 | - [ 'EEM_Registration' => EE_Dependency_Map::load_from_cache ] |
|
| 54 | - ); |
|
| 55 | - } |
|
| 18 | + /** |
|
| 19 | + * @since $VID:$ |
|
| 20 | + */ |
|
| 21 | + protected function registerDependencies() |
|
| 22 | + { |
|
| 23 | + $this->dependency_map->registerDependencies( |
|
| 24 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields', |
|
| 25 | + [ |
|
| 26 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache |
|
| 27 | + ] |
|
| 28 | + ); |
|
| 29 | + $this->dependency_map->registerDependencies( |
|
| 30 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory', |
|
| 31 | + [ 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache ] |
|
| 32 | + ); |
|
| 33 | + $this->dependency_map->registerDependencies( |
|
| 34 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
|
| 35 | + [ 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache ] |
|
| 36 | + ); |
|
| 37 | + $this->dependency_map->registerDependencies( |
|
| 38 | + 'EventEspresso\core\libraries\rest_api\calculations\Datetime', |
|
| 39 | + [ |
|
| 40 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 41 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 42 | + ] |
|
| 43 | + ); |
|
| 44 | + $this->dependency_map->registerDependencies( |
|
| 45 | + 'EventEspresso\core\libraries\rest_api\calculations\Event', |
|
| 46 | + [ |
|
| 47 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 48 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 49 | + ] |
|
| 50 | + ); |
|
| 51 | + $this->dependency_map->registerDependencies( |
|
| 52 | + 'EventEspresso\core\libraries\rest_api\calculations\Registration', |
|
| 53 | + [ 'EEM_Registration' => EE_Dependency_Map::load_from_cache ] |
|
| 54 | + ); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * implements logic required to run during request |
|
| 60 | - * |
|
| 61 | - * @return bool |
|
| 62 | - * @since $VID:$ |
|
| 63 | - */ |
|
| 64 | - protected function requestHandler() |
|
| 65 | - { |
|
| 66 | - // rest api handled by module for now |
|
| 67 | - return true; |
|
| 68 | - } |
|
| 58 | + /** |
|
| 59 | + * implements logic required to run during request |
|
| 60 | + * |
|
| 61 | + * @return bool |
|
| 62 | + * @since $VID:$ |
|
| 63 | + */ |
|
| 64 | + protected function requestHandler() |
|
| 65 | + { |
|
| 66 | + // rest api handled by module for now |
|
| 67 | + return true; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * returns true if the current request matches this route |
|
| 73 | - * child classes can override and use Request directly to match route with request |
|
| 74 | - * or supply a RouteMatchSpecification class and just use the below |
|
| 75 | - * |
|
| 76 | - * @return bool |
|
| 77 | - * @since $VID:$ |
|
| 78 | - */ |
|
| 79 | - public function matchesCurrentRequest() |
|
| 80 | - { |
|
| 81 | - return $this->request->isWordPressApi(); |
|
| 82 | - } |
|
| 71 | + /** |
|
| 72 | + * returns true if the current request matches this route |
|
| 73 | + * child classes can override and use Request directly to match route with request |
|
| 74 | + * or supply a RouteMatchSpecification class and just use the below |
|
| 75 | + * |
|
| 76 | + * @return bool |
|
| 77 | + * @since $VID:$ |
|
| 78 | + */ |
|
| 79 | + public function matchesCurrentRequest() |
|
| 80 | + { |
|
| 81 | + return $this->request->isWordPressApi(); |
|
| 82 | + } |
|
| 83 | 83 | } |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | ); |
| 29 | 29 | $this->dependency_map->registerDependencies( |
| 30 | 30 | 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory', |
| 31 | - [ 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache ] |
|
| 31 | + ['EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache] |
|
| 32 | 32 | ); |
| 33 | 33 | $this->dependency_map->registerDependencies( |
| 34 | 34 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
| 35 | - [ 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache ] |
|
| 35 | + ['EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache] |
|
| 36 | 36 | ); |
| 37 | 37 | $this->dependency_map->registerDependencies( |
| 38 | 38 | 'EventEspresso\core\libraries\rest_api\calculations\Datetime', |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | ); |
| 51 | 51 | $this->dependency_map->registerDependencies( |
| 52 | 52 | 'EventEspresso\core\libraries\rest_api\calculations\Registration', |
| 53 | - [ 'EEM_Registration' => EE_Dependency_Map::load_from_cache ] |
|
| 53 | + ['EEM_Registration' => EE_Dependency_Map::load_from_cache] |
|
| 54 | 54 | ); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -16,173 +16,173 @@ |
||
| 16 | 16 | class GQLRequests extends Route |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @since $VID:$ |
|
| 21 | - */ |
|
| 22 | - protected function registerDependencies() |
|
| 23 | - { |
|
| 24 | - $this->dependency_map->registerDependencies( |
|
| 25 | - 'EventEspresso\core\services\graphql\GraphQLManager', |
|
| 26 | - [ |
|
| 27 | - 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
| 28 | - 'EventEspresso\core\services\graphql\DataLoaderManager' => EE_Dependency_Map::load_from_cache, |
|
| 29 | - 'EventEspresso\core\services\graphql\EnumsManager' => EE_Dependency_Map::load_from_cache, |
|
| 30 | - 'EventEspresso\core\services\graphql\InputsManager' => EE_Dependency_Map::load_from_cache, |
|
| 31 | - 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
| 32 | - ] |
|
| 33 | - ); |
|
| 34 | - $this->dependency_map->registerDependencies( |
|
| 35 | - 'EventEspresso\core\services\graphql\TypesManager', |
|
| 36 | - [ |
|
| 37 | - 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
| 38 | - ] |
|
| 39 | - ); |
|
| 40 | - $this->dependency_map->registerDependencies( |
|
| 41 | - 'EventEspresso\core\services\graphql\InputsManager', |
|
| 42 | - [ |
|
| 43 | - 'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache, |
|
| 44 | - ] |
|
| 45 | - ); |
|
| 46 | - $this->dependency_map->registerDependencies( |
|
| 47 | - 'EventEspresso\core\services\graphql\EnumsManager', |
|
| 48 | - [ |
|
| 49 | - 'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache, |
|
| 50 | - ] |
|
| 51 | - ); |
|
| 52 | - $this->dependency_map->registerDependencies( |
|
| 53 | - 'EventEspresso\core\services\graphql\ConnectionsManager', |
|
| 54 | - [ |
|
| 55 | - 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
| 56 | - ] |
|
| 57 | - ); |
|
| 58 | - $this->dependency_map->registerDependencies( |
|
| 59 | - 'EventEspresso\core\services\graphql\DataLoaderManager', |
|
| 60 | - [ |
|
| 61 | - 'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache, |
|
| 62 | - ] |
|
| 63 | - ); |
|
| 64 | - $this->dependency_map->registerDependencies( |
|
| 65 | - 'EventEspresso\core\domain\services\graphql\types\Datetime', |
|
| 66 | - [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 67 | - ); |
|
| 68 | - $this->dependency_map->registerDependencies( |
|
| 69 | - 'EventEspresso\core\domain\services\graphql\types\Attendee', |
|
| 70 | - [ 'EEM_Attendee' => EE_Dependency_Map::load_from_cache ] |
|
| 71 | - ); |
|
| 72 | - $this->dependency_map->registerDependencies( |
|
| 73 | - 'EventEspresso\core\domain\services\graphql\types\Event', |
|
| 74 | - [ 'EEM_Event' => EE_Dependency_Map::load_from_cache ] |
|
| 75 | - ); |
|
| 76 | - $this->dependency_map->registerDependencies( |
|
| 77 | - 'EventEspresso\core\domain\services\graphql\types\Ticket', |
|
| 78 | - [ 'EEM_Ticket' => EE_Dependency_Map::load_from_cache ] |
|
| 79 | - ); |
|
| 80 | - $this->dependency_map->registerDependencies( |
|
| 81 | - 'EventEspresso\core\domain\services\graphql\types\Price', |
|
| 82 | - [ 'EEM_Price' => EE_Dependency_Map::load_from_cache ] |
|
| 83 | - ); |
|
| 84 | - $this->dependency_map->registerDependencies( |
|
| 85 | - 'EventEspresso\core\domain\services\graphql\types\PriceType', |
|
| 86 | - [ 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache ] |
|
| 87 | - ); |
|
| 88 | - $this->dependency_map->registerDependencies( |
|
| 89 | - 'EventEspresso\core\domain\services\graphql\types\Venue', |
|
| 90 | - [ 'EEM_Venue' => EE_Dependency_Map::load_from_cache ] |
|
| 91 | - ); |
|
| 92 | - $this->dependency_map->registerDependencies( |
|
| 93 | - 'EventEspresso\core\domain\services\graphql\types\State', |
|
| 94 | - [ 'EEM_State' => EE_Dependency_Map::load_from_cache ] |
|
| 95 | - ); |
|
| 96 | - $this->dependency_map->registerDependencies( |
|
| 97 | - 'EventEspresso\core\domain\services\graphql\types\Country', |
|
| 98 | - [ 'EEM_Country' => EE_Dependency_Map::load_from_cache ] |
|
| 99 | - ); |
|
| 100 | - $this->dependency_map->registerDependencies( |
|
| 101 | - 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection', |
|
| 102 | - [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 103 | - ); |
|
| 104 | - $this->dependency_map->registerDependencies( |
|
| 105 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection', |
|
| 106 | - [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 107 | - ); |
|
| 108 | - $this->dependency_map->registerDependencies( |
|
| 109 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection', |
|
| 110 | - [ 'EEM_Attendee' => EE_Dependency_Map::load_from_cache ] |
|
| 111 | - ); |
|
| 112 | - $this->dependency_map->registerDependencies( |
|
| 113 | - 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection', |
|
| 114 | - [ 'EEM_Ticket' => EE_Dependency_Map::load_from_cache ] |
|
| 115 | - ); |
|
| 116 | - $this->dependency_map->registerDependencies( |
|
| 117 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection', |
|
| 118 | - [ 'EEM_Ticket' => EE_Dependency_Map::load_from_cache ] |
|
| 119 | - ); |
|
| 120 | - $this->dependency_map->registerDependencies( |
|
| 121 | - 'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection', |
|
| 122 | - [ 'EEM_Price' => EE_Dependency_Map::load_from_cache ] |
|
| 123 | - ); |
|
| 124 | - $this->dependency_map->registerDependencies( |
|
| 125 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection', |
|
| 126 | - [ 'EEM_Price' => EE_Dependency_Map::load_from_cache ] |
|
| 127 | - ); |
|
| 128 | - $this->dependency_map->registerDependencies( |
|
| 129 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection', |
|
| 130 | - [ 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache ] |
|
| 131 | - ); |
|
| 132 | - $this->dependency_map->registerDependencies( |
|
| 133 | - 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection', |
|
| 134 | - [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 135 | - ); |
|
| 136 | - $this->dependency_map->registerDependencies( |
|
| 137 | - 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection', |
|
| 138 | - [ 'EEM_Venue' => EE_Dependency_Map::load_from_cache ] |
|
| 139 | - ); |
|
| 140 | - } |
|
| 19 | + /** |
|
| 20 | + * @since $VID:$ |
|
| 21 | + */ |
|
| 22 | + protected function registerDependencies() |
|
| 23 | + { |
|
| 24 | + $this->dependency_map->registerDependencies( |
|
| 25 | + 'EventEspresso\core\services\graphql\GraphQLManager', |
|
| 26 | + [ |
|
| 27 | + 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
| 28 | + 'EventEspresso\core\services\graphql\DataLoaderManager' => EE_Dependency_Map::load_from_cache, |
|
| 29 | + 'EventEspresso\core\services\graphql\EnumsManager' => EE_Dependency_Map::load_from_cache, |
|
| 30 | + 'EventEspresso\core\services\graphql\InputsManager' => EE_Dependency_Map::load_from_cache, |
|
| 31 | + 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
| 32 | + ] |
|
| 33 | + ); |
|
| 34 | + $this->dependency_map->registerDependencies( |
|
| 35 | + 'EventEspresso\core\services\graphql\TypesManager', |
|
| 36 | + [ |
|
| 37 | + 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
| 38 | + ] |
|
| 39 | + ); |
|
| 40 | + $this->dependency_map->registerDependencies( |
|
| 41 | + 'EventEspresso\core\services\graphql\InputsManager', |
|
| 42 | + [ |
|
| 43 | + 'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache, |
|
| 44 | + ] |
|
| 45 | + ); |
|
| 46 | + $this->dependency_map->registerDependencies( |
|
| 47 | + 'EventEspresso\core\services\graphql\EnumsManager', |
|
| 48 | + [ |
|
| 49 | + 'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache, |
|
| 50 | + ] |
|
| 51 | + ); |
|
| 52 | + $this->dependency_map->registerDependencies( |
|
| 53 | + 'EventEspresso\core\services\graphql\ConnectionsManager', |
|
| 54 | + [ |
|
| 55 | + 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
| 56 | + ] |
|
| 57 | + ); |
|
| 58 | + $this->dependency_map->registerDependencies( |
|
| 59 | + 'EventEspresso\core\services\graphql\DataLoaderManager', |
|
| 60 | + [ |
|
| 61 | + 'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache, |
|
| 62 | + ] |
|
| 63 | + ); |
|
| 64 | + $this->dependency_map->registerDependencies( |
|
| 65 | + 'EventEspresso\core\domain\services\graphql\types\Datetime', |
|
| 66 | + [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 67 | + ); |
|
| 68 | + $this->dependency_map->registerDependencies( |
|
| 69 | + 'EventEspresso\core\domain\services\graphql\types\Attendee', |
|
| 70 | + [ 'EEM_Attendee' => EE_Dependency_Map::load_from_cache ] |
|
| 71 | + ); |
|
| 72 | + $this->dependency_map->registerDependencies( |
|
| 73 | + 'EventEspresso\core\domain\services\graphql\types\Event', |
|
| 74 | + [ 'EEM_Event' => EE_Dependency_Map::load_from_cache ] |
|
| 75 | + ); |
|
| 76 | + $this->dependency_map->registerDependencies( |
|
| 77 | + 'EventEspresso\core\domain\services\graphql\types\Ticket', |
|
| 78 | + [ 'EEM_Ticket' => EE_Dependency_Map::load_from_cache ] |
|
| 79 | + ); |
|
| 80 | + $this->dependency_map->registerDependencies( |
|
| 81 | + 'EventEspresso\core\domain\services\graphql\types\Price', |
|
| 82 | + [ 'EEM_Price' => EE_Dependency_Map::load_from_cache ] |
|
| 83 | + ); |
|
| 84 | + $this->dependency_map->registerDependencies( |
|
| 85 | + 'EventEspresso\core\domain\services\graphql\types\PriceType', |
|
| 86 | + [ 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache ] |
|
| 87 | + ); |
|
| 88 | + $this->dependency_map->registerDependencies( |
|
| 89 | + 'EventEspresso\core\domain\services\graphql\types\Venue', |
|
| 90 | + [ 'EEM_Venue' => EE_Dependency_Map::load_from_cache ] |
|
| 91 | + ); |
|
| 92 | + $this->dependency_map->registerDependencies( |
|
| 93 | + 'EventEspresso\core\domain\services\graphql\types\State', |
|
| 94 | + [ 'EEM_State' => EE_Dependency_Map::load_from_cache ] |
|
| 95 | + ); |
|
| 96 | + $this->dependency_map->registerDependencies( |
|
| 97 | + 'EventEspresso\core\domain\services\graphql\types\Country', |
|
| 98 | + [ 'EEM_Country' => EE_Dependency_Map::load_from_cache ] |
|
| 99 | + ); |
|
| 100 | + $this->dependency_map->registerDependencies( |
|
| 101 | + 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection', |
|
| 102 | + [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 103 | + ); |
|
| 104 | + $this->dependency_map->registerDependencies( |
|
| 105 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection', |
|
| 106 | + [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 107 | + ); |
|
| 108 | + $this->dependency_map->registerDependencies( |
|
| 109 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection', |
|
| 110 | + [ 'EEM_Attendee' => EE_Dependency_Map::load_from_cache ] |
|
| 111 | + ); |
|
| 112 | + $this->dependency_map->registerDependencies( |
|
| 113 | + 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection', |
|
| 114 | + [ 'EEM_Ticket' => EE_Dependency_Map::load_from_cache ] |
|
| 115 | + ); |
|
| 116 | + $this->dependency_map->registerDependencies( |
|
| 117 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection', |
|
| 118 | + [ 'EEM_Ticket' => EE_Dependency_Map::load_from_cache ] |
|
| 119 | + ); |
|
| 120 | + $this->dependency_map->registerDependencies( |
|
| 121 | + 'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection', |
|
| 122 | + [ 'EEM_Price' => EE_Dependency_Map::load_from_cache ] |
|
| 123 | + ); |
|
| 124 | + $this->dependency_map->registerDependencies( |
|
| 125 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection', |
|
| 126 | + [ 'EEM_Price' => EE_Dependency_Map::load_from_cache ] |
|
| 127 | + ); |
|
| 128 | + $this->dependency_map->registerDependencies( |
|
| 129 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection', |
|
| 130 | + [ 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache ] |
|
| 131 | + ); |
|
| 132 | + $this->dependency_map->registerDependencies( |
|
| 133 | + 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection', |
|
| 134 | + [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 135 | + ); |
|
| 136 | + $this->dependency_map->registerDependencies( |
|
| 137 | + 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection', |
|
| 138 | + [ 'EEM_Venue' => EE_Dependency_Map::load_from_cache ] |
|
| 139 | + ); |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | 142 | |
| 143 | - /** |
|
| 144 | - * implements logic required to run during request |
|
| 145 | - * |
|
| 146 | - * @return bool |
|
| 147 | - * @since $VID:$ |
|
| 148 | - */ |
|
| 149 | - protected function requestHandler() |
|
| 150 | - { |
|
| 143 | + /** |
|
| 144 | + * implements logic required to run during request |
|
| 145 | + * |
|
| 146 | + * @return bool |
|
| 147 | + * @since $VID:$ |
|
| 148 | + */ |
|
| 149 | + protected function requestHandler() |
|
| 150 | + { |
|
| 151 | 151 | |
| 152 | - if (! class_exists('WPGraphQL')) { |
|
| 153 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
| 154 | - } |
|
| 155 | - // load handler for EE GraphQL requests |
|
| 156 | - $graphQL_manager = $this->loader->getShared( |
|
| 157 | - 'EventEspresso\core\services\graphql\GraphQLManager' |
|
| 158 | - ); |
|
| 159 | - $graphQL_manager->init(); |
|
| 160 | - return true; |
|
| 161 | - } |
|
| 152 | + if (! class_exists('WPGraphQL')) { |
|
| 153 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
| 154 | + } |
|
| 155 | + // load handler for EE GraphQL requests |
|
| 156 | + $graphQL_manager = $this->loader->getShared( |
|
| 157 | + 'EventEspresso\core\services\graphql\GraphQLManager' |
|
| 158 | + ); |
|
| 159 | + $graphQL_manager->init(); |
|
| 160 | + return true; |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | 163 | |
| 164 | - /** |
|
| 165 | - * returns true if the current request matches this route |
|
| 166 | - * child classes can override and use Request directly to match route with request |
|
| 167 | - * or supply a RouteMatchSpecification class and just use the below |
|
| 168 | - * |
|
| 169 | - * @return bool |
|
| 170 | - * @since $VID:$ |
|
| 171 | - */ |
|
| 172 | - public function matchesCurrentRequest() |
|
| 173 | - { |
|
| 174 | - return PHP_VERSION_ID > 70000 |
|
| 175 | - && ( |
|
| 176 | - $this->request->isGQL() |
|
| 177 | - || $this->request->isUnitTesting() |
|
| 178 | - || ( |
|
| 179 | - $this->request->isAdmin() |
|
| 180 | - && $this->request->getRequestParam('page') === 'espresso_events' |
|
| 181 | - && ( |
|
| 182 | - $this->request->getRequestParam('action') === 'create_new' |
|
| 183 | - || $this->request->getRequestParam('action') === 'edit' |
|
| 184 | - ) |
|
| 185 | - ) |
|
| 186 | - ); |
|
| 187 | - } |
|
| 164 | + /** |
|
| 165 | + * returns true if the current request matches this route |
|
| 166 | + * child classes can override and use Request directly to match route with request |
|
| 167 | + * or supply a RouteMatchSpecification class and just use the below |
|
| 168 | + * |
|
| 169 | + * @return bool |
|
| 170 | + * @since $VID:$ |
|
| 171 | + */ |
|
| 172 | + public function matchesCurrentRequest() |
|
| 173 | + { |
|
| 174 | + return PHP_VERSION_ID > 70000 |
|
| 175 | + && ( |
|
| 176 | + $this->request->isGQL() |
|
| 177 | + || $this->request->isUnitTesting() |
|
| 178 | + || ( |
|
| 179 | + $this->request->isAdmin() |
|
| 180 | + && $this->request->getRequestParam('page') === 'espresso_events' |
|
| 181 | + && ( |
|
| 182 | + $this->request->getRequestParam('action') === 'create_new' |
|
| 183 | + || $this->request->getRequestParam('action') === 'edit' |
|
| 184 | + ) |
|
| 185 | + ) |
|
| 186 | + ); |
|
| 187 | + } |
|
| 188 | 188 | } |
@@ -63,79 +63,79 @@ discard block |
||
| 63 | 63 | ); |
| 64 | 64 | $this->dependency_map->registerDependencies( |
| 65 | 65 | 'EventEspresso\core\domain\services\graphql\types\Datetime', |
| 66 | - [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 66 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 67 | 67 | ); |
| 68 | 68 | $this->dependency_map->registerDependencies( |
| 69 | 69 | 'EventEspresso\core\domain\services\graphql\types\Attendee', |
| 70 | - [ 'EEM_Attendee' => EE_Dependency_Map::load_from_cache ] |
|
| 70 | + ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
| 71 | 71 | ); |
| 72 | 72 | $this->dependency_map->registerDependencies( |
| 73 | 73 | 'EventEspresso\core\domain\services\graphql\types\Event', |
| 74 | - [ 'EEM_Event' => EE_Dependency_Map::load_from_cache ] |
|
| 74 | + ['EEM_Event' => EE_Dependency_Map::load_from_cache] |
|
| 75 | 75 | ); |
| 76 | 76 | $this->dependency_map->registerDependencies( |
| 77 | 77 | 'EventEspresso\core\domain\services\graphql\types\Ticket', |
| 78 | - [ 'EEM_Ticket' => EE_Dependency_Map::load_from_cache ] |
|
| 78 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
| 79 | 79 | ); |
| 80 | 80 | $this->dependency_map->registerDependencies( |
| 81 | 81 | 'EventEspresso\core\domain\services\graphql\types\Price', |
| 82 | - [ 'EEM_Price' => EE_Dependency_Map::load_from_cache ] |
|
| 82 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
| 83 | 83 | ); |
| 84 | 84 | $this->dependency_map->registerDependencies( |
| 85 | 85 | 'EventEspresso\core\domain\services\graphql\types\PriceType', |
| 86 | - [ 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache ] |
|
| 86 | + ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
| 87 | 87 | ); |
| 88 | 88 | $this->dependency_map->registerDependencies( |
| 89 | 89 | 'EventEspresso\core\domain\services\graphql\types\Venue', |
| 90 | - [ 'EEM_Venue' => EE_Dependency_Map::load_from_cache ] |
|
| 90 | + ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
| 91 | 91 | ); |
| 92 | 92 | $this->dependency_map->registerDependencies( |
| 93 | 93 | 'EventEspresso\core\domain\services\graphql\types\State', |
| 94 | - [ 'EEM_State' => EE_Dependency_Map::load_from_cache ] |
|
| 94 | + ['EEM_State' => EE_Dependency_Map::load_from_cache] |
|
| 95 | 95 | ); |
| 96 | 96 | $this->dependency_map->registerDependencies( |
| 97 | 97 | 'EventEspresso\core\domain\services\graphql\types\Country', |
| 98 | - [ 'EEM_Country' => EE_Dependency_Map::load_from_cache ] |
|
| 98 | + ['EEM_Country' => EE_Dependency_Map::load_from_cache] |
|
| 99 | 99 | ); |
| 100 | 100 | $this->dependency_map->registerDependencies( |
| 101 | 101 | 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection', |
| 102 | - [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 102 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 103 | 103 | ); |
| 104 | 104 | $this->dependency_map->registerDependencies( |
| 105 | 105 | 'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection', |
| 106 | - [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 106 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 107 | 107 | ); |
| 108 | 108 | $this->dependency_map->registerDependencies( |
| 109 | 109 | 'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection', |
| 110 | - [ 'EEM_Attendee' => EE_Dependency_Map::load_from_cache ] |
|
| 110 | + ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
| 111 | 111 | ); |
| 112 | 112 | $this->dependency_map->registerDependencies( |
| 113 | 113 | 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection', |
| 114 | - [ 'EEM_Ticket' => EE_Dependency_Map::load_from_cache ] |
|
| 114 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
| 115 | 115 | ); |
| 116 | 116 | $this->dependency_map->registerDependencies( |
| 117 | 117 | 'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection', |
| 118 | - [ 'EEM_Ticket' => EE_Dependency_Map::load_from_cache ] |
|
| 118 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
| 119 | 119 | ); |
| 120 | 120 | $this->dependency_map->registerDependencies( |
| 121 | 121 | 'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection', |
| 122 | - [ 'EEM_Price' => EE_Dependency_Map::load_from_cache ] |
|
| 122 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
| 123 | 123 | ); |
| 124 | 124 | $this->dependency_map->registerDependencies( |
| 125 | 125 | 'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection', |
| 126 | - [ 'EEM_Price' => EE_Dependency_Map::load_from_cache ] |
|
| 126 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
| 127 | 127 | ); |
| 128 | 128 | $this->dependency_map->registerDependencies( |
| 129 | 129 | 'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection', |
| 130 | - [ 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache ] |
|
| 130 | + ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
| 131 | 131 | ); |
| 132 | 132 | $this->dependency_map->registerDependencies( |
| 133 | 133 | 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection', |
| 134 | - [ 'EEM_Datetime' => EE_Dependency_Map::load_from_cache ] |
|
| 134 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 135 | 135 | ); |
| 136 | 136 | $this->dependency_map->registerDependencies( |
| 137 | 137 | 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection', |
| 138 | - [ 'EEM_Venue' => EE_Dependency_Map::load_from_cache ] |
|
| 138 | + ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
| 139 | 139 | ); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | protected function requestHandler() |
| 150 | 150 | { |
| 151 | 151 | |
| 152 | - if (! class_exists('WPGraphQL')) { |
|
| 153 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
| 152 | + if ( ! class_exists('WPGraphQL')) { |
|
| 153 | + require_once EE_THIRD_PARTY.'wp-graphql/wp-graphql.php'; |
|
| 154 | 154 | } |
| 155 | 155 | // load handler for EE GraphQL requests |
| 156 | 156 | $graphQL_manager = $this->loader->getShared( |
@@ -16,113 +16,113 @@ |
||
| 16 | 16 | class AssetRequests extends Route |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @since $VID:$ |
|
| 21 | - */ |
|
| 22 | - protected function registerDependencies() |
|
| 23 | - { |
|
| 24 | - $default_dependencies = [ |
|
| 25 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 26 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 27 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 28 | - ]; |
|
| 29 | - $this->dependency_map->registerDependencies( |
|
| 30 | - 'EventEspresso\core\domain\services\assets\ReactAssetManager', |
|
| 31 | - $default_dependencies |
|
| 32 | - ); |
|
| 33 | - $this->dependency_map->registerDependencies( |
|
| 34 | - 'EventEspresso\core\domain\services\assets\CoreAssetManager', |
|
| 35 | - [ |
|
| 36 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 37 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
| 38 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
| 39 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 40 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 41 | - ] |
|
| 42 | - ); |
|
| 43 | - $this->dependency_map->registerDependencies( |
|
| 44 | - 'EventEspresso\core\services\editor\BlockRegistrationManager', |
|
| 45 | - [ |
|
| 46 | - 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
| 47 | - 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
| 48 | - 'EventEspresso\core\services\routes\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
| 49 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 50 | - ] |
|
| 51 | - ); |
|
| 52 | - $this->dependency_map->registerDependencies( |
|
| 53 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager', |
|
| 54 | - [ |
|
| 55 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 56 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 57 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 58 | - ] |
|
| 59 | - ); |
|
| 60 | - $this->dependency_map->registerDependencies( |
|
| 61 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer', |
|
| 62 | - [ |
|
| 63 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 64 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 65 | - ] |
|
| 66 | - ); |
|
| 67 | - $this->dependency_map->registerDependencies( |
|
| 68 | - 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees', |
|
| 69 | - [ |
|
| 70 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => EE_Dependency_Map::load_from_cache, |
|
| 71 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 72 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => EE_Dependency_Map::load_from_cache, |
|
| 73 | - ] |
|
| 74 | - ); |
|
| 75 | - } |
|
| 19 | + /** |
|
| 20 | + * @since $VID:$ |
|
| 21 | + */ |
|
| 22 | + protected function registerDependencies() |
|
| 23 | + { |
|
| 24 | + $default_dependencies = [ |
|
| 25 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 26 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 27 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 28 | + ]; |
|
| 29 | + $this->dependency_map->registerDependencies( |
|
| 30 | + 'EventEspresso\core\domain\services\assets\ReactAssetManager', |
|
| 31 | + $default_dependencies |
|
| 32 | + ); |
|
| 33 | + $this->dependency_map->registerDependencies( |
|
| 34 | + 'EventEspresso\core\domain\services\assets\CoreAssetManager', |
|
| 35 | + [ |
|
| 36 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 37 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
| 38 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
| 39 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 40 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 41 | + ] |
|
| 42 | + ); |
|
| 43 | + $this->dependency_map->registerDependencies( |
|
| 44 | + 'EventEspresso\core\services\editor\BlockRegistrationManager', |
|
| 45 | + [ |
|
| 46 | + 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
| 47 | + 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
| 48 | + 'EventEspresso\core\services\routes\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
| 49 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 50 | + ] |
|
| 51 | + ); |
|
| 52 | + $this->dependency_map->registerDependencies( |
|
| 53 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager', |
|
| 54 | + [ |
|
| 55 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 56 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 57 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 58 | + ] |
|
| 59 | + ); |
|
| 60 | + $this->dependency_map->registerDependencies( |
|
| 61 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer', |
|
| 62 | + [ |
|
| 63 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 64 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 65 | + ] |
|
| 66 | + ); |
|
| 67 | + $this->dependency_map->registerDependencies( |
|
| 68 | + 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees', |
|
| 69 | + [ |
|
| 70 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => EE_Dependency_Map::load_from_cache, |
|
| 71 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 72 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => EE_Dependency_Map::load_from_cache, |
|
| 73 | + ] |
|
| 74 | + ); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * implements logic required to run during request |
|
| 80 | - * |
|
| 81 | - * @return bool |
|
| 82 | - * @since $VID:$ |
|
| 83 | - */ |
|
| 84 | - protected function requestHandler() |
|
| 85 | - { |
|
| 86 | - $this->loader->getShared('EventEspresso\core\services\assets\Registry'); |
|
| 87 | - $this->loader->getShared('EventEspresso\core\domain\services\assets\CoreAssetManager'); |
|
| 88 | - if ($this->canLoadBlocks()) { |
|
| 89 | - $this->loader->getShared( |
|
| 90 | - 'EventEspresso\core\services\editor\BlockRegistrationManager' |
|
| 91 | - ); |
|
| 92 | - } |
|
| 93 | - return true; |
|
| 94 | - } |
|
| 78 | + /** |
|
| 79 | + * implements logic required to run during request |
|
| 80 | + * |
|
| 81 | + * @return bool |
|
| 82 | + * @since $VID:$ |
|
| 83 | + */ |
|
| 84 | + protected function requestHandler() |
|
| 85 | + { |
|
| 86 | + $this->loader->getShared('EventEspresso\core\services\assets\Registry'); |
|
| 87 | + $this->loader->getShared('EventEspresso\core\domain\services\assets\CoreAssetManager'); |
|
| 88 | + if ($this->canLoadBlocks()) { |
|
| 89 | + $this->loader->getShared( |
|
| 90 | + 'EventEspresso\core\services\editor\BlockRegistrationManager' |
|
| 91 | + ); |
|
| 92 | + } |
|
| 93 | + return true; |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Return whether blocks can be registered/loaded or not. |
|
| 99 | - * |
|
| 100 | - * @return bool |
|
| 101 | - * @since $VID:$ |
|
| 102 | - */ |
|
| 103 | - private function canLoadBlocks() |
|
| 104 | - { |
|
| 105 | - return apply_filters('FHEE__EE_System__canLoadBlocks', true) |
|
| 106 | - && function_exists('register_block_type') |
|
| 107 | - // don't load blocks if in the Divi page builder editor context |
|
| 108 | - // @see https://github.com/eventespresso/event-espresso-core/issues/814 |
|
| 109 | - && ! $this->request->getRequestParam('et_fb', false); |
|
| 110 | - } |
|
| 97 | + /** |
|
| 98 | + * Return whether blocks can be registered/loaded or not. |
|
| 99 | + * |
|
| 100 | + * @return bool |
|
| 101 | + * @since $VID:$ |
|
| 102 | + */ |
|
| 103 | + private function canLoadBlocks() |
|
| 104 | + { |
|
| 105 | + return apply_filters('FHEE__EE_System__canLoadBlocks', true) |
|
| 106 | + && function_exists('register_block_type') |
|
| 107 | + // don't load blocks if in the Divi page builder editor context |
|
| 108 | + // @see https://github.com/eventespresso/event-espresso-core/issues/814 |
|
| 109 | + && ! $this->request->getRequestParam('et_fb', false); |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * returns true if the current request matches this route |
|
| 115 | - * child classes can override and use Request directly to match route with request |
|
| 116 | - * or supply a RouteMatchSpecification class and just use the below |
|
| 117 | - * |
|
| 118 | - * @return bool |
|
| 119 | - * @since $VID:$ |
|
| 120 | - */ |
|
| 121 | - public function matchesCurrentRequest() |
|
| 122 | - { |
|
| 123 | - return $this->request->isAdmin() |
|
| 124 | - || $this->request->isFrontend() |
|
| 125 | - || $this->request->isIframe() |
|
| 126 | - || $this->request->isWordPressApi(); |
|
| 127 | - } |
|
| 113 | + /** |
|
| 114 | + * returns true if the current request matches this route |
|
| 115 | + * child classes can override and use Request directly to match route with request |
|
| 116 | + * or supply a RouteMatchSpecification class and just use the below |
|
| 117 | + * |
|
| 118 | + * @return bool |
|
| 119 | + * @since $VID:$ |
|
| 120 | + */ |
|
| 121 | + public function matchesCurrentRequest() |
|
| 122 | + { |
|
| 123 | + return $this->request->isAdmin() |
|
| 124 | + || $this->request->isFrontend() |
|
| 125 | + || $this->request->isIframe() |
|
| 126 | + || $this->request->isWordPressApi(); |
|
| 127 | + } |
|
| 128 | 128 | } |
@@ -15,12 +15,12 @@ |
||
| 15 | 15 | class WordPressPluginsPage extends RouteMatchSpecification |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @inheritDoc |
|
| 20 | - */ |
|
| 21 | - public function isMatchingRoute() |
|
| 22 | - { |
|
| 23 | - return $this->request->isAdmin() |
|
| 24 | - && strpos($this->request->requestUri(), 'wp-admin/plugins.php') !== false; |
|
| 25 | - } |
|
| 18 | + /** |
|
| 19 | + * @inheritDoc |
|
| 20 | + */ |
|
| 21 | + public function isMatchingRoute() |
|
| 22 | + { |
|
| 23 | + return $this->request->isAdmin() |
|
| 24 | + && strpos($this->request->requestUri(), 'wp-admin/plugins.php') !== false; |
|
| 25 | + } |
|
| 26 | 26 | } |