@@ -37,122 +37,122 @@ |
||
37 | 37 | * @since 4.0 |
38 | 38 | */ |
39 | 39 | if (function_exists('espresso_version')) { |
40 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
41 | - /** |
|
42 | - * espresso_duplicate_plugin_error |
|
43 | - * displays if more than one version of EE is activated at the same time |
|
44 | - */ |
|
45 | - function espresso_duplicate_plugin_error() |
|
46 | - { |
|
47 | - ?> |
|
40 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
41 | + /** |
|
42 | + * espresso_duplicate_plugin_error |
|
43 | + * displays if more than one version of EE is activated at the same time |
|
44 | + */ |
|
45 | + function espresso_duplicate_plugin_error() |
|
46 | + { |
|
47 | + ?> |
|
48 | 48 | <div class="error"> |
49 | 49 | <p> |
50 | 50 | <?php |
51 | - echo esc_html__( |
|
52 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
53 | - 'event_espresso' |
|
54 | - ); ?> |
|
51 | + echo esc_html__( |
|
52 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
53 | + 'event_espresso' |
|
54 | + ); ?> |
|
55 | 55 | </p> |
56 | 56 | </div> |
57 | 57 | <?php |
58 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
59 | - } |
|
60 | - } |
|
61 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
58 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
59 | + } |
|
60 | + } |
|
61 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
62 | 62 | } else { |
63 | - define('EE_MIN_PHP_VER_REQUIRED', '7.1.0'); |
|
64 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
65 | - /** |
|
66 | - * espresso_minimum_php_version_error |
|
67 | - * |
|
68 | - * @return void |
|
69 | - */ |
|
70 | - function espresso_minimum_php_version_error() |
|
71 | - { |
|
72 | - ?> |
|
63 | + define('EE_MIN_PHP_VER_REQUIRED', '7.1.0'); |
|
64 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
65 | + /** |
|
66 | + * espresso_minimum_php_version_error |
|
67 | + * |
|
68 | + * @return void |
|
69 | + */ |
|
70 | + function espresso_minimum_php_version_error() |
|
71 | + { |
|
72 | + ?> |
|
73 | 73 | <div class="error"> |
74 | 74 | <p> |
75 | 75 | <?php |
76 | - printf( |
|
77 | - esc_html__( |
|
78 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
79 | - 'event_espresso' |
|
80 | - ), |
|
81 | - EE_MIN_PHP_VER_REQUIRED, |
|
82 | - PHP_VERSION, |
|
83 | - '<br/>', |
|
84 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
85 | - ); |
|
86 | - ?> |
|
76 | + printf( |
|
77 | + esc_html__( |
|
78 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
79 | + 'event_espresso' |
|
80 | + ), |
|
81 | + EE_MIN_PHP_VER_REQUIRED, |
|
82 | + PHP_VERSION, |
|
83 | + '<br/>', |
|
84 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
85 | + ); |
|
86 | + ?> |
|
87 | 87 | </p> |
88 | 88 | </div> |
89 | 89 | <?php |
90 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
91 | - } |
|
90 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
91 | + } |
|
92 | 92 | |
93 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
94 | - } else { |
|
95 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
96 | - /** |
|
97 | - * espresso_version |
|
98 | - * Returns the plugin version |
|
99 | - * |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - function espresso_version() |
|
103 | - { |
|
104 | - return apply_filters('FHEE__espresso__espresso_version', '4.10.7.rc.059'); |
|
105 | - } |
|
93 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
94 | + } else { |
|
95 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
96 | + /** |
|
97 | + * espresso_version |
|
98 | + * Returns the plugin version |
|
99 | + * |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + function espresso_version() |
|
103 | + { |
|
104 | + return apply_filters('FHEE__espresso__espresso_version', '4.10.7.rc.059'); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * espresso_plugin_activation |
|
109 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
110 | - */ |
|
111 | - function espresso_plugin_activation() |
|
112 | - { |
|
113 | - update_option('ee_espresso_activation', true); |
|
107 | + /** |
|
108 | + * espresso_plugin_activation |
|
109 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
110 | + */ |
|
111 | + function espresso_plugin_activation() |
|
112 | + { |
|
113 | + update_option('ee_espresso_activation', true); |
|
114 | 114 | |
115 | - // Run WP GraphQL activation callback |
|
116 | - if (! class_exists('WPGraphQL')) { |
|
117 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
118 | - } |
|
119 | - graphql_init()->activate(); |
|
120 | - } |
|
115 | + // Run WP GraphQL activation callback |
|
116 | + if (! class_exists('WPGraphQL')) { |
|
117 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
118 | + } |
|
119 | + graphql_init()->activate(); |
|
120 | + } |
|
121 | 121 | |
122 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
122 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
123 | 123 | |
124 | - /** |
|
125 | - * espresso_plugin_deactivation |
|
126 | - */ |
|
127 | - function espresso_plugin_deactivation() |
|
128 | - { |
|
129 | - // Run WP GraphQL deactivation callback |
|
130 | - if (! class_exists('WPGraphQL')) { |
|
131 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
132 | - } |
|
133 | - graphql_init()->deactivate(); |
|
134 | - } |
|
135 | - register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
124 | + /** |
|
125 | + * espresso_plugin_deactivation |
|
126 | + */ |
|
127 | + function espresso_plugin_deactivation() |
|
128 | + { |
|
129 | + // Run WP GraphQL deactivation callback |
|
130 | + if (! class_exists('WPGraphQL')) { |
|
131 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
132 | + } |
|
133 | + graphql_init()->deactivate(); |
|
134 | + } |
|
135 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
136 | 136 | |
137 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
138 | - bootstrap_espresso(); |
|
139 | - } |
|
137 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
138 | + bootstrap_espresso(); |
|
139 | + } |
|
140 | 140 | } |
141 | 141 | if (! function_exists('espresso_deactivate_plugin')) { |
142 | - /** |
|
143 | - * deactivate_plugin |
|
144 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
145 | - * |
|
146 | - * @access public |
|
147 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
148 | - * @return void |
|
149 | - */ |
|
150 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
151 | - { |
|
152 | - if (! function_exists('deactivate_plugins')) { |
|
153 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
154 | - } |
|
155 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
156 | - deactivate_plugins($plugin_basename); |
|
157 | - } |
|
142 | + /** |
|
143 | + * deactivate_plugin |
|
144 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
145 | + * |
|
146 | + * @access public |
|
147 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
148 | + * @return void |
|
149 | + */ |
|
150 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
151 | + { |
|
152 | + if (! function_exists('deactivate_plugins')) { |
|
153 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
154 | + } |
|
155 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
156 | + deactivate_plugins($plugin_basename); |
|
157 | + } |
|
158 | 158 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @since 4.0 |
38 | 38 | */ |
39 | 39 | if (function_exists('espresso_version')) { |
40 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
40 | + if ( ! function_exists('espresso_duplicate_plugin_error')) { |
|
41 | 41 | /** |
42 | 42 | * espresso_duplicate_plugin_error |
43 | 43 | * displays if more than one version of EE is activated at the same time |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
62 | 62 | } else { |
63 | 63 | define('EE_MIN_PHP_VER_REQUIRED', '7.1.0'); |
64 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
64 | + if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
65 | 65 | /** |
66 | 66 | * espresso_minimum_php_version_error |
67 | 67 | * |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | update_option('ee_espresso_activation', true); |
114 | 114 | |
115 | 115 | // Run WP GraphQL activation callback |
116 | - if (! class_exists('WPGraphQL')) { |
|
117 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
116 | + if ( ! class_exists('WPGraphQL')) { |
|
117 | + require_once EE_THIRD_PARTY.'wp-graphql/wp-graphql.php'; |
|
118 | 118 | } |
119 | 119 | graphql_init()->activate(); |
120 | 120 | } |
@@ -127,18 +127,18 @@ discard block |
||
127 | 127 | function espresso_plugin_deactivation() |
128 | 128 | { |
129 | 129 | // Run WP GraphQL deactivation callback |
130 | - if (! class_exists('WPGraphQL')) { |
|
131 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
130 | + if ( ! class_exists('WPGraphQL')) { |
|
131 | + require_once EE_THIRD_PARTY.'wp-graphql/wp-graphql.php'; |
|
132 | 132 | } |
133 | 133 | graphql_init()->deactivate(); |
134 | 134 | } |
135 | 135 | register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
136 | 136 | |
137 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
137 | + require_once __DIR__.'/core/bootstrap_espresso.php'; |
|
138 | 138 | bootstrap_espresso(); |
139 | 139 | } |
140 | 140 | } |
141 | -if (! function_exists('espresso_deactivate_plugin')) { |
|
141 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
142 | 142 | /** |
143 | 143 | * deactivate_plugin |
144 | 144 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | */ |
150 | 150 | function espresso_deactivate_plugin($plugin_basename = '') |
151 | 151 | { |
152 | - if (! function_exists('deactivate_plugins')) { |
|
153 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
152 | + if ( ! function_exists('deactivate_plugins')) { |
|
153 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
154 | 154 | } |
155 | 155 | unset($_GET['activate'], $_REQUEST['activate']); |
156 | 156 | deactivate_plugins($plugin_basename); |
@@ -19,207 +19,207 @@ |
||
19 | 19 | */ |
20 | 20 | class GQLRequests extends Route |
21 | 21 | { |
22 | - /** |
|
23 | - * @var AssetManifestFactory |
|
24 | - */ |
|
25 | - private $manifest_factory; |
|
22 | + /** |
|
23 | + * @var AssetManifestFactory |
|
24 | + */ |
|
25 | + private $manifest_factory; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * AssetRequests constructor. |
|
30 | - * |
|
31 | - * @param EE_Dependency_Map $dependency_map |
|
32 | - * @param LoaderInterface $loader |
|
33 | - * @param RequestInterface $request |
|
34 | - * @param AssetManifestFactory $manifest_factory |
|
35 | - */ |
|
36 | - public function __construct( |
|
37 | - EE_Dependency_Map $dependency_map, |
|
38 | - LoaderInterface $loader, |
|
39 | - RequestInterface $request, |
|
40 | - AssetManifestFactory $manifest_factory |
|
41 | - ) { |
|
42 | - $this->manifest_factory = $manifest_factory; |
|
43 | - parent::__construct($dependency_map, $loader, $request); |
|
44 | - } |
|
28 | + /** |
|
29 | + * AssetRequests constructor. |
|
30 | + * |
|
31 | + * @param EE_Dependency_Map $dependency_map |
|
32 | + * @param LoaderInterface $loader |
|
33 | + * @param RequestInterface $request |
|
34 | + * @param AssetManifestFactory $manifest_factory |
|
35 | + */ |
|
36 | + public function __construct( |
|
37 | + EE_Dependency_Map $dependency_map, |
|
38 | + LoaderInterface $loader, |
|
39 | + RequestInterface $request, |
|
40 | + AssetManifestFactory $manifest_factory |
|
41 | + ) { |
|
42 | + $this->manifest_factory = $manifest_factory; |
|
43 | + parent::__construct($dependency_map, $loader, $request); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * returns true if the current request matches this route |
|
49 | - * |
|
50 | - * @return bool |
|
51 | - * @since $VID:$ |
|
52 | - */ |
|
53 | - public function matchesCurrentRequest() |
|
54 | - { |
|
55 | - global $pagenow; |
|
56 | - return ( |
|
57 | - $this->request->isGQL() |
|
58 | - || $this->request->isUnitTesting() |
|
59 | - || ( |
|
60 | - $this->request->isAdmin() |
|
61 | - && $this->request->getRequestParam('page') === 'espresso_events' |
|
62 | - && ( |
|
63 | - $this->request->getRequestParam('action') === 'create_new' |
|
64 | - || $this->request->getRequestParam('action') === 'edit' |
|
65 | - ) |
|
66 | - ) |
|
67 | - || ( |
|
68 | - $pagenow |
|
69 | - && ( |
|
70 | - $pagenow === 'post-new.php' |
|
71 | - || ( |
|
72 | - $pagenow === 'post.php' |
|
73 | - && $this->request->getRequestParam('action') === 'edit' |
|
74 | - ) |
|
75 | - ) |
|
76 | - ) |
|
77 | - ); |
|
78 | - } |
|
47 | + /** |
|
48 | + * returns true if the current request matches this route |
|
49 | + * |
|
50 | + * @return bool |
|
51 | + * @since $VID:$ |
|
52 | + */ |
|
53 | + public function matchesCurrentRequest() |
|
54 | + { |
|
55 | + global $pagenow; |
|
56 | + return ( |
|
57 | + $this->request->isGQL() |
|
58 | + || $this->request->isUnitTesting() |
|
59 | + || ( |
|
60 | + $this->request->isAdmin() |
|
61 | + && $this->request->getRequestParam('page') === 'espresso_events' |
|
62 | + && ( |
|
63 | + $this->request->getRequestParam('action') === 'create_new' |
|
64 | + || $this->request->getRequestParam('action') === 'edit' |
|
65 | + ) |
|
66 | + ) |
|
67 | + || ( |
|
68 | + $pagenow |
|
69 | + && ( |
|
70 | + $pagenow === 'post-new.php' |
|
71 | + || ( |
|
72 | + $pagenow === 'post.php' |
|
73 | + && $this->request->getRequestParam('action') === 'edit' |
|
74 | + ) |
|
75 | + ) |
|
76 | + ) |
|
77 | + ); |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | - /** |
|
82 | - * @since $VID:$ |
|
83 | - */ |
|
84 | - protected function registerDependencies() |
|
85 | - { |
|
86 | - $this->dependency_map->registerDependencies( |
|
87 | - 'EventEspresso\core\services\graphql\GraphQLManager', |
|
88 | - [ |
|
89 | - 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
90 | - 'EventEspresso\core\services\graphql\DataLoaderManager' => EE_Dependency_Map::load_from_cache, |
|
91 | - 'EventEspresso\core\services\graphql\EnumsManager' => EE_Dependency_Map::load_from_cache, |
|
92 | - 'EventEspresso\core\services\graphql\InputsManager' => EE_Dependency_Map::load_from_cache, |
|
93 | - 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
94 | - ] |
|
95 | - ); |
|
96 | - $this->dependency_map->registerDependencies( |
|
97 | - 'EventEspresso\core\services\graphql\TypesManager', |
|
98 | - [ |
|
99 | - 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
100 | - ] |
|
101 | - ); |
|
102 | - $this->dependency_map->registerDependencies( |
|
103 | - 'EventEspresso\core\services\graphql\InputsManager', |
|
104 | - [ |
|
105 | - 'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache, |
|
106 | - ] |
|
107 | - ); |
|
108 | - $this->dependency_map->registerDependencies( |
|
109 | - 'EventEspresso\core\services\graphql\EnumsManager', |
|
110 | - [ |
|
111 | - 'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache, |
|
112 | - ] |
|
113 | - ); |
|
114 | - $this->dependency_map->registerDependencies( |
|
115 | - 'EventEspresso\core\services\graphql\ConnectionsManager', |
|
116 | - [ |
|
117 | - 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
118 | - ] |
|
119 | - ); |
|
120 | - $this->dependency_map->registerDependencies( |
|
121 | - 'EventEspresso\core\services\graphql\DataLoaderManager', |
|
122 | - [ |
|
123 | - 'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache, |
|
124 | - ] |
|
125 | - ); |
|
126 | - $this->dependency_map->registerDependencies( |
|
127 | - 'EventEspresso\core\domain\services\graphql\types\Datetime', |
|
128 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
129 | - ); |
|
130 | - $this->dependency_map->registerDependencies( |
|
131 | - 'EventEspresso\core\domain\services\graphql\types\Attendee', |
|
132 | - ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
133 | - ); |
|
134 | - $this->dependency_map->registerDependencies( |
|
135 | - 'EventEspresso\core\domain\services\graphql\types\Event', |
|
136 | - ['EEM_Event' => EE_Dependency_Map::load_from_cache] |
|
137 | - ); |
|
138 | - $this->dependency_map->registerDependencies( |
|
139 | - 'EventEspresso\core\domain\services\graphql\types\Ticket', |
|
140 | - ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
141 | - ); |
|
142 | - $this->dependency_map->registerDependencies( |
|
143 | - 'EventEspresso\core\domain\services\graphql\types\Price', |
|
144 | - ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
145 | - ); |
|
146 | - $this->dependency_map->registerDependencies( |
|
147 | - 'EventEspresso\core\domain\services\graphql\types\PriceType', |
|
148 | - ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
149 | - ); |
|
150 | - $this->dependency_map->registerDependencies( |
|
151 | - 'EventEspresso\core\domain\services\graphql\types\Venue', |
|
152 | - ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
153 | - ); |
|
154 | - $this->dependency_map->registerDependencies( |
|
155 | - 'EventEspresso\core\domain\services\graphql\types\State', |
|
156 | - ['EEM_State' => EE_Dependency_Map::load_from_cache] |
|
157 | - ); |
|
158 | - $this->dependency_map->registerDependencies( |
|
159 | - 'EventEspresso\core\domain\services\graphql\types\Country', |
|
160 | - ['EEM_Country' => EE_Dependency_Map::load_from_cache] |
|
161 | - ); |
|
162 | - $this->dependency_map->registerDependencies( |
|
163 | - 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection', |
|
164 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
165 | - ); |
|
166 | - $this->dependency_map->registerDependencies( |
|
167 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection', |
|
168 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
169 | - ); |
|
170 | - $this->dependency_map->registerDependencies( |
|
171 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection', |
|
172 | - ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
173 | - ); |
|
174 | - $this->dependency_map->registerDependencies( |
|
175 | - 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection', |
|
176 | - ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
177 | - ); |
|
178 | - $this->dependency_map->registerDependencies( |
|
179 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection', |
|
180 | - ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
181 | - ); |
|
182 | - $this->dependency_map->registerDependencies( |
|
183 | - 'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection', |
|
184 | - ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
185 | - ); |
|
186 | - $this->dependency_map->registerDependencies( |
|
187 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection', |
|
188 | - ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
189 | - ); |
|
190 | - $this->dependency_map->registerDependencies( |
|
191 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection', |
|
192 | - ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
193 | - ); |
|
194 | - $this->dependency_map->registerDependencies( |
|
195 | - 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection', |
|
196 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
197 | - ); |
|
198 | - $this->dependency_map->registerDependencies( |
|
199 | - 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection', |
|
200 | - ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
201 | - ); |
|
202 | - } |
|
81 | + /** |
|
82 | + * @since $VID:$ |
|
83 | + */ |
|
84 | + protected function registerDependencies() |
|
85 | + { |
|
86 | + $this->dependency_map->registerDependencies( |
|
87 | + 'EventEspresso\core\services\graphql\GraphQLManager', |
|
88 | + [ |
|
89 | + 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
90 | + 'EventEspresso\core\services\graphql\DataLoaderManager' => EE_Dependency_Map::load_from_cache, |
|
91 | + 'EventEspresso\core\services\graphql\EnumsManager' => EE_Dependency_Map::load_from_cache, |
|
92 | + 'EventEspresso\core\services\graphql\InputsManager' => EE_Dependency_Map::load_from_cache, |
|
93 | + 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
94 | + ] |
|
95 | + ); |
|
96 | + $this->dependency_map->registerDependencies( |
|
97 | + 'EventEspresso\core\services\graphql\TypesManager', |
|
98 | + [ |
|
99 | + 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
100 | + ] |
|
101 | + ); |
|
102 | + $this->dependency_map->registerDependencies( |
|
103 | + 'EventEspresso\core\services\graphql\InputsManager', |
|
104 | + [ |
|
105 | + 'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache, |
|
106 | + ] |
|
107 | + ); |
|
108 | + $this->dependency_map->registerDependencies( |
|
109 | + 'EventEspresso\core\services\graphql\EnumsManager', |
|
110 | + [ |
|
111 | + 'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache, |
|
112 | + ] |
|
113 | + ); |
|
114 | + $this->dependency_map->registerDependencies( |
|
115 | + 'EventEspresso\core\services\graphql\ConnectionsManager', |
|
116 | + [ |
|
117 | + 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
118 | + ] |
|
119 | + ); |
|
120 | + $this->dependency_map->registerDependencies( |
|
121 | + 'EventEspresso\core\services\graphql\DataLoaderManager', |
|
122 | + [ |
|
123 | + 'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache, |
|
124 | + ] |
|
125 | + ); |
|
126 | + $this->dependency_map->registerDependencies( |
|
127 | + 'EventEspresso\core\domain\services\graphql\types\Datetime', |
|
128 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
129 | + ); |
|
130 | + $this->dependency_map->registerDependencies( |
|
131 | + 'EventEspresso\core\domain\services\graphql\types\Attendee', |
|
132 | + ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
133 | + ); |
|
134 | + $this->dependency_map->registerDependencies( |
|
135 | + 'EventEspresso\core\domain\services\graphql\types\Event', |
|
136 | + ['EEM_Event' => EE_Dependency_Map::load_from_cache] |
|
137 | + ); |
|
138 | + $this->dependency_map->registerDependencies( |
|
139 | + 'EventEspresso\core\domain\services\graphql\types\Ticket', |
|
140 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
141 | + ); |
|
142 | + $this->dependency_map->registerDependencies( |
|
143 | + 'EventEspresso\core\domain\services\graphql\types\Price', |
|
144 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
145 | + ); |
|
146 | + $this->dependency_map->registerDependencies( |
|
147 | + 'EventEspresso\core\domain\services\graphql\types\PriceType', |
|
148 | + ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
149 | + ); |
|
150 | + $this->dependency_map->registerDependencies( |
|
151 | + 'EventEspresso\core\domain\services\graphql\types\Venue', |
|
152 | + ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
153 | + ); |
|
154 | + $this->dependency_map->registerDependencies( |
|
155 | + 'EventEspresso\core\domain\services\graphql\types\State', |
|
156 | + ['EEM_State' => EE_Dependency_Map::load_from_cache] |
|
157 | + ); |
|
158 | + $this->dependency_map->registerDependencies( |
|
159 | + 'EventEspresso\core\domain\services\graphql\types\Country', |
|
160 | + ['EEM_Country' => EE_Dependency_Map::load_from_cache] |
|
161 | + ); |
|
162 | + $this->dependency_map->registerDependencies( |
|
163 | + 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection', |
|
164 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
165 | + ); |
|
166 | + $this->dependency_map->registerDependencies( |
|
167 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection', |
|
168 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
169 | + ); |
|
170 | + $this->dependency_map->registerDependencies( |
|
171 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection', |
|
172 | + ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
173 | + ); |
|
174 | + $this->dependency_map->registerDependencies( |
|
175 | + 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection', |
|
176 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
177 | + ); |
|
178 | + $this->dependency_map->registerDependencies( |
|
179 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection', |
|
180 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
181 | + ); |
|
182 | + $this->dependency_map->registerDependencies( |
|
183 | + 'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection', |
|
184 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
185 | + ); |
|
186 | + $this->dependency_map->registerDependencies( |
|
187 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection', |
|
188 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
189 | + ); |
|
190 | + $this->dependency_map->registerDependencies( |
|
191 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection', |
|
192 | + ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
193 | + ); |
|
194 | + $this->dependency_map->registerDependencies( |
|
195 | + 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection', |
|
196 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
197 | + ); |
|
198 | + $this->dependency_map->registerDependencies( |
|
199 | + 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection', |
|
200 | + ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
201 | + ); |
|
202 | + } |
|
203 | 203 | |
204 | 204 | |
205 | - /** |
|
206 | - * implements logic required to run during request |
|
207 | - * |
|
208 | - * @return bool |
|
209 | - * @since $VID:$ |
|
210 | - */ |
|
211 | - protected function requestHandler() |
|
212 | - { |
|
213 | - if (! class_exists('WPGraphQL')) { |
|
214 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
215 | - } |
|
216 | - // load handler for EE GraphQL requests |
|
217 | - $graphQL_manager = $this->loader->getShared( |
|
218 | - 'EventEspresso\core\services\graphql\GraphQLManager' |
|
219 | - ); |
|
220 | - $graphQL_manager->init(); |
|
221 | - $manifest = $this->manifest_factory->createFromDomainObject(DomainFactory::getEventEspressoCoreDomain()); |
|
222 | - $manifest->initialize(); |
|
223 | - return true; |
|
224 | - } |
|
205 | + /** |
|
206 | + * implements logic required to run during request |
|
207 | + * |
|
208 | + * @return bool |
|
209 | + * @since $VID:$ |
|
210 | + */ |
|
211 | + protected function requestHandler() |
|
212 | + { |
|
213 | + if (! class_exists('WPGraphQL')) { |
|
214 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
215 | + } |
|
216 | + // load handler for EE GraphQL requests |
|
217 | + $graphQL_manager = $this->loader->getShared( |
|
218 | + 'EventEspresso\core\services\graphql\GraphQLManager' |
|
219 | + ); |
|
220 | + $graphQL_manager->init(); |
|
221 | + $manifest = $this->manifest_factory->createFromDomainObject(DomainFactory::getEventEspressoCoreDomain()); |
|
222 | + $manifest->initialize(); |
|
223 | + return true; |
|
224 | + } |
|
225 | 225 | } |
@@ -19,127 +19,127 @@ |
||
19 | 19 | class EspressoEventEditor extends EspressoEventsAdmin |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * returns true if the current request matches this route |
|
24 | - * |
|
25 | - * @return bool |
|
26 | - * @since $VID:$ |
|
27 | - */ |
|
28 | - public function matchesCurrentRequest() |
|
29 | - { |
|
30 | - return parent::matchesCurrentRequest() |
|
31 | - && $this->admin_config->useAdvancedEditor() |
|
32 | - && ( |
|
33 | - $this->request->getRequestParam('action') === 'create_new' |
|
34 | - || $this->request->getRequestParam('action') === 'edit' |
|
35 | - ); |
|
36 | - } |
|
22 | + /** |
|
23 | + * returns true if the current request matches this route |
|
24 | + * |
|
25 | + * @return bool |
|
26 | + * @since $VID:$ |
|
27 | + */ |
|
28 | + public function matchesCurrentRequest() |
|
29 | + { |
|
30 | + return parent::matchesCurrentRequest() |
|
31 | + && $this->admin_config->useAdvancedEditor() |
|
32 | + && ( |
|
33 | + $this->request->getRequestParam('action') === 'create_new' |
|
34 | + || $this->request->getRequestParam('action') === 'edit' |
|
35 | + ); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @since $VID:$ |
|
41 | - */ |
|
42 | - protected function registerDependencies() |
|
43 | - { |
|
44 | - $this->dependency_map->registerDependencies( |
|
45 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData', |
|
46 | - [ |
|
47 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes' => EE_Dependency_Map::load_from_cache, |
|
48 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Prices' => EE_Dependency_Map::load_from_cache, |
|
49 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes' => EE_Dependency_Map::load_from_cache, |
|
50 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets' => EE_Dependency_Map::load_from_cache, |
|
51 | - 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache, |
|
52 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => EE_Dependency_Map::load_from_cache, |
|
53 | - ] |
|
54 | - ); |
|
55 | - $this->dependency_map->registerDependencies( |
|
56 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations', |
|
57 | - [ |
|
58 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
59 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
60 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
61 | - 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
62 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
63 | - ] |
|
64 | - ); |
|
65 | - $this->dependency_map->registerDependencies( |
|
66 | - 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities', |
|
67 | - [ |
|
68 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
69 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
70 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
71 | - 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
72 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
73 | - 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache, |
|
74 | - ] |
|
75 | - ); |
|
76 | - $this->dependency_map->registerDependencies( |
|
77 | - 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes', |
|
78 | - [ |
|
79 | - 'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache, |
|
80 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
81 | - ] |
|
82 | - ); |
|
83 | - $this->dependency_map->registerDependencies( |
|
84 | - 'EventEspresso\core\domain\services\admin\entities\DefaultTickets', |
|
85 | - [ |
|
86 | - 'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache, |
|
87 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
88 | - ] |
|
89 | - ); |
|
90 | - $this->dependency_map->registerDependencies( |
|
91 | - 'EventEspresso\core\domain\services\admin\entities\DefaultPrices', |
|
92 | - [ |
|
93 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
94 | - 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
95 | - ] |
|
96 | - ); |
|
97 | - $this->dependency_map->registerDependencies( |
|
98 | - 'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor', |
|
99 | - [ |
|
100 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => EE_Dependency_Map::load_from_cache, |
|
101 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
102 | - ] |
|
103 | - ); |
|
104 | - $this->dependency_map->registerDependencies( |
|
105 | - 'EventEspresso\core\domain\services\assets\EventEditorAssetManager', |
|
106 | - [ |
|
107 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
108 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
109 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
110 | - ] |
|
111 | - ); |
|
112 | - $this->loader->getShared( |
|
113 | - 'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData' |
|
114 | - ); |
|
115 | - /** @var EventEditor $data_node */ |
|
116 | - $data_node = $this->loader->getShared( |
|
117 | - 'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor' |
|
118 | - ); |
|
119 | - $this->setDataNode($data_node); |
|
120 | - } |
|
39 | + /** |
|
40 | + * @since $VID:$ |
|
41 | + */ |
|
42 | + protected function registerDependencies() |
|
43 | + { |
|
44 | + $this->dependency_map->registerDependencies( |
|
45 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData', |
|
46 | + [ |
|
47 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes' => EE_Dependency_Map::load_from_cache, |
|
48 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Prices' => EE_Dependency_Map::load_from_cache, |
|
49 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes' => EE_Dependency_Map::load_from_cache, |
|
50 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets' => EE_Dependency_Map::load_from_cache, |
|
51 | + 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache, |
|
52 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => EE_Dependency_Map::load_from_cache, |
|
53 | + ] |
|
54 | + ); |
|
55 | + $this->dependency_map->registerDependencies( |
|
56 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations', |
|
57 | + [ |
|
58 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
59 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
60 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
61 | + 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
62 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
63 | + ] |
|
64 | + ); |
|
65 | + $this->dependency_map->registerDependencies( |
|
66 | + 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities', |
|
67 | + [ |
|
68 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
69 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
70 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
71 | + 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
72 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
73 | + 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache, |
|
74 | + ] |
|
75 | + ); |
|
76 | + $this->dependency_map->registerDependencies( |
|
77 | + 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes', |
|
78 | + [ |
|
79 | + 'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache, |
|
80 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
81 | + ] |
|
82 | + ); |
|
83 | + $this->dependency_map->registerDependencies( |
|
84 | + 'EventEspresso\core\domain\services\admin\entities\DefaultTickets', |
|
85 | + [ |
|
86 | + 'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache, |
|
87 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
88 | + ] |
|
89 | + ); |
|
90 | + $this->dependency_map->registerDependencies( |
|
91 | + 'EventEspresso\core\domain\services\admin\entities\DefaultPrices', |
|
92 | + [ |
|
93 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
94 | + 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
95 | + ] |
|
96 | + ); |
|
97 | + $this->dependency_map->registerDependencies( |
|
98 | + 'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor', |
|
99 | + [ |
|
100 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => EE_Dependency_Map::load_from_cache, |
|
101 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
102 | + ] |
|
103 | + ); |
|
104 | + $this->dependency_map->registerDependencies( |
|
105 | + 'EventEspresso\core\domain\services\assets\EventEditorAssetManager', |
|
106 | + [ |
|
107 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
108 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
109 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
110 | + ] |
|
111 | + ); |
|
112 | + $this->loader->getShared( |
|
113 | + 'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData' |
|
114 | + ); |
|
115 | + /** @var EventEditor $data_node */ |
|
116 | + $data_node = $this->loader->getShared( |
|
117 | + 'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor' |
|
118 | + ); |
|
119 | + $this->setDataNode($data_node); |
|
120 | + } |
|
121 | 121 | |
122 | 122 | |
123 | - /** |
|
124 | - * implements logic required to run during request |
|
125 | - * |
|
126 | - * @return bool |
|
127 | - * @since $VID:$ |
|
128 | - */ |
|
129 | - protected function requestHandler() |
|
130 | - { |
|
131 | - if (! class_exists('WPGraphQL')) { |
|
132 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
133 | - } |
|
134 | - /** @var GraphQLManager $graphQL_manager */ |
|
135 | - $graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager'); |
|
136 | - $graphQL_manager->init(); |
|
123 | + /** |
|
124 | + * implements logic required to run during request |
|
125 | + * |
|
126 | + * @return bool |
|
127 | + * @since $VID:$ |
|
128 | + */ |
|
129 | + protected function requestHandler() |
|
130 | + { |
|
131 | + if (! class_exists('WPGraphQL')) { |
|
132 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
133 | + } |
|
134 | + /** @var GraphQLManager $graphQL_manager */ |
|
135 | + $graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager'); |
|
136 | + $graphQL_manager->init(); |
|
137 | 137 | |
138 | - /** @var EventEditorAssetManager $asset_manager */ |
|
139 | - $asset_manager = $this->loader->getShared( |
|
140 | - 'EventEspresso\core\domain\services\assets\EventEditorAssetManager' |
|
141 | - ); |
|
142 | - add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueEventEditor']); |
|
143 | - return true; |
|
144 | - } |
|
138 | + /** @var EventEditorAssetManager $asset_manager */ |
|
139 | + $asset_manager = $this->loader->getShared( |
|
140 | + 'EventEspresso\core\domain\services\assets\EventEditorAssetManager' |
|
141 | + ); |
|
142 | + add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueEventEditor']); |
|
143 | + return true; |
|
144 | + } |
|
145 | 145 | } |
@@ -128,8 +128,8 @@ |
||
128 | 128 | */ |
129 | 129 | protected function requestHandler() |
130 | 130 | { |
131 | - if (! class_exists('WPGraphQL')) { |
|
132 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
131 | + if ( ! class_exists('WPGraphQL')) { |
|
132 | + require_once EE_THIRD_PARTY.'wp-graphql/wp-graphql.php'; |
|
133 | 133 | } |
134 | 134 | /** @var GraphQLManager $graphQL_manager */ |
135 | 135 | $graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager'); |
@@ -21,174 +21,174 @@ |
||
21 | 21 | class RouteHandler |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var JsonDataNodeHandler $data_node_handler |
|
26 | - */ |
|
27 | - private $data_node_handler; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var LoaderInterface $loader |
|
31 | - */ |
|
32 | - private $loader; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var RequestInterface $request |
|
36 | - */ |
|
37 | - protected $request; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var RouteCollection $routes |
|
41 | - */ |
|
42 | - private $routes; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var boolean $print_data_nodes |
|
46 | - */ |
|
47 | - private $print_data_nodes = true; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var string $route_request_type |
|
51 | - */ |
|
52 | - protected $route_request_type; |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * RouteHandler constructor. |
|
57 | - * |
|
58 | - * @param JsonDataNodeHandler $data_node_handler |
|
59 | - * @param LoaderInterface $loader |
|
60 | - * @param RequestInterface $request |
|
61 | - * @param RouteCollection $routes |
|
62 | - */ |
|
63 | - public function __construct( |
|
64 | - JsonDataNodeHandler $data_node_handler, |
|
65 | - LoaderInterface $loader, |
|
66 | - RequestInterface $request, |
|
67 | - RouteCollection $routes |
|
68 | - ) { |
|
69 | - $this->data_node_handler = $data_node_handler; |
|
70 | - $this->loader = $loader; |
|
71 | - $this->request = $request; |
|
72 | - $this->routes = $routes; |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * @param string $fqcn Fully Qualified Class Name for Route |
|
78 | - * @param bool $handle if true [default] will immediately call RouteInterface::handleRequest() after adding |
|
79 | - * @throws Exception |
|
80 | - * @since $VID:$ |
|
81 | - */ |
|
82 | - public function addRoute($fqcn, $handle = true) |
|
83 | - { |
|
84 | - try { |
|
85 | - $route = $this->loader->getShared($fqcn); |
|
86 | - $this->validateRoute($route, $fqcn); |
|
87 | - $this->routes->add($route); |
|
88 | - $this->handle($route, $handle); |
|
89 | - } catch (Exception $exception) { |
|
90 | - new ExceptionStackTraceDisplay( |
|
91 | - new DomainException( |
|
92 | - sprintf( |
|
93 | - esc_html__( |
|
94 | - 'The following error occurred while trying to handle the "%1$s" route:%2$s%3$s', |
|
95 | - 'event_espresso' |
|
96 | - ), |
|
97 | - $fqcn, |
|
98 | - '<br />', |
|
99 | - $exception->getMessage() |
|
100 | - ) |
|
101 | - ) |
|
102 | - ); |
|
103 | - } |
|
104 | - } |
|
105 | - |
|
106 | - |
|
107 | - /** |
|
108 | - * @return string |
|
109 | - */ |
|
110 | - public function getRouteRequestType() |
|
111 | - { |
|
112 | - return $this->route_request_type; |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * @param string $route_request_type |
|
118 | - */ |
|
119 | - public function setRouteRequestType($route_request_type) |
|
120 | - { |
|
121 | - $this->route_request_type = $route_request_type !== null ? $route_request_type : $this->route_request_type; |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - /** |
|
126 | - * @param RouteInterface $route |
|
127 | - * @param bool $handle if true [default] will immediately call RouteInterface::handleRequest() |
|
128 | - */ |
|
129 | - public function handle(RouteInterface $route, $handle = true) |
|
130 | - { |
|
131 | - if ($handle && $route->isNotHandled()) { |
|
132 | - $route->handleRequest(); |
|
133 | - if ($route instanceof PrimaryRoute) { |
|
134 | - $this->setRouteRequestType($route->getRouteRequestType()); |
|
135 | - } |
|
136 | - $data_node = $route->dataNode(); |
|
137 | - if ($data_node instanceof JsonDataNode) { |
|
138 | - $this->data_node_handler->addDataNode($data_node); |
|
139 | - $this->printDataNodes(); |
|
140 | - } |
|
141 | - } |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - /** |
|
146 | - * calls RouteInterface::handleRequest() on all Routes that |
|
147 | - * - match current request |
|
148 | - * - have yet to be handled |
|
149 | - * |
|
150 | - * @return void |
|
151 | - */ |
|
152 | - public function handleRoutesForCurrentRequest() |
|
153 | - { |
|
154 | - $this->routes->handleRoutesForCurrentRequest(); |
|
155 | - } |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * @since $VID:$ |
|
160 | - */ |
|
161 | - private function printDataNodes() |
|
162 | - { |
|
163 | - if ($this->print_data_nodes) { |
|
164 | - add_action('admin_footer', [$this->data_node_handler, 'printDataNode'], 0); |
|
165 | - add_action('wp_footer', [$this->data_node_handler, 'printDataNode'], 0); |
|
166 | - $this->print_data_nodes = false; |
|
167 | - } |
|
168 | - } |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * @param RouteInterface $route |
|
173 | - * @param string $fqcn |
|
174 | - * @since $VID:$ |
|
175 | - */ |
|
176 | - private function validateRoute($route, $fqcn) |
|
177 | - { |
|
178 | - if (! $route instanceof RouteInterface) { |
|
179 | - throw new InvalidClassException( |
|
180 | - sprintf( |
|
181 | - /* |
|
24 | + /** |
|
25 | + * @var JsonDataNodeHandler $data_node_handler |
|
26 | + */ |
|
27 | + private $data_node_handler; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var LoaderInterface $loader |
|
31 | + */ |
|
32 | + private $loader; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var RequestInterface $request |
|
36 | + */ |
|
37 | + protected $request; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var RouteCollection $routes |
|
41 | + */ |
|
42 | + private $routes; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var boolean $print_data_nodes |
|
46 | + */ |
|
47 | + private $print_data_nodes = true; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var string $route_request_type |
|
51 | + */ |
|
52 | + protected $route_request_type; |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * RouteHandler constructor. |
|
57 | + * |
|
58 | + * @param JsonDataNodeHandler $data_node_handler |
|
59 | + * @param LoaderInterface $loader |
|
60 | + * @param RequestInterface $request |
|
61 | + * @param RouteCollection $routes |
|
62 | + */ |
|
63 | + public function __construct( |
|
64 | + JsonDataNodeHandler $data_node_handler, |
|
65 | + LoaderInterface $loader, |
|
66 | + RequestInterface $request, |
|
67 | + RouteCollection $routes |
|
68 | + ) { |
|
69 | + $this->data_node_handler = $data_node_handler; |
|
70 | + $this->loader = $loader; |
|
71 | + $this->request = $request; |
|
72 | + $this->routes = $routes; |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * @param string $fqcn Fully Qualified Class Name for Route |
|
78 | + * @param bool $handle if true [default] will immediately call RouteInterface::handleRequest() after adding |
|
79 | + * @throws Exception |
|
80 | + * @since $VID:$ |
|
81 | + */ |
|
82 | + public function addRoute($fqcn, $handle = true) |
|
83 | + { |
|
84 | + try { |
|
85 | + $route = $this->loader->getShared($fqcn); |
|
86 | + $this->validateRoute($route, $fqcn); |
|
87 | + $this->routes->add($route); |
|
88 | + $this->handle($route, $handle); |
|
89 | + } catch (Exception $exception) { |
|
90 | + new ExceptionStackTraceDisplay( |
|
91 | + new DomainException( |
|
92 | + sprintf( |
|
93 | + esc_html__( |
|
94 | + 'The following error occurred while trying to handle the "%1$s" route:%2$s%3$s', |
|
95 | + 'event_espresso' |
|
96 | + ), |
|
97 | + $fqcn, |
|
98 | + '<br />', |
|
99 | + $exception->getMessage() |
|
100 | + ) |
|
101 | + ) |
|
102 | + ); |
|
103 | + } |
|
104 | + } |
|
105 | + |
|
106 | + |
|
107 | + /** |
|
108 | + * @return string |
|
109 | + */ |
|
110 | + public function getRouteRequestType() |
|
111 | + { |
|
112 | + return $this->route_request_type; |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * @param string $route_request_type |
|
118 | + */ |
|
119 | + public function setRouteRequestType($route_request_type) |
|
120 | + { |
|
121 | + $this->route_request_type = $route_request_type !== null ? $route_request_type : $this->route_request_type; |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + /** |
|
126 | + * @param RouteInterface $route |
|
127 | + * @param bool $handle if true [default] will immediately call RouteInterface::handleRequest() |
|
128 | + */ |
|
129 | + public function handle(RouteInterface $route, $handle = true) |
|
130 | + { |
|
131 | + if ($handle && $route->isNotHandled()) { |
|
132 | + $route->handleRequest(); |
|
133 | + if ($route instanceof PrimaryRoute) { |
|
134 | + $this->setRouteRequestType($route->getRouteRequestType()); |
|
135 | + } |
|
136 | + $data_node = $route->dataNode(); |
|
137 | + if ($data_node instanceof JsonDataNode) { |
|
138 | + $this->data_node_handler->addDataNode($data_node); |
|
139 | + $this->printDataNodes(); |
|
140 | + } |
|
141 | + } |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + /** |
|
146 | + * calls RouteInterface::handleRequest() on all Routes that |
|
147 | + * - match current request |
|
148 | + * - have yet to be handled |
|
149 | + * |
|
150 | + * @return void |
|
151 | + */ |
|
152 | + public function handleRoutesForCurrentRequest() |
|
153 | + { |
|
154 | + $this->routes->handleRoutesForCurrentRequest(); |
|
155 | + } |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * @since $VID:$ |
|
160 | + */ |
|
161 | + private function printDataNodes() |
|
162 | + { |
|
163 | + if ($this->print_data_nodes) { |
|
164 | + add_action('admin_footer', [$this->data_node_handler, 'printDataNode'], 0); |
|
165 | + add_action('wp_footer', [$this->data_node_handler, 'printDataNode'], 0); |
|
166 | + $this->print_data_nodes = false; |
|
167 | + } |
|
168 | + } |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * @param RouteInterface $route |
|
173 | + * @param string $fqcn |
|
174 | + * @since $VID:$ |
|
175 | + */ |
|
176 | + private function validateRoute($route, $fqcn) |
|
177 | + { |
|
178 | + if (! $route instanceof RouteInterface) { |
|
179 | + throw new InvalidClassException( |
|
180 | + sprintf( |
|
181 | + /* |
|
182 | 182 | * translators: |
183 | 183 | * The supplied FQCN (Fully\Qualified\Class\Name) must be an instance of RouteInterface. |
184 | 184 | */ |
185 | - esc_html__( |
|
186 | - 'The supplied FQCN (%1$s) must be an instance of RouteInterface.', |
|
187 | - 'event_espresso' |
|
188 | - ), |
|
189 | - $fqcn |
|
190 | - ) |
|
191 | - ); |
|
192 | - } |
|
193 | - } |
|
185 | + esc_html__( |
|
186 | + 'The supplied FQCN (%1$s) must be an instance of RouteInterface.', |
|
187 | + 'event_espresso' |
|
188 | + ), |
|
189 | + $fqcn |
|
190 | + ) |
|
191 | + ); |
|
192 | + } |
|
193 | + } |
|
194 | 194 | } |
@@ -7,34 +7,34 @@ |
||
7 | 7 | |
8 | 8 | class SitePermissions extends JsonDataNode |
9 | 9 | { |
10 | - const NODE_NAME = 'sitePermissions'; |
|
10 | + const NODE_NAME = 'sitePermissions'; |
|
11 | 11 | |
12 | - /** |
|
13 | - * @param JsonDataNodeValidator $validator |
|
14 | - */ |
|
15 | - public function __construct(JsonDataNodeValidator $validator) |
|
16 | - { |
|
17 | - parent::__construct($validator); |
|
18 | - $this->setNodeName(SitePermissions::NODE_NAME); |
|
19 | - } |
|
12 | + /** |
|
13 | + * @param JsonDataNodeValidator $validator |
|
14 | + */ |
|
15 | + public function __construct(JsonDataNodeValidator $validator) |
|
16 | + { |
|
17 | + parent::__construct($validator); |
|
18 | + $this->setNodeName(SitePermissions::NODE_NAME); |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * @inheritDoc |
|
23 | - */ |
|
24 | - public function initialize() |
|
25 | - { |
|
26 | - $permissions = []; |
|
27 | - $site_permissions = apply_filters( |
|
28 | - 'FHEE__EventEspresso_core_domain_entities_routing_data_nodes_core_SitePermissions__initialize__site_permissions', |
|
29 | - [ |
|
30 | - 'use_bulk_edit' => true, |
|
31 | - ] |
|
32 | - ); |
|
33 | - foreach ($site_permissions as $permission => $you_can_do_it) { |
|
34 | - if ($you_can_do_it) { |
|
35 | - $permissions[] = $permission; |
|
36 | - } |
|
37 | - } |
|
38 | - $this->setDataArray($permissions); |
|
39 | - } |
|
21 | + /** |
|
22 | + * @inheritDoc |
|
23 | + */ |
|
24 | + public function initialize() |
|
25 | + { |
|
26 | + $permissions = []; |
|
27 | + $site_permissions = apply_filters( |
|
28 | + 'FHEE__EventEspresso_core_domain_entities_routing_data_nodes_core_SitePermissions__initialize__site_permissions', |
|
29 | + [ |
|
30 | + 'use_bulk_edit' => true, |
|
31 | + ] |
|
32 | + ); |
|
33 | + foreach ($site_permissions as $permission => $you_can_do_it) { |
|
34 | + if ($you_can_do_it) { |
|
35 | + $permissions[] = $permission; |
|
36 | + } |
|
37 | + } |
|
38 | + $this->setDataArray($permissions); |
|
39 | + } |
|
40 | 40 | } |
@@ -7,32 +7,32 @@ |
||
7 | 7 | |
8 | 8 | class Capabilities extends JsonDataNode |
9 | 9 | { |
10 | - const NODE_NAME = 'capabilities'; |
|
10 | + const NODE_NAME = 'capabilities'; |
|
11 | 11 | |
12 | 12 | |
13 | - /** |
|
14 | - * @param JsonDataNodeValidator $validator |
|
15 | - */ |
|
16 | - public function __construct(JsonDataNodeValidator $validator) |
|
17 | - { |
|
18 | - parent::__construct($validator); |
|
19 | - $this->setNodeName(Capabilities::NODE_NAME); |
|
20 | - } |
|
13 | + /** |
|
14 | + * @param JsonDataNodeValidator $validator |
|
15 | + */ |
|
16 | + public function __construct(JsonDataNodeValidator $validator) |
|
17 | + { |
|
18 | + parent::__construct($validator); |
|
19 | + $this->setNodeName(Capabilities::NODE_NAME); |
|
20 | + } |
|
21 | 21 | |
22 | 22 | |
23 | - /** |
|
24 | - * @inheritDoc |
|
25 | - */ |
|
26 | - public function initialize() |
|
27 | - { |
|
28 | - $current_user = wp_get_current_user(); |
|
29 | - $capabilities = []; |
|
30 | - $role_capabilities = $current_user->get_role_caps(); |
|
31 | - foreach ($role_capabilities as $capability => $you_can_do_it) { |
|
32 | - if ($you_can_do_it) { |
|
33 | - $capabilities[] = $capability; |
|
34 | - } |
|
35 | - } |
|
36 | - $this->setDataArray($capabilities); |
|
37 | - } |
|
23 | + /** |
|
24 | + * @inheritDoc |
|
25 | + */ |
|
26 | + public function initialize() |
|
27 | + { |
|
28 | + $current_user = wp_get_current_user(); |
|
29 | + $capabilities = []; |
|
30 | + $role_capabilities = $current_user->get_role_caps(); |
|
31 | + foreach ($role_capabilities as $capability => $you_can_do_it) { |
|
32 | + if ($you_can_do_it) { |
|
33 | + $capabilities[] = $capability; |
|
34 | + } |
|
35 | + } |
|
36 | + $this->setDataArray($capabilities); |
|
37 | + } |
|
38 | 38 | } |
@@ -17,92 +17,92 @@ |
||
17 | 17 | class Config extends JsonDataNode |
18 | 18 | { |
19 | 19 | |
20 | - const NODE_NAME = 'config'; |
|
20 | + const NODE_NAME = 'config'; |
|
21 | 21 | |
22 | - /** |
|
23 | - * @var CurrentUser $current_user |
|
24 | - */ |
|
25 | - private $current_user; |
|
22 | + /** |
|
23 | + * @var CurrentUser $current_user |
|
24 | + */ |
|
25 | + private $current_user; |
|
26 | 26 | |
27 | - /** |
|
28 | - * @var EspressoCoreDomain $core_domain |
|
29 | - */ |
|
30 | - private $core_domain; |
|
27 | + /** |
|
28 | + * @var EspressoCoreDomain $core_domain |
|
29 | + */ |
|
30 | + private $core_domain; |
|
31 | 31 | |
32 | - /** |
|
33 | - * @var GeneralSettings $general_settings |
|
34 | - */ |
|
35 | - private $general_settings; |
|
32 | + /** |
|
33 | + * @var GeneralSettings $general_settings |
|
34 | + */ |
|
35 | + private $general_settings; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @var Locale $locale |
|
39 | - */ |
|
40 | - private $locale; |
|
37 | + /** |
|
38 | + * @var Locale $locale |
|
39 | + */ |
|
40 | + private $locale; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @var SiteCurrency $site_currency |
|
44 | - */ |
|
45 | - private $site_currency; |
|
42 | + /** |
|
43 | + * @var SiteCurrency $site_currency |
|
44 | + */ |
|
45 | + private $site_currency; |
|
46 | 46 | |
47 | - /** |
|
48 | - * @var SitePermissions $site_permissions |
|
49 | - */ |
|
50 | - private $site_permissions; |
|
47 | + /** |
|
48 | + * @var SitePermissions $site_permissions |
|
49 | + */ |
|
50 | + private $site_permissions; |
|
51 | 51 | |
52 | - /** |
|
53 | - * @var SiteUrls $site_urls |
|
54 | - */ |
|
55 | - private $site_urls; |
|
52 | + /** |
|
53 | + * @var SiteUrls $site_urls |
|
54 | + */ |
|
55 | + private $site_urls; |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * JsonDataNode constructor. |
|
60 | - * |
|
61 | - * @param CurrentUser $current_user |
|
62 | - * @param EspressoCoreDomain $core_domain |
|
63 | - * @param GeneralSettings $general_settings |
|
64 | - * @param Locale $locale |
|
65 | - * @param SiteCurrency $site_currency |
|
66 | - * @param SitePermissions $site_permissions |
|
67 | - * @param SiteUrls $site_urls |
|
68 | - * @param JsonDataNodeValidator $validator |
|
69 | - */ |
|
70 | - public function __construct( |
|
71 | - CurrentUser $current_user, |
|
72 | - EspressoCoreDomain $core_domain, |
|
73 | - GeneralSettings $general_settings, |
|
74 | - Locale $locale, |
|
75 | - SiteCurrency $site_currency, |
|
76 | - SitePermissions $site_permissions, |
|
77 | - SiteUrls $site_urls, |
|
78 | - JsonDataNodeValidator $validator |
|
79 | - ) { |
|
80 | - parent::__construct($validator); |
|
81 | - $this->current_user = $current_user; |
|
82 | - $this->core_domain = $core_domain; |
|
83 | - $this->general_settings = $general_settings; |
|
84 | - $this->locale = $locale; |
|
85 | - $this->site_currency = $site_currency; |
|
86 | - $this->site_permissions = $site_permissions; |
|
87 | - $this->site_urls = $site_urls; |
|
88 | - $this->setNodeName(Config::NODE_NAME); |
|
89 | - } |
|
58 | + /** |
|
59 | + * JsonDataNode constructor. |
|
60 | + * |
|
61 | + * @param CurrentUser $current_user |
|
62 | + * @param EspressoCoreDomain $core_domain |
|
63 | + * @param GeneralSettings $general_settings |
|
64 | + * @param Locale $locale |
|
65 | + * @param SiteCurrency $site_currency |
|
66 | + * @param SitePermissions $site_permissions |
|
67 | + * @param SiteUrls $site_urls |
|
68 | + * @param JsonDataNodeValidator $validator |
|
69 | + */ |
|
70 | + public function __construct( |
|
71 | + CurrentUser $current_user, |
|
72 | + EspressoCoreDomain $core_domain, |
|
73 | + GeneralSettings $general_settings, |
|
74 | + Locale $locale, |
|
75 | + SiteCurrency $site_currency, |
|
76 | + SitePermissions $site_permissions, |
|
77 | + SiteUrls $site_urls, |
|
78 | + JsonDataNodeValidator $validator |
|
79 | + ) { |
|
80 | + parent::__construct($validator); |
|
81 | + $this->current_user = $current_user; |
|
82 | + $this->core_domain = $core_domain; |
|
83 | + $this->general_settings = $general_settings; |
|
84 | + $this->locale = $locale; |
|
85 | + $this->site_currency = $site_currency; |
|
86 | + $this->site_permissions = $site_permissions; |
|
87 | + $this->site_urls = $site_urls; |
|
88 | + $this->setNodeName(Config::NODE_NAME); |
|
89 | + } |
|
90 | 90 | |
91 | 91 | |
92 | - /** |
|
93 | - * @throws DomainException |
|
94 | - * @since $VID:$ |
|
95 | - */ |
|
96 | - public function initialize() |
|
97 | - { |
|
98 | - $this->addDataNode($this->core_domain); |
|
99 | - $this->addDataNode($this->current_user); |
|
100 | - $this->addDataNode($this->general_settings); |
|
101 | - $this->addDataNode($this->locale); |
|
102 | - $this->addDataNode($this->site_currency); |
|
103 | - $this->addDataNode($this->site_permissions); |
|
104 | - $this->addDataNode($this->site_urls); |
|
105 | - $this->addData('wp_debug', WP_DEBUG); |
|
106 | - $this->setInitialized(true); |
|
107 | - } |
|
92 | + /** |
|
93 | + * @throws DomainException |
|
94 | + * @since $VID:$ |
|
95 | + */ |
|
96 | + public function initialize() |
|
97 | + { |
|
98 | + $this->addDataNode($this->core_domain); |
|
99 | + $this->addDataNode($this->current_user); |
|
100 | + $this->addDataNode($this->general_settings); |
|
101 | + $this->addDataNode($this->locale); |
|
102 | + $this->addDataNode($this->site_currency); |
|
103 | + $this->addDataNode($this->site_permissions); |
|
104 | + $this->addDataNode($this->site_urls); |
|
105 | + $this->addData('wp_debug', WP_DEBUG); |
|
106 | + $this->setInitialized(true); |
|
107 | + } |
|
108 | 108 | } |
@@ -17,143 +17,143 @@ |
||
17 | 17 | class RegularRequests extends PrimaryRoute |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * called just before matchesCurrentRequest() |
|
22 | - * and allows Route to perform any setup required such as calling setSpecification() |
|
23 | - * |
|
24 | - * @since $VID:$ |
|
25 | - */ |
|
26 | - public function initialize() |
|
27 | - { |
|
28 | - $basic_nodes = [ |
|
29 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Api', |
|
30 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities', |
|
31 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale', |
|
32 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions', |
|
33 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls', |
|
34 | - ]; |
|
35 | - foreach ($basic_nodes as $basic_node) { |
|
36 | - $this->dependency_map->registerDependencies( |
|
37 | - $basic_node, |
|
38 | - ['EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache] |
|
39 | - ); |
|
40 | - } |
|
41 | - $this->dependency_map->registerDependencies( |
|
42 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings', |
|
43 | - [ |
|
44 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
45 | - 'EventEspresso\core\services\converters\date_time_formats\PhpToUnicode' => EE_Dependency_Map::load_from_cache, |
|
46 | - ] |
|
47 | - ); |
|
48 | - $this->dependency_map->registerDependencies( |
|
49 | - 'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData', |
|
50 | - [ |
|
51 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Api' => EE_Dependency_Map::load_from_cache, |
|
52 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config' => EE_Dependency_Map::load_from_cache, |
|
53 | - 'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache, |
|
54 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
55 | - ] |
|
56 | - ); |
|
57 | - $this->dependency_map->registerDependencies( |
|
58 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config', |
|
59 | - [ |
|
60 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser' => EE_Dependency_Map::load_from_cache, |
|
61 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain' => EE_Dependency_Map::load_from_cache, |
|
62 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings' => EE_Dependency_Map::load_from_cache, |
|
63 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale' => EE_Dependency_Map::load_from_cache, |
|
64 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency' => EE_Dependency_Map::load_from_cache, |
|
65 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions' => EE_Dependency_Map::load_from_cache, |
|
66 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls' => EE_Dependency_Map::load_from_cache, |
|
67 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
68 | - ] |
|
69 | - ); |
|
70 | - $this->dependency_map->registerDependencies( |
|
71 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser', |
|
72 | - [ |
|
73 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities' => EE_Dependency_Map::load_from_cache, |
|
74 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
75 | - ] |
|
76 | - ); |
|
77 | - $this->dependency_map->registerDependencies( |
|
78 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain', |
|
79 | - [ |
|
80 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
81 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
82 | - ] |
|
83 | - ); |
|
84 | - $this->dependency_map->registerDependencies( |
|
85 | - 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency', |
|
86 | - [ |
|
87 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
88 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
89 | - ] |
|
90 | - ); |
|
91 | - $this->setDataNode( |
|
92 | - $this->loader->getShared('EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData') |
|
93 | - ); |
|
94 | - } |
|
20 | + /** |
|
21 | + * called just before matchesCurrentRequest() |
|
22 | + * and allows Route to perform any setup required such as calling setSpecification() |
|
23 | + * |
|
24 | + * @since $VID:$ |
|
25 | + */ |
|
26 | + public function initialize() |
|
27 | + { |
|
28 | + $basic_nodes = [ |
|
29 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Api', |
|
30 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities', |
|
31 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale', |
|
32 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions', |
|
33 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls', |
|
34 | + ]; |
|
35 | + foreach ($basic_nodes as $basic_node) { |
|
36 | + $this->dependency_map->registerDependencies( |
|
37 | + $basic_node, |
|
38 | + ['EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache] |
|
39 | + ); |
|
40 | + } |
|
41 | + $this->dependency_map->registerDependencies( |
|
42 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings', |
|
43 | + [ |
|
44 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
45 | + 'EventEspresso\core\services\converters\date_time_formats\PhpToUnicode' => EE_Dependency_Map::load_from_cache, |
|
46 | + ] |
|
47 | + ); |
|
48 | + $this->dependency_map->registerDependencies( |
|
49 | + 'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData', |
|
50 | + [ |
|
51 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Api' => EE_Dependency_Map::load_from_cache, |
|
52 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config' => EE_Dependency_Map::load_from_cache, |
|
53 | + 'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache, |
|
54 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
55 | + ] |
|
56 | + ); |
|
57 | + $this->dependency_map->registerDependencies( |
|
58 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config', |
|
59 | + [ |
|
60 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser' => EE_Dependency_Map::load_from_cache, |
|
61 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain' => EE_Dependency_Map::load_from_cache, |
|
62 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings' => EE_Dependency_Map::load_from_cache, |
|
63 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale' => EE_Dependency_Map::load_from_cache, |
|
64 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency' => EE_Dependency_Map::load_from_cache, |
|
65 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions' => EE_Dependency_Map::load_from_cache, |
|
66 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls' => EE_Dependency_Map::load_from_cache, |
|
67 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
68 | + ] |
|
69 | + ); |
|
70 | + $this->dependency_map->registerDependencies( |
|
71 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser', |
|
72 | + [ |
|
73 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities' => EE_Dependency_Map::load_from_cache, |
|
74 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
75 | + ] |
|
76 | + ); |
|
77 | + $this->dependency_map->registerDependencies( |
|
78 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain', |
|
79 | + [ |
|
80 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
81 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
82 | + ] |
|
83 | + ); |
|
84 | + $this->dependency_map->registerDependencies( |
|
85 | + 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency', |
|
86 | + [ |
|
87 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
88 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
89 | + ] |
|
90 | + ); |
|
91 | + $this->setDataNode( |
|
92 | + $this->loader->getShared('EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData') |
|
93 | + ); |
|
94 | + } |
|
95 | 95 | |
96 | 96 | |
97 | - /** |
|
98 | - * returns true if the current request matches this route |
|
99 | - * |
|
100 | - * @return bool |
|
101 | - * @since $VID:$ |
|
102 | - */ |
|
103 | - public function matchesCurrentRequest() |
|
104 | - { |
|
105 | - return ! $this->request->isActivation() || $this->request->isUnitTesting(); |
|
106 | - } |
|
97 | + /** |
|
98 | + * returns true if the current request matches this route |
|
99 | + * |
|
100 | + * @return bool |
|
101 | + * @since $VID:$ |
|
102 | + */ |
|
103 | + public function matchesCurrentRequest() |
|
104 | + { |
|
105 | + return ! $this->request->isActivation() || $this->request->isUnitTesting(); |
|
106 | + } |
|
107 | 107 | |
108 | 108 | |
109 | - /** |
|
110 | - * @since $VID:$ |
|
111 | - */ |
|
112 | - protected function registerDependencies() |
|
113 | - { |
|
114 | - $admin = ['EE_Admin_Config' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies; |
|
115 | - $public = ['EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies; |
|
116 | - $default_with_barista = [ |
|
117 | - 'EventEspresso\core\services\assets\BaristaFactory' => EE_Dependency_Map::load_from_cache |
|
118 | - ] + Route::$default_dependencies; |
|
119 | - $default_with_manifest = [ |
|
120 | - 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache |
|
121 | - ] + Route::$default_dependencies; |
|
122 | - $default_routes = [ |
|
123 | - // default dependencies |
|
124 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests' => Route::$default_dependencies, |
|
125 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage' => Route::$default_dependencies, |
|
126 | - 'EventEspresso\core\domain\entities\routing\handlers\frontend\ShortcodeRequests' => Route::$default_dependencies, |
|
127 | - 'EventEspresso\core\domain\entities\routing\handlers\shared\RestApiRequests' => Route::$default_dependencies, |
|
128 | - 'EventEspresso\core\domain\entities\routing\handlers\shared\SessionRequests' => Route::$default_dependencies, |
|
129 | - 'EventEspresso\core\domain\entities\routing\handlers\shared\WordPressHeartbeat' => Route::$default_dependencies, |
|
130 | - 'EventEspresso\core\domain\entities\routing\handlers\shared\AssetRequests' => $default_with_barista, |
|
131 | - 'EventEspresso\core\domain\entities\routing\handlers\shared\GQLRequests' => $default_with_manifest, |
|
132 | - // admin dependencies |
|
133 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\AdminRoute' => $admin, |
|
134 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventsAdmin' => $admin, |
|
135 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventEditor' => $admin, |
|
136 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoLegacyAdmin' => $admin, |
|
137 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\GutenbergEditor' => $admin, |
|
138 | - // public dependencies |
|
139 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\PersonalDataRequests' => $public, |
|
140 | - 'EventEspresso\core\domain\entities\routing\handlers\frontend\FrontendRequests' => $public, |
|
141 | - ]; |
|
142 | - foreach ($default_routes as $route => $dependencies) { |
|
143 | - $this->dependency_map->registerDependencies($route, $dependencies); |
|
144 | - } |
|
145 | - } |
|
109 | + /** |
|
110 | + * @since $VID:$ |
|
111 | + */ |
|
112 | + protected function registerDependencies() |
|
113 | + { |
|
114 | + $admin = ['EE_Admin_Config' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies; |
|
115 | + $public = ['EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies; |
|
116 | + $default_with_barista = [ |
|
117 | + 'EventEspresso\core\services\assets\BaristaFactory' => EE_Dependency_Map::load_from_cache |
|
118 | + ] + Route::$default_dependencies; |
|
119 | + $default_with_manifest = [ |
|
120 | + 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache |
|
121 | + ] + Route::$default_dependencies; |
|
122 | + $default_routes = [ |
|
123 | + // default dependencies |
|
124 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests' => Route::$default_dependencies, |
|
125 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage' => Route::$default_dependencies, |
|
126 | + 'EventEspresso\core\domain\entities\routing\handlers\frontend\ShortcodeRequests' => Route::$default_dependencies, |
|
127 | + 'EventEspresso\core\domain\entities\routing\handlers\shared\RestApiRequests' => Route::$default_dependencies, |
|
128 | + 'EventEspresso\core\domain\entities\routing\handlers\shared\SessionRequests' => Route::$default_dependencies, |
|
129 | + 'EventEspresso\core\domain\entities\routing\handlers\shared\WordPressHeartbeat' => Route::$default_dependencies, |
|
130 | + 'EventEspresso\core\domain\entities\routing\handlers\shared\AssetRequests' => $default_with_barista, |
|
131 | + 'EventEspresso\core\domain\entities\routing\handlers\shared\GQLRequests' => $default_with_manifest, |
|
132 | + // admin dependencies |
|
133 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\AdminRoute' => $admin, |
|
134 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventsAdmin' => $admin, |
|
135 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventEditor' => $admin, |
|
136 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoLegacyAdmin' => $admin, |
|
137 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\GutenbergEditor' => $admin, |
|
138 | + // public dependencies |
|
139 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\PersonalDataRequests' => $public, |
|
140 | + 'EventEspresso\core\domain\entities\routing\handlers\frontend\FrontendRequests' => $public, |
|
141 | + ]; |
|
142 | + foreach ($default_routes as $route => $dependencies) { |
|
143 | + $this->dependency_map->registerDependencies($route, $dependencies); |
|
144 | + } |
|
145 | + } |
|
146 | 146 | |
147 | 147 | |
148 | - /** |
|
149 | - * implements logic required to run during request |
|
150 | - * |
|
151 | - * @return bool |
|
152 | - * @since $VID:$ |
|
153 | - */ |
|
154 | - protected function requestHandler() |
|
155 | - { |
|
156 | - $this->setRouteRequestType(PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR); |
|
157 | - return true; |
|
158 | - } |
|
148 | + /** |
|
149 | + * implements logic required to run during request |
|
150 | + * |
|
151 | + * @return bool |
|
152 | + * @since $VID:$ |
|
153 | + */ |
|
154 | + protected function requestHandler() |
|
155 | + { |
|
156 | + $this->setRouteRequestType(PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR); |
|
157 | + return true; |
|
158 | + } |
|
159 | 159 | } |
@@ -14,91 +14,91 @@ |
||
14 | 14 | class JsonDataNodeValidator |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @param JsonDataNode $data_node |
|
19 | - * @return bool returns true if data array is safe to set, false if overwrite will occur |
|
20 | - * @throws DomainException throws exception if WP_DEBUG is true |
|
21 | - */ |
|
22 | - public function dataArrayEmpty(JsonDataNode $data_node) |
|
23 | - { |
|
24 | - $data = $data_node->data(); |
|
25 | - if (! empty($data)) { |
|
26 | - $this->overwriteError($data_node->nodeName(), esc_html__('data array', 'event_espresso')); |
|
27 | - return false; |
|
28 | - } |
|
29 | - return true; |
|
30 | - } |
|
17 | + /** |
|
18 | + * @param JsonDataNode $data_node |
|
19 | + * @return bool returns true if data array is safe to set, false if overwrite will occur |
|
20 | + * @throws DomainException throws exception if WP_DEBUG is true |
|
21 | + */ |
|
22 | + public function dataArrayEmpty(JsonDataNode $data_node) |
|
23 | + { |
|
24 | + $data = $data_node->data(); |
|
25 | + if (! empty($data)) { |
|
26 | + $this->overwriteError($data_node->nodeName(), esc_html__('data array', 'event_espresso')); |
|
27 | + return false; |
|
28 | + } |
|
29 | + return true; |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * @param array $data data array to check for property key |
|
34 | - * @param string $key value for the key being checked for |
|
35 | - * @param string $type the type of key and/or the data being checked |
|
36 | - * @return bool returns true if property is safe to write, false if overwrite will occur |
|
37 | - * @throws DomainException throws exception if WP_DEBUG is true |
|
38 | - */ |
|
39 | - public function propertyNotSet(array $data, $key, $type = 'key') |
|
40 | - { |
|
41 | - if (isset($data[ $key ])) { |
|
42 | - $this->overwriteError($key, $type); |
|
43 | - return false; |
|
44 | - } |
|
45 | - return true; |
|
46 | - } |
|
32 | + /** |
|
33 | + * @param array $data data array to check for property key |
|
34 | + * @param string $key value for the key being checked for |
|
35 | + * @param string $type the type of key and/or the data being checked |
|
36 | + * @return bool returns true if property is safe to write, false if overwrite will occur |
|
37 | + * @throws DomainException throws exception if WP_DEBUG is true |
|
38 | + */ |
|
39 | + public function propertyNotSet(array $data, $key, $type = 'key') |
|
40 | + { |
|
41 | + if (isset($data[ $key ])) { |
|
42 | + $this->overwriteError($key, $type); |
|
43 | + return false; |
|
44 | + } |
|
45 | + return true; |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * @param string $key value for the key being checked for |
|
51 | - * @param string $type the type of key and/or the data being checked |
|
52 | - * @throws DomainException throws exception if WP_DEBUG is true |
|
53 | - */ |
|
54 | - public function overwriteError($key, $type) |
|
55 | - { |
|
56 | - if (WP_DEBUG) { |
|
57 | - throw new DomainException( |
|
58 | - sprintf( |
|
59 | - /* |
|
49 | + /** |
|
50 | + * @param string $key value for the key being checked for |
|
51 | + * @param string $type the type of key and/or the data being checked |
|
52 | + * @throws DomainException throws exception if WP_DEBUG is true |
|
53 | + */ |
|
54 | + public function overwriteError($key, $type) |
|
55 | + { |
|
56 | + if (WP_DEBUG) { |
|
57 | + throw new DomainException( |
|
58 | + sprintf( |
|
59 | + /* |
|
60 | 60 | * translators: |
61 | 61 | * 'The "i18n" JsonDataNode key is already set and would be overwritten by the current action.' |
62 | 62 | */ |
63 | - esc_html__( |
|
64 | - 'The "%1$s" JsonDataNode %2$s is already set and would be overwritten by the current action.', |
|
65 | - 'event_espresso' |
|
66 | - ), |
|
67 | - $key, |
|
68 | - $type |
|
69 | - ) |
|
70 | - ); |
|
71 | - } |
|
72 | - } |
|
63 | + esc_html__( |
|
64 | + 'The "%1$s" JsonDataNode %2$s is already set and would be overwritten by the current action.', |
|
65 | + 'event_espresso' |
|
66 | + ), |
|
67 | + $key, |
|
68 | + $type |
|
69 | + ) |
|
70 | + ); |
|
71 | + } |
|
72 | + } |
|
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * @param string $property name for the key being checked for |
|
77 | - * @param string $type the type of key and/or the data being checked |
|
78 | - * @param bool $throw if true [default] and WP_DEBUG is also true, then will throw exceptions |
|
79 | - * @return bool returns true if property is set, false if property is missing |
|
80 | - * @throws DomainException throws exception if WP_DEBUG is true |
|
81 | - */ |
|
82 | - public function validateCriticalProperty($property, $type, $throw = true) |
|
83 | - { |
|
84 | - if (empty($property)) { |
|
85 | - if (WP_DEBUG && $throw) { |
|
86 | - throw new DomainException( |
|
87 | - sprintf( |
|
88 | - /* |
|
75 | + /** |
|
76 | + * @param string $property name for the key being checked for |
|
77 | + * @param string $type the type of key and/or the data being checked |
|
78 | + * @param bool $throw if true [default] and WP_DEBUG is also true, then will throw exceptions |
|
79 | + * @return bool returns true if property is set, false if property is missing |
|
80 | + * @throws DomainException throws exception if WP_DEBUG is true |
|
81 | + */ |
|
82 | + public function validateCriticalProperty($property, $type, $throw = true) |
|
83 | + { |
|
84 | + if (empty($property)) { |
|
85 | + if (WP_DEBUG && $throw) { |
|
86 | + throw new DomainException( |
|
87 | + sprintf( |
|
88 | + /* |
|
89 | 89 | * translators: |
90 | 90 | * 'The JsonDataNodeHandler domain route is a required property but has not been set.' |
91 | 91 | */ |
92 | - esc_html__( |
|
93 | - 'The JsonDataNodeHandler %1$s is a required property but has not been set.', |
|
94 | - 'event_espresso' |
|
95 | - ), |
|
96 | - $type |
|
97 | - ) |
|
98 | - ); |
|
99 | - } |
|
100 | - return false; |
|
101 | - } |
|
102 | - return true; |
|
103 | - } |
|
92 | + esc_html__( |
|
93 | + 'The JsonDataNodeHandler %1$s is a required property but has not been set.', |
|
94 | + 'event_espresso' |
|
95 | + ), |
|
96 | + $type |
|
97 | + ) |
|
98 | + ); |
|
99 | + } |
|
100 | + return false; |
|
101 | + } |
|
102 | + return true; |
|
103 | + } |
|
104 | 104 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function dataArrayEmpty(JsonDataNode $data_node) |
23 | 23 | { |
24 | 24 | $data = $data_node->data(); |
25 | - if (! empty($data)) { |
|
25 | + if ( ! empty($data)) { |
|
26 | 26 | $this->overwriteError($data_node->nodeName(), esc_html__('data array', 'event_espresso')); |
27 | 27 | return false; |
28 | 28 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function propertyNotSet(array $data, $key, $type = 'key') |
40 | 40 | { |
41 | - if (isset($data[ $key ])) { |
|
41 | + if (isset($data[$key])) { |
|
42 | 42 | $this->overwriteError($key, $type); |
43 | 43 | return false; |
44 | 44 | } |