Completed
Branch FET/10339/exit-modal-for-ee-de... (0298d1)
by
unknown
90:20 queued 75:09
created
core/services/request/InvalidRequestStackMiddlewareException.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -19,33 +19,33 @@
 block discarded – undo
19 19
 class InvalidRequestStackMiddlewareException extends InvalidDataTypeException
20 20
 {
21 21
 
22
-    /**
23
-     * @param  mixed     $middleware_app_class
24
-     * @param  string    $message
25
-     * @param int        $code
26
-     * @param Exception $previous
27
-     */
28
-    public function __construct($middleware_app_class, $message = '', $code = 0, Exception $previous = null)
29
-    {
30
-        if(is_array($middleware_app_class)) {
31
-            $middleware_app_class = reset($middleware_app_class);
32
-        }
33
-        if (empty($message)) {
34
-            $message = sprintf(
35
-                esc_html__(
36
-                    'The supplied Request Stack Middleware class "%1$s" is invalid or could no be found.',
37
-                    'event_espresso'
38
-                ),
39
-                $middleware_app_class
40
-            );
41
-        }
42
-        parent::__construct(
43
-            '$middleware_app_class',
44
-            $middleware_app_class,
45
-            'EventEspresso\core\services\request\middleware\Middleware',
46
-            $message,
47
-            $code,
48
-            $previous
49
-        );
50
-    }
22
+	/**
23
+	 * @param  mixed     $middleware_app_class
24
+	 * @param  string    $message
25
+	 * @param int        $code
26
+	 * @param Exception $previous
27
+	 */
28
+	public function __construct($middleware_app_class, $message = '', $code = 0, Exception $previous = null)
29
+	{
30
+		if(is_array($middleware_app_class)) {
31
+			$middleware_app_class = reset($middleware_app_class);
32
+		}
33
+		if (empty($message)) {
34
+			$message = sprintf(
35
+				esc_html__(
36
+					'The supplied Request Stack Middleware class "%1$s" is invalid or could no be found.',
37
+					'event_espresso'
38
+				),
39
+				$middleware_app_class
40
+			);
41
+		}
42
+		parent::__construct(
43
+			'$middleware_app_class',
44
+			$middleware_app_class,
45
+			'EventEspresso\core\services\request\middleware\Middleware',
46
+			$message,
47
+			$code,
48
+			$previous
49
+		);
50
+	}
51 51
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
      */
28 28
     public function __construct($middleware_app_class, $message = '', $code = 0, Exception $previous = null)
29 29
     {
30
-        if(is_array($middleware_app_class)) {
30
+        if (is_array($middleware_app_class)) {
31 31
             $middleware_app_class = reset($middleware_app_class);
32 32
         }
33 33
         if (empty($message)) {
Please login to merge, or discard this patch.
core/services/request/RequestStackBuilder.php 2 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -24,97 +24,97 @@
 block discarded – undo
24 24
 class RequestStackBuilder extends SplDoublyLinkedList
25 25
 {
26 26
 
27
-    /**
28
-     * @type LoaderInterface $loader
29
-     */
30
-    private $loader;
27
+	/**
28
+	 * @type LoaderInterface $loader
29
+	 */
30
+	private $loader;
31 31
 
32 32
 
33
-    /**
34
-     * RequestStackBuilder constructor.
35
-     *
36
-     * @param LoaderInterface $loader
37
-     */
38
-    public function __construct(LoaderInterface $loader)
39
-    {
40
-        $this->loader = $loader;
41
-        $this->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO | SplDoublyLinkedList::IT_MODE_KEEP);
42
-    }
33
+	/**
34
+	 * RequestStackBuilder constructor.
35
+	 *
36
+	 * @param LoaderInterface $loader
37
+	 */
38
+	public function __construct(LoaderInterface $loader)
39
+	{
40
+		$this->loader = $loader;
41
+		$this->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO | SplDoublyLinkedList::IT_MODE_KEEP);
42
+	}
43 43
 
44 44
 
45
-    /**
46
-     * builds decorated middleware stack
47
-     * by continuously injecting previous middleware app into the next
48
-     *
49
-     * @param RequestStackCoreAppInterface $application
50
-     * @return RequestStack
51
-     * @throws Exception
52
-     */
53
-    public function resolve(RequestStackCoreAppInterface $application)
54
-    {
55
-        $core_app = $application;
56
-        // NOW... because the RequestStack is following the decorator pattern,
57
-        // the first stack app we add will end up at the center of the stack,
58
-        // and will end up being the last item to actually run, but we don't want that!
59
-        // Basically we're dealing with TWO stacks, and transferring items from one to the other,
60
-        // BUT... we want the final stack to be in the same order as the first.
61
-        // So we need to reverse the iterator mode when transferring items,
62
-        // because if we don't, the second stack will end  up in the incorrect order.
63
-        $this->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_KEEP);
64
-        for ($this->rewind(); $this->valid(); $this->next()) {
65
-            try {
66
-                $middleware_app       = $this->validateMiddlewareAppDetails($this->current(), true);
67
-                $middleware_app_class = array_shift($middleware_app);
68
-                $middleware_app_args  = is_array($middleware_app) ? $middleware_app : array();
69
-                $middleware_app_args  = array($application, $this->loader) + $middleware_app_args;
70
-                $application          = $this->loader->getShared($middleware_app_class, $middleware_app_args);
71
-            } catch (InvalidRequestStackMiddlewareException $exception) {
72
-                if(WP_DEBUG) {
73
-                    new ExceptionStackTraceDisplay($exception);
74
-                    continue;
75
-                }
76
-                error_log($exception->getMessage());
77
-            }
78
-        }
79
-        return new RequestStack($application, $core_app);
80
-    }
45
+	/**
46
+	 * builds decorated middleware stack
47
+	 * by continuously injecting previous middleware app into the next
48
+	 *
49
+	 * @param RequestStackCoreAppInterface $application
50
+	 * @return RequestStack
51
+	 * @throws Exception
52
+	 */
53
+	public function resolve(RequestStackCoreAppInterface $application)
54
+	{
55
+		$core_app = $application;
56
+		// NOW... because the RequestStack is following the decorator pattern,
57
+		// the first stack app we add will end up at the center of the stack,
58
+		// and will end up being the last item to actually run, but we don't want that!
59
+		// Basically we're dealing with TWO stacks, and transferring items from one to the other,
60
+		// BUT... we want the final stack to be in the same order as the first.
61
+		// So we need to reverse the iterator mode when transferring items,
62
+		// because if we don't, the second stack will end  up in the incorrect order.
63
+		$this->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_KEEP);
64
+		for ($this->rewind(); $this->valid(); $this->next()) {
65
+			try {
66
+				$middleware_app       = $this->validateMiddlewareAppDetails($this->current(), true);
67
+				$middleware_app_class = array_shift($middleware_app);
68
+				$middleware_app_args  = is_array($middleware_app) ? $middleware_app : array();
69
+				$middleware_app_args  = array($application, $this->loader) + $middleware_app_args;
70
+				$application          = $this->loader->getShared($middleware_app_class, $middleware_app_args);
71
+			} catch (InvalidRequestStackMiddlewareException $exception) {
72
+				if(WP_DEBUG) {
73
+					new ExceptionStackTraceDisplay($exception);
74
+					continue;
75
+				}
76
+				error_log($exception->getMessage());
77
+			}
78
+		}
79
+		return new RequestStack($application, $core_app);
80
+	}
81 81
 
82 82
 
83
-    /**
84
-     * Ensures that the app details that have been pushed onto RequestStackBuilder
85
-     * are all ordered correctly so that the middleware can be properly constructed
86
-     *
87
-     * @param array $middleware_app
88
-     * @param bool  $recurse
89
-     * @return array
90
-     * @throws InvalidRequestStackMiddlewareException
91
-     */
92
-    protected function validateMiddlewareAppDetails(array $middleware_app, $recurse = false)
93
-    {
94
-        $middleware_app_class = reset($middleware_app);
95
-        // is array empty ?
96
-        if($middleware_app_class === false) {
97
-            throw new InvalidRequestStackMiddlewareException($middleware_app_class);
98
-        }
99
-        // are the class and arguments in the wrong order ?
100
-        if(is_array($middleware_app_class)) {
101
-            if ($recurse === true) {
102
-                return $this->validateMiddlewareAppDetails(array_reverse($middleware_app));
103
-            }
104
-            throw new InvalidRequestStackMiddlewareException($middleware_app_class);
105
-        }
106
-        // is filter callback working like legacy middleware and sending a numerically indexed array ?
107
-        if(is_int($middleware_app_class)) {
108
-            if ($recurse === true) {
109
-                $middleware_app = array_reverse($middleware_app);
110
-                return $this->validateMiddlewareAppDetails(array(reset($middleware_app), array()));
111
-            }
112
-            throw new InvalidRequestStackMiddlewareException($middleware_app_class);
113
-        }
114
-        // is $middleware_app_class a valid FQCN (or class is already loaded) ?
115
-        if(! class_exists($middleware_app_class)) {
116
-            throw new InvalidRequestStackMiddlewareException($middleware_app_class);
117
-        }
118
-        return $middleware_app;
119
-    }
83
+	/**
84
+	 * Ensures that the app details that have been pushed onto RequestStackBuilder
85
+	 * are all ordered correctly so that the middleware can be properly constructed
86
+	 *
87
+	 * @param array $middleware_app
88
+	 * @param bool  $recurse
89
+	 * @return array
90
+	 * @throws InvalidRequestStackMiddlewareException
91
+	 */
92
+	protected function validateMiddlewareAppDetails(array $middleware_app, $recurse = false)
93
+	{
94
+		$middleware_app_class = reset($middleware_app);
95
+		// is array empty ?
96
+		if($middleware_app_class === false) {
97
+			throw new InvalidRequestStackMiddlewareException($middleware_app_class);
98
+		}
99
+		// are the class and arguments in the wrong order ?
100
+		if(is_array($middleware_app_class)) {
101
+			if ($recurse === true) {
102
+				return $this->validateMiddlewareAppDetails(array_reverse($middleware_app));
103
+			}
104
+			throw new InvalidRequestStackMiddlewareException($middleware_app_class);
105
+		}
106
+		// is filter callback working like legacy middleware and sending a numerically indexed array ?
107
+		if(is_int($middleware_app_class)) {
108
+			if ($recurse === true) {
109
+				$middleware_app = array_reverse($middleware_app);
110
+				return $this->validateMiddlewareAppDetails(array(reset($middleware_app), array()));
111
+			}
112
+			throw new InvalidRequestStackMiddlewareException($middleware_app_class);
113
+		}
114
+		// is $middleware_app_class a valid FQCN (or class is already loaded) ?
115
+		if(! class_exists($middleware_app_class)) {
116
+			throw new InvalidRequestStackMiddlewareException($middleware_app_class);
117
+		}
118
+		return $middleware_app;
119
+	}
120 120
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                 $middleware_app_args  = array($application, $this->loader) + $middleware_app_args;
70 70
                 $application          = $this->loader->getShared($middleware_app_class, $middleware_app_args);
71 71
             } catch (InvalidRequestStackMiddlewareException $exception) {
72
-                if(WP_DEBUG) {
72
+                if (WP_DEBUG) {
73 73
                     new ExceptionStackTraceDisplay($exception);
74 74
                     continue;
75 75
                 }
@@ -93,18 +93,18 @@  discard block
 block discarded – undo
93 93
     {
94 94
         $middleware_app_class = reset($middleware_app);
95 95
         // is array empty ?
96
-        if($middleware_app_class === false) {
96
+        if ($middleware_app_class === false) {
97 97
             throw new InvalidRequestStackMiddlewareException($middleware_app_class);
98 98
         }
99 99
         // are the class and arguments in the wrong order ?
100
-        if(is_array($middleware_app_class)) {
100
+        if (is_array($middleware_app_class)) {
101 101
             if ($recurse === true) {
102 102
                 return $this->validateMiddlewareAppDetails(array_reverse($middleware_app));
103 103
             }
104 104
             throw new InvalidRequestStackMiddlewareException($middleware_app_class);
105 105
         }
106 106
         // is filter callback working like legacy middleware and sending a numerically indexed array ?
107
-        if(is_int($middleware_app_class)) {
107
+        if (is_int($middleware_app_class)) {
108 108
             if ($recurse === true) {
109 109
                 $middleware_app = array_reverse($middleware_app);
110 110
                 return $this->validateMiddlewareAppDetails(array(reset($middleware_app), array()));
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             throw new InvalidRequestStackMiddlewareException($middleware_app_class);
113 113
         }
114 114
         // is $middleware_app_class a valid FQCN (or class is already loaded) ?
115
-        if(! class_exists($middleware_app_class)) {
115
+        if ( ! class_exists($middleware_app_class)) {
116 116
             throw new InvalidRequestStackMiddlewareException($middleware_app_class);
117 117
         }
118 118
         return $middleware_app;
Please login to merge, or discard this patch.
core/services/bootstrap/BootstrapCore.php 1 patch
Indentation   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -52,234 +52,234 @@
 block discarded – undo
52 52
 class BootstrapCore
53 53
 {
54 54
 
55
-    /**
56
-     * @type LoaderInterface $loader
57
-     */
58
-    private $loader;
59
-
60
-    /**
61
-     * @var RequestInterface $request
62
-     */
63
-    protected $request;
64
-
65
-    /**
66
-     * @var ResponseInterface $response
67
-     */
68
-    protected $response;
69
-
70
-    /**
71
-     * @var RequestStackBuilder $request_stack_builder
72
-     */
73
-    protected $request_stack_builder;
74
-
75
-    /**
76
-     * @var RequestStack $request_stack
77
-     */
78
-    protected $request_stack;
79
-
80
-
81
-    /**
82
-     * BootstrapCore constructor.
83
-     */
84
-    public function __construct()
85
-    {
86
-        // construct request stack and run middleware apps as soon as all WP plugins are loaded
87
-        add_action('plugins_loaded', array($this, 'initialize'), 0);
88
-    }
89
-
90
-
91
-    /**
92
-     * @throws InvalidRequestStackMiddlewareException
93
-     * @throws InvalidClassException
94
-     * @throws DomainException
95
-     * @throws EE_Error
96
-     * @throws InvalidArgumentException
97
-     * @throws InvalidDataTypeException
98
-     * @throws InvalidInterfaceException
99
-     * @throws ReflectionException
100
-     */
101
-    public function initialize()
102
-    {
103
-        $this->bootstrapDependencyInjectionContainer();
104
-        $this->bootstrapDomain();
105
-        $bootstrap_request = $this->bootstrapRequestResponseObjects();
106
-        add_action(
107
-            'EE_Load_Espresso_Core__handle_request__initialize_core_loading',
108
-            array($bootstrap_request, 'setupLegacyRequest')
109
-        );
110
-        $this->runRequestStack();
111
-    }
112
-
113
-
114
-    /**
115
-     * @throws ReflectionException
116
-     * @throws EE_Error
117
-     * @throws InvalidArgumentException
118
-     * @throws InvalidDataTypeException
119
-     * @throws InvalidInterfaceException
120
-     */
121
-    private function bootstrapDependencyInjectionContainer()
122
-    {
123
-        $bootstrap_di = new BootstrapDependencyInjectionContainer();
124
-        $bootstrap_di->buildLegacyDependencyInjectionContainer();
125
-        $bootstrap_di->buildLoader();
126
-        $registry = $bootstrap_di->getRegistry();
127
-        $dependency_map = $bootstrap_di->getDependencyMap();
128
-        $dependency_map->initialize();
129
-        $registry->initialize();
130
-        $this->loader = $bootstrap_di->getLoader();
131
-    }
132
-
133
-
134
-    /**
135
-     * configures the Domain object for core
136
-     *
137
-     * @return void
138
-     * @throws DomainException
139
-     * @throws InvalidArgumentException
140
-     * @throws InvalidDataTypeException
141
-     * @throws InvalidClassException
142
-     * @throws InvalidFilePathException
143
-     * @throws InvalidInterfaceException
144
-     */
145
-    private function bootstrapDomain()
146
-    {
147
-        DomainFactory::getShared(
148
-            new FullyQualifiedName(
149
-                'EventEspresso\core\domain\Domain'
150
-            ),
151
-            array(
152
-                new FilePath(EVENT_ESPRESSO_MAIN_FILE),
153
-                Version::fromString(espresso_version())
154
-            )
155
-        );
156
-    }
157
-
158
-
159
-    /**
160
-     * sets up the request and response objects
161
-     *
162
-     * @return BootstrapRequestResponseObjects
163
-     * @throws InvalidArgumentException
164
-     */
165
-    private function bootstrapRequestResponseObjects()
166
-    {
167
-        /** @var BootstrapRequestResponseObjects $bootstrap_request */
168
-        $bootstrap_request = $this->loader->getShared(
169
-            'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects',
170
-            array($this->loader)
171
-        );
172
-        $bootstrap_request->buildRequestResponse();
173
-        $bootstrap_request->shareRequestResponse();
174
-        $this->request  = $this->loader->getShared('EventEspresso\core\services\request\Request');
175
-        $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response');
176
-        return $bootstrap_request;
177
-    }
178
-
179
-
180
-    /**
181
-     * run_request_stack
182
-     * construct request stack and run middleware apps
183
-     *
184
-     * @throws InvalidRequestStackMiddlewareException
185
-     * @throws InvalidInterfaceException
186
-     * @throws InvalidDataTypeException
187
-     * @throws EE_Error
188
-     */
189
-    public function runRequestStack()
190
-    {
191
-        $this->loadAutoloader();
192
-        $this->setAutoloadersForRequiredFiles();
193
-        $this->request_stack_builder = $this->buildRequestStack();
194
-        $this->request_stack         = $this->request_stack_builder->resolve(
195
-            new RequestStackCoreApp()
196
-        );
197
-        $this->request_stack->handleRequest($this->request, $this->response);
198
-        $this->request_stack->handleResponse();
199
-    }
200
-
201
-
202
-    /**
203
-     * load_autoloader
204
-     *
205
-     * @throws EE_Error
206
-     */
207
-    protected function loadAutoloader()
208
-    {
209
-        // load interfaces
210
-        espresso_load_required(
211
-            'EEH_Autoloader',
212
-            EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php'
213
-        );
214
-        EEH_Autoloader::instance();
215
-    }
216
-
217
-
218
-
219
-    /**
220
-     * load_required_files
221
-     *
222
-     * @throws EE_Error
223
-     */
224
-    protected function setAutoloadersForRequiredFiles()
225
-    {
226
-        // load interfaces
227
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true);
228
-        // load helpers
229
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS);
230
-        // load request stack
231
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS);
232
-        // load middleware
233
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS);
234
-    }
235
-
236
-
237
-
238
-    /**
239
-     * build_request_stack
240
-     *
241
-     * @return RequestStackBuilder
242
-     */
243
-    public function buildRequestStack()
244
-    {
245
-        $request_stack_builder = new RequestStackBuilder($this->loader);
246
-        /**
247
-         * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT
248
-         * so items at the beginning of the final middleware stack will run last.
249
-         * First parameter is the middleware classname, second is an array of arguments
250
-         */
251
-        $stack_apps            = apply_filters(
252
-            'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps',
253
-            array(
254
-                // first in last out
255
-                'EventEspresso\core\services\request\middleware\BotDetector' => array(),
256
-                'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(),
257
-                'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(),
258
-                'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(),
259
-                // last in first out
260
-                'EventEspresso\core\services\request\middleware\DetectLogin' => array(),
261
-            )
262
-        );
263
-        // legacy filter for backwards compatibility
264
-        $stack_apps            = apply_filters(
265
-            'FHEE__EE_Bootstrap__build_request_stack__stack_apps',
266
-            $stack_apps
267
-        );
268
-        // load middleware onto stack : FILO (First In Last Out)
269
-        // items at the beginning of the $stack_apps array will run last
270
-        foreach ((array) $stack_apps as $stack_app => $stack_app_args) {
271
-            $request_stack_builder->push(array($stack_app, $stack_app_args));
272
-        }
273
-        // finally, we'll add this on its own because we need it to always be part of the stack
274
-        // and we also need it to always run first because the rest of the system relies on it
275
-        $request_stack_builder->push(
276
-            array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array())
277
-        );
278
-        return apply_filters(
279
-            'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder',
280
-            $request_stack_builder
281
-        );
282
-    }
55
+	/**
56
+	 * @type LoaderInterface $loader
57
+	 */
58
+	private $loader;
59
+
60
+	/**
61
+	 * @var RequestInterface $request
62
+	 */
63
+	protected $request;
64
+
65
+	/**
66
+	 * @var ResponseInterface $response
67
+	 */
68
+	protected $response;
69
+
70
+	/**
71
+	 * @var RequestStackBuilder $request_stack_builder
72
+	 */
73
+	protected $request_stack_builder;
74
+
75
+	/**
76
+	 * @var RequestStack $request_stack
77
+	 */
78
+	protected $request_stack;
79
+
80
+
81
+	/**
82
+	 * BootstrapCore constructor.
83
+	 */
84
+	public function __construct()
85
+	{
86
+		// construct request stack and run middleware apps as soon as all WP plugins are loaded
87
+		add_action('plugins_loaded', array($this, 'initialize'), 0);
88
+	}
89
+
90
+
91
+	/**
92
+	 * @throws InvalidRequestStackMiddlewareException
93
+	 * @throws InvalidClassException
94
+	 * @throws DomainException
95
+	 * @throws EE_Error
96
+	 * @throws InvalidArgumentException
97
+	 * @throws InvalidDataTypeException
98
+	 * @throws InvalidInterfaceException
99
+	 * @throws ReflectionException
100
+	 */
101
+	public function initialize()
102
+	{
103
+		$this->bootstrapDependencyInjectionContainer();
104
+		$this->bootstrapDomain();
105
+		$bootstrap_request = $this->bootstrapRequestResponseObjects();
106
+		add_action(
107
+			'EE_Load_Espresso_Core__handle_request__initialize_core_loading',
108
+			array($bootstrap_request, 'setupLegacyRequest')
109
+		);
110
+		$this->runRequestStack();
111
+	}
112
+
113
+
114
+	/**
115
+	 * @throws ReflectionException
116
+	 * @throws EE_Error
117
+	 * @throws InvalidArgumentException
118
+	 * @throws InvalidDataTypeException
119
+	 * @throws InvalidInterfaceException
120
+	 */
121
+	private function bootstrapDependencyInjectionContainer()
122
+	{
123
+		$bootstrap_di = new BootstrapDependencyInjectionContainer();
124
+		$bootstrap_di->buildLegacyDependencyInjectionContainer();
125
+		$bootstrap_di->buildLoader();
126
+		$registry = $bootstrap_di->getRegistry();
127
+		$dependency_map = $bootstrap_di->getDependencyMap();
128
+		$dependency_map->initialize();
129
+		$registry->initialize();
130
+		$this->loader = $bootstrap_di->getLoader();
131
+	}
132
+
133
+
134
+	/**
135
+	 * configures the Domain object for core
136
+	 *
137
+	 * @return void
138
+	 * @throws DomainException
139
+	 * @throws InvalidArgumentException
140
+	 * @throws InvalidDataTypeException
141
+	 * @throws InvalidClassException
142
+	 * @throws InvalidFilePathException
143
+	 * @throws InvalidInterfaceException
144
+	 */
145
+	private function bootstrapDomain()
146
+	{
147
+		DomainFactory::getShared(
148
+			new FullyQualifiedName(
149
+				'EventEspresso\core\domain\Domain'
150
+			),
151
+			array(
152
+				new FilePath(EVENT_ESPRESSO_MAIN_FILE),
153
+				Version::fromString(espresso_version())
154
+			)
155
+		);
156
+	}
157
+
158
+
159
+	/**
160
+	 * sets up the request and response objects
161
+	 *
162
+	 * @return BootstrapRequestResponseObjects
163
+	 * @throws InvalidArgumentException
164
+	 */
165
+	private function bootstrapRequestResponseObjects()
166
+	{
167
+		/** @var BootstrapRequestResponseObjects $bootstrap_request */
168
+		$bootstrap_request = $this->loader->getShared(
169
+			'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects',
170
+			array($this->loader)
171
+		);
172
+		$bootstrap_request->buildRequestResponse();
173
+		$bootstrap_request->shareRequestResponse();
174
+		$this->request  = $this->loader->getShared('EventEspresso\core\services\request\Request');
175
+		$this->response = $this->loader->getShared('EventEspresso\core\services\request\Response');
176
+		return $bootstrap_request;
177
+	}
178
+
179
+
180
+	/**
181
+	 * run_request_stack
182
+	 * construct request stack and run middleware apps
183
+	 *
184
+	 * @throws InvalidRequestStackMiddlewareException
185
+	 * @throws InvalidInterfaceException
186
+	 * @throws InvalidDataTypeException
187
+	 * @throws EE_Error
188
+	 */
189
+	public function runRequestStack()
190
+	{
191
+		$this->loadAutoloader();
192
+		$this->setAutoloadersForRequiredFiles();
193
+		$this->request_stack_builder = $this->buildRequestStack();
194
+		$this->request_stack         = $this->request_stack_builder->resolve(
195
+			new RequestStackCoreApp()
196
+		);
197
+		$this->request_stack->handleRequest($this->request, $this->response);
198
+		$this->request_stack->handleResponse();
199
+	}
200
+
201
+
202
+	/**
203
+	 * load_autoloader
204
+	 *
205
+	 * @throws EE_Error
206
+	 */
207
+	protected function loadAutoloader()
208
+	{
209
+		// load interfaces
210
+		espresso_load_required(
211
+			'EEH_Autoloader',
212
+			EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php'
213
+		);
214
+		EEH_Autoloader::instance();
215
+	}
216
+
217
+
218
+
219
+	/**
220
+	 * load_required_files
221
+	 *
222
+	 * @throws EE_Error
223
+	 */
224
+	protected function setAutoloadersForRequiredFiles()
225
+	{
226
+		// load interfaces
227
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true);
228
+		// load helpers
229
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS);
230
+		// load request stack
231
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS);
232
+		// load middleware
233
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS);
234
+	}
235
+
236
+
237
+
238
+	/**
239
+	 * build_request_stack
240
+	 *
241
+	 * @return RequestStackBuilder
242
+	 */
243
+	public function buildRequestStack()
244
+	{
245
+		$request_stack_builder = new RequestStackBuilder($this->loader);
246
+		/**
247
+		 * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT
248
+		 * so items at the beginning of the final middleware stack will run last.
249
+		 * First parameter is the middleware classname, second is an array of arguments
250
+		 */
251
+		$stack_apps            = apply_filters(
252
+			'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps',
253
+			array(
254
+				// first in last out
255
+				'EventEspresso\core\services\request\middleware\BotDetector' => array(),
256
+				'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(),
257
+				'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(),
258
+				'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(),
259
+				// last in first out
260
+				'EventEspresso\core\services\request\middleware\DetectLogin' => array(),
261
+			)
262
+		);
263
+		// legacy filter for backwards compatibility
264
+		$stack_apps            = apply_filters(
265
+			'FHEE__EE_Bootstrap__build_request_stack__stack_apps',
266
+			$stack_apps
267
+		);
268
+		// load middleware onto stack : FILO (First In Last Out)
269
+		// items at the beginning of the $stack_apps array will run last
270
+		foreach ((array) $stack_apps as $stack_app => $stack_app_args) {
271
+			$request_stack_builder->push(array($stack_app, $stack_app_args));
272
+		}
273
+		// finally, we'll add this on its own because we need it to always be part of the stack
274
+		// and we also need it to always run first because the rest of the system relies on it
275
+		$request_stack_builder->push(
276
+			array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array())
277
+		);
278
+		return apply_filters(
279
+			'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder',
280
+			$request_stack_builder
281
+		);
282
+	}
283 283
 
