@@ -90,7 +90,7 @@ |
||
90 | 90 | { |
91 | 91 | espresso_load_required( |
92 | 92 | 'EE_Request', |
93 | - EE_CORE . 'request_stack/EE_Request.core.php' |
|
93 | + EE_CORE.'request_stack/EE_Request.core.php' |
|
94 | 94 | ); |
95 | 95 | $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
96 | 96 | $this->legacy_request->setRequest($this->request); |
@@ -28,84 +28,84 @@ |
||
28 | 28 | */ |
29 | 29 | class BootstrapRequestResponseObjects |
30 | 30 | { |
31 | - /** |
|
32 | - * @var LegacyRequestInterface |
|
33 | - */ |
|
34 | - protected $legacy_request; |
|
31 | + /** |
|
32 | + * @var LegacyRequestInterface |
|
33 | + */ |
|
34 | + protected $legacy_request; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @var LoaderInterface |
|
38 | - */ |
|
39 | - protected $loader; |
|
36 | + /** |
|
37 | + * @var LoaderInterface |
|
38 | + */ |
|
39 | + protected $loader; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var RequestInterface |
|
43 | - */ |
|
44 | - protected $request; |
|
41 | + /** |
|
42 | + * @var RequestInterface |
|
43 | + */ |
|
44 | + protected $request; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @var ResponseInterface |
|
48 | - */ |
|
49 | - protected $response; |
|
46 | + /** |
|
47 | + * @var ResponseInterface |
|
48 | + */ |
|
49 | + protected $response; |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * BootstrapRequestResponseObjects constructor. |
|
54 | - * |
|
55 | - * @param LoaderInterface $loader |
|
56 | - */ |
|
57 | - public function __construct(LoaderInterface $loader) |
|
58 | - { |
|
59 | - $this->loader = $loader; |
|
60 | - } |
|
52 | + /** |
|
53 | + * BootstrapRequestResponseObjects constructor. |
|
54 | + * |
|
55 | + * @param LoaderInterface $loader |
|
56 | + */ |
|
57 | + public function __construct(LoaderInterface $loader) |
|
58 | + { |
|
59 | + $this->loader = $loader; |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | - /** |
|
64 | - * @return void |
|
65 | - */ |
|
66 | - public function buildRequestResponse() |
|
67 | - { |
|
68 | - $request_params = new RequestParams(new RequestSanitizer(), $_GET, $_POST); |
|
69 | - $server_params = new ServerParams(new ServerSanitizer(), $_SERVER); |
|
70 | - // load our Request and Response objects |
|
71 | - $this->request = new Request($request_params, $server_params); |
|
72 | - $this->response = new Response(); |
|
73 | - $this->loader->share(RequestParams::class, $request_params); |
|
74 | - $this->loader->share(ServerParams::class, $server_params); |
|
75 | - } |
|
63 | + /** |
|
64 | + * @return void |
|
65 | + */ |
|
66 | + public function buildRequestResponse() |
|
67 | + { |
|
68 | + $request_params = new RequestParams(new RequestSanitizer(), $_GET, $_POST); |
|
69 | + $server_params = new ServerParams(new ServerSanitizer(), $_SERVER); |
|
70 | + // load our Request and Response objects |
|
71 | + $this->request = new Request($request_params, $server_params); |
|
72 | + $this->response = new Response(); |
|
73 | + $this->loader->share(RequestParams::class, $request_params); |
|
74 | + $this->loader->share(ServerParams::class, $server_params); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * @return void |
|
80 | - * @throws InvalidArgumentException |
|
81 | - */ |
|
82 | - public function shareRequestResponse() |
|
83 | - { |
|
84 | - $this->loader->share('EventEspresso\core\services\request\Request', $this->request); |
|
85 | - $this->loader->share('EventEspresso\core\services\request\Response', $this->response); |
|
86 | - EE_Dependency_Map::instance()->setRequest($this->request); |
|
87 | - EE_Dependency_Map::instance()->setResponse($this->response); |
|
88 | - } |
|
78 | + /** |
|
79 | + * @return void |
|
80 | + * @throws InvalidArgumentException |
|
81 | + */ |
|
82 | + public function shareRequestResponse() |
|
83 | + { |
|
84 | + $this->loader->share('EventEspresso\core\services\request\Request', $this->request); |
|
85 | + $this->loader->share('EventEspresso\core\services\request\Response', $this->response); |
|
86 | + EE_Dependency_Map::instance()->setRequest($this->request); |
|
87 | + EE_Dependency_Map::instance()->setResponse($this->response); |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * @return void |
|
93 | - * @throws InvalidArgumentException |
|
94 | - * @throws EE_Error |
|
95 | - */ |
|
96 | - public function setupLegacyRequest() |
|
97 | - { |
|
98 | - espresso_load_required( |
|
99 | - 'EE_Request', |
|
100 | - EE_CORE . 'request_stack/EE_Request.core.php' |
|
101 | - ); |
|
102 | - $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
103 | - $this->legacy_request->setRequest($this->request); |
|
104 | - $this->legacy_request->admin = $this->request->isAdmin(); |
|
105 | - $this->legacy_request->ajax = $this->request->isAjax(); |
|
106 | - $this->legacy_request->front_ajax = $this->request->isFrontAjax(); |
|
107 | - EE_Dependency_Map::instance()->setLegacyRequest($this->legacy_request); |
|
108 | - $this->loader->share('EE_Request', $this->legacy_request); |
|
109 | - $this->loader->share('EventEspresso\core\services\request\LegacyRequestInterface', $this->legacy_request); |
|
110 | - } |
|
91 | + /** |
|
92 | + * @return void |
|
93 | + * @throws InvalidArgumentException |
|
94 | + * @throws EE_Error |
|
95 | + */ |
|
96 | + public function setupLegacyRequest() |
|
97 | + { |
|
98 | + espresso_load_required( |
|
99 | + 'EE_Request', |
|
100 | + EE_CORE . 'request_stack/EE_Request.core.php' |
|
101 | + ); |
|
102 | + $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
103 | + $this->legacy_request->setRequest($this->request); |
|
104 | + $this->legacy_request->admin = $this->request->isAdmin(); |
|
105 | + $this->legacy_request->ajax = $this->request->isAjax(); |
|
106 | + $this->legacy_request->front_ajax = $this->request->isFrontAjax(); |
|
107 | + EE_Dependency_Map::instance()->setLegacyRequest($this->legacy_request); |
|
108 | + $this->loader->share('EE_Request', $this->legacy_request); |
|
109 | + $this->loader->share('EventEspresso\core\services\request\LegacyRequestInterface', $this->legacy_request); |
|
110 | + } |
|
111 | 111 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | // load interfaces |
200 | 200 | espresso_load_required( |
201 | 201 | 'EEH_Autoloader', |
202 | - EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
202 | + EE_CORE.'helpers/EEH_Autoloader.helper.php' |
|
203 | 203 | ); |
204 | 204 | EEH_Autoloader::instance(); |
205 | 205 | } |
@@ -213,13 +213,13 @@ discard block |
||
213 | 213 | protected function setAutoloadersForRequiredFiles() |
214 | 214 | { |
215 | 215 | // load interfaces |
216 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
216 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'interfaces', true); |
|
217 | 217 | // load helpers |
218 | 218 | EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
219 | 219 | // register legacy request stack classes just in case |
220 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
220 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'request_stack/'); |
|
221 | 221 | // register legacy middleware classes just in case |
222 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
222 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'middleware/'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 |
@@ -53,227 +53,227 @@ |
||
53 | 53 | */ |
54 | 54 | class BootstrapCore |
55 | 55 | { |
56 | - /** |
|
57 | - * @var LoaderInterface |
|
58 | - */ |
|
59 | - private $loader; |
|
56 | + /** |
|
57 | + * @var LoaderInterface |
|
58 | + */ |
|
59 | + private $loader; |
|
60 | 60 | |
61 | - /** |
|
62 | - * @var RequestInterface |
|
63 | - */ |
|
64 | - protected $request; |
|
61 | + /** |
|
62 | + * @var RequestInterface |
|
63 | + */ |
|
64 | + protected $request; |
|
65 | 65 | |
66 | - /** |
|
67 | - * @var ResponseInterface |
|
68 | - */ |
|
69 | - protected $response; |
|
66 | + /** |
|
67 | + * @var ResponseInterface |
|
68 | + */ |
|
69 | + protected $response; |
|
70 | 70 | |
71 | - /** |
|
72 | - * @var RequestStackBuilder |
|
73 | - */ |
|
74 | - protected $request_stack_builder; |
|
71 | + /** |
|
72 | + * @var RequestStackBuilder |
|
73 | + */ |
|
74 | + protected $request_stack_builder; |
|
75 | 75 | |
76 | - /** |
|
77 | - * @var RequestStack |
|
78 | - */ |
|
79 | - protected $request_stack; |
|
76 | + /** |
|
77 | + * @var RequestStack |
|
78 | + */ |
|
79 | + protected $request_stack; |
|
80 | 80 | |
81 | 81 | |
82 | - /** |
|
83 | - * BootstrapCore constructor. |
|
84 | - */ |
|
85 | - public function __construct() |
|
86 | - { |
|
87 | - do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
88 | - // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
89 | - add_action('plugins_loaded', [$this, 'initialize'], 0); |
|
90 | - } |
|
82 | + /** |
|
83 | + * BootstrapCore constructor. |
|
84 | + */ |
|
85 | + public function __construct() |
|
86 | + { |
|
87 | + do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
88 | + // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
89 | + add_action('plugins_loaded', [$this, 'initialize'], 0); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | |
93 | - /** |
|
94 | - * @throws DomainException |
|
95 | - * @throws EE_Error |
|
96 | - * @throws Exception |
|
97 | - * @throws InvalidArgumentException |
|
98 | - * @throws InvalidClassException |
|
99 | - * @throws InvalidDataTypeException |
|
100 | - * @throws InvalidFilePathException |
|
101 | - * @throws InvalidInterfaceException |
|
102 | - * @throws InvalidRequestStackMiddlewareException |
|
103 | - * @throws OutOfBoundsException |
|
104 | - * @throws ReflectionException |
|
105 | - * @throws Throwable |
|
106 | - */ |
|
107 | - public function initialize() |
|
108 | - { |
|
109 | - $this->bootstrapDependencyInjectionContainer(); |
|
110 | - $this->bootstrapDomain(); |
|
111 | - $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
112 | - add_action( |
|
113 | - 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
114 | - [$bootstrap_request, 'setupLegacyRequest'] |
|
115 | - ); |
|
116 | - $this->runRequestStack(); |
|
117 | - } |
|
93 | + /** |
|
94 | + * @throws DomainException |
|
95 | + * @throws EE_Error |
|
96 | + * @throws Exception |
|
97 | + * @throws InvalidArgumentException |
|
98 | + * @throws InvalidClassException |
|
99 | + * @throws InvalidDataTypeException |
|
100 | + * @throws InvalidFilePathException |
|
101 | + * @throws InvalidInterfaceException |
|
102 | + * @throws InvalidRequestStackMiddlewareException |
|
103 | + * @throws OutOfBoundsException |
|
104 | + * @throws ReflectionException |
|
105 | + * @throws Throwable |
|
106 | + */ |
|
107 | + public function initialize() |
|
108 | + { |
|
109 | + $this->bootstrapDependencyInjectionContainer(); |
|
110 | + $this->bootstrapDomain(); |
|
111 | + $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
112 | + add_action( |
|
113 | + 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
114 | + [$bootstrap_request, 'setupLegacyRequest'] |
|
115 | + ); |
|
116 | + $this->runRequestStack(); |
|
117 | + } |
|
118 | 118 | |
119 | 119 | |
120 | - /** |
|
121 | - * @throws ReflectionException |
|
122 | - * @throws EE_Error |
|
123 | - * @throws InvalidArgumentException |
|
124 | - * @throws InvalidDataTypeException |
|
125 | - * @throws InvalidInterfaceException |
|
126 | - * @throws OutOfBoundsException |
|
127 | - */ |
|
128 | - private function bootstrapDependencyInjectionContainer() |
|
129 | - { |
|
130 | - $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
131 | - $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
132 | - $bootstrap_di->buildLoader(); |
|
133 | - $registry = $bootstrap_di->getRegistry(); |
|
134 | - $dependency_map = $bootstrap_di->getDependencyMap(); |
|
135 | - $dependency_map->initialize(); |
|
136 | - $registry->initialize(); |
|
137 | - $this->loader = $bootstrap_di->getLoader(); |
|
138 | - } |
|
120 | + /** |
|
121 | + * @throws ReflectionException |
|
122 | + * @throws EE_Error |
|
123 | + * @throws InvalidArgumentException |
|
124 | + * @throws InvalidDataTypeException |
|
125 | + * @throws InvalidInterfaceException |
|
126 | + * @throws OutOfBoundsException |
|
127 | + */ |
|
128 | + private function bootstrapDependencyInjectionContainer() |
|
129 | + { |
|
130 | + $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
131 | + $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
132 | + $bootstrap_di->buildLoader(); |
|
133 | + $registry = $bootstrap_di->getRegistry(); |
|
134 | + $dependency_map = $bootstrap_di->getDependencyMap(); |
|
135 | + $dependency_map->initialize(); |
|
136 | + $registry->initialize(); |
|
137 | + $this->loader = $bootstrap_di->getLoader(); |
|
138 | + } |
|
139 | 139 | |
140 | 140 | |
141 | - /** |
|
142 | - * configures the Domain object for core |
|
143 | - * |
|
144 | - * @return void |
|
145 | - * @throws DomainException |
|
146 | - * @throws InvalidArgumentException |
|
147 | - * @throws InvalidDataTypeException |
|
148 | - * @throws InvalidClassException |
|
149 | - * @throws InvalidFilePathException |
|
150 | - * @throws InvalidInterfaceException |
|
151 | - */ |
|
152 | - private function bootstrapDomain() |
|
153 | - { |
|
154 | - DomainFactory::getEventEspressoCoreDomain(); |
|
155 | - } |
|
141 | + /** |
|
142 | + * configures the Domain object for core |
|
143 | + * |
|
144 | + * @return void |
|
145 | + * @throws DomainException |
|
146 | + * @throws InvalidArgumentException |
|
147 | + * @throws InvalidDataTypeException |
|
148 | + * @throws InvalidClassException |
|
149 | + * @throws InvalidFilePathException |
|
150 | + * @throws InvalidInterfaceException |
|
151 | + */ |
|
152 | + private function bootstrapDomain() |
|
153 | + { |
|
154 | + DomainFactory::getEventEspressoCoreDomain(); |
|
155 | + } |
|
156 | 156 | |
157 | 157 | |
158 | - /** |
|
159 | - * sets up the request and response objects |
|
160 | - * |
|
161 | - * @return BootstrapRequestResponseObjects |
|
162 | - * @throws InvalidArgumentException |
|
163 | - */ |
|
164 | - private function bootstrapRequestResponseObjects() |
|
165 | - { |
|
166 | - /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
167 | - $bootstrap_request = $this->loader->getShared( |
|
168 | - 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
169 | - [$this->loader] |
|
170 | - ); |
|
171 | - $bootstrap_request->buildRequestResponse(); |
|
172 | - $bootstrap_request->shareRequestResponse(); |
|
173 | - $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
174 | - $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
175 | - return $bootstrap_request; |
|
176 | - } |
|
158 | + /** |
|
159 | + * sets up the request and response objects |
|
160 | + * |
|
161 | + * @return BootstrapRequestResponseObjects |
|
162 | + * @throws InvalidArgumentException |
|
163 | + */ |
|
164 | + private function bootstrapRequestResponseObjects() |
|
165 | + { |
|
166 | + /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
167 | + $bootstrap_request = $this->loader->getShared( |
|
168 | + 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
169 | + [$this->loader] |
|
170 | + ); |
|
171 | + $bootstrap_request->buildRequestResponse(); |
|
172 | + $bootstrap_request->shareRequestResponse(); |
|
173 | + $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
174 | + $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
175 | + return $bootstrap_request; |
|
176 | + } |
|
177 | 177 | |
178 | 178 | |
179 | - /** |
|
180 | - * run_request_stack |
|
181 | - * construct request stack and run middleware apps |
|
182 | - * |
|
183 | - * @throws EE_Error |
|
184 | - * @throws Exception |
|
185 | - * @throws Throwable |
|
186 | - */ |
|
187 | - public function runRequestStack() |
|
188 | - { |
|
189 | - $this->loadAutoloader(); |
|
190 | - $this->setAutoloadersForRequiredFiles(); |
|
191 | - $this->request_stack_builder = $this->buildRequestStack(); |
|
192 | - $this->request_stack = $this->request_stack_builder->resolve( |
|
193 | - new RequestStackCoreApp() |
|
194 | - ); |
|
195 | - $this->request_stack->handleRequest($this->request, $this->response); |
|
196 | - $this->request_stack->handleResponse(); |
|
197 | - } |
|
179 | + /** |
|
180 | + * run_request_stack |
|
181 | + * construct request stack and run middleware apps |
|
182 | + * |
|
183 | + * @throws EE_Error |
|
184 | + * @throws Exception |
|
185 | + * @throws Throwable |
|
186 | + */ |
|
187 | + public function runRequestStack() |
|
188 | + { |
|
189 | + $this->loadAutoloader(); |
|
190 | + $this->setAutoloadersForRequiredFiles(); |
|
191 | + $this->request_stack_builder = $this->buildRequestStack(); |
|
192 | + $this->request_stack = $this->request_stack_builder->resolve( |
|
193 | + new RequestStackCoreApp() |
|
194 | + ); |
|
195 | + $this->request_stack->handleRequest($this->request, $this->response); |
|
196 | + $this->request_stack->handleResponse(); |
|
197 | + } |
|
198 | 198 | |
199 | 199 | |
200 | - /** |
|
201 | - * load_autoloader |
|
202 | - * |
|
203 | - * @throws EE_Error |
|
204 | - */ |
|
205 | - protected function loadAutoloader() |
|
206 | - { |
|
207 | - // load interfaces |
|
208 | - espresso_load_required( |
|
209 | - 'EEH_Autoloader', |
|
210 | - EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
211 | - ); |
|
212 | - EEH_Autoloader::instance(); |
|
213 | - } |
|
200 | + /** |
|
201 | + * load_autoloader |
|
202 | + * |
|
203 | + * @throws EE_Error |
|
204 | + */ |
|
205 | + protected function loadAutoloader() |
|
206 | + { |
|
207 | + // load interfaces |
|
208 | + espresso_load_required( |
|
209 | + 'EEH_Autoloader', |
|
210 | + EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
211 | + ); |
|
212 | + EEH_Autoloader::instance(); |
|
213 | + } |
|
214 | 214 | |
215 | 215 | |
216 | - /** |
|
217 | - * load_required_files |
|
218 | - * |
|
219 | - * @throws EE_Error |
|
220 | - */ |
|
221 | - protected function setAutoloadersForRequiredFiles() |
|
222 | - { |
|
223 | - // load interfaces |
|
224 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
225 | - // load helpers |
|
226 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
227 | - // register legacy request stack classes just in case |
|
228 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
229 | - // register legacy middleware classes just in case |
|
230 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
231 | - } |
|
216 | + /** |
|
217 | + * load_required_files |
|
218 | + * |
|
219 | + * @throws EE_Error |
|
220 | + */ |
|
221 | + protected function setAutoloadersForRequiredFiles() |
|
222 | + { |
|
223 | + // load interfaces |
|
224 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
225 | + // load helpers |
|
226 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
227 | + // register legacy request stack classes just in case |
|
228 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
229 | + // register legacy middleware classes just in case |
|
230 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
231 | + } |
|
232 | 232 | |
233 | 233 | |
234 | - /** |
|
235 | - * build_request_stack |
|
236 | - * |
|
237 | - * @return RequestStackBuilder |
|
238 | - */ |
|
239 | - public function buildRequestStack() |
|
240 | - { |
|
241 | - $request_stack_builder = new RequestStackBuilder($this->loader); |
|
242 | - /** |
|
243 | - * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
244 | - * so items at the beginning of the final middleware stack will run last. |
|
245 | - * First parameter is the middleware classname, second is an array of arguments |
|
246 | - */ |
|
247 | - $stack_apps = apply_filters( |
|
248 | - 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
249 | - [ |
|
250 | - // first in last out |
|
251 | - BotDetector::class => [], |
|
252 | - DetectFileEditorRequest::class => [], |
|
253 | - PreProductionVersionWarning::class => [], |
|
254 | - RecommendedVersions::class => [], |
|
255 | - // last in first out |
|
256 | - DetectLogin::class => [], |
|
257 | - ] |
|
258 | - ); |
|
259 | - // legacy filter for backwards compatibility |
|
260 | - $stack_apps = apply_filters( |
|
261 | - 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
262 | - $stack_apps |
|
263 | - ); |
|
264 | - // load middleware onto stack : FILO (First In Last Out) |
|
265 | - // items at the beginning of the $stack_apps array will run last |
|
266 | - foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
267 | - $request_stack_builder->push([$stack_app, $stack_app_args]); |
|
268 | - } |
|
269 | - // finally, we'll add this on its own because we need it to always be part of the stack |
|
270 | - // and we also need it to always run first because the rest of the system relies on it |
|
271 | - $request_stack_builder->push( |
|
272 | - [SetRequestTypeContextChecker::class, []] |
|
273 | - ); |
|
274 | - return apply_filters( |
|
275 | - 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
276 | - $request_stack_builder |
|
277 | - ); |
|
278 | - } |
|
234 | + /** |
|
235 | + * build_request_stack |
|
236 | + * |
|
237 | + * @return RequestStackBuilder |
|
238 | + */ |
|
239 | + public function buildRequestStack() |
|
240 | + { |
|
241 | + $request_stack_builder = new RequestStackBuilder($this->loader); |
|
242 | + /** |
|
243 | + * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
244 | + * so items at the beginning of the final middleware stack will run last. |
|
245 | + * First parameter is the middleware classname, second is an array of arguments |
|
246 | + */ |
|
247 | + $stack_apps = apply_filters( |
|
248 | + 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
249 | + [ |
|
250 | + // first in last out |
|
251 | + BotDetector::class => [], |
|
252 | + DetectFileEditorRequest::class => [], |
|
253 | + PreProductionVersionWarning::class => [], |
|
254 | + RecommendedVersions::class => [], |
|
255 | + // last in first out |
|
256 | + DetectLogin::class => [], |
|
257 | + ] |
|
258 | + ); |
|
259 | + // legacy filter for backwards compatibility |
|
260 | + $stack_apps = apply_filters( |
|
261 | + 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
262 | + $stack_apps |
|
263 | + ); |
|
264 | + // load middleware onto stack : FILO (First In Last Out) |
|
265 | + // items at the beginning of the $stack_apps array will run last |
|
266 | + foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
267 | + $request_stack_builder->push([$stack_app, $stack_app_args]); |
|
268 | + } |
|
269 | + // finally, we'll add this on its own because we need it to always be part of the stack |
|
270 | + // and we also need it to always run first because the rest of the system relies on it |
|
271 | + $request_stack_builder->push( |
|
272 | + [SetRequestTypeContextChecker::class, []] |
|
273 | + ); |
|
274 | + return apply_filters( |
|
275 | + 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
276 | + $request_stack_builder |
|
277 | + ); |
|
278 | + } |
|
279 | 279 | } |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | array(), |
130 | 130 | CoffeeMaker::BREW_LOAD_ONLY, |
131 | 131 | array( |
132 | - EE_INTERFACES . '*.php', |
|
133 | - EE_INTERFACES . '*.interfaces.php', |
|
132 | + EE_INTERFACES.'*.php', |
|
133 | + EE_INTERFACES.'*.interfaces.php', |
|
134 | 134 | ) |
135 | 135 | ) |
136 | 136 | ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | array(), |
143 | 143 | array(), |
144 | 144 | CoffeeMaker::BREW_SHARED, |
145 | - EE_MODELS . '*.model.php' |
|
145 | + EE_MODELS.'*.model.php' |
|
146 | 146 | ) |
147 | 147 | ); |
148 | 148 | // add a wildcard recipe for loading core classes |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | array(), |
155 | 155 | CoffeeMaker::BREW_SHARED, |
156 | 156 | array( |
157 | - EE_CORE . '*.core.php', |
|
158 | - EE_ADMIN . '*.core.php', |
|
159 | - EE_CPTS . '*.core.php', |
|
160 | - EE_CORE . 'data_migration_scripts/*.core.php', |
|
157 | + EE_CORE.'*.core.php', |
|
158 | + EE_ADMIN.'*.core.php', |
|
159 | + EE_CPTS.'*.core.php', |
|
160 | + EE_CORE.'data_migration_scripts/*.core.php', |
|
161 | 161 | ) |
162 | 162 | ) |
163 | 163 | ); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | array(), |
170 | 170 | array(), |
171 | 171 | CoffeeMaker::BREW_LOAD_ONLY, |
172 | - array(EE_ADMIN . '*.core.php') |
|
172 | + array(EE_ADMIN.'*.core.php') |
|
173 | 173 | ) |
174 | 174 | ); |
175 | 175 | // add a wildcard recipe for loading core classes |
@@ -20,192 +20,192 @@ |
||
20 | 20 | */ |
21 | 21 | class OpenCoffeeShop |
22 | 22 | { |
23 | - /** |
|
24 | - * @var CoffeeShop $CoffeeShop |
|
25 | - */ |
|
26 | - private $CoffeeShop; |
|
23 | + /** |
|
24 | + * @var CoffeeShop $CoffeeShop |
|
25 | + */ |
|
26 | + private $CoffeeShop; |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * OpenCoffeeShop constructor |
|
31 | - * |
|
32 | - * @throws InvalidInterfaceException |
|
33 | - */ |
|
34 | - public function __construct() |
|
35 | - { |
|
36 | - // instantiate the DI container |
|
37 | - $this->CoffeeShop = new CoffeeShop(); |
|
38 | - } |
|
29 | + /** |
|
30 | + * OpenCoffeeShop constructor |
|
31 | + * |
|
32 | + * @throws InvalidInterfaceException |
|
33 | + */ |
|
34 | + public function __construct() |
|
35 | + { |
|
36 | + // instantiate the DI container |
|
37 | + $this->CoffeeShop = new CoffeeShop(); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
42 | - /** |
|
43 | - * @return CoffeeShop |
|
44 | - */ |
|
45 | - public function CoffeeShop() |
|
46 | - { |
|
47 | - return $this->CoffeeShop; |
|
48 | - } |
|
41 | + // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
42 | + /** |
|
43 | + * @return CoffeeShop |
|
44 | + */ |
|
45 | + public function CoffeeShop() |
|
46 | + { |
|
47 | + return $this->CoffeeShop; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * configure coffee makers which control the different kinds of brews |
|
53 | - * ( shared services, new factory objects, etc ) |
|
54 | - * |
|
55 | - * @throws InvalidEntityException |
|
56 | - */ |
|
57 | - public function setupCoffeeMakers() |
|
58 | - { |
|
59 | - // create a dependency injector class for resolving class constructor arguments |
|
60 | - $DependencyInjector = new DependencyInjector( |
|
61 | - $this->CoffeeShop, |
|
62 | - new EEH_Array() |
|
63 | - ); |
|
64 | - // and some coffeemakers, one for creating new instances |
|
65 | - $this->CoffeeShop->addCoffeeMaker( |
|
66 | - new NewCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
67 | - CoffeeMaker::BREW_NEW |
|
68 | - ); |
|
69 | - // one for shared services |
|
70 | - $this->CoffeeShop->addCoffeeMaker( |
|
71 | - new SharedCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
72 | - CoffeeMaker::BREW_SHARED |
|
73 | - ); |
|
74 | - // and one for classes that only get loaded |
|
75 | - $this->CoffeeShop->addCoffeeMaker( |
|
76 | - new LoadOnlyCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
77 | - CoffeeMaker::BREW_LOAD_ONLY |
|
78 | - ); |
|
79 | - } |
|
51 | + /** |
|
52 | + * configure coffee makers which control the different kinds of brews |
|
53 | + * ( shared services, new factory objects, etc ) |
|
54 | + * |
|
55 | + * @throws InvalidEntityException |
|
56 | + */ |
|
57 | + public function setupCoffeeMakers() |
|
58 | + { |
|
59 | + // create a dependency injector class for resolving class constructor arguments |
|
60 | + $DependencyInjector = new DependencyInjector( |
|
61 | + $this->CoffeeShop, |
|
62 | + new EEH_Array() |
|
63 | + ); |
|
64 | + // and some coffeemakers, one for creating new instances |
|
65 | + $this->CoffeeShop->addCoffeeMaker( |
|
66 | + new NewCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
67 | + CoffeeMaker::BREW_NEW |
|
68 | + ); |
|
69 | + // one for shared services |
|
70 | + $this->CoffeeShop->addCoffeeMaker( |
|
71 | + new SharedCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
72 | + CoffeeMaker::BREW_SHARED |
|
73 | + ); |
|
74 | + // and one for classes that only get loaded |
|
75 | + $this->CoffeeShop->addCoffeeMaker( |
|
76 | + new LoadOnlyCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
77 | + CoffeeMaker::BREW_LOAD_ONLY |
|
78 | + ); |
|
79 | + } |
|
80 | 80 | |
81 | 81 | |
82 | - /** |
|
83 | - * Recipes define how to load legacy classes |
|
84 | - * |
|
85 | - * @throws InvalidIdentifierException |
|
86 | - */ |
|
87 | - public function addRecipes() |
|
88 | - { |
|
89 | - // add default recipe, which should handle loading for most PSR-4 compatible classes |
|
90 | - // as long as they are not type hinting for interfaces |
|
91 | - $this->CoffeeShop->addRecipe( |
|
92 | - new Recipe( |
|
93 | - Recipe::DEFAULT_ID |
|
94 | - ) |
|
95 | - ); |
|
96 | - // PSR-4 compatible class with aliases |
|
97 | - $this->CoffeeShop->addRecipe( |
|
98 | - new Recipe( |
|
99 | - 'CommandHandlerManager', |
|
100 | - 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
101 | - array( |
|
102 | - 'CommandHandlerManagerInterface', |
|
103 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
104 | - ), |
|
105 | - array(), |
|
106 | - CoffeeMaker::BREW_SHARED |
|
107 | - ) |
|
108 | - ); |
|
109 | - // PSR-4 compatible class with aliases, which dependency on CommandHandlerManager |
|
110 | - $this->CoffeeShop->addRecipe( |
|
111 | - new Recipe( |
|
112 | - 'CommandBus', |
|
113 | - 'EventEspresso\core\services\commands\CommandBus', |
|
114 | - array( |
|
115 | - 'CommandBusInterface', |
|
116 | - 'EventEspresso\core\services\commands\CommandBusInterface', |
|
117 | - ), |
|
118 | - array(), |
|
119 | - CoffeeMaker::BREW_SHARED |
|
120 | - ) |
|
121 | - ); |
|
122 | - // LEGACY classes that are NOT compatible with PSR-4 autoloading, and so must specify a filepath |
|
123 | - // add a wildcard recipe for loading legacy core interfaces |
|
124 | - $this->CoffeeShop->addRecipe( |
|
125 | - new Recipe( |
|
126 | - 'EEI_*', |
|
127 | - '', |
|
128 | - array(), |
|
129 | - array(), |
|
130 | - CoffeeMaker::BREW_LOAD_ONLY, |
|
131 | - array( |
|
132 | - EE_INTERFACES . '*.php', |
|
133 | - EE_INTERFACES . '*.interfaces.php', |
|
134 | - ) |
|
135 | - ) |
|
136 | - ); |
|
137 | - // add a wildcard recipe for loading models |
|
138 | - $this->CoffeeShop->addRecipe( |
|
139 | - new Recipe( |
|
140 | - 'EEM_*', |
|
141 | - '', |
|
142 | - array(), |
|
143 | - array(), |
|
144 | - CoffeeMaker::BREW_SHARED, |
|
145 | - EE_MODELS . '*.model.php' |
|
146 | - ) |
|
147 | - ); |
|
148 | - // add a wildcard recipe for loading core classes |
|
149 | - $this->CoffeeShop->addRecipe( |
|
150 | - new Recipe( |
|
151 | - 'EE_*', |
|
152 | - '', |
|
153 | - array(), |
|
154 | - array(), |
|
155 | - CoffeeMaker::BREW_SHARED, |
|
156 | - array( |
|
157 | - EE_CORE . '*.core.php', |
|
158 | - EE_ADMIN . '*.core.php', |
|
159 | - EE_CPTS . '*.core.php', |
|
160 | - EE_CORE . 'data_migration_scripts/*.core.php', |
|
161 | - ) |
|
162 | - ) |
|
163 | - ); |
|
164 | - // load admin page parent class |
|
165 | - $this->CoffeeShop->addRecipe( |
|
166 | - new Recipe( |
|
167 | - 'EE_Admin_Page*', |
|
168 | - '', |
|
169 | - array(), |
|
170 | - array(), |
|
171 | - CoffeeMaker::BREW_LOAD_ONLY, |
|
172 | - array(EE_ADMIN . '*.core.php') |
|
173 | - ) |
|
174 | - ); |
|
175 | - // add a wildcard recipe for loading core classes |
|
176 | - // $this->CoffeeShop->addRecipe( |
|
177 | - // new Recipe( |
|
178 | - // '*_Admin_Page', |
|
179 | - // '', |
|
180 | - // array(), |
|
181 | - // array(), |
|
182 | - // CoffeeMaker::BREW_SHARED, |
|
183 | - // array( |
|
184 | - // EE_ADMIN_PAGES . 'transactions/*.core.php', |
|
185 | - // ) |
|
186 | - // ) |
|
187 | - // ); |
|
188 | - } |
|
82 | + /** |
|
83 | + * Recipes define how to load legacy classes |
|
84 | + * |
|
85 | + * @throws InvalidIdentifierException |
|
86 | + */ |
|
87 | + public function addRecipes() |
|
88 | + { |
|
89 | + // add default recipe, which should handle loading for most PSR-4 compatible classes |
|
90 | + // as long as they are not type hinting for interfaces |
|
91 | + $this->CoffeeShop->addRecipe( |
|
92 | + new Recipe( |
|
93 | + Recipe::DEFAULT_ID |
|
94 | + ) |
|
95 | + ); |
|
96 | + // PSR-4 compatible class with aliases |
|
97 | + $this->CoffeeShop->addRecipe( |
|
98 | + new Recipe( |
|
99 | + 'CommandHandlerManager', |
|
100 | + 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
101 | + array( |
|
102 | + 'CommandHandlerManagerInterface', |
|
103 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
104 | + ), |
|
105 | + array(), |
|
106 | + CoffeeMaker::BREW_SHARED |
|
107 | + ) |
|
108 | + ); |
|
109 | + // PSR-4 compatible class with aliases, which dependency on CommandHandlerManager |
|
110 | + $this->CoffeeShop->addRecipe( |
|
111 | + new Recipe( |
|
112 | + 'CommandBus', |
|
113 | + 'EventEspresso\core\services\commands\CommandBus', |
|
114 | + array( |
|
115 | + 'CommandBusInterface', |
|
116 | + 'EventEspresso\core\services\commands\CommandBusInterface', |
|
117 | + ), |
|
118 | + array(), |
|
119 | + CoffeeMaker::BREW_SHARED |
|
120 | + ) |
|
121 | + ); |
|
122 | + // LEGACY classes that are NOT compatible with PSR-4 autoloading, and so must specify a filepath |
|
123 | + // add a wildcard recipe for loading legacy core interfaces |
|
124 | + $this->CoffeeShop->addRecipe( |
|
125 | + new Recipe( |
|
126 | + 'EEI_*', |
|
127 | + '', |
|
128 | + array(), |
|
129 | + array(), |
|
130 | + CoffeeMaker::BREW_LOAD_ONLY, |
|
131 | + array( |
|
132 | + EE_INTERFACES . '*.php', |
|
133 | + EE_INTERFACES . '*.interfaces.php', |
|
134 | + ) |
|
135 | + ) |
|
136 | + ); |
|
137 | + // add a wildcard recipe for loading models |
|
138 | + $this->CoffeeShop->addRecipe( |
|
139 | + new Recipe( |
|
140 | + 'EEM_*', |
|
141 | + '', |
|
142 | + array(), |
|
143 | + array(), |
|
144 | + CoffeeMaker::BREW_SHARED, |
|
145 | + EE_MODELS . '*.model.php' |
|
146 | + ) |
|
147 | + ); |
|
148 | + // add a wildcard recipe for loading core classes |
|
149 | + $this->CoffeeShop->addRecipe( |
|
150 | + new Recipe( |
|
151 | + 'EE_*', |
|
152 | + '', |
|
153 | + array(), |
|
154 | + array(), |
|
155 | + CoffeeMaker::BREW_SHARED, |
|
156 | + array( |
|
157 | + EE_CORE . '*.core.php', |
|
158 | + EE_ADMIN . '*.core.php', |
|
159 | + EE_CPTS . '*.core.php', |
|
160 | + EE_CORE . 'data_migration_scripts/*.core.php', |
|
161 | + ) |
|
162 | + ) |
|
163 | + ); |
|
164 | + // load admin page parent class |
|
165 | + $this->CoffeeShop->addRecipe( |
|
166 | + new Recipe( |
|
167 | + 'EE_Admin_Page*', |
|
168 | + '', |
|
169 | + array(), |
|
170 | + array(), |
|
171 | + CoffeeMaker::BREW_LOAD_ONLY, |
|
172 | + array(EE_ADMIN . '*.core.php') |
|
173 | + ) |
|
174 | + ); |
|
175 | + // add a wildcard recipe for loading core classes |
|
176 | + // $this->CoffeeShop->addRecipe( |
|
177 | + // new Recipe( |
|
178 | + // '*_Admin_Page', |
|
179 | + // '', |
|
180 | + // array(), |
|
181 | + // array(), |
|
182 | + // CoffeeMaker::BREW_SHARED, |
|
183 | + // array( |
|
184 | + // EE_ADMIN_PAGES . 'transactions/*.core.php', |
|
185 | + // ) |
|
186 | + // ) |
|
187 | + // ); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | |
191 | - /** |
|
192 | - * bootstrap EE and the request stack |
|
193 | - * |
|
194 | - * @throws ServiceNotFoundException |
|
195 | - * @throws InvalidClassException |
|
196 | - * @throws InvalidDataTypeException |
|
197 | - * @throws InvalidIdentifierException |
|
198 | - * @throws exceptions\ServiceExistsException |
|
199 | - * @throws OutOfBoundsException |
|
200 | - * @throws exceptions\InstantiationException |
|
201 | - */ |
|
202 | - public function firstBrew() |
|
203 | - { |
|
204 | - $this->CoffeeShop->brew( |
|
205 | - 'EventEspresso\core\services\request\Request', |
|
206 | - array($_GET, $_POST, $_COOKIE, $_SERVER) |
|
207 | - ); |
|
208 | - $this->CoffeeShop->brew('EventEspresso\core\services\request\Response'); |
|
209 | - $this->CoffeeShop->brew('EE_Bootstrap'); |
|
210 | - } |
|
191 | + /** |
|
192 | + * bootstrap EE and the request stack |
|
193 | + * |
|
194 | + * @throws ServiceNotFoundException |
|
195 | + * @throws InvalidClassException |
|
196 | + * @throws InvalidDataTypeException |
|
197 | + * @throws InvalidIdentifierException |
|
198 | + * @throws exceptions\ServiceExistsException |
|
199 | + * @throws OutOfBoundsException |
|
200 | + * @throws exceptions\InstantiationException |
|
201 | + */ |
|
202 | + public function firstBrew() |
|
203 | + { |
|
204 | + $this->CoffeeShop->brew( |
|
205 | + 'EventEspresso\core\services\request\Request', |
|
206 | + array($_GET, $_POST, $_COOKIE, $_SERVER) |
|
207 | + ); |
|
208 | + $this->CoffeeShop->brew('EventEspresso\core\services\request\Response'); |
|
209 | + $this->CoffeeShop->brew('EE_Bootstrap'); |
|
210 | + } |
|
211 | 211 | } |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | private function loadPueClient() |
37 | 37 | { |
38 | 38 | // PUE Auto Upgrades stuff |
39 | - if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file |
|
40 | - require_once(EE_THIRD_PARTY . 'pue/pue-client.php'); |
|
39 | + if (is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { // include the file |
|
40 | + require_once(EE_THIRD_PARTY.'pue/pue-client.php'); |
|
41 | 41 | |
42 | 42 | // $options needs to be an array with the included keys as listed. |
43 | 43 | $options = array( |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $update = false; |
88 | 88 | |
89 | 89 | // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
90 | - $folder = '/' . dirname($basename); |
|
90 | + $folder = '/'.dirname($basename); |
|
91 | 91 | |
92 | 92 | $plugins = get_plugins($folder); |
93 | 93 | $current = get_site_transient('update_plugins'); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // it's possible that there is an update but an invalid site-license-key is in use |
102 | - if (get_site_option('pue_json_error_' . $basename)) { |
|
102 | + if (get_site_option('pue_json_error_'.$basename)) { |
|
103 | 103 | $update = true; |
104 | 104 | } |
105 | 105 |
@@ -14,94 +14,94 @@ |
||
14 | 14 | */ |
15 | 15 | class LicenseService |
16 | 16 | { |
17 | - /** |
|
18 | - * @var Config |
|
19 | - */ |
|
20 | - private $config; |
|
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * @var Stats |
|
25 | - */ |
|
26 | - private $stats_collection; |
|
27 | - |
|
28 | - public function __construct(Stats $stats_collection, Config $config) |
|
29 | - { |
|
30 | - $this->config = $config; |
|
31 | - $this->stats_collection = $stats_collection; |
|
32 | - $this->loadPueClient(); |
|
33 | - } |
|
34 | - |
|
35 | - private function loadPueClient() |
|
36 | - { |
|
37 | - // PUE Auto Upgrades stuff |
|
38 | - if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file |
|
39 | - require_once(EE_THIRD_PARTY . 'pue/pue-client.php'); |
|
40 | - |
|
41 | - // $options needs to be an array with the included keys as listed. |
|
42 | - $options = array( |
|
43 | - // 'optionName' => '', //(optional) - used as the reference for saving update information in the |
|
44 | - // clients options table. Will be automatically set if left blank. |
|
45 | - 'apikey' => $this->config->siteLicenseKey(), |
|
46 | - // (required), you will need to obtain the apikey that the client gets from your site and |
|
47 | - // then saves in their sites options table (see 'getting an api-key' below) |
|
48 | - 'lang_domain' => $this->config->i18nDomain(), |
|
49 | - // (optional) - put here whatever reference you are using for the localization of your plugin (if it's |
|
50 | - // localized). That way strings in this file will be included in the translation for your plugin. |
|
51 | - 'checkPeriod' => $this->config->checkPeriod(), |
|
52 | - // (optional) - use this parameter to indicate how often you want the client's install to ping your |
|
53 | - // server for update checks. The integer indicates hours. If you don't include this parameter it will |
|
54 | - // default to 12 hours. |
|
55 | - 'option_key' => $this->config->optionKey(), |
|
56 | - // this is what is used to reference the api_key in your plugin options. PUE uses this to trigger |
|
57 | - // updating your information message whenever this option_key is modified. |
|
58 | - 'options_page_slug' => $this->config->optionsPageSlug(), |
|
59 | - 'plugin_basename' => EE_PLUGIN_BASENAME, |
|
60 | - 'use_wp_update' => true, |
|
61 | - // if TRUE then you want FREE versions of the plugin to be updated from WP |
|
62 | - 'extra_stats' => $this->stats_collection->statsCallback(), |
|
63 | - 'turn_on_notices_saved' => true, |
|
64 | - ); |
|
65 | - // initiate the class and start the plugin update engine! |
|
66 | - new \PluginUpdateEngineChecker( |
|
67 | - $this->config->hostServerUrl(), |
|
68 | - $this->config->pluginSlug(), |
|
69 | - $options |
|
70 | - ); |
|
71 | - } |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * This is a handy helper method for retrieving whether there is an update available for the given plugin. |
|
77 | - * |
|
78 | - * @param string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to |
|
79 | - * identify plugins. Defaults to core update |
|
80 | - * @return boolean True if update available, false if not. |
|
81 | - */ |
|
82 | - public static function isUpdateAvailable($basename = '') |
|
83 | - { |
|
84 | - $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME; |
|
85 | - |
|
86 | - $update = false; |
|
87 | - |
|
88 | - // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
89 | - $folder = '/' . dirname($basename); |
|
90 | - |
|
91 | - $plugins = get_plugins($folder); |
|
92 | - $current = get_site_transient('update_plugins'); |
|
93 | - |
|
94 | - foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
95 | - if (isset($current->response['plugin_file'])) { |
|
96 | - $update = true; |
|
97 | - } |
|
98 | - } |
|
99 | - |
|
100 | - // it's possible that there is an update but an invalid site-license-key is in use |
|
101 | - if (get_site_option('pue_json_error_' . $basename)) { |
|
102 | - $update = true; |
|
103 | - } |
|
104 | - |
|
105 | - return $update; |
|
106 | - } |
|
17 | + /** |
|
18 | + * @var Config |
|
19 | + */ |
|
20 | + private $config; |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * @var Stats |
|
25 | + */ |
|
26 | + private $stats_collection; |
|
27 | + |
|
28 | + public function __construct(Stats $stats_collection, Config $config) |
|
29 | + { |
|
30 | + $this->config = $config; |
|
31 | + $this->stats_collection = $stats_collection; |
|
32 | + $this->loadPueClient(); |
|
33 | + } |
|
34 | + |
|
35 | + private function loadPueClient() |
|
36 | + { |
|
37 | + // PUE Auto Upgrades stuff |
|
38 | + if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file |
|
39 | + require_once(EE_THIRD_PARTY . 'pue/pue-client.php'); |
|
40 | + |
|
41 | + // $options needs to be an array with the included keys as listed. |
|
42 | + $options = array( |
|
43 | + // 'optionName' => '', //(optional) - used as the reference for saving update information in the |
|
44 | + // clients options table. Will be automatically set if left blank. |
|
45 | + 'apikey' => $this->config->siteLicenseKey(), |
|
46 | + // (required), you will need to obtain the apikey that the client gets from your site and |
|
47 | + // then saves in their sites options table (see 'getting an api-key' below) |
|
48 | + 'lang_domain' => $this->config->i18nDomain(), |
|
49 | + // (optional) - put here whatever reference you are using for the localization of your plugin (if it's |
|
50 | + // localized). That way strings in this file will be included in the translation for your plugin. |
|
51 | + 'checkPeriod' => $this->config->checkPeriod(), |
|
52 | + // (optional) - use this parameter to indicate how often you want the client's install to ping your |
|
53 | + // server for update checks. The integer indicates hours. If you don't include this parameter it will |
|
54 | + // default to 12 hours. |
|
55 | + 'option_key' => $this->config->optionKey(), |
|
56 | + // this is what is used to reference the api_key in your plugin options. PUE uses this to trigger |
|
57 | + // updating your information message whenever this option_key is modified. |
|
58 | + 'options_page_slug' => $this->config->optionsPageSlug(), |
|
59 | + 'plugin_basename' => EE_PLUGIN_BASENAME, |
|
60 | + 'use_wp_update' => true, |
|
61 | + // if TRUE then you want FREE versions of the plugin to be updated from WP |
|
62 | + 'extra_stats' => $this->stats_collection->statsCallback(), |
|
63 | + 'turn_on_notices_saved' => true, |
|
64 | + ); |
|
65 | + // initiate the class and start the plugin update engine! |
|
66 | + new \PluginUpdateEngineChecker( |
|
67 | + $this->config->hostServerUrl(), |
|
68 | + $this->config->pluginSlug(), |
|
69 | + $options |
|
70 | + ); |
|
71 | + } |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * This is a handy helper method for retrieving whether there is an update available for the given plugin. |
|
77 | + * |
|
78 | + * @param string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to |
|
79 | + * identify plugins. Defaults to core update |
|
80 | + * @return boolean True if update available, false if not. |
|
81 | + */ |
|
82 | + public static function isUpdateAvailable($basename = '') |
|
83 | + { |
|
84 | + $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME; |
|
85 | + |
|
86 | + $update = false; |
|
87 | + |
|
88 | + // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
89 | + $folder = '/' . dirname($basename); |
|
90 | + |
|
91 | + $plugins = get_plugins($folder); |
|
92 | + $current = get_site_transient('update_plugins'); |
|
93 | + |
|
94 | + foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
95 | + if (isset($current->response['plugin_file'])) { |
|
96 | + $update = true; |
|
97 | + } |
|
98 | + } |
|
99 | + |
|
100 | + // it's possible that there is an update but an invalid site-license-key is in use |
|
101 | + if (get_site_option('pue_json_error_' . $basename)) { |
|
102 | + $update = true; |
|
103 | + } |
|
104 | + |
|
105 | + return $update; |
|
106 | + } |
|
107 | 107 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css |
27 | 27 | wp_enqueue_style( |
28 | 28 | 'ee_progress_steps_display_number_bubbles', |
29 | - plugin_dir_url(__FILE__) . 'number_bubbles.css' |
|
29 | + plugin_dir_url(__FILE__).'number_bubbles.css' |
|
30 | 30 | ); |
31 | 31 | } |
32 | 32 | |
@@ -39,6 +39,6 @@ discard block |
||
39 | 39 | public function getTemplate() |
40 | 40 | { |
41 | 41 | // return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php'; |
42 | - return __DIR__ . '/number_bubbles.template.php'; |
|
42 | + return __DIR__.'/number_bubbles.template.php'; |
|
43 | 43 | } |
44 | 44 | } |
@@ -14,29 +14,29 @@ |
||
14 | 14 | */ |
15 | 15 | class NumberBubblesProgressStepsDisplay implements ProgressStepsDisplayInterface |
16 | 16 | { |
17 | - /** |
|
18 | - * used for setting up css and js required for the display strategy |
|
19 | - * |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - public function enqueueStylesAndScripts() |
|
23 | - { |
|
24 | - // core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css |
|
25 | - wp_enqueue_style( |
|
26 | - 'ee_progress_steps_display_number_bubbles', |
|
27 | - plugin_dir_url(__FILE__) . 'number_bubbles.css' |
|
28 | - ); |
|
29 | - } |
|
17 | + /** |
|
18 | + * used for setting up css and js required for the display strategy |
|
19 | + * |
|
20 | + * @return void |
|
21 | + */ |
|
22 | + public function enqueueStylesAndScripts() |
|
23 | + { |
|
24 | + // core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css |
|
25 | + wp_enqueue_style( |
|
26 | + 'ee_progress_steps_display_number_bubbles', |
|
27 | + plugin_dir_url(__FILE__) . 'number_bubbles.css' |
|
28 | + ); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * loads and returns a full server path to the template used for the display strategy |
|
34 | - * |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public function getTemplate() |
|
38 | - { |
|
39 | - // return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php'; |
|
40 | - return __DIR__ . '/number_bubbles.template.php'; |
|
41 | - } |
|
32 | + /** |
|
33 | + * loads and returns a full server path to the template used for the display strategy |
|
34 | + * |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public function getTemplate() |
|
38 | + { |
|
39 | + // return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php'; |
|
40 | + return __DIR__ . '/number_bubbles.template.php'; |
|
41 | + } |
|
42 | 42 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function venue_location($content) |
164 | 164 | { |
165 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
165 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | // get some style |
178 | 178 | if (apply_filters('FHEE_enable_default_espresso_css', true) && is_single()) { |
179 | 179 | // first check theme folder |
180 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
180 | + if (is_readable(get_stylesheet_directory().$this->theme.'/style.css')) { |
|
181 | 181 | wp_register_style( |
182 | 182 | $this->theme, |
183 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
183 | + get_stylesheet_directory_uri().$this->theme.'/style.css', |
|
184 | 184 | array('dashicons', 'espresso_default') |
185 | 185 | ); |
186 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
186 | + } elseif (is_readable(EE_TEMPLATES.$this->theme.'/style.css')) { |
|
187 | 187 | wp_register_style( |
188 | 188 | $this->theme, |
189 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
189 | + EE_TEMPLATES_URL.$this->theme.'/style.css', |
|
190 | 190 | array('dashicons', 'espresso_default') |
191 | 191 | ); |
192 | 192 | } |
@@ -29,173 +29,173 @@ |
||
29 | 29 | */ |
30 | 30 | class EED_Venue_Single extends EED_Module |
31 | 31 | { |
32 | - /** |
|
33 | - * @return EED_Venue_Single |
|
34 | - */ |
|
35 | - public static function instance() |
|
36 | - { |
|
37 | - return parent::get_instance(__CLASS__); |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
43 | - * |
|
44 | - * @return void |
|
45 | - * @throws InvalidArgumentException |
|
46 | - * @throws InvalidDataTypeException |
|
47 | - * @throws InvalidInterfaceException |
|
48 | - */ |
|
49 | - public static function set_hooks() |
|
50 | - { |
|
51 | - /** @var CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
52 | - $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
53 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
54 | - ); |
|
55 | - $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
56 | - EE_Config::register_route( |
|
57 | - $custom_post_types['espresso_venues']['singular_slug'], |
|
58 | - 'Venue_Single', |
|
59 | - 'run' |
|
60 | - ); |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
65 | - * |
|
66 | - * @access public |
|
67 | - * @return void |
|
68 | - */ |
|
69 | - public static function set_hooks_admin() |
|
70 | - { |
|
71 | - } |
|
72 | - |
|
73 | - |
|
74 | - /** |
|
75 | - * run - initial module setup |
|
76 | - * |
|
77 | - * @access public |
|
78 | - * @param \WP $WP |
|
79 | - */ |
|
80 | - public function run($WP) |
|
81 | - { |
|
82 | - // check what template is loaded |
|
83 | - add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
84 | - add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * template_include |
|
90 | - * |
|
91 | - * @access public |
|
92 | - * @param string $template |
|
93 | - * @return string |
|
94 | - */ |
|
95 | - public function template_include($template) |
|
96 | - { |
|
97 | - // not a custom template? |
|
98 | - if ( |
|
99 | - EE_Registry::instance() |
|
100 | - ->load_core('Front_Controller', array(), false, true) |
|
101 | - ->get_selected_template() != 'single-espresso_venues.php' |
|
102 | - ) { |
|
103 | - EEH_Template::load_espresso_theme_functions(); |
|
104 | - // then add extra event data via hooks |
|
105 | - add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
106 | - add_filter('the_content', array($this, 'venue_details'), 100); |
|
107 | - // don't display entry meta because the existing theme will take car of that |
|
108 | - add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
109 | - } |
|
110 | - return $template; |
|
111 | - } |
|
112 | - |
|
113 | - |
|
114 | - /** |
|
115 | - * the_title |
|
116 | - * |
|
117 | - * @access public |
|
118 | - * @param string $title |
|
119 | - * @return string |
|
120 | - */ |
|
121 | - public function the_title($title = '') |
|
122 | - { |
|
123 | - return $title; |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - /** |
|
128 | - * venue_details |
|
129 | - * |
|
130 | - * @access public |
|
131 | - * @param string $content |
|
132 | - * @return string |
|
133 | - */ |
|
134 | - public function venue_details($content) |
|
135 | - { |
|
136 | - global $post; |
|
137 | - if ( |
|
138 | - $post->post_type == 'espresso_venues' |
|
139 | - && ! post_password_required() |
|
140 | - ) { |
|
141 | - // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
142 | - // it uses the_content() for displaying the $post->post_content |
|
143 | - // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
144 | - // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
145 | - remove_filter('the_content', array($this, 'venue_details'), 100); |
|
146 | - // add filters we want |
|
147 | - add_filter('the_content', array($this, 'venue_location'), 110); |
|
148 | - // now load our template |
|
149 | - $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
150 | - // remove other filters we added so they won't get applied to the next post |
|
151 | - remove_filter('the_content', array($this, 'venue_location'), 110); |
|
152 | - } |
|
153 | - // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
154 | - return ! empty($template) ? $template : $content; |
|
155 | - } |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * venue_location |
|
160 | - * |
|
161 | - * @access public |
|
162 | - * @param string $content |
|
163 | - * @return string |
|
164 | - */ |
|
165 | - public function venue_location($content) |
|
166 | - { |
|
167 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
168 | - } |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * wp_enqueue_scripts |
|
173 | - * |
|
174 | - * @access public |
|
175 | - * @return void |
|
176 | - */ |
|
177 | - public function wp_enqueue_scripts() |
|
178 | - { |
|
179 | - // get some style |
|
180 | - if (apply_filters('FHEE_enable_default_espresso_css', true) && is_single()) { |
|
181 | - // first check theme folder |
|
182 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
183 | - wp_register_style( |
|
184 | - $this->theme, |
|
185 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
186 | - array('dashicons', 'espresso_default') |
|
187 | - ); |
|
188 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
189 | - wp_register_style( |
|
190 | - $this->theme, |
|
191 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
192 | - array('dashicons', 'espresso_default') |
|
193 | - ); |
|
194 | - } |
|
195 | - wp_enqueue_style($this->theme); |
|
196 | - if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
197 | - add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
198 | - } |
|
199 | - } |
|
200 | - } |
|
32 | + /** |
|
33 | + * @return EED_Venue_Single |
|
34 | + */ |
|
35 | + public static function instance() |
|
36 | + { |
|
37 | + return parent::get_instance(__CLASS__); |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
43 | + * |
|
44 | + * @return void |
|
45 | + * @throws InvalidArgumentException |
|
46 | + * @throws InvalidDataTypeException |
|
47 | + * @throws InvalidInterfaceException |
|
48 | + */ |
|
49 | + public static function set_hooks() |
|
50 | + { |
|
51 | + /** @var CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
52 | + $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
53 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
54 | + ); |
|
55 | + $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
56 | + EE_Config::register_route( |
|
57 | + $custom_post_types['espresso_venues']['singular_slug'], |
|
58 | + 'Venue_Single', |
|
59 | + 'run' |
|
60 | + ); |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
65 | + * |
|
66 | + * @access public |
|
67 | + * @return void |
|
68 | + */ |
|
69 | + public static function set_hooks_admin() |
|
70 | + { |
|
71 | + } |
|
72 | + |
|
73 | + |
|
74 | + /** |
|
75 | + * run - initial module setup |
|
76 | + * |
|
77 | + * @access public |
|
78 | + * @param \WP $WP |
|
79 | + */ |
|
80 | + public function run($WP) |
|
81 | + { |
|
82 | + // check what template is loaded |
|
83 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
84 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * template_include |
|
90 | + * |
|
91 | + * @access public |
|
92 | + * @param string $template |
|
93 | + * @return string |
|
94 | + */ |
|
95 | + public function template_include($template) |
|
96 | + { |
|
97 | + // not a custom template? |
|
98 | + if ( |
|
99 | + EE_Registry::instance() |
|
100 | + ->load_core('Front_Controller', array(), false, true) |
|
101 | + ->get_selected_template() != 'single-espresso_venues.php' |
|
102 | + ) { |
|
103 | + EEH_Template::load_espresso_theme_functions(); |
|
104 | + // then add extra event data via hooks |
|
105 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
106 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
107 | + // don't display entry meta because the existing theme will take car of that |
|
108 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
109 | + } |
|
110 | + return $template; |
|
111 | + } |
|
112 | + |
|
113 | + |
|
114 | + /** |
|
115 | + * the_title |
|
116 | + * |
|
117 | + * @access public |
|
118 | + * @param string $title |
|
119 | + * @return string |
|
120 | + */ |
|
121 | + public function the_title($title = '') |
|
122 | + { |
|
123 | + return $title; |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + /** |
|
128 | + * venue_details |
|
129 | + * |
|
130 | + * @access public |
|
131 | + * @param string $content |
|
132 | + * @return string |
|
133 | + */ |
|
134 | + public function venue_details($content) |
|
135 | + { |
|
136 | + global $post; |
|
137 | + if ( |
|
138 | + $post->post_type == 'espresso_venues' |
|
139 | + && ! post_password_required() |
|
140 | + ) { |
|
141 | + // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
142 | + // it uses the_content() for displaying the $post->post_content |
|
143 | + // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
144 | + // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
145 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
146 | + // add filters we want |
|
147 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
148 | + // now load our template |
|
149 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
150 | + // remove other filters we added so they won't get applied to the next post |
|
151 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
152 | + } |
|
153 | + // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
154 | + return ! empty($template) ? $template : $content; |
|
155 | + } |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * venue_location |
|
160 | + * |
|
161 | + * @access public |
|
162 | + * @param string $content |
|
163 | + * @return string |
|
164 | + */ |
|
165 | + public function venue_location($content) |
|
166 | + { |
|
167 | + return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
168 | + } |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * wp_enqueue_scripts |
|
173 | + * |
|
174 | + * @access public |
|
175 | + * @return void |
|
176 | + */ |
|
177 | + public function wp_enqueue_scripts() |
|
178 | + { |
|
179 | + // get some style |
|
180 | + if (apply_filters('FHEE_enable_default_espresso_css', true) && is_single()) { |
|
181 | + // first check theme folder |
|
182 | + if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
183 | + wp_register_style( |
|
184 | + $this->theme, |
|
185 | + get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
186 | + array('dashicons', 'espresso_default') |
|
187 | + ); |
|
188 | + } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
189 | + wp_register_style( |
|
190 | + $this->theme, |
|
191 | + EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
192 | + array('dashicons', 'espresso_default') |
|
193 | + ); |
|
194 | + } |
|
195 | + wp_enqueue_style($this->theme); |
|
196 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
197 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
198 | + } |
|
199 | + } |
|
200 | + } |
|
201 | 201 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function venue_location($content) |
172 | 172 | { |
173 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
173 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | // get some style |
186 | 186 | if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
187 | 187 | // first check theme folder |
188 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
188 | + if (is_readable(get_stylesheet_directory().$this->theme.'/style.css')) { |
|
189 | 189 | wp_register_style( |
190 | 190 | $this->theme, |
191 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
191 | + get_stylesheet_directory_uri().$this->theme.'/style.css', |
|
192 | 192 | array('dashicons', 'espresso_default') |
193 | 193 | ); |
194 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
194 | + } elseif (is_readable(EE_TEMPLATES.$this->theme.'/style.css')) { |
|
195 | 195 | wp_register_style( |
196 | 196 | $this->theme, |
197 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
197 | + EE_TEMPLATES_URL.$this->theme.'/style.css', |
|
198 | 198 | array('dashicons', 'espresso_default') |
199 | 199 | ); |
200 | 200 | } |
@@ -29,178 +29,178 @@ |
||
29 | 29 | */ |
30 | 30 | class EED_Venues_Archive extends EED_Module |
31 | 31 | { |
32 | - /** |
|
33 | - * @return EED_Venues_Archive |
|
34 | - */ |
|
35 | - public static function instance() |
|
36 | - { |
|
37 | - return parent::get_instance(__CLASS__); |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
43 | - * |
|
44 | - * @return void |
|
45 | - * @throws InvalidArgumentException |
|
46 | - * @throws InvalidDataTypeException |
|
47 | - * @throws InvalidInterfaceException |
|
48 | - */ |
|
49 | - public static function set_hooks() |
|
50 | - { |
|
51 | - /** @var CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
52 | - $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
53 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
54 | - ); |
|
55 | - $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
56 | - EE_Config::register_route( |
|
57 | - $custom_post_types['espresso_venues']['plural_slug'], |
|
58 | - 'Venues_Archive', |
|
59 | - 'run' |
|
60 | - ); |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
65 | - * |
|
66 | - * @access public |
|
67 | - * @return void |
|
68 | - */ |
|
69 | - public static function set_hooks_admin() |
|
70 | - { |
|
71 | - } |
|
72 | - |
|
73 | - |
|
74 | - /** |
|
75 | - * run - initial module setup |
|
76 | - * |
|
77 | - * @access public |
|
78 | - * @param \WP $WP |
|
79 | - */ |
|
80 | - public function run($WP) |
|
81 | - { |
|
82 | - // check what template is loaded |
|
83 | - add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
84 | - add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * template_include |
|
90 | - * |
|
91 | - * @access public |
|
92 | - * @param string $template |
|
93 | - * @return string |
|
94 | - */ |
|
95 | - public function template_include($template) |
|
96 | - { |
|
97 | - // not a custom template? |
|
98 | - if ( |
|
99 | - EE_Registry::instance()->load_core('Front_Controller', array(), false, true) |
|
100 | - ->get_selected_template() != 'archive-espresso_venues.php' |
|
101 | - ) { |
|
102 | - EEH_Template::load_espresso_theme_functions(); |
|
103 | - // then add extra event data via hooks |
|
104 | - add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
105 | - // don't know if theme uses the_excerpt |
|
106 | - add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
107 | - // or the_content |
|
108 | - add_filter('the_content', array($this, 'venue_details'), 100); |
|
109 | - // don't display entry meta because the existing theme will take care of that |
|
110 | - add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
111 | - } |
|
112 | - return $template; |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * the_title |
|
118 | - * |
|
119 | - * @access public |
|
120 | - * @param string $title |
|
121 | - * @return string |
|
122 | - */ |
|
123 | - public function the_title($title = '') |
|
124 | - { |
|
125 | - return $title; |
|
126 | - } |
|
127 | - |
|
128 | - |
|
129 | - /** |
|
130 | - * venue_details |
|
131 | - * |
|
132 | - * @access public |
|
133 | - * @param string $content |
|
134 | - * @return string |
|
135 | - */ |
|
136 | - public function venue_details($content) |
|
137 | - { |
|
138 | - global $post; |
|
139 | - if ( |
|
140 | - $post->post_type == 'espresso_venues' |
|
141 | - && ! post_password_required() |
|
142 | - ) { |
|
143 | - // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
144 | - // it uses the_content() for displaying the $post->post_content |
|
145 | - // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
146 | - // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
147 | - remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
148 | - remove_filter('the_content', array($this, 'venue_details'), 100); |
|
149 | - // add filters we want |
|
150 | - add_filter('the_content', array($this, 'venue_location'), 110); |
|
151 | - add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
152 | - // now load our template |
|
153 | - $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
154 | - // now add our filter back in, plus some others |
|
155 | - add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
156 | - add_filter('the_content', array($this, 'venue_details'), 100); |
|
157 | - // remove other filters we added so they won't get applied to the next post |
|
158 | - remove_filter('the_content', array($this, 'venue_location'), 110); |
|
159 | - remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
160 | - // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
161 | - } |
|
162 | - return ! empty($template) ? $template : $content; |
|
163 | - } |
|
164 | - |
|
165 | - |
|
166 | - /** |
|
167 | - * venue_location |
|
168 | - * |
|
169 | - * @access public |
|
170 | - * @param string $content |
|
171 | - * @return string |
|
172 | - */ |
|
173 | - public function venue_location($content) |
|
174 | - { |
|
175 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
176 | - } |
|
177 | - |
|
178 | - |
|
179 | - /** |
|
180 | - * wp_enqueue_scripts |
|
181 | - * |
|
182 | - * @access public |
|
183 | - * @return void |
|
184 | - */ |
|
185 | - public function wp_enqueue_scripts() |
|
186 | - { |
|
187 | - // get some style |
|
188 | - if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
|
189 | - // first check theme folder |
|
190 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
191 | - wp_register_style( |
|
192 | - $this->theme, |
|
193 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
194 | - array('dashicons', 'espresso_default') |
|
195 | - ); |
|
196 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
197 | - wp_register_style( |
|
198 | - $this->theme, |
|
199 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
200 | - array('dashicons', 'espresso_default') |
|
201 | - ); |
|
202 | - } |
|
203 | - wp_enqueue_style($this->theme); |
|
204 | - } |
|
205 | - } |
|
32 | + /** |
|
33 | + * @return EED_Venues_Archive |
|
34 | + */ |
|
35 | + public static function instance() |
|
36 | + { |
|
37 | + return parent::get_instance(__CLASS__); |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
43 | + * |
|
44 | + * @return void |
|
45 | + * @throws InvalidArgumentException |
|
46 | + * @throws InvalidDataTypeException |
|
47 | + * @throws InvalidInterfaceException |
|
48 | + */ |
|
49 | + public static function set_hooks() |
|
50 | + { |
|
51 | + /** @var CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
52 | + $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
53 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
54 | + ); |
|
55 | + $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
56 | + EE_Config::register_route( |
|
57 | + $custom_post_types['espresso_venues']['plural_slug'], |
|
58 | + 'Venues_Archive', |
|
59 | + 'run' |
|
60 | + ); |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
65 | + * |
|
66 | + * @access public |
|
67 | + * @return void |
|
68 | + */ |
|
69 | + public static function set_hooks_admin() |
|
70 | + { |
|
71 | + } |
|
72 | + |
|
73 | + |
|
74 | + /** |
|
75 | + * run - initial module setup |
|
76 | + * |
|
77 | + * @access public |
|
78 | + * @param \WP $WP |
|
79 | + */ |
|
80 | + public function run($WP) |
|
81 | + { |
|
82 | + // check what template is loaded |
|
83 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
84 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * template_include |
|
90 | + * |
|
91 | + * @access public |
|
92 | + * @param string $template |
|
93 | + * @return string |
|
94 | + */ |
|
95 | + public function template_include($template) |
|
96 | + { |
|
97 | + // not a custom template? |
|
98 | + if ( |
|
99 | + EE_Registry::instance()->load_core('Front_Controller', array(), false, true) |
|
100 | + ->get_selected_template() != 'archive-espresso_venues.php' |
|
101 | + ) { |
|
102 | + EEH_Template::load_espresso_theme_functions(); |
|
103 | + // then add extra event data via hooks |
|
104 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
105 | + // don't know if theme uses the_excerpt |
|
106 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
107 | + // or the_content |
|
108 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
109 | + // don't display entry meta because the existing theme will take care of that |
|
110 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
111 | + } |
|
112 | + return $template; |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * the_title |
|
118 | + * |
|
119 | + * @access public |
|
120 | + * @param string $title |
|
121 | + * @return string |
|
122 | + */ |
|
123 | + public function the_title($title = '') |
|
124 | + { |
|
125 | + return $title; |
|
126 | + } |
|
127 | + |
|
128 | + |
|
129 | + /** |
|
130 | + * venue_details |
|
131 | + * |
|
132 | + * @access public |
|
133 | + * @param string $content |
|
134 | + * @return string |
|
135 | + */ |
|
136 | + public function venue_details($content) |
|
137 | + { |
|
138 | + global $post; |
|
139 | + if ( |
|
140 | + $post->post_type == 'espresso_venues' |
|
141 | + && ! post_password_required() |
|
142 | + ) { |
|
143 | + // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
144 | + // it uses the_content() for displaying the $post->post_content |
|
145 | + // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
146 | + // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
147 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
148 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
149 | + // add filters we want |
|
150 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
151 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
152 | + // now load our template |
|
153 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
154 | + // now add our filter back in, plus some others |
|
155 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
156 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
157 | + // remove other filters we added so they won't get applied to the next post |
|
158 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
159 | + remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
160 | + // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
161 | + } |
|
162 | + return ! empty($template) ? $template : $content; |
|
163 | + } |
|
164 | + |
|
165 | + |
|
166 | + /** |
|
167 | + * venue_location |
|
168 | + * |
|
169 | + * @access public |
|
170 | + * @param string $content |
|
171 | + * @return string |
|
172 | + */ |
|
173 | + public function venue_location($content) |
|
174 | + { |
|
175 | + return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
176 | + } |
|
177 | + |
|
178 | + |
|
179 | + /** |
|
180 | + * wp_enqueue_scripts |
|
181 | + * |
|
182 | + * @access public |
|
183 | + * @return void |
|
184 | + */ |
|
185 | + public function wp_enqueue_scripts() |
|
186 | + { |
|
187 | + // get some style |
|
188 | + if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
|
189 | + // first check theme folder |
|
190 | + if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
191 | + wp_register_style( |
|
192 | + $this->theme, |
|
193 | + get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
194 | + array('dashicons', 'espresso_default') |
|
195 | + ); |
|
196 | + } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
197 | + wp_register_style( |
|
198 | + $this->theme, |
|
199 | + EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
200 | + array('dashicons', 'espresso_default') |
|
201 | + ); |
|
202 | + } |
|
203 | + wp_enqueue_style($this->theme); |
|
204 | + } |
|
205 | + } |
|
206 | 206 | } |
@@ -16,314 +16,314 @@ |
||
16 | 16 | class StatsGatherer |
17 | 17 | { |
18 | 18 | |
19 | - const COUNT_ALL_EVENTS = 'event'; |
|
20 | - const COUNT_ACTIVE_EVENTS = 'active_event'; |
|
21 | - const COUNT_DATETIMES = 'datetime'; |
|
22 | - const COUNT_TICKETS = 'ticket'; |
|
23 | - const COUNT_DATETIMES_SOLD = 'datetime_sold'; |
|
24 | - const COUNT_TICKETS_FREE = 'free_ticket'; |
|
25 | - const COUNT_TICKETS_PAID = 'paid_ticket'; |
|
26 | - const COUNT_TICKETS_SOLD = 'ticket_sold'; |
|
27 | - const COUNT_REGISTRATIONS_APPROVED = 'registrations_approved'; |
|
28 | - const COUNT_REGISTRATIONS_NOT_APPROVED = 'registrations_not_approved'; |
|
29 | - const COUNT_REGISTRATIONS_PENDING = 'registrations_pending'; |
|
30 | - const COUNT_REGISTRATIONS_INCOMPLETE = 'registrations_incomplete'; |
|
31 | - const COUNT_REGISTRATIONS_ALL = 'registrations_all'; |
|
32 | - const COUNT_REGISTRATIONS_CANCELLED = 'registrations_cancelled'; |
|
33 | - const COUNT_REGISTRATIONS_DECLINED = 'registrations_declined'; |
|
34 | - const SUM_TRANSACTIONS_COMPLETE_TOTAL = 'transactions_complete_total_sum'; |
|
35 | - const SUM_TRANSACTIONS_ALL_PAID = 'transactions_all_paid'; |
|
36 | - const INFO_SITE_CURRENCY = 'site_currency'; |
|
19 | + const COUNT_ALL_EVENTS = 'event'; |
|
20 | + const COUNT_ACTIVE_EVENTS = 'active_event'; |
|
21 | + const COUNT_DATETIMES = 'datetime'; |
|
22 | + const COUNT_TICKETS = 'ticket'; |
|
23 | + const COUNT_DATETIMES_SOLD = 'datetime_sold'; |
|
24 | + const COUNT_TICKETS_FREE = 'free_ticket'; |
|
25 | + const COUNT_TICKETS_PAID = 'paid_ticket'; |
|
26 | + const COUNT_TICKETS_SOLD = 'ticket_sold'; |
|
27 | + const COUNT_REGISTRATIONS_APPROVED = 'registrations_approved'; |
|
28 | + const COUNT_REGISTRATIONS_NOT_APPROVED = 'registrations_not_approved'; |
|
29 | + const COUNT_REGISTRATIONS_PENDING = 'registrations_pending'; |
|
30 | + const COUNT_REGISTRATIONS_INCOMPLETE = 'registrations_incomplete'; |
|
31 | + const COUNT_REGISTRATIONS_ALL = 'registrations_all'; |
|
32 | + const COUNT_REGISTRATIONS_CANCELLED = 'registrations_cancelled'; |
|
33 | + const COUNT_REGISTRATIONS_DECLINED = 'registrations_declined'; |
|
34 | + const SUM_TRANSACTIONS_COMPLETE_TOTAL = 'transactions_complete_total_sum'; |
|
35 | + const SUM_TRANSACTIONS_ALL_PAID = 'transactions_all_paid'; |
|
36 | + const INFO_SITE_CURRENCY = 'site_currency'; |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @var EEM_Payment_Method |
|
41 | - */ |
|
42 | - private $payment_method_model; |
|
39 | + /** |
|
40 | + * @var EEM_Payment_Method |
|
41 | + */ |
|
42 | + private $payment_method_model; |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @var EEM_Event |
|
47 | - */ |
|
48 | - private $event_model; |
|
45 | + /** |
|
46 | + * @var EEM_Event |
|
47 | + */ |
|
48 | + private $event_model; |
|
49 | 49 | |
50 | - /** |
|
51 | - * @var EEM_Datetime |
|
52 | - */ |
|
53 | - private $datetime_model; |
|
50 | + /** |
|
51 | + * @var EEM_Datetime |
|
52 | + */ |
|
53 | + private $datetime_model; |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * @var EEM_Ticket |
|
58 | - */ |
|
59 | - private $ticket_model; |
|
56 | + /** |
|
57 | + * @var EEM_Ticket |
|
58 | + */ |
|
59 | + private $ticket_model; |
|
60 | 60 | |
61 | 61 | |
62 | - /** |
|
63 | - * @var EEM_Registration |
|
64 | - */ |
|
65 | - private $registration_model; |
|
62 | + /** |
|
63 | + * @var EEM_Registration |
|
64 | + */ |
|
65 | + private $registration_model; |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * @var EEM_Transaction |
|
70 | - */ |
|
71 | - private $transaction_model; |
|
68 | + /** |
|
69 | + * @var EEM_Transaction |
|
70 | + */ |
|
71 | + private $transaction_model; |
|
72 | 72 | |
73 | 73 | |
74 | - /** |
|
75 | - * @var EE_Config |
|
76 | - */ |
|
77 | - private $config; |
|
74 | + /** |
|
75 | + * @var EE_Config |
|
76 | + */ |
|
77 | + private $config; |
|
78 | 78 | |
79 | 79 | |
80 | - /** |
|
81 | - * StatsGatherer constructor. |
|
82 | - * |
|
83 | - * @param EEM_Payment_Method $payment_method_model |
|
84 | - * @param EEM_Event $event_model |
|
85 | - * @param EEM_Datetime $datetime_model |
|
86 | - * @param EEM_Ticket $ticket_model |
|
87 | - * @param EEM_Registration $registration_model |
|
88 | - * @param EEM_Transaction $transaction_model |
|
89 | - * @param EE_Config $config |
|
90 | - */ |
|
91 | - public function __construct( |
|
92 | - EEM_Payment_Method $payment_method_model, |
|
93 | - EEM_Event $event_model, |
|
94 | - EEM_Datetime $datetime_model, |
|
95 | - EEM_Ticket $ticket_model, |
|
96 | - EEM_Registration $registration_model, |
|
97 | - EEM_Transaction $transaction_model, |
|
98 | - EE_Config $config |
|
99 | - ) { |
|
100 | - $this->payment_method_model = $payment_method_model; |
|
101 | - $this->event_model = $event_model; |
|
102 | - $this->datetime_model = $datetime_model; |
|
103 | - $this->ticket_model = $ticket_model; |
|
104 | - $this->registration_model = $registration_model; |
|
105 | - $this->transaction_model = $transaction_model; |
|
106 | - $this->config = $config; |
|
107 | - } |
|
80 | + /** |
|
81 | + * StatsGatherer constructor. |
|
82 | + * |
|
83 | + * @param EEM_Payment_Method $payment_method_model |
|
84 | + * @param EEM_Event $event_model |
|
85 | + * @param EEM_Datetime $datetime_model |
|
86 | + * @param EEM_Ticket $ticket_model |
|
87 | + * @param EEM_Registration $registration_model |
|
88 | + * @param EEM_Transaction $transaction_model |
|
89 | + * @param EE_Config $config |
|
90 | + */ |
|
91 | + public function __construct( |
|
92 | + EEM_Payment_Method $payment_method_model, |
|
93 | + EEM_Event $event_model, |
|
94 | + EEM_Datetime $datetime_model, |
|
95 | + EEM_Ticket $ticket_model, |
|
96 | + EEM_Registration $registration_model, |
|
97 | + EEM_Transaction $transaction_model, |
|
98 | + EE_Config $config |
|
99 | + ) { |
|
100 | + $this->payment_method_model = $payment_method_model; |
|
101 | + $this->event_model = $event_model; |
|
102 | + $this->datetime_model = $datetime_model; |
|
103 | + $this->ticket_model = $ticket_model; |
|
104 | + $this->registration_model = $registration_model; |
|
105 | + $this->transaction_model = $transaction_model; |
|
106 | + $this->config = $config; |
|
107 | + } |
|
108 | 108 | |
109 | 109 | |
110 | - /** |
|
111 | - * Return the stats array for PUE UXIP stats. |
|
112 | - * |
|
113 | - * @return array |
|
114 | - */ |
|
115 | - public function stats() |
|
116 | - { |
|
117 | - global $wp_version; |
|
118 | - $stats = $this->paymentMethodStats(); |
|
119 | - // a-ok so let's setup our stats. |
|
120 | - $stats = array_merge($stats, array( |
|
121 | - 'is_multisite' => is_multisite() && is_main_site(), |
|
122 | - 'active_theme' => $this->getActiveThemeStat(), |
|
123 | - 'ee4_all_events_count' => $this->getCountFor(self::COUNT_ALL_EVENTS), |
|
124 | - 'ee4_active_events_count' => $this->getCountFor(self::COUNT_ACTIVE_EVENTS), |
|
125 | - 'all_dtts_count' => $this->getCountFor(self::COUNT_DATETIMES), |
|
126 | - 'dtt_sold' => $this->getCountFor(self::COUNT_DATETIMES_SOLD), |
|
127 | - 'all_tkt_count' => $this->getCountFor(self::COUNT_TICKETS), |
|
128 | - 'free_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_FREE), |
|
129 | - 'paid_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_PAID), |
|
130 | - 'tkt_sold' => $this->getCountFor(self::COUNT_TICKETS_SOLD), |
|
131 | - 'approve_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_APPROVED), |
|
132 | - 'pending_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_PENDING), |
|
133 | - 'not_approved_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_NOT_APPROVED), |
|
134 | - 'incomplete_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_INCOMPLETE), |
|
135 | - 'cancelled_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_CANCELLED), |
|
136 | - 'declined_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_DECLINED), |
|
137 | - 'all_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_ALL), |
|
138 | - 'completed_transaction_total_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_COMPLETE_TOTAL), |
|
139 | - 'all_transaction_paid_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_ALL_PAID), |
|
140 | - self::INFO_SITE_CURRENCY => $this->config->currency instanceof EE_Currency_Config |
|
141 | - ? $this->config->currency->code |
|
142 | - : 'unknown', |
|
143 | - 'phpversion' => implode( |
|
144 | - '.', |
|
145 | - array(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION) |
|
146 | - ), |
|
147 | - 'wpversion' => $wp_version, |
|
148 | - 'active_addons' => $this->getActiveAddons(), |
|
149 | - )); |
|
150 | - // remove any values that equal null. This ensures any stats that weren't retrieved successfully are excluded. |
|
151 | - return array_filter($stats, function ($value) { |
|
152 | - return $value !== null; |
|
153 | - }); |
|
154 | - } |
|
110 | + /** |
|
111 | + * Return the stats array for PUE UXIP stats. |
|
112 | + * |
|
113 | + * @return array |
|
114 | + */ |
|
115 | + public function stats() |
|
116 | + { |
|
117 | + global $wp_version; |
|
118 | + $stats = $this->paymentMethodStats(); |
|
119 | + // a-ok so let's setup our stats. |
|
120 | + $stats = array_merge($stats, array( |
|
121 | + 'is_multisite' => is_multisite() && is_main_site(), |
|
122 | + 'active_theme' => $this->getActiveThemeStat(), |
|
123 | + 'ee4_all_events_count' => $this->getCountFor(self::COUNT_ALL_EVENTS), |
|
124 | + 'ee4_active_events_count' => $this->getCountFor(self::COUNT_ACTIVE_EVENTS), |
|
125 | + 'all_dtts_count' => $this->getCountFor(self::COUNT_DATETIMES), |
|
126 | + 'dtt_sold' => $this->getCountFor(self::COUNT_DATETIMES_SOLD), |
|
127 | + 'all_tkt_count' => $this->getCountFor(self::COUNT_TICKETS), |
|
128 | + 'free_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_FREE), |
|
129 | + 'paid_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_PAID), |
|
130 | + 'tkt_sold' => $this->getCountFor(self::COUNT_TICKETS_SOLD), |
|
131 | + 'approve_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_APPROVED), |
|
132 | + 'pending_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_PENDING), |
|
133 | + 'not_approved_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_NOT_APPROVED), |
|
134 | + 'incomplete_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_INCOMPLETE), |
|
135 | + 'cancelled_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_CANCELLED), |
|
136 | + 'declined_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_DECLINED), |
|
137 | + 'all_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_ALL), |
|
138 | + 'completed_transaction_total_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_COMPLETE_TOTAL), |
|
139 | + 'all_transaction_paid_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_ALL_PAID), |
|
140 | + self::INFO_SITE_CURRENCY => $this->config->currency instanceof EE_Currency_Config |
|
141 | + ? $this->config->currency->code |
|
142 | + : 'unknown', |
|
143 | + 'phpversion' => implode( |
|
144 | + '.', |
|
145 | + array(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION) |
|
146 | + ), |
|
147 | + 'wpversion' => $wp_version, |
|
148 | + 'active_addons' => $this->getActiveAddons(), |
|
149 | + )); |
|
150 | + // remove any values that equal null. This ensures any stats that weren't retrieved successfully are excluded. |
|
151 | + return array_filter($stats, function ($value) { |
|
152 | + return $value !== null; |
|
153 | + }); |
|
154 | + } |
|
155 | 155 | |
156 | - /** |
|
157 | - * @param string $which enum (@see constants prefixed with COUNT) |
|
158 | - * @return int|null |
|
159 | - */ |
|
160 | - private function getCountFor($which) |
|
161 | - { |
|
162 | - try { |
|
163 | - switch ($which) { |
|
164 | - case self::COUNT_ALL_EVENTS: |
|
165 | - $count = $this->event_model->count(); |
|
166 | - break; |
|
167 | - case self::COUNT_TICKETS: |
|
168 | - $count = $this->ticket_model->count(); |
|
169 | - break; |
|
170 | - case self::COUNT_DATETIMES: |
|
171 | - $count = $this->datetime_model->count(); |
|
172 | - break; |
|
173 | - case self::COUNT_ACTIVE_EVENTS: |
|
174 | - $count = $this->event_model->get_active_events(array(), true); |
|
175 | - break; |
|
176 | - case self::COUNT_DATETIMES_SOLD: |
|
177 | - $count = $this->datetime_model->sum(array(), 'DTT_sold'); |
|
178 | - break; |
|
179 | - case self::COUNT_TICKETS_FREE: |
|
180 | - $count = $this->ticket_model->count(array( |
|
181 | - array( |
|
182 | - 'TKT_price' => 0, |
|
183 | - ), |
|
184 | - )); |
|
185 | - break; |
|
186 | - case self::COUNT_TICKETS_PAID: |
|
187 | - $count = $this->ticket_model->count(array( |
|
188 | - array( |
|
189 | - 'TKT_price' => array('>', 0), |
|
190 | - ), |
|
191 | - )); |
|
192 | - break; |
|
193 | - case self::COUNT_TICKETS_SOLD: |
|
194 | - $count = $this->ticket_model->sum(array(), 'TKT_sold'); |
|
195 | - break; |
|
196 | - case self::COUNT_REGISTRATIONS_ALL: |
|
197 | - $count = $this->registration_model->count(); |
|
198 | - break; |
|
199 | - case self::COUNT_REGISTRATIONS_CANCELLED: |
|
200 | - $count = $this->registration_model->count( |
|
201 | - array( |
|
202 | - array( |
|
203 | - 'STS_ID' => EEM_Registration::status_id_cancelled, |
|
204 | - ), |
|
205 | - ) |
|
206 | - ); |
|
207 | - break; |
|
208 | - case self::COUNT_REGISTRATIONS_INCOMPLETE: |
|
209 | - $count = $this->registration_model->count( |
|
210 | - array( |
|
211 | - array( |
|
212 | - 'STS_ID' => EEM_Registration::status_id_incomplete, |
|
213 | - ), |
|
214 | - ) |
|
215 | - ); |
|
216 | - break; |
|
217 | - case self::COUNT_REGISTRATIONS_NOT_APPROVED: |
|
218 | - $count = $this->registration_model->count( |
|
219 | - array( |
|
220 | - array( |
|
221 | - 'STS_ID' => EEM_Registration::status_id_not_approved, |
|
222 | - ), |
|
223 | - ) |
|
224 | - ); |
|
225 | - break; |
|
226 | - case self::COUNT_REGISTRATIONS_DECLINED: |
|
227 | - $count = $this->registration_model->count( |
|
228 | - array( |
|
229 | - array( |
|
230 | - 'STS_ID' => EEM_Registration::status_id_declined, |
|
231 | - ), |
|
232 | - ) |
|
233 | - ); |
|
234 | - break; |
|
235 | - case self::COUNT_REGISTRATIONS_PENDING: |
|
236 | - $count = $this->registration_model->count( |
|
237 | - array( |
|
238 | - array( |
|
239 | - 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
240 | - ), |
|
241 | - ) |
|
242 | - ); |
|
243 | - break; |
|
244 | - case self::COUNT_REGISTRATIONS_APPROVED: |
|
245 | - $count = $this->registration_model->count( |
|
246 | - array( |
|
247 | - array( |
|
248 | - 'STS_ID' => EEM_Registration::status_id_approved, |
|
249 | - ), |
|
250 | - ) |
|
251 | - ); |
|
252 | - break; |
|
253 | - case self::SUM_TRANSACTIONS_COMPLETE_TOTAL: |
|
254 | - $count = $this->transaction_model->sum( |
|
255 | - array( |
|
256 | - array( |
|
257 | - 'STS_ID' => EEM_Transaction::complete_status_code, |
|
258 | - ), |
|
259 | - ), |
|
260 | - 'TXN_total' |
|
261 | - ); |
|
262 | - break; |
|
263 | - case self::SUM_TRANSACTIONS_ALL_PAID: |
|
264 | - $count = $this->transaction_model->sum( |
|
265 | - array(), |
|
266 | - 'TXN_paid' |
|
267 | - ); |
|
268 | - break; |
|
269 | - default: |
|
270 | - $count = null; |
|
271 | - break; |
|
272 | - } |
|
273 | - } catch (Exception $e) { |
|
274 | - $count = null; |
|
275 | - } |
|
276 | - return $count; |
|
277 | - } |
|
156 | + /** |
|
157 | + * @param string $which enum (@see constants prefixed with COUNT) |
|
158 | + * @return int|null |
|
159 | + */ |
|
160 | + private function getCountFor($which) |
|
161 | + { |
|
162 | + try { |
|
163 | + switch ($which) { |
|
164 | + case self::COUNT_ALL_EVENTS: |
|
165 | + $count = $this->event_model->count(); |
|
166 | + break; |
|
167 | + case self::COUNT_TICKETS: |
|
168 | + $count = $this->ticket_model->count(); |
|
169 | + break; |
|
170 | + case self::COUNT_DATETIMES: |
|
171 | + $count = $this->datetime_model->count(); |
|
172 | + break; |
|
173 | + case self::COUNT_ACTIVE_EVENTS: |
|
174 | + $count = $this->event_model->get_active_events(array(), true); |
|
175 | + break; |
|
176 | + case self::COUNT_DATETIMES_SOLD: |
|
177 | + $count = $this->datetime_model->sum(array(), 'DTT_sold'); |
|
178 | + break; |
|
179 | + case self::COUNT_TICKETS_FREE: |
|
180 | + $count = $this->ticket_model->count(array( |
|
181 | + array( |
|
182 | + 'TKT_price' => 0, |
|
183 | + ), |
|
184 | + )); |
|
185 | + break; |
|
186 | + case self::COUNT_TICKETS_PAID: |
|
187 | + $count = $this->ticket_model->count(array( |
|
188 | + array( |
|
189 | + 'TKT_price' => array('>', 0), |
|
190 | + ), |
|
191 | + )); |
|
192 | + break; |
|
193 | + case self::COUNT_TICKETS_SOLD: |
|
194 | + $count = $this->ticket_model->sum(array(), 'TKT_sold'); |
|
195 | + break; |
|
196 | + case self::COUNT_REGISTRATIONS_ALL: |
|
197 | + $count = $this->registration_model->count(); |
|
198 | + break; |
|
199 | + case self::COUNT_REGISTRATIONS_CANCELLED: |
|
200 | + $count = $this->registration_model->count( |
|
201 | + array( |
|
202 | + array( |
|
203 | + 'STS_ID' => EEM_Registration::status_id_cancelled, |
|
204 | + ), |
|
205 | + ) |
|
206 | + ); |
|
207 | + break; |
|
208 | + case self::COUNT_REGISTRATIONS_INCOMPLETE: |
|
209 | + $count = $this->registration_model->count( |
|
210 | + array( |
|
211 | + array( |
|
212 | + 'STS_ID' => EEM_Registration::status_id_incomplete, |
|
213 | + ), |
|
214 | + ) |
|
215 | + ); |
|
216 | + break; |
|
217 | + case self::COUNT_REGISTRATIONS_NOT_APPROVED: |
|
218 | + $count = $this->registration_model->count( |
|
219 | + array( |
|
220 | + array( |
|
221 | + 'STS_ID' => EEM_Registration::status_id_not_approved, |
|
222 | + ), |
|
223 | + ) |
|
224 | + ); |
|
225 | + break; |
|
226 | + case self::COUNT_REGISTRATIONS_DECLINED: |
|
227 | + $count = $this->registration_model->count( |
|
228 | + array( |
|
229 | + array( |
|
230 | + 'STS_ID' => EEM_Registration::status_id_declined, |
|
231 | + ), |
|
232 | + ) |
|
233 | + ); |
|
234 | + break; |
|
235 | + case self::COUNT_REGISTRATIONS_PENDING: |
|
236 | + $count = $this->registration_model->count( |
|
237 | + array( |
|
238 | + array( |
|
239 | + 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
240 | + ), |
|
241 | + ) |
|
242 | + ); |
|
243 | + break; |
|
244 | + case self::COUNT_REGISTRATIONS_APPROVED: |
|
245 | + $count = $this->registration_model->count( |
|
246 | + array( |
|
247 | + array( |
|
248 | + 'STS_ID' => EEM_Registration::status_id_approved, |
|
249 | + ), |
|
250 | + ) |
|
251 | + ); |
|
252 | + break; |
|
253 | + case self::SUM_TRANSACTIONS_COMPLETE_TOTAL: |
|
254 | + $count = $this->transaction_model->sum( |
|
255 | + array( |
|
256 | + array( |
|
257 | + 'STS_ID' => EEM_Transaction::complete_status_code, |
|
258 | + ), |
|
259 | + ), |
|
260 | + 'TXN_total' |
|
261 | + ); |
|
262 | + break; |
|
263 | + case self::SUM_TRANSACTIONS_ALL_PAID: |
|
264 | + $count = $this->transaction_model->sum( |
|
265 | + array(), |
|
266 | + 'TXN_paid' |
|
267 | + ); |
|
268 | + break; |
|
269 | + default: |
|
270 | + $count = null; |
|
271 | + break; |
|
272 | + } |
|
273 | + } catch (Exception $e) { |
|
274 | + $count = null; |
|
275 | + } |
|
276 | + return $count; |
|
277 | + } |
|
278 | 278 | |
279 | - /** |
|
280 | - * Return the active theme. |
|
281 | - * |
|
282 | - * @return false|string |
|
283 | - */ |
|
284 | - private function getActiveThemeStat() |
|
285 | - { |
|
286 | - $theme = wp_get_theme(); |
|
287 | - return $theme->get('Name'); |
|
288 | - } |
|
279 | + /** |
|
280 | + * Return the active theme. |
|
281 | + * |
|
282 | + * @return false|string |
|
283 | + */ |
|
284 | + private function getActiveThemeStat() |
|
285 | + { |
|
286 | + $theme = wp_get_theme(); |
|
287 | + return $theme->get('Name'); |
|
288 | + } |
|
289 | 289 | |
290 | - /** |
|
291 | - * @return array |
|
292 | - */ |
|
293 | - private function paymentMethodStats() |
|
294 | - { |
|
295 | - $payment_method_stats = array(); |
|
296 | - try { |
|
297 | - $active_payment_methods = $this->payment_method_model->get_all_active( |
|
298 | - null, |
|
299 | - array('group_by' => 'PMD_type') |
|
300 | - ); |
|
301 | - if ($active_payment_methods) { |
|
302 | - foreach ($active_payment_methods as $payment_method) { |
|
303 | - $payment_method_stats[ $payment_method->name() . '_active_payment_method' ] = 1; |
|
304 | - } |
|
305 | - } |
|
306 | - } catch (Exception $e) { |
|
307 | - // do nothing just prevents fatals. |
|
308 | - } |
|
309 | - return $payment_method_stats; |
|
310 | - } |
|
290 | + /** |
|
291 | + * @return array |
|
292 | + */ |
|
293 | + private function paymentMethodStats() |
|
294 | + { |
|
295 | + $payment_method_stats = array(); |
|
296 | + try { |
|
297 | + $active_payment_methods = $this->payment_method_model->get_all_active( |
|
298 | + null, |
|
299 | + array('group_by' => 'PMD_type') |
|
300 | + ); |
|
301 | + if ($active_payment_methods) { |
|
302 | + foreach ($active_payment_methods as $payment_method) { |
|
303 | + $payment_method_stats[ $payment_method->name() . '_active_payment_method' ] = 1; |
|
304 | + } |
|
305 | + } |
|
306 | + } catch (Exception $e) { |
|
307 | + // do nothing just prevents fatals. |
|
308 | + } |
|
309 | + return $payment_method_stats; |
|
310 | + } |
|
311 | 311 | |
312 | 312 | |
313 | - /** |
|
314 | - * Return a list of active EE add-ons and their versions. |
|
315 | - * |
|
316 | - * @return string |
|
317 | - */ |
|
318 | - private function getActiveAddons() |
|
319 | - { |
|
320 | - $activeAddons = []; |
|
321 | - $addOns = EE_Registry::instance()->addons; |
|
322 | - if (! empty($addOns)) { |
|
323 | - foreach ($addOns as $addon) { |
|
324 | - $activeAddons[] = $addon->name() . '@' . $addon->version(); |
|
325 | - } |
|
326 | - } |
|
327 | - return implode(',', $activeAddons); |
|
328 | - } |
|
313 | + /** |
|
314 | + * Return a list of active EE add-ons and their versions. |
|
315 | + * |
|
316 | + * @return string |
|
317 | + */ |
|
318 | + private function getActiveAddons() |
|
319 | + { |
|
320 | + $activeAddons = []; |
|
321 | + $addOns = EE_Registry::instance()->addons; |
|
322 | + if (! empty($addOns)) { |
|
323 | + foreach ($addOns as $addon) { |
|
324 | + $activeAddons[] = $addon->name() . '@' . $addon->version(); |
|
325 | + } |
|
326 | + } |
|
327 | + return implode(',', $activeAddons); |
|
328 | + } |
|
329 | 329 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | 'active_addons' => $this->getActiveAddons(), |
149 | 149 | )); |
150 | 150 | // remove any values that equal null. This ensures any stats that weren't retrieved successfully are excluded. |
151 | - return array_filter($stats, function ($value) { |
|
151 | + return array_filter($stats, function($value) { |
|
152 | 152 | return $value !== null; |
153 | 153 | }); |
154 | 154 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | ); |
301 | 301 | if ($active_payment_methods) { |
302 | 302 | foreach ($active_payment_methods as $payment_method) { |
303 | - $payment_method_stats[ $payment_method->name() . '_active_payment_method' ] = 1; |
|
303 | + $payment_method_stats[$payment_method->name().'_active_payment_method'] = 1; |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | } catch (Exception $e) { |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | { |
320 | 320 | $activeAddons = []; |
321 | 321 | $addOns = EE_Registry::instance()->addons; |
322 | - if (! empty($addOns)) { |
|
322 | + if ( ! empty($addOns)) { |
|
323 | 323 | foreach ($addOns as $addon) { |
324 | - $activeAddons[] = $addon->name() . '@' . $addon->version(); |
|
324 | + $activeAddons[] = $addon->name().'@'.$addon->version(); |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | return implode(',', $activeAddons); |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | // unfortunately, this needs to be done upon INCLUSION of this file, |
15 | 15 | // instead of construction, because it only gets constructed on first page load |
16 | 16 | // (all other times it gets resurrected from a wordpress option) |
17 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*'); |
|
17 | +$stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
|
18 | 18 | $class_to_filepath = array(); |
19 | 19 | foreach ($stages as $filepath) { |
20 | 20 | $matches = array(); |
21 | 21 | preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
22 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
22 | + $class_to_filepath[$matches[1]] = $filepath; |
|
23 | 23 | } |
24 | 24 | // give addons a chance to autoload their stages too |
25 | 25 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | if (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
73 | 73 | // echo "$version_string can be migrated from"; |
74 | 74 | return true; |
75 | - } elseif (! $version_string) { |
|
75 | + } elseif ( ! $version_string) { |
|
76 | 76 | // echo "no version string provided: $version_string"; |
77 | 77 | // no version string provided... this must be pre 4.3 |
78 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
79 | 79 | } else { |
80 | 80 | // echo "$version_string doesnt apply"; |
81 | 81 | return false; |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function schema_changes_before_migration() |
91 | 91 | { |
92 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
92 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
93 | 93 | $now_in_mysql = current_time('mysql', true); |
94 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
94 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
95 | 95 | $table_name = 'esp_answer'; |
96 | 96 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
97 | 97 | REG_ID int(10) unsigned NOT NULL, |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | ), |
686 | 686 | ); |
687 | 687 | global $wpdb; |
688 | - $country_table = $wpdb->prefix . "esp_country"; |
|
688 | + $country_table = $wpdb->prefix."esp_country"; |
|
689 | 689 | $country_format = array( |
690 | 690 | "CNT_ISO" => '%s', |
691 | 691 | "CNT_ISO3" => '%s', |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | foreach ($newer_countries as $country) { |
706 | 706 | $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
707 | 707 | $countries = $wpdb->get_var($SQL); |
708 | - if (! $countries) { |
|
708 | + if ( ! $countries) { |
|
709 | 709 | $wpdb->insert( |
710 | 710 | $country_table, |
711 | 711 | array_combine(array_keys($country_format), $country), |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
733 | 733 | ); |
734 | 734 | global $wpdb; |
735 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
735 | + $currency_table = $wpdb->prefix."esp_currency"; |
|
736 | 736 | $currency_format = array( |
737 | 737 | "CUR_code" => '%s', |
738 | 738 | "CUR_single" => '%s', |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | foreach ($newer_currencies as $currency) { |
746 | 746 | $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
747 | 747 | $countries = $wpdb->get_var($SQL); |
748 | - if (! $countries) { |
|
748 | + if ( ! $countries) { |
|
749 | 749 | $wpdb->insert( |
750 | 750 | $currency_table, |
751 | 751 | array_combine(array_keys($currency_format), $currency), |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | $stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*'); |
11 | 11 | $class_to_filepath = array(); |
12 | 12 | foreach ($stages as $filepath) { |
13 | - $matches = array(); |
|
14 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
15 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
13 | + $matches = array(); |
|
14 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
15 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
16 | 16 | } |
17 | 17 | // give addons a chance to autoload their stages too |
18 | 18 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
@@ -34,71 +34,71 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base |
36 | 36 | { |
37 | - /** |
|
38 | - * return EE_DMS_Core_4_8_0 |
|
39 | - * |
|
40 | - * @param TableManager $table_manager |
|
41 | - * @param TableAnalysis $table_analysis |
|
42 | - */ |
|
43 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
44 | - { |
|
45 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso"); |
|
46 | - $this->_priority = 10; |
|
47 | - $this->_migration_stages = array( |
|
48 | - new EE_DMS_4_8_0_pretax_totals(), |
|
49 | - new EE_DMS_4_8_0_event_subtotals(), |
|
50 | - ); |
|
51 | - parent::__construct($table_manager, $table_analysis); |
|
52 | - } |
|
37 | + /** |
|
38 | + * return EE_DMS_Core_4_8_0 |
|
39 | + * |
|
40 | + * @param TableManager $table_manager |
|
41 | + * @param TableAnalysis $table_analysis |
|
42 | + */ |
|
43 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
44 | + { |
|
45 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso"); |
|
46 | + $this->_priority = 10; |
|
47 | + $this->_migration_stages = array( |
|
48 | + new EE_DMS_4_8_0_pretax_totals(), |
|
49 | + new EE_DMS_4_8_0_event_subtotals(), |
|
50 | + ); |
|
51 | + parent::__construct($table_manager, $table_analysis); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Because this is being done at basically the same time as the MER-ready branch |
|
58 | - * of core, it's possible people might have installed MEr-ready branch first, |
|
59 | - * and then this one, in which case we still want to perform this migration, |
|
60 | - * even though the version might not have increased |
|
61 | - * |
|
62 | - * @param array $version_array |
|
63 | - * @return bool |
|
64 | - */ |
|
65 | - public function can_migrate_from_version($version_array) |
|
66 | - { |
|
67 | - $version_string = $version_array['Core']; |
|
68 | - if (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
|
56 | + /** |
|
57 | + * Because this is being done at basically the same time as the MER-ready branch |
|
58 | + * of core, it's possible people might have installed MEr-ready branch first, |
|
59 | + * and then this one, in which case we still want to perform this migration, |
|
60 | + * even though the version might not have increased |
|
61 | + * |
|
62 | + * @param array $version_array |
|
63 | + * @return bool |
|
64 | + */ |
|
65 | + public function can_migrate_from_version($version_array) |
|
66 | + { |
|
67 | + $version_string = $version_array['Core']; |
|
68 | + if (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
|
69 | 69 | // echo "$version_string can be migrated from"; |
70 | - return true; |
|
71 | - } elseif (! $version_string) { |
|
70 | + return true; |
|
71 | + } elseif (! $version_string) { |
|
72 | 72 | // echo "no version string provided: $version_string"; |
73 | - // no version string provided... this must be pre 4.3 |
|
74 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
75 | - } else { |
|
73 | + // no version string provided... this must be pre 4.3 |
|
74 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
75 | + } else { |
|
76 | 76 | // echo "$version_string doesnt apply"; |
77 | - return false; |
|
78 | - } |
|
79 | - } |
|
77 | + return false; |
|
78 | + } |
|
79 | + } |
|
80 | 80 | |
81 | 81 | |
82 | 82 | |
83 | - /** |
|
84 | - * @return bool |
|
85 | - */ |
|
86 | - public function schema_changes_before_migration() |
|
87 | - { |
|
88 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
89 | - $now_in_mysql = current_time('mysql', true); |
|
90 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
91 | - $table_name = 'esp_answer'; |
|
92 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
83 | + /** |
|
84 | + * @return bool |
|
85 | + */ |
|
86 | + public function schema_changes_before_migration() |
|
87 | + { |
|
88 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
89 | + $now_in_mysql = current_time('mysql', true); |
|
90 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
91 | + $table_name = 'esp_answer'; |
|
92 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
93 | 93 | REG_ID int(10) unsigned NOT NULL, |
94 | 94 | QST_ID int(10) unsigned NOT NULL, |
95 | 95 | ANS_value text NOT NULL, |
96 | 96 | PRIMARY KEY (ANS_ID), |
97 | 97 | KEY REG_ID (REG_ID), |
98 | 98 | KEY QST_ID (QST_ID)"; |
99 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
100 | - $table_name = 'esp_attendee_meta'; |
|
101 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
99 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
100 | + $table_name = 'esp_attendee_meta'; |
|
101 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
102 | 102 | ATT_ID bigint(20) unsigned NOT NULL, |
103 | 103 | ATT_fname varchar(45) NOT NULL, |
104 | 104 | ATT_lname varchar(45) NOT NULL, |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | PRIMARY KEY (ATTM_ID), |
114 | 114 | KEY ATT_ID (ATT_ID), |
115 | 115 | KEY ATT_email (ATT_email(191))"; |
116 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
117 | - $table_name = 'esp_country'; |
|
118 | - $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
116 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
117 | + $table_name = 'esp_country'; |
|
118 | + $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
119 | 119 | CNT_ISO3 varchar(3) collate utf8_bin NOT NULL, |
120 | 120 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
121 | 121 | CNT_name varchar(45) collate utf8_bin NOT NULL, |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | CNT_is_EU tinyint(1) DEFAULT '0', |
132 | 132 | CNT_active tinyint(1) DEFAULT '0', |
133 | 133 | PRIMARY KEY (CNT_ISO)"; |
134 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
135 | - $table_name = 'esp_currency'; |
|
136 | - $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
134 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
135 | + $table_name = 'esp_currency'; |
|
136 | + $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
137 | 137 | CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar', |
138 | 138 | CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars', |
139 | 139 | CUR_sign varchar(45) collate utf8_bin DEFAULT '$', |
140 | 140 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
141 | 141 | CUR_active tinyint(1) DEFAULT '0', |
142 | 142 | PRIMARY KEY (CUR_code)"; |
143 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | - $table_name = 'esp_datetime'; |
|
145 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
143 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | + $table_name = 'esp_datetime'; |
|
145 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
146 | 146 | EVT_ID bigint(20) unsigned NOT NULL, |
147 | 147 | DTT_name varchar(255) NOT NULL DEFAULT '', |
148 | 148 | DTT_description text NOT NULL, |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | KEY DTT_EVT_start (DTT_EVT_start), |
159 | 159 | KEY EVT_ID (EVT_ID), |
160 | 160 | KEY DTT_is_primary (DTT_is_primary)"; |
161 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | - $table_name = 'esp_event_meta'; |
|
163 | - $sql = " |
|
161 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
162 | + $table_name = 'esp_event_meta'; |
|
163 | + $sql = " |
|
164 | 164 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
165 | 165 | EVT_ID bigint(20) unsigned NOT NULL, |
166 | 166 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -176,34 +176,34 @@ discard block |
||
176 | 176 | EVT_donations tinyint(1) NULL, |
177 | 177 | PRIMARY KEY (EVTM_ID), |
178 | 178 | KEY EVT_ID (EVT_ID)"; |
179 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
180 | - $table_name = 'esp_event_question_group'; |
|
181 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
179 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
180 | + $table_name = 'esp_event_question_group'; |
|
181 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
182 | 182 | EVT_ID bigint(20) unsigned NOT NULL, |
183 | 183 | QSG_ID int(10) unsigned NOT NULL, |
184 | 184 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
185 | 185 | PRIMARY KEY (EQG_ID), |
186 | 186 | KEY EVT_ID (EVT_ID), |
187 | 187 | KEY QSG_ID (QSG_ID)"; |
188 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
189 | - $table_name = 'esp_event_venue'; |
|
190 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
188 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
189 | + $table_name = 'esp_event_venue'; |
|
190 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
191 | 191 | EVT_ID bigint(20) unsigned NOT NULL, |
192 | 192 | VNU_ID bigint(20) unsigned NOT NULL, |
193 | 193 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
194 | 194 | PRIMARY KEY (EVV_ID)"; |
195 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
196 | - $table_name = 'esp_extra_meta'; |
|
197 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
195 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
196 | + $table_name = 'esp_extra_meta'; |
|
197 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
198 | 198 | OBJ_ID int(11) DEFAULT NULL, |
199 | 199 | EXM_type varchar(45) DEFAULT NULL, |
200 | 200 | EXM_key varchar(45) DEFAULT NULL, |
201 | 201 | EXM_value text, |
202 | 202 | PRIMARY KEY (EXM_ID), |
203 | 203 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
204 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
205 | - $table_name = 'esp_extra_join'; |
|
206 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
204 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
205 | + $table_name = 'esp_extra_join'; |
|
206 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
207 | 207 | EXJ_first_model_id varchar(6) NOT NULL, |
208 | 208 | EXJ_first_model_name varchar(20) NOT NULL, |
209 | 209 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | PRIMARY KEY (EXJ_ID), |
212 | 212 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
213 | 213 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
214 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
215 | - $table_name = 'esp_line_item'; |
|
216 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
214 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
215 | + $table_name = 'esp_line_item'; |
|
216 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
217 | 217 | LIN_code varchar(245) NOT NULL DEFAULT '', |
218 | 218 | TXN_ID int(11) DEFAULT NULL, |
219 | 219 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | PRIMARY KEY (LIN_ID), |
233 | 233 | KEY LIN_code (LIN_code(191)), |
234 | 234 | KEY TXN_ID (TXN_ID)"; |
235 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
236 | - $table_name = 'esp_log'; |
|
237 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
235 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
236 | + $table_name = 'esp_log'; |
|
237 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
238 | 238 | LOG_time datetime DEFAULT NULL, |
239 | 239 | OBJ_ID varchar(45) DEFAULT NULL, |
240 | 240 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -245,18 +245,18 @@ discard block |
||
245 | 245 | KEY LOG_time (LOG_time), |
246 | 246 | KEY OBJ (OBJ_type,OBJ_ID), |
247 | 247 | KEY LOG_type (LOG_type)"; |
248 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
249 | - $table_name = 'esp_message_template'; |
|
250 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
248 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
249 | + $table_name = 'esp_message_template'; |
|
250 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
251 | 251 | GRP_ID int(10) unsigned NOT NULL, |
252 | 252 | MTP_context varchar(50) NOT NULL, |
253 | 253 | MTP_template_field varchar(30) NOT NULL, |
254 | 254 | MTP_content text NOT NULL, |
255 | 255 | PRIMARY KEY (MTP_ID), |
256 | 256 | KEY GRP_ID (GRP_ID)"; |
257 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | - $table_name = 'esp_message_template_group'; |
|
259 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
257 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | + $table_name = 'esp_message_template_group'; |
|
259 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
260 | 260 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
261 | 261 | MTP_name varchar(245) NOT NULL DEFAULT '', |
262 | 262 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -268,17 +268,17 @@ discard block |
||
268 | 268 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
269 | 269 | PRIMARY KEY (GRP_ID), |
270 | 270 | KEY MTP_user_id (MTP_user_id)"; |
271 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
272 | - $table_name = 'esp_event_message_template'; |
|
273 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
271 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
272 | + $table_name = 'esp_event_message_template'; |
|
273 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
274 | 274 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
275 | 275 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
276 | 276 | PRIMARY KEY (EMT_ID), |
277 | 277 | KEY EVT_ID (EVT_ID), |
278 | 278 | KEY GRP_ID (GRP_ID)"; |
279 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
280 | - $table_name = 'esp_payment'; |
|
281 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
279 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
280 | + $table_name = 'esp_payment'; |
|
281 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
282 | 282 | TXN_ID int(10) unsigned DEFAULT NULL, |
283 | 283 | STS_ID varchar(3) collate utf8_bin DEFAULT NULL, |
284 | 284 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | PRIMARY KEY (PAY_ID), |
296 | 296 | KEY PAY_timestamp (PAY_timestamp), |
297 | 297 | KEY TXN_ID (TXN_ID)"; |
298 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
299 | - $table_name = 'esp_payment_method'; |
|
300 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
298 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
299 | + $table_name = 'esp_payment_method'; |
|
300 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
301 | 301 | PMD_type varchar(124) DEFAULT NULL, |
302 | 302 | PMD_name varchar(255) DEFAULT NULL, |
303 | 303 | PMD_desc text, |
@@ -313,32 +313,32 @@ discard block |
||
313 | 313 | PRIMARY KEY (PMD_ID), |
314 | 314 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
315 | 315 | KEY PMD_type (PMD_type)"; |
316 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
317 | - $table_name = "esp_ticket_price"; |
|
318 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
316 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
317 | + $table_name = "esp_ticket_price"; |
|
318 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
319 | 319 | TKT_ID int(10) unsigned NOT NULL, |
320 | 320 | PRC_ID int(10) unsigned NOT NULL, |
321 | 321 | PRIMARY KEY (TKP_ID), |
322 | 322 | KEY TKT_ID (TKT_ID), |
323 | 323 | KEY PRC_ID (PRC_ID)"; |
324 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
325 | - $table_name = "esp_datetime_ticket"; |
|
326 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
324 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
325 | + $table_name = "esp_datetime_ticket"; |
|
326 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
327 | 327 | DTT_ID int(10) unsigned NOT NULL, |
328 | 328 | TKT_ID int(10) unsigned NOT NULL, |
329 | 329 | PRIMARY KEY (DTK_ID), |
330 | 330 | KEY DTT_ID (DTT_ID), |
331 | 331 | KEY TKT_ID (TKT_ID)"; |
332 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
333 | - $table_name = "esp_ticket_template"; |
|
334 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
332 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
333 | + $table_name = "esp_ticket_template"; |
|
334 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
335 | 335 | TTM_name varchar(45) NOT NULL, |
336 | 336 | TTM_description text, |
337 | 337 | TTM_file varchar(45), |
338 | 338 | PRIMARY KEY (TTM_ID)"; |
339 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
340 | - $table_name = 'esp_question'; |
|
341 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
339 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
340 | + $table_name = 'esp_question'; |
|
341 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
342 | 342 | QST_display_text text NOT NULL, |
343 | 343 | QST_admin_label varchar(255) NOT NULL, |
344 | 344 | QST_system varchar(25) NOT NULL DEFAULT "", |
@@ -352,18 +352,18 @@ discard block |
||
352 | 352 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
353 | 353 | PRIMARY KEY (QST_ID), |
354 | 354 | KEY QST_order (QST_order)'; |
355 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
356 | - $table_name = 'esp_question_group_question'; |
|
357 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
355 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
356 | + $table_name = 'esp_question_group_question'; |
|
357 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
358 | 358 | QSG_ID int(10) unsigned NOT NULL, |
359 | 359 | QST_ID int(10) unsigned NOT NULL, |
360 | 360 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
361 | 361 | PRIMARY KEY (QGQ_ID), |
362 | 362 | KEY QST_ID (QST_ID), |
363 | 363 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
364 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
365 | - $table_name = 'esp_question_option'; |
|
366 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
364 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
365 | + $table_name = 'esp_question_option'; |
|
366 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
367 | 367 | QSO_value varchar(255) NOT NULL, |
368 | 368 | QSO_desc text NOT NULL, |
369 | 369 | QST_ID int(10) unsigned NOT NULL, |
@@ -373,9 +373,9 @@ discard block |
||
373 | 373 | PRIMARY KEY (QSO_ID), |
374 | 374 | KEY QST_ID (QST_ID), |
375 | 375 | KEY QSO_order (QSO_order)"; |
376 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
377 | - $table_name = 'esp_registration'; |
|
378 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
376 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
377 | + $table_name = 'esp_registration'; |
|
378 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
379 | 379 | EVT_ID bigint(20) unsigned NOT NULL, |
380 | 380 | ATT_ID bigint(20) unsigned NOT NULL, |
381 | 381 | TXN_ID int(10) unsigned NOT NULL, |
@@ -399,18 +399,18 @@ discard block |
||
399 | 399 | KEY TKT_ID (TKT_ID), |
400 | 400 | KEY EVT_ID (EVT_ID), |
401 | 401 | KEY STS_ID (STS_ID)"; |
402 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
403 | - $table_name = 'esp_registration_payment'; |
|
404 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
402 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
403 | + $table_name = 'esp_registration_payment'; |
|
404 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
405 | 405 | REG_ID int(10) unsigned NOT NULL, |
406 | 406 | PAY_ID int(10) unsigned NULL, |
407 | 407 | RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
408 | 408 | PRIMARY KEY (RPY_ID), |
409 | 409 | KEY REG_ID (REG_ID), |
410 | 410 | KEY PAY_ID (PAY_ID)"; |
411 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
412 | - $table_name = 'esp_checkin'; |
|
413 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
411 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
412 | + $table_name = 'esp_checkin'; |
|
413 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
414 | 414 | REG_ID int(10) unsigned NOT NULL, |
415 | 415 | DTT_ID int(10) unsigned NOT NULL, |
416 | 416 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -418,9 +418,9 @@ discard block |
||
418 | 418 | PRIMARY KEY (CHK_ID), |
419 | 419 | KEY REG_ID (REG_ID), |
420 | 420 | KEY DTT_ID (DTT_ID)"; |
421 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
422 | - $table_name = 'esp_state'; |
|
423 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
421 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
422 | + $table_name = 'esp_state'; |
|
423 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
424 | 424 | CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
425 | 425 | STA_abbrev varchar(24) collate utf8_bin NOT NULL, |
426 | 426 | STA_name varchar(100) collate utf8_bin NOT NULL, |
@@ -428,9 +428,9 @@ discard block |
||
428 | 428 | PRIMARY KEY (STA_ID), |
429 | 429 | KEY STA_abbrev (STA_abbrev), |
430 | 430 | KEY CNT_ISO (CNT_ISO)"; |
431 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
432 | - $table_name = 'esp_status'; |
|
433 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
431 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
432 | + $table_name = 'esp_status'; |
|
433 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
434 | 434 | STS_code varchar(45) NOT NULL, |
435 | 435 | STS_type varchar(45) NOT NULL, |
436 | 436 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -438,9 +438,9 @@ discard block |
||
438 | 438 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
439 | 439 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
440 | 440 | KEY STS_type (STS_type)"; |
441 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
442 | - $table_name = 'esp_transaction'; |
|
443 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
441 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
442 | + $table_name = 'esp_transaction'; |
|
443 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
444 | 444 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
445 | 445 | TXN_total decimal(10,3) DEFAULT '0.00', |
446 | 446 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | PRIMARY KEY (TXN_ID), |
453 | 453 | KEY TXN_timestamp (TXN_timestamp), |
454 | 454 | KEY STS_ID (STS_ID)"; |
455 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
456 | - $table_name = 'esp_venue_meta'; |
|
457 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
455 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
456 | + $table_name = 'esp_venue_meta'; |
|
457 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
458 | 458 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
459 | 459 | VNU_address varchar(255) DEFAULT NULL, |
460 | 460 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | KEY VNU_ID (VNU_ID), |
474 | 474 | KEY STA_ID (STA_ID), |
475 | 475 | KEY CNT_ISO (CNT_ISO)"; |
476 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
477 | - // modified tables |
|
478 | - $table_name = "esp_price"; |
|
479 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
476 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
477 | + // modified tables |
|
478 | + $table_name = "esp_price"; |
|
479 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
480 | 480 | PRT_ID tinyint(3) unsigned NOT NULL, |
481 | 481 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
482 | 482 | PRC_name varchar(245) NOT NULL, |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | PRC_parent int(10) unsigned DEFAULT 0, |
490 | 490 | PRIMARY KEY (PRC_ID), |
491 | 491 | KEY PRT_ID (PRT_ID)"; |
492 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
493 | - $table_name = "esp_price_type"; |
|
494 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
492 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
493 | + $table_name = "esp_price_type"; |
|
494 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
495 | 495 | PRT_name varchar(45) NOT NULL, |
496 | 496 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
497 | 497 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
501 | 501 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
502 | 502 | PRIMARY KEY (PRT_ID)"; |
503 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
504 | - $table_name = "esp_ticket"; |
|
505 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
503 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
504 | + $table_name = "esp_ticket"; |
|
505 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
506 | 506 | TTM_ID int(10) unsigned NOT NULL, |
507 | 507 | TKT_name varchar(245) NOT NULL DEFAULT '', |
508 | 508 | TKT_description text NOT NULL, |
@@ -524,9 +524,9 @@ discard block |
||
524 | 524 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
525 | 525 | PRIMARY KEY (TKT_ID), |
526 | 526 | KEY TKT_start_date (TKT_start_date)"; |
527 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
528 | - $table_name = 'esp_question_group'; |
|
529 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
527 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
528 | + $table_name = 'esp_question_group'; |
|
529 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
530 | 530 | QSG_name varchar(255) NOT NULL, |
531 | 531 | QSG_identifier varchar(100) NOT NULL, |
532 | 532 | QSG_desc text NULL, |
@@ -539,223 +539,223 @@ discard block |
||
539 | 539 | PRIMARY KEY (QSG_ID), |
540 | 540 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
541 | 541 | KEY QSG_order (QSG_order)'; |
542 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
543 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
544 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
545 | - // (because many need to convert old string states to foreign keys into the states table) |
|
546 | - $script_4_1_defaults->insert_default_states(); |
|
547 | - $script_4_1_defaults->insert_default_countries(); |
|
548 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
549 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
550 | - $script_4_5_defaults->insert_default_price_types(); |
|
551 | - $script_4_5_defaults->insert_default_prices(); |
|
552 | - $script_4_5_defaults->insert_default_tickets(); |
|
553 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
554 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
555 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
556 | - $script_4_6_defaults->insert_default_currencies(); |
|
557 | - $this->verify_new_countries(); |
|
558 | - $this->verify_new_currencies(); |
|
559 | - return true; |
|
560 | - } |
|
542 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
543 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
544 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
545 | + // (because many need to convert old string states to foreign keys into the states table) |
|
546 | + $script_4_1_defaults->insert_default_states(); |
|
547 | + $script_4_1_defaults->insert_default_countries(); |
|
548 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
549 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
550 | + $script_4_5_defaults->insert_default_price_types(); |
|
551 | + $script_4_5_defaults->insert_default_prices(); |
|
552 | + $script_4_5_defaults->insert_default_tickets(); |
|
553 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
554 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
555 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
556 | + $script_4_6_defaults->insert_default_currencies(); |
|
557 | + $this->verify_new_countries(); |
|
558 | + $this->verify_new_currencies(); |
|
559 | + return true; |
|
560 | + } |
|
561 | 561 | |
562 | 562 | |
563 | 563 | |
564 | - /** |
|
565 | - * @return boolean |
|
566 | - */ |
|
567 | - public function schema_changes_after_migration() |
|
568 | - { |
|
569 | - $this->fix_non_default_taxes(); |
|
570 | - // this is actually the same as the last DMS |
|
571 | - /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
572 | - $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
573 | - return $script_4_7_defaults->schema_changes_after_migration(); |
|
574 | - } |
|
564 | + /** |
|
565 | + * @return boolean |
|
566 | + */ |
|
567 | + public function schema_changes_after_migration() |
|
568 | + { |
|
569 | + $this->fix_non_default_taxes(); |
|
570 | + // this is actually the same as the last DMS |
|
571 | + /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
572 | + $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
573 | + return $script_4_7_defaults->schema_changes_after_migration(); |
|
574 | + } |
|
575 | 575 | |
576 | 576 | |
577 | 577 | |
578 | - public function migration_page_hooks() |
|
579 | - { |
|
580 | - } |
|
578 | + public function migration_page_hooks() |
|
579 | + { |
|
580 | + } |
|
581 | 581 | |
582 | 582 | |
583 | 583 | |
584 | - /** |
|
585 | - * verifies each of the new countries exists that somehow we missed in 4.1 |
|
586 | - */ |
|
587 | - public function verify_new_countries() |
|
588 | - { |
|
589 | - // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
590 | - // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
591 | - // currency symbols: http://www.xe.com/symbols.php |
|
592 | - // CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
|
593 | - // ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
594 | - $newer_countries = array( |
|
595 | - array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
596 | - array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
597 | - array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
598 | - array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
599 | - array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
600 | - array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
601 | - array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
602 | - array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
603 | - array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
604 | - array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
605 | - array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
606 | - array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
607 | - array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
608 | - array( |
|
609 | - 'BQ', |
|
610 | - 'BES', |
|
611 | - 0, |
|
612 | - 'Bonaire, Saint Eustatius and Saba', |
|
613 | - 'USD', |
|
614 | - 'Dollar', |
|
615 | - 'Dollars', |
|
616 | - '$', |
|
617 | - 1, |
|
618 | - 2, |
|
619 | - '+599', |
|
620 | - 0, |
|
621 | - 0, |
|
622 | - ), |
|
623 | - array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
624 | - array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
625 | - array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
626 | - array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
627 | - array( |
|
628 | - 'HM', |
|
629 | - 'HMD', |
|
630 | - 0, |
|
631 | - 'Heard Island and McDonald Islands', |
|
632 | - 'AUD', |
|
633 | - 'Dollar', |
|
634 | - 'Dollars', |
|
635 | - '$', |
|
636 | - 1, |
|
637 | - 2, |
|
638 | - '+891', |
|
639 | - 0, |
|
640 | - 0, |
|
641 | - ), |
|
642 | - array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
643 | - array( |
|
644 | - 'GS', |
|
645 | - 'SGS', |
|
646 | - 0, |
|
647 | - 'South Georgia and the South Sandwich Islands', |
|
648 | - 'GBP', |
|
649 | - 'Pound', |
|
650 | - 'Pounds', |
|
651 | - '£', |
|
652 | - 1, |
|
653 | - 2, |
|
654 | - '+500', |
|
655 | - 0, |
|
656 | - 0, |
|
657 | - ), |
|
658 | - array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
659 | - array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
660 | - array( |
|
661 | - 'UM', |
|
662 | - 'UMI', |
|
663 | - 0, |
|
664 | - 'United States Minor Outlying Islands', |
|
665 | - 'USD', |
|
666 | - 'Dollar', |
|
667 | - 'Dollars', |
|
668 | - '$', |
|
669 | - 1, |
|
670 | - 2, |
|
671 | - '+1', |
|
672 | - 0, |
|
673 | - 0, |
|
674 | - ), |
|
675 | - ); |
|
676 | - global $wpdb; |
|
677 | - $country_table = $wpdb->prefix . "esp_country"; |
|
678 | - $country_format = array( |
|
679 | - "CNT_ISO" => '%s', |
|
680 | - "CNT_ISO3" => '%s', |
|
681 | - "RGN_ID" => '%d', |
|
682 | - "CNT_name" => '%s', |
|
683 | - "CNT_cur_code" => '%s', |
|
684 | - "CNT_cur_single" => '%s', |
|
685 | - "CNT_cur_plural" => '%s', |
|
686 | - "CNT_cur_sign" => '%s', |
|
687 | - "CNT_cur_sign_b4" => '%d', |
|
688 | - "CNT_cur_dec_plc" => '%d', |
|
689 | - "CNT_tel_code" => '%s', |
|
690 | - "CNT_is_EU" => '%d', |
|
691 | - "CNT_active" => '%d', |
|
692 | - ); |
|
693 | - if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
694 | - foreach ($newer_countries as $country) { |
|
695 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
696 | - $countries = $wpdb->get_var($SQL); |
|
697 | - if (! $countries) { |
|
698 | - $wpdb->insert( |
|
699 | - $country_table, |
|
700 | - array_combine(array_keys($country_format), $country), |
|
701 | - $country_format |
|
702 | - ); |
|
703 | - } |
|
704 | - } |
|
705 | - } |
|
706 | - } |
|
584 | + /** |
|
585 | + * verifies each of the new countries exists that somehow we missed in 4.1 |
|
586 | + */ |
|
587 | + public function verify_new_countries() |
|
588 | + { |
|
589 | + // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
590 | + // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
591 | + // currency symbols: http://www.xe.com/symbols.php |
|
592 | + // CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
|
593 | + // ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
594 | + $newer_countries = array( |
|
595 | + array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
596 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
597 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
598 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
599 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
600 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
601 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
602 | + array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
603 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
604 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
605 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
606 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
607 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
608 | + array( |
|
609 | + 'BQ', |
|
610 | + 'BES', |
|
611 | + 0, |
|
612 | + 'Bonaire, Saint Eustatius and Saba', |
|
613 | + 'USD', |
|
614 | + 'Dollar', |
|
615 | + 'Dollars', |
|
616 | + '$', |
|
617 | + 1, |
|
618 | + 2, |
|
619 | + '+599', |
|
620 | + 0, |
|
621 | + 0, |
|
622 | + ), |
|
623 | + array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
624 | + array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
625 | + array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
626 | + array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
627 | + array( |
|
628 | + 'HM', |
|
629 | + 'HMD', |
|
630 | + 0, |
|
631 | + 'Heard Island and McDonald Islands', |
|
632 | + 'AUD', |
|
633 | + 'Dollar', |
|
634 | + 'Dollars', |
|
635 | + '$', |
|
636 | + 1, |
|
637 | + 2, |
|
638 | + '+891', |
|
639 | + 0, |
|
640 | + 0, |
|
641 | + ), |
|
642 | + array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
643 | + array( |
|
644 | + 'GS', |
|
645 | + 'SGS', |
|
646 | + 0, |
|
647 | + 'South Georgia and the South Sandwich Islands', |
|
648 | + 'GBP', |
|
649 | + 'Pound', |
|
650 | + 'Pounds', |
|
651 | + '£', |
|
652 | + 1, |
|
653 | + 2, |
|
654 | + '+500', |
|
655 | + 0, |
|
656 | + 0, |
|
657 | + ), |
|
658 | + array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
659 | + array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
660 | + array( |
|
661 | + 'UM', |
|
662 | + 'UMI', |
|
663 | + 0, |
|
664 | + 'United States Minor Outlying Islands', |
|
665 | + 'USD', |
|
666 | + 'Dollar', |
|
667 | + 'Dollars', |
|
668 | + '$', |
|
669 | + 1, |
|
670 | + 2, |
|
671 | + '+1', |
|
672 | + 0, |
|
673 | + 0, |
|
674 | + ), |
|
675 | + ); |
|
676 | + global $wpdb; |
|
677 | + $country_table = $wpdb->prefix . "esp_country"; |
|
678 | + $country_format = array( |
|
679 | + "CNT_ISO" => '%s', |
|
680 | + "CNT_ISO3" => '%s', |
|
681 | + "RGN_ID" => '%d', |
|
682 | + "CNT_name" => '%s', |
|
683 | + "CNT_cur_code" => '%s', |
|
684 | + "CNT_cur_single" => '%s', |
|
685 | + "CNT_cur_plural" => '%s', |
|
686 | + "CNT_cur_sign" => '%s', |
|
687 | + "CNT_cur_sign_b4" => '%d', |
|
688 | + "CNT_cur_dec_plc" => '%d', |
|
689 | + "CNT_tel_code" => '%s', |
|
690 | + "CNT_is_EU" => '%d', |
|
691 | + "CNT_active" => '%d', |
|
692 | + ); |
|
693 | + if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
694 | + foreach ($newer_countries as $country) { |
|
695 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
696 | + $countries = $wpdb->get_var($SQL); |
|
697 | + if (! $countries) { |
|
698 | + $wpdb->insert( |
|
699 | + $country_table, |
|
700 | + array_combine(array_keys($country_format), $country), |
|
701 | + $country_format |
|
702 | + ); |
|
703 | + } |
|
704 | + } |
|
705 | + } |
|
706 | + } |
|
707 | 707 | |
708 | 708 | |
709 | 709 | |
710 | - /** |
|
711 | - * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
712 | - */ |
|
713 | - public function verify_new_currencies() |
|
714 | - { |
|
715 | - // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
716 | - // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
717 | - // currency symbols: http://www.xe.com/symbols.php |
|
718 | - // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
719 | - // ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
720 | - $newer_currencies = array( |
|
721 | - array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
722 | - ); |
|
723 | - global $wpdb; |
|
724 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
725 | - $currency_format = array( |
|
726 | - "CUR_code" => '%s', |
|
727 | - "CUR_single" => '%s', |
|
728 | - "CUR_plural" => '%s', |
|
729 | - "CUR_sign" => '%s', |
|
730 | - "CUR_dec_plc" => '%d', |
|
731 | - "CUR_active" => '%d', |
|
732 | - ); |
|
733 | - if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
734 | - foreach ($newer_currencies as $currency) { |
|
735 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
736 | - $countries = $wpdb->get_var($SQL); |
|
737 | - if (! $countries) { |
|
738 | - $wpdb->insert( |
|
739 | - $currency_table, |
|
740 | - array_combine(array_keys($currency_format), $currency), |
|
741 | - $currency_format |
|
742 | - ); |
|
743 | - } |
|
744 | - } |
|
745 | - } |
|
746 | - } |
|
710 | + /** |
|
711 | + * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
712 | + */ |
|
713 | + public function verify_new_currencies() |
|
714 | + { |
|
715 | + // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
716 | + // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
717 | + // currency symbols: http://www.xe.com/symbols.php |
|
718 | + // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
719 | + // ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
720 | + $newer_currencies = array( |
|
721 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
722 | + ); |
|
723 | + global $wpdb; |
|
724 | + $currency_table = $wpdb->prefix . "esp_currency"; |
|
725 | + $currency_format = array( |
|
726 | + "CUR_code" => '%s', |
|
727 | + "CUR_single" => '%s', |
|
728 | + "CUR_plural" => '%s', |
|
729 | + "CUR_sign" => '%s', |
|
730 | + "CUR_dec_plc" => '%d', |
|
731 | + "CUR_active" => '%d', |
|
732 | + ); |
|
733 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
734 | + foreach ($newer_currencies as $currency) { |
|
735 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
736 | + $countries = $wpdb->get_var($SQL); |
|
737 | + if (! $countries) { |
|
738 | + $wpdb->insert( |
|
739 | + $currency_table, |
|
740 | + array_combine(array_keys($currency_format), $currency), |
|
741 | + $currency_format |
|
742 | + ); |
|
743 | + } |
|
744 | + } |
|
745 | + } |
|
746 | + } |
|
747 | 747 | |
748 | 748 | |
749 | 749 | |
750 | - /** |
|
751 | - * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
752 | - * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
753 | - * we should be able to stop doing this in 4.9 |
|
754 | - */ |
|
755 | - public function fix_non_default_taxes() |
|
756 | - { |
|
757 | - global $wpdb; |
|
758 | - $query = $wpdb->prepare("UPDATE |
|
750 | + /** |
|
751 | + * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
752 | + * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
753 | + * we should be able to stop doing this in 4.9 |
|
754 | + */ |
|
755 | + public function fix_non_default_taxes() |
|
756 | + { |
|
757 | + global $wpdb; |
|
758 | + $query = $wpdb->prepare("UPDATE |
|
759 | 759 | {$wpdb->prefix}esp_price p INNER JOIN |
760 | 760 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
761 | 761 | SET |
@@ -764,6 +764,6 @@ discard block |
||
764 | 764 | p.PRC_is_default = 0 AND |
765 | 765 | pt.PBT_ID = %d |
766 | 766 | ", EEM_Price_Type::base_type_tax); |
767 | - $wpdb->query($query); |
|
768 | - } |
|
767 | + $wpdb->query($query); |
|
768 | + } |
|
769 | 769 | } |