284 284
 
285 285
 }
Please login to merge, or discard this patch.
message_type/newsletter/EE_Messages_Email_Newsletter_Validator.class.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @since           4.3.0
8 8
  */
9 9
 if (! defined('EVENT_ESPRESSO_VERSION')) {
10
-    exit('No direct script access allowed');
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 /**
@@ -21,59 +21,59 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class EE_Messages_Email_Newsletter_Validator extends EE_Messages_Validator
23 23
 {
24
-    public function __construct($fields, $context)
25
-    {
26
-        $this->_m_name = 'email';
27
-        $this->_mt_name = 'newsletter';
24
+	public function __construct($fields, $context)
25
+	{
26
+		$this->_m_name = 'email';
27
+		$this->_mt_name = 'newsletter';
28 28
 
29
-        parent::__construct($fields, $context);
30
-    }
29
+		parent::__construct($fields, $context);
30
+	}
31 31
 
32
-    /**
33
-     * custom validator (restricting what was originally set by the messenger)
34
-     */
35
-    protected function _modify_validator()
36
-    {
37
-        if ($this->_context == 'attendee') {
38
-            $this->_valid_shortcodes_modifier[$this->_context]['from'] = array(
39
-                'recipient_details',
40
-                'email',
41
-                'organization',
42
-            );
43
-        }
32
+	/**
33
+	 * custom validator (restricting what was originally set by the messenger)
34
+	 */
35
+	protected function _modify_validator()
36
+	{
37
+		if ($this->_context == 'attendee') {
38
+			$this->_valid_shortcodes_modifier[$this->_context]['from'] = array(
39
+				'recipient_details',
40
+				'email',
41
+				'organization',
42
+			);
43
+		}
44 44
 
45
-        //excluded shortcodes
46
-        $fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
47
-        foreach ($fields as $field) {
48
-            $this->_specific_shortcode_excludes[$field] = array(
49
-                '[RECIPIENT_REGISTRATION_CODE]',
50
-                '[EVENT_AUTHOR_FORMATTED_EMAIL]',
51
-                '[EVENT_AUTHOR_EMAIL]',
52
-            );
53
-        }
54
-        $add_excludes = array(
55
-            '[RECIPIENT_FNAME]',
56
-            '[RECIPIENT_LNAME]',
57
-            '[RECIPIENT_EMAIL]',
58
-            '[COMPANY]',
59
-            '[CO_ADD1]',
60
-            '[CO_ADD2]',
61
-            '[CO_CITY]',
62
-            '[CO_STATE]',
63
-            '[CO_ZIP]',
64
-            '[CO_LOGO]',
65
-            '[CO_PHONE]',
66
-            '[CO_LOGO_URL]',
67
-            '[CO_FACEBOOK_URL]',
68
-            '[CO_TWITTER_URL]',
69
-            '[CO_PINTEREST_URL]',
70
-            '[CO_GOOGLE_URL]',
71
-            '[CO_LINKEDIN_URL]',
72
-            '[CO_INSTAGRAM_URL]',
73
-        );
74
-        $this->_specific_shortcode_excludes['from'] = array_merge($this->_specific_shortcode_excludes['from'],
75
-            $add_excludes);
76
-        $this->_specific_shortcode_excludes['content'] = array_merge($this->_specific_shortcode_excludes['content'],
77
-            array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'));
78
-    }
45
+		//excluded shortcodes
46
+		$fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
47
+		foreach ($fields as $field) {
48
+			$this->_specific_shortcode_excludes[$field] = array(
49
+				'[RECIPIENT_REGISTRATION_CODE]',
50
+				'[EVENT_AUTHOR_FORMATTED_EMAIL]',
51
+				'[EVENT_AUTHOR_EMAIL]',
52
+			);
53
+		}
54
+		$add_excludes = array(
55
+			'[RECIPIENT_FNAME]',
56
+			'[RECIPIENT_LNAME]',
57
+			'[RECIPIENT_EMAIL]',
58
+			'[COMPANY]',
59
+			'[CO_ADD1]',
60
+			'[CO_ADD2]',
61
+			'[CO_CITY]',
62
+			'[CO_STATE]',
63
+			'[CO_ZIP]',
64
+			'[CO_LOGO]',
65
+			'[CO_PHONE]',
66
+			'[CO_LOGO_URL]',
67
+			'[CO_FACEBOOK_URL]',
68
+			'[CO_TWITTER_URL]',
69
+			'[CO_PINTEREST_URL]',
70
+			'[CO_GOOGLE_URL]',
71
+			'[CO_LINKEDIN_URL]',
72
+			'[CO_INSTAGRAM_URL]',
73
+		);
74
+		$this->_specific_shortcode_excludes['from'] = array_merge($this->_specific_shortcode_excludes['from'],
75
+			$add_excludes);
76
+		$this->_specific_shortcode_excludes['content'] = array_merge($this->_specific_shortcode_excludes['content'],
77
+			array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'));
78
+	}
79 79
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @subpackage      helpers
7 7
  * @since           4.3.0
8 8
  */
9
-if (! defined('EVENT_ESPRESSO_VERSION')) {
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10 10
     exit('No direct script access allowed');
11 11
 }
12 12
 
Please login to merge, or discard this patch.
messages/message_type/newsletter/EE_Newsletter_message_type.class.php 2 patches
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @since           4.3.0
8 8
  */
9 9
 if (! defined('EVENT_ESPRESSO_VERSION')) {
10
-    exit('No direct script access allowed');
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 /**
@@ -23,152 +23,152 @@  discard block
 block discarded – undo
23 23
 class EE_Newsletter_message_type extends EE_message_type
24 24
 {
25 25
 
26
-    public function __construct()
27
-    {
28
-        $this->name = 'newsletter';
29
-        $this->description = __('Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.',
30
-            'event_espresso');
31
-        $this->label = array(
32
-            'singular' => __('batch', 'event_espresso'),
33
-            'plural'   => __('batches', 'event_espresso'),
34
-        );
35
-        $this->_master_templates = array(
36
-            'email' => 'registration',
37
-        );
38
-
39
-        parent::__construct();
40
-    }
41
-
42
-
43
-    protected function _set_admin_pages()
44
-    {
45
-        $this->admin_registered_pages = array(); //no admin pages to register this with.
46
-    }
47
-
48
-
49
-    protected function _set_data_handler()
50
-    {
51
-        $this->_data_handler = 'Registrations';
52
-        $this->_single_message = $this->_data instanceof EE_Registration;
53
-    }
54
-
55
-
56
-    protected function _get_data_for_context($context, EE_Registration $registration, $id)
57
-    {
58
-        //newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects.
59
-        return array($registration);
60
-    }
61
-
62
-
63
-    protected function _set_admin_settings_fields()
64
-    {
65
-        $this->_admin_settings_fields = array();
66
-    }
67
-
68
-
69
-    protected function _set_contexts()
70
-    {
71
-        $this->_context_label = array(
72
-            'label'       => __('recipient', 'event_espresso'),
73
-            'plural'      => __('recipients', 'event_espresso'),
74
-            'description' => __('Recipient\'s are who will receive the message.', 'event_espresso'),
75
-        );
76
-
77
-        $this->_contexts = array(
78
-            'attendee' => array(
79
-                'label'       => __('Registrant', 'event_espresso'),
80
-                'description' => __('This template goes to selected registrants.', 'event_espresso'),
81
-            ),
82
-        );
83
-    }
84
-
85
-
86
-    /**
87
-     * used to set the valid shortcodes.
88
-     * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and
89
-     * organization.  That's it!
90
-     *
91
-     * @since   4.3.0
92
-     * @return  void
93
-     */
94
-    protected function _set_valid_shortcodes()
95
-    {
96
-        parent::_set_valid_shortcodes();
97
-
98
-        $included_shortcodes = array(
99
-            'recipient_details',
100
-            'organization',
101
-            'newsletter',
102
-        );
103
-
104
-        foreach ($this->_valid_shortcodes as $context => $shortcodes) {
105
-            foreach ($shortcodes as $key => $shortcode) {
106
-                if (! in_array($shortcode, $included_shortcodes)) {
107
-                    unset($this->_valid_shortcodes[$context][$key]);
108
-                }
109
-            }
110
-            $this->_valid_shortcodes[$context][] = 'newsletter';
111
-        }
112
-
113
-    }
114
-
115
-
116
-    /**
117
-     * Override default _attendee_addressees in EE_message_type because we want to loop through the registrations
118
-     * for EE_message_type.
119
-     */
120
-    protected function _attendee_addressees()
121
-    {
122
-        $addressee = array();
123
-
124
-        //looping through registrations
125
-        foreach ($this->_data->registrations as $reg_id => $details) {
126
-            //set $attendee array to blank on each loop
127
-            $aee = array();
128
-
129
-            //need to get the attendee from this registration.
130
-            $attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee
131
-                ? $details['att_obj']
132
-                : null;
133
-
134
-            if (! $attendee instanceof EE_Attendee) {
135
-                continue;
136
-            }
137
-
138
-            //set $aee from attendee object
139
-            $aee['att_obj'] = $attendee;
140
-            $aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs'])
141
-                ? $this->_data->attendees[$attendee->ID()]['reg_objs']
142
-                : array();
143
-            $aee['attendee_email'] = $attendee->email();
144
-            $aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs'])
145
-                ? $this->_data->attendees[$attendee->ID()]['tkt_objs']
146
-                : array();
147
-
148
-            if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) {
149
-                $aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
150
-                $aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
151
-            } else {
152
-                $aee['evt_objs'] = $aee['events'] = array();
153
-            }
154
-
155
-            $aee['reg_obj'] = isset($details['reg_obj'])
156
-                ? $details['reg_obj']
157
-                : null;
158
-            $aee['attendees'] = $this->_data->attendees;
159
-
160
-            //merge in the primary attendee data
161
-            $aee = array_merge($this->_default_addressee_data, $aee);
162
-
163
-            //make sure txn is set
164
-            if (empty($aee['txn']) && $aee['reg_obj'] instanceof EE_Registration) {
165
-                $aee['txn'] = $aee['reg_obj']->transaction();
166
-            }
167
-
168
-            $addressee[] = new EE_Messages_Addressee($aee);
169
-        }
170
-        return $addressee;
171
-    }
26
+	public function __construct()
27
+	{
28
+		$this->name = 'newsletter';
29
+		$this->description = __('Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.',
30
+			'event_espresso');
31
+		$this->label = array(
32
+			'singular' => __('batch', 'event_espresso'),
33
+			'plural'   => __('batches', 'event_espresso'),
34
+		);
35
+		$this->_master_templates = array(
36
+			'email' => 'registration',
37
+		);
38
+
39
+		parent::__construct();
40
+	}
41
+
42
+
43
+	protected function _set_admin_pages()
44
+	{
45
+		$this->admin_registered_pages = array(); //no admin pages to register this with.
46
+	}
47
+
48
+
49
+	protected function _set_data_handler()
50
+	{
51
+		$this->_data_handler = 'Registrations';
52
+		$this->_single_message = $this->_data instanceof EE_Registration;
53
+	}
54
+
55
+
56
+	protected function _get_data_for_context($context, EE_Registration $registration, $id)
57
+	{
58
+		//newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects.
59
+		return array($registration);
60
+	}
61
+
62
+
63
+	protected function _set_admin_settings_fields()
64
+	{
65
+		$this->_admin_settings_fields = array();
66
+	}
67
+
68
+
69
+	protected function _set_contexts()
70
+	{
71
+		$this->_context_label = array(
72
+			'label'       => __('recipient', 'event_espresso'),
73
+			'plural'      => __('recipients', 'event_espresso'),
74
+			'description' => __('Recipient\'s are who will receive the message.', 'event_espresso'),
75
+		);
76
+
77
+		$this->_contexts = array(
78
+			'attendee' => array(
79
+				'label'       => __('Registrant', 'event_espresso'),
80
+				'description' => __('This template goes to selected registrants.', 'event_espresso'),
81
+			),
82
+		);
83
+	}
84
+
85
+
86
+	/**
87
+	 * used to set the valid shortcodes.
88
+	 * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and
89
+	 * organization.  That's it!
90
+	 *
91
+	 * @since   4.3.0
92
+	 * @return  void
93
+	 */
94
+	protected function _set_valid_shortcodes()
95
+	{
96
+		parent::_set_valid_shortcodes();
97
+
98
+		$included_shortcodes = array(
99
+			'recipient_details',
100
+			'organization',
101
+			'newsletter',
102
+		);
103
+
104
+		foreach ($this->_valid_shortcodes as $context => $shortcodes) {
105
+			foreach ($shortcodes as $key => $shortcode) {
106
+				if (! in_array($shortcode, $included_shortcodes)) {
107
+					unset($this->_valid_shortcodes[$context][$key]);
108
+				}
109
+			}
110
+			$this->_valid_shortcodes[$context][] = 'newsletter';
111
+		}
112
+
113
+	}
114
+
115
+
116
+	/**
117
+	 * Override default _attendee_addressees in EE_message_type because we want to loop through the registrations
118
+	 * for EE_message_type.
119
+	 */
120
+	protected function _attendee_addressees()
121
+	{
122
+		$addressee = array();
123
+
124
+		//looping through registrations
125
+		foreach ($this->_data->registrations as $reg_id => $details) {
126
+			//set $attendee array to blank on each loop
127
+			$aee = array();
128
+
129
+			//need to get the attendee from this registration.
130
+			$attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee
131
+				? $details['att_obj']
132
+				: null;
133
+
134
+			if (! $attendee instanceof EE_Attendee) {
135
+				continue;
136
+			}
137
+
138
+			//set $aee from attendee object
139
+			$aee['att_obj'] = $attendee;
140
+			$aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs'])
141
+				? $this->_data->attendees[$attendee->ID()]['reg_objs']
142
+				: array();
143
+			$aee['attendee_email'] = $attendee->email();
144
+			$aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs'])
145
+				? $this->_data->attendees[$attendee->ID()]['tkt_objs']
146
+				: array();
147
+
148
+			if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) {
149
+				$aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
150
+				$aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
151
+			} else {
152
+				$aee['evt_objs'] = $aee['events'] = array();
153
+			}
154
+
155
+			$aee['reg_obj'] = isset($details['reg_obj'])
156
+				? $details['reg_obj']
157
+				: null;
158
+			$aee['attendees'] = $this->_data->attendees;
159
+
160
+			//merge in the primary attendee data
161
+			$aee = array_merge($this->_default_addressee_data, $aee);
162
+
163
+			//make sure txn is set
164
+			if (empty($aee['txn']) && $aee['reg_obj'] instanceof EE_Registration) {
165
+				$aee['txn'] = $aee['reg_obj']->transaction();
166
+			}
167
+
168
+			$addressee[] = new EE_Messages_Addressee($aee);
169
+		}
170
+		return $addressee;
171
+	}
172 172
 
173 173
 
174 174
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @subpackage      helpers
7 7
  * @since           4.3.0
8 8
  */
9
-if (! defined('EVENT_ESPRESSO_VERSION')) {
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10 10
     exit('No direct script access allowed');
11 11
 }
12 12
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
         foreach ($this->_valid_shortcodes as $context => $shortcodes) {
105 105
             foreach ($shortcodes as $key => $shortcode) {
106
-                if (! in_array($shortcode, $included_shortcodes)) {
106
+                if ( ! in_array($shortcode, $included_shortcodes)) {
107 107
                     unset($this->_valid_shortcodes[$context][$key]);
108 108
                 }
109 109
             }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
                 ? $details['att_obj']
132 132
                 : null;
133 133
 
134
-            if (! $attendee instanceof EE_Attendee) {
134
+            if ( ! $attendee instanceof EE_Attendee) {
135 135
                 continue;
136 136
             }
137 137
 
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -38,103 +38,103 @@
 block discarded – undo
38 38
  * @since       4.0
39 39
  */
40 40
 if (function_exists('espresso_version')) {
41
-    if (! function_exists('espresso_duplicate_plugin_error')) {
42
-        /**
43
-         *    espresso_duplicate_plugin_error
44
-         *    displays if more than one version of EE is activated at the same time
45
-         */
46
-        function espresso_duplicate_plugin_error()
47
-        {
48
-            ?>
41
+	if (! function_exists('espresso_duplicate_plugin_error')) {
42
+		/**
43
+		 *    espresso_duplicate_plugin_error
44
+		 *    displays if more than one version of EE is activated at the same time
45
+		 */
46
+		function espresso_duplicate_plugin_error()
47
+		{
48
+			?>
49 49
             <div class="error">
50 50
                 <p>
51 51
                     <?php
52
-                    echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                    ); ?>
52
+					echo esc_html__(
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+					); ?>
56 56
                 </p>
57 57
             </div>
58 58
             <?php
59
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-        }
61
-    }
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+		}
61
+	}
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 
64 64
 } else {
65
-    define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
66
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
67
-        /**
68
-         * espresso_minimum_php_version_error
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
65
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
66
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
67
+		/**
68
+		 * espresso_minimum_php_version_error
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                        esc_html__(
79
-                            'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                            'event_espresso'
81
-                        ),
82
-                        EE_MIN_PHP_VER_REQUIRED,
83
-                        PHP_VERSION,
84
-                        '<br/>',
85
-                        '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+						esc_html__(
79
+							'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+							'event_espresso'
81
+						),
82
+						EE_MIN_PHP_VER_REQUIRED,
83
+						PHP_VERSION,
84
+						'<br/>',
85
+						'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
-        /**
98
-         * espresso_version
99
-         * Returns the plugin version
100
-         *
101
-         * @return string
102
-         */
103
-        function espresso_version()
104
-        {
105
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.59.rc.032');
106
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
+		/**
98
+		 * espresso_version
99
+		 * Returns the plugin version
100
+		 *
101
+		 * @return string
102
+		 */
103
+		function espresso_version()
104
+		{
105
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.59.rc.032');
106
+		}
107 107
 
108
-        /**
109
-         * espresso_plugin_activation
110
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
-         */
112
-        function espresso_plugin_activation()
113
-        {
114
-            update_option('ee_espresso_activation', true);
115
-        }
108
+		/**
109
+		 * espresso_plugin_activation
110
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
+		 */
112
+		function espresso_plugin_activation()
113
+		{
114
+			update_option('ee_espresso_activation', true);
115
+		}
116 116
 
117
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
117
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
118 118
 
119
-        require_once __DIR__ . '/core/bootstrap_espresso.php';
120
-        bootstrap_espresso();
121
-    }
119
+		require_once __DIR__ . '/core/bootstrap_espresso.php';
120
+		bootstrap_espresso();
121
+	}
122 122
 }
123 123
 if (! function_exists('espresso_deactivate_plugin')) {
124
-    /**
125
-     *    deactivate_plugin
126
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
-     *
128
-     * @access public
129
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
-     * @return    void
131
-     */
132
-    function espresso_deactivate_plugin($plugin_basename = '')
133
-    {
134
-        if (! function_exists('deactivate_plugins')) {
135
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
-        }
137
-        unset($_GET['activate'], $_REQUEST['activate']);
138
-        deactivate_plugins($plugin_basename);
139
-    }
124
+	/**
125
+	 *    deactivate_plugin
126
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
+	 *
128
+	 * @access public
129
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
+	 * @return    void
131
+	 */
132
+	function espresso_deactivate_plugin($plugin_basename = '')
133
+	{
134
+		if (! function_exists('deactivate_plugins')) {
135
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
+		}
137
+		unset($_GET['activate'], $_REQUEST['activate']);
138
+		deactivate_plugins($plugin_basename);
139
+	}
140 140
 }
Please login to merge, or discard this patch.