Completed
Branch BUG-8698-ticket-sellouts (330ec2)
by
unknown
34:27 queued 16:21
created
core/services/container/DependencyInjector.php 1 patch
Indentation   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use UnexpectedValueException;
5 5
 
6 6
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
-    exit('No direct script access allowed');
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -22,214 +22,214 @@  discard block
 block discarded – undo
22 22
 class DependencyInjector implements InjectorInterface
23 23
 {
24 24
 
25
-    /**
26
-     * @var CoffeePotInterface $coffee_pot
27
-     */
28
-    private $coffee_pot;
29
-
30
-    /**
31
-     * @var \EEH_Array $array_helper
32
-     */
33
-    private $array_helper;
34
-
35
-    /**
36
-     * @var \ReflectionClass[] $reflectors
37
-     */
38
-    private $reflectors;
39
-
40
-    /**
41
-     * @var \ReflectionMethod[] $constructors
42
-     */
43
-    private $constructors;
44
-
45
-    /**
46
-     * @var \ReflectionParameter[] $parameters
47
-     */
48
-    private $parameters;
49
-
50
-
51
-
52
-    /**
53
-     * DependencyInjector constructor
54
-     *
55
-     * @param CoffeePotInterface $coffee_pot
56
-     * @param \EEH_Array         $array_helper
57
-     */
58
-    public function __construct(CoffeePotInterface $coffee_pot, \EEH_Array $array_helper)
59
-    {
60
-        $this->coffee_pot = $coffee_pot;
61
-        $this->array_helper = $array_helper;
62
-    }
63
-
64
-
65
-
66
-    /**
67
-     * getReflectionClass
68
-     * checks if a ReflectionClass object has already been generated for a class
69
-     * and returns that instead of creating a new one
70
-     *
71
-     * @param string $class_name
72
-     * @return \ReflectionClass
73
-     */
74
-    public function getReflectionClass($class_name)
75
-    {
76
-        if (
77
-            ! isset($this->reflectors[$class_name])
78
-            || ! $this->reflectors[$class_name] instanceof \ReflectionClass
79
-        ) {
80
-            $this->reflectors[$class_name] = new \ReflectionClass($class_name);
81
-        }
82
-        return $this->reflectors[$class_name];
83
-    }
84
-
85
-
86
-
87
-    /**
88
-     * getConstructor
89
-     * checks if a ReflectionMethod object has already been generated for the class constructor
90
-     * and returns that instead of creating a new one
91
-     *
92
-     * @param \ReflectionClass $reflector
93
-     * @return \ReflectionMethod
94
-     */
95
-    protected function getConstructor(\ReflectionClass $reflector)
96
-    {
97
-        if (
98
-            ! isset($this->constructors[$reflector->getName()])
99
-            || ! $this->constructors[$reflector->getName()] instanceof \ReflectionMethod
100
-        ) {
101
-            $this->constructors[$reflector->getName()] = $reflector->getConstructor();
102
-        }
103
-        return $this->constructors[$reflector->getName()];
104
-    }
105
-
106
-
107
-
108
-    /**
109
-     * getParameters
110
-     * checks if an array of ReflectionParameter objects has already been generated for the class constructor
111
-     * and returns that instead of creating a new one
112
-     *
113
-     * @param \ReflectionMethod $constructor
114
-     * @return \ReflectionParameter[]
115
-     */
116
-    protected function getParameters(\ReflectionMethod $constructor)
117
-    {
118
-        if ( ! isset($this->parameters[$constructor->class])) {
119
-            $this->parameters[$constructor->class] = $constructor->getParameters();
120
-        }
121
-        return $this->parameters[$constructor->class];
122
-    }
123
-
124
-
125
-
126
-    /**
127
-     * resolveDependencies
128
-     * examines the constructor for the requested class to determine
129
-     * if any dependencies exist, and if they can be injected.
130
-     * If so, then those classes will be added to the array of arguments passed to the constructor
131
-     * PLZ NOTE: this is achieved by type hinting the constructor params
132
-     * For example:
133
-     *        if attempting to load a class "Foo" with the following constructor:
134
-     *        __construct( Bar $bar_class, Fighter $grohl_class )
135
-     *        then $bar_class and $grohl_class will be added to the $arguments array,
136
-     *        but only IF they are NOT already present in the incoming arguments array,
137
-     *        and the correct classes can be loaded
138
-     *
139
-     * @param RecipeInterface   $recipe
140
-     * @param \ReflectionClass  $reflector
141
-     * @param array             $arguments
142
-     * @return array
143
-     */
144
-    public function resolveDependencies(RecipeInterface $recipe, \ReflectionClass $reflector, $arguments = array())
145
-    {
146
-        // if arguments array is numerically and sequentially indexed, then we want it to remain as is,
147
-        // else wrap it in an additional array so that it doesn't get split into multiple parameters
148
-        $arguments = $this->array_helper->is_array_numerically_and_sequentially_indexed($arguments)
149
-            ? $arguments
150
-            : array($arguments);
151
-        $resolved_parameters = array();
152
-        // let's examine the constructor
153
-        // let's examine the constructor
154
-        $constructor = $this->getConstructor($reflector);
155
-        // whu? huh? nothing?
156
-        if ( ! $constructor) {
157
-            return $arguments;
158
-        }
159
-        // get constructor parameters
160
-        $params = $this->getParameters($constructor);
161
-        if (empty($params)) {
162
-            return $resolved_parameters;
163
-        }
164
-        $ingredients = $recipe->ingredients();
165
-        // and the keys for the incoming arguments array so that we can compare existing arguments with what is expected
166
-        $argument_keys = array_keys($arguments);
167
-        // now loop thru all of the constructors expected parameters
168
-        foreach ($params as $index => $param) {
169
-            if ( ! $param instanceof \ReflectionParameter) {
170
-                continue;
171
-            }
172
-            // is this a dependency for a specific class ?
173
-            $param_class = $param->getClass() ? $param->getClass()->name : null;
174
-            if (
175
-                // param is specified in the list of ingredients for this Recipe
176
-                isset($ingredients[$param_class])
177
-            ) {
178
-                // attempt to inject the dependency
179
-                $resolved_parameters[$index] = $this->injectDependency($ingredients[$param_class]);
180
-            } else if (
181
-                // param is not even a class
182
-                empty($param_class)
183
-                // and something already exists in the incoming arguments for this param
184
-                && isset($argument_keys[$index], $arguments[$argument_keys[$index]])
185
-            ) {
186
-                // add parameter from incoming arguments
187
-                $resolved_parameters[$index] = $arguments[$argument_keys[$index]];
188
-            } else if (
189
-                // parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class
190
-                ! empty($param_class)
191
-                && isset($argument_keys[$index], $arguments[$argument_keys[$index]])
192
-                && $arguments[$argument_keys[$index]] instanceof $param_class
193
-            ) {
194
-                // add parameter from incoming arguments
195
-                $resolved_parameters[$index] = $arguments[$argument_keys[$index]];
196
-            } else if (
197
-                // parameter is type hinted as a class, and should be injected
198
-            ! empty($param_class)
199
-            ) {
200
-                // attempt to inject the dependency
201
-                $resolved_parameters[$index] = $this->injectDependency($param_class);
202
-            } else if ($param->isOptional()) {
203
-                $resolved_parameters[$index] = $param->getDefaultValue();
204
-            } else {
205
-                $resolved_parameters[$index] = null;
206
-            }
207
-        }
208
-        return $resolved_parameters;
209
-    }
210
-
211
-
212
-
213
-    /**
214
-     * @param string $param_class
215
-     * @return mixed
216
-     */
217
-    private function injectDependency($param_class)
218
-    {
219
-        $dependency = $this->coffee_pot->brew($param_class);
220
-        if ( ! $dependency instanceof $param_class) {
221
-            throw new UnexpectedValueException(
222
-                sprintf(
223
-                    __(
224
-                        'Could not resolve dependency for "%1$s" for the "%2$s" class constructor.',
225
-                        'event_espresso'
226
-                    ),
227
-                    $param_class
228
-                )
229
-            );
230
-        }
231
-        return $dependency;
232
-    }
25
+	/**
26
+	 * @var CoffeePotInterface $coffee_pot
27
+	 */
28
+	private $coffee_pot;
29
+
30
+	/**
31
+	 * @var \EEH_Array $array_helper
32
+	 */
33
+	private $array_helper;
34
+
35
+	/**
36
+	 * @var \ReflectionClass[] $reflectors
37
+	 */
38
+	private $reflectors;
39
+
40
+	/**
41
+	 * @var \ReflectionMethod[] $constructors
42
+	 */
43
+	private $constructors;
44
+
45
+	/**
46
+	 * @var \ReflectionParameter[] $parameters
47
+	 */
48
+	private $parameters;
49
+
50
+
51
+
52
+	/**
53
+	 * DependencyInjector constructor
54
+	 *
55
+	 * @param CoffeePotInterface $coffee_pot
56
+	 * @param \EEH_Array         $array_helper
57
+	 */
58
+	public function __construct(CoffeePotInterface $coffee_pot, \EEH_Array $array_helper)
59
+	{
60
+		$this->coffee_pot = $coffee_pot;
61
+		$this->array_helper = $array_helper;
62
+	}
63
+
64
+
65
+
66
+	/**
67
+	 * getReflectionClass
68
+	 * checks if a ReflectionClass object has already been generated for a class
69
+	 * and returns that instead of creating a new one
70
+	 *
71
+	 * @param string $class_name
72
+	 * @return \ReflectionClass
73
+	 */
74
+	public function getReflectionClass($class_name)
75
+	{
76
+		if (
77
+			! isset($this->reflectors[$class_name])
78
+			|| ! $this->reflectors[$class_name] instanceof \ReflectionClass
79
+		) {
80
+			$this->reflectors[$class_name] = new \ReflectionClass($class_name);
81
+		}
82
+		return $this->reflectors[$class_name];
83
+	}
84
+
85
+
86
+
87
+	/**
88
+	 * getConstructor
89
+	 * checks if a ReflectionMethod object has already been generated for the class constructor
90
+	 * and returns that instead of creating a new one
91
+	 *
92
+	 * @param \ReflectionClass $reflector
93
+	 * @return \ReflectionMethod
94
+	 */
95
+	protected function getConstructor(\ReflectionClass $reflector)
96
+	{
97
+		if (
98
+			! isset($this->constructors[$reflector->getName()])
99
+			|| ! $this->constructors[$reflector->getName()] instanceof \ReflectionMethod
100
+		) {
101
+			$this->constructors[$reflector->getName()] = $reflector->getConstructor();
102
+		}
103
+		return $this->constructors[$reflector->getName()];
104
+	}
105
+
106
+
107
+
108
+	/**
109
+	 * getParameters
110
+	 * checks if an array of ReflectionParameter objects has already been generated for the class constructor
111
+	 * and returns that instead of creating a new one
112
+	 *
113
+	 * @param \ReflectionMethod $constructor
114
+	 * @return \ReflectionParameter[]
115
+	 */
116
+	protected function getParameters(\ReflectionMethod $constructor)
117
+	{
118
+		if ( ! isset($this->parameters[$constructor->class])) {
119
+			$this->parameters[$constructor->class] = $constructor->getParameters();
120
+		}
121
+		return $this->parameters[$constructor->class];
122
+	}
123
+
124
+
125
+
126
+	/**
127
+	 * resolveDependencies
128
+	 * examines the constructor for the requested class to determine
129
+	 * if any dependencies exist, and if they can be injected.
130
+	 * If so, then those classes will be added to the array of arguments passed to the constructor
131
+	 * PLZ NOTE: this is achieved by type hinting the constructor params
132
+	 * For example:
133
+	 *        if attempting to load a class "Foo" with the following constructor:
134
+	 *        __construct( Bar $bar_class, Fighter $grohl_class )
135
+	 *        then $bar_class and $grohl_class will be added to the $arguments array,
136
+	 *        but only IF they are NOT already present in the incoming arguments array,
137
+	 *        and the correct classes can be loaded
138
+	 *
139
+	 * @param RecipeInterface   $recipe
140
+	 * @param \ReflectionClass  $reflector
141
+	 * @param array             $arguments
142
+	 * @return array
143
+	 */
144
+	public function resolveDependencies(RecipeInterface $recipe, \ReflectionClass $reflector, $arguments = array())
145
+	{
146
+		// if arguments array is numerically and sequentially indexed, then we want it to remain as is,
147
+		// else wrap it in an additional array so that it doesn't get split into multiple parameters
148
+		$arguments = $this->array_helper->is_array_numerically_and_sequentially_indexed($arguments)
149
+			? $arguments
150
+			: array($arguments);
151
+		$resolved_parameters = array();
152
+		// let's examine the constructor
153
+		// let's examine the constructor
154
+		$constructor = $this->getConstructor($reflector);
155
+		// whu? huh? nothing?
156
+		if ( ! $constructor) {
157
+			return $arguments;
158
+		}
159
+		// get constructor parameters
160
+		$params = $this->getParameters($constructor);
161
+		if (empty($params)) {
162
+			return $resolved_parameters;
163
+		}
164
+		$ingredients = $recipe->ingredients();
165
+		// and the keys for the incoming arguments array so that we can compare existing arguments with what is expected
166
+		$argument_keys = array_keys($arguments);
167
+		// now loop thru all of the constructors expected parameters
168
+		foreach ($params as $index => $param) {
169
+			if ( ! $param instanceof \ReflectionParameter) {
170
+				continue;
171
+			}
172
+			// is this a dependency for a specific class ?
173
+			$param_class = $param->getClass() ? $param->getClass()->name : null;
174
+			if (
175
+				// param is specified in the list of ingredients for this Recipe
176
+				isset($ingredients[$param_class])
177
+			) {
178
+				// attempt to inject the dependency
179
+				$resolved_parameters[$index] = $this->injectDependency($ingredients[$param_class]);
180
+			} else if (
181
+				// param is not even a class
182
+				empty($param_class)
183
+				// and something already exists in the incoming arguments for this param
184
+				&& isset($argument_keys[$index], $arguments[$argument_keys[$index]])
185
+			) {
186
+				// add parameter from incoming arguments
187
+				$resolved_parameters[$index] = $arguments[$argument_keys[$index]];
188
+			} else if (
189
+				// parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class
190
+				! empty($param_class)
191
+				&& isset($argument_keys[$index], $arguments[$argument_keys[$index]])
192
+				&& $arguments[$argument_keys[$index]] instanceof $param_class
193
+			) {
194
+				// add parameter from incoming arguments
195
+				$resolved_parameters[$index] = $arguments[$argument_keys[$index]];
196
+			} else if (
197
+				// parameter is type hinted as a class, and should be injected
198
+			! empty($param_class)
199
+			) {
200
+				// attempt to inject the dependency
201
+				$resolved_parameters[$index] = $this->injectDependency($param_class);
202
+			} else if ($param->isOptional()) {
203
+				$resolved_parameters[$index] = $param->getDefaultValue();
204
+			} else {
205
+				$resolved_parameters[$index] = null;
206
+			}
207
+		}
208
+		return $resolved_parameters;
209
+	}
210
+
211
+
212
+
213
+	/**
214
+	 * @param string $param_class
215
+	 * @return mixed
216
+	 */
217
+	private function injectDependency($param_class)
218
+	{
219
+		$dependency = $this->coffee_pot->brew($param_class);
220
+		if ( ! $dependency instanceof $param_class) {
221
+			throw new UnexpectedValueException(
222
+				sprintf(
223
+					__(
224
+						'Could not resolve dependency for "%1$s" for the "%2$s" class constructor.',
225
+						'event_espresso'
226
+					),
227
+					$param_class
228
+				)
229
+			);
230
+		}
231
+		return $dependency;
232
+	}
233 233
 
234 234
 }
235 235
 // End of file DependencyInjector.php
Please login to merge, or discard this patch.
core/services/container/InjectorInterface.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -17,39 +17,39 @@  discard block
 block discarded – undo
17 17
 interface InjectorInterface
18 18
 {
19 19
 
20
-    /**
21
-     * getReflectionClass
22
-     * checks if a ReflectionClass object has already been generated for a class
23
-     * and returns that instead of creating a new one
24
-     *
25
-     * @access public
26
-     * @param string $class_name
27
-     * @return \ReflectionClass
28
-     */
29
-    public function getReflectionClass($class_name);
30
-
31
-
32
-
33
-    /**
34
-     * resolveDependencies
35
-     * examines the constructor for the requested class to determine
36
-     * if any dependencies exist, and if they can be injected.
37
-     * If so, then those classes will be added to the array of arguments passed to the constructor
38
-     * PLZ NOTE: this is achieved by type hinting the constructor params
39
-     * For example:
40
-     *        if attempting to load a class "Foo" with the following constructor:
41
-     *        __construct( Bar $bar_class, Fighter $grohl_class )
42
-     *        then $bar_class and $grohl_class will be added to the $arguments array,
43
-     *        but only IF they are NOT already present in the incoming arguments array,
44
-     *        and the correct classes can be loaded
45
-     *
46
-     * @access public
47
-     * @param \EventEspresso\core\services\container\RecipeInterface $recipe
48
-     * @param \ReflectionClass                                       $reflector
49
-     * @param array                                                  $arguments
50
-     * @return array
51
-     */
52
-    public function resolveDependencies(RecipeInterface $recipe, \ReflectionClass $reflector, $arguments = array());
20
+	/**
21
+	 * getReflectionClass
22
+	 * checks if a ReflectionClass object has already been generated for a class
23
+	 * and returns that instead of creating a new one
24
+	 *
25
+	 * @access public
26
+	 * @param string $class_name
27
+	 * @return \ReflectionClass
28
+	 */
29
+	public function getReflectionClass($class_name);
30
+
31
+
32
+
33
+	/**
34
+	 * resolveDependencies
35
+	 * examines the constructor for the requested class to determine
36
+	 * if any dependencies exist, and if they can be injected.
37
+	 * If so, then those classes will be added to the array of arguments passed to the constructor
38
+	 * PLZ NOTE: this is achieved by type hinting the constructor params
39
+	 * For example:
40
+	 *        if attempting to load a class "Foo" with the following constructor:
41
+	 *        __construct( Bar $bar_class, Fighter $grohl_class )
42
+	 *        then $bar_class and $grohl_class will be added to the $arguments array,
43
+	 *        but only IF they are NOT already present in the incoming arguments array,
44
+	 *        and the correct classes can be loaded
45
+	 *
46
+	 * @access public
47
+	 * @param \EventEspresso\core\services\container\RecipeInterface $recipe
48
+	 * @param \ReflectionClass                                       $reflector
49
+	 * @param array                                                  $arguments
50
+	 * @return array
51
+	 */
52
+	public function resolveDependencies(RecipeInterface $recipe, \ReflectionClass $reflector, $arguments = array());
53 53
 
54 54
 }
55 55
 // End of file InjectorInterface.php
Please login to merge, or discard this patch.
core/services/container/SharedCoffeeMaker.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -24,46 +24,46 @@  discard block
 block discarded – undo
24 24
 
25 25
 
26 26
 
27
-    /**
28
-     * @return string
29
-     */
30
-    public function type()
31
-    {
32
-        return CoffeeMaker::BREW_SHARED;
33
-    }
27
+	/**
28
+	 * @return string
29
+	 */
30
+	public function type()
31
+	{
32
+		return CoffeeMaker::BREW_SHARED;
33
+	}
34 34
 
35 35
 
36 36
 
37
-    /**
38
-     * @param RecipeInterface $recipe
39
-     * @param array           $arguments
40
-     * @return mixed
41
-     */
42
-    public function brew(RecipeInterface $recipe, $arguments = array())
43
-    {
44
-        $this->resolveClassAndFilepath($recipe);
45
-        $reflector = $this->injector()->getReflectionClass($recipe->fqcn());
46
-        $method = $this->resolveInstantiationMethod($reflector);
47
-        switch ($method) {
48
-            case 'instance' :
49
-            case 'new_instance' :
50
-            case 'new_instance_from_db';
51
-                $service = call_user_func_array(
52
-                    array($reflector->getName(), $method),
53
-                    $this->injector()->resolveDependencies($recipe, $reflector, $arguments)
54
-                );
55
-                break;
56
-            case 'newInstance' :
57
-                $service = $reflector->newInstance();
58
-                break;
59
-            case 'newInstanceArgs' :
60
-            default :
61
-                $service = $reflector->newInstanceArgs(
62
-                    $this->injector()->resolveDependencies($recipe, $reflector, $arguments)
63
-                );
64
-        }
65
-        return $this->coffeePot()->addService($recipe->identifier(), $service);
66
-    }
37
+	/**
38
+	 * @param RecipeInterface $recipe
39
+	 * @param array           $arguments
40
+	 * @return mixed
41
+	 */
42
+	public function brew(RecipeInterface $recipe, $arguments = array())
43
+	{
44
+		$this->resolveClassAndFilepath($recipe);
45
+		$reflector = $this->injector()->getReflectionClass($recipe->fqcn());
46
+		$method = $this->resolveInstantiationMethod($reflector);
47
+		switch ($method) {
48
+			case 'instance' :
49
+			case 'new_instance' :
50
+			case 'new_instance_from_db';
51
+				$service = call_user_func_array(
52
+					array($reflector->getName(), $method),
53
+					$this->injector()->resolveDependencies($recipe, $reflector, $arguments)
54
+				);
55
+				break;
56
+			case 'newInstance' :
57
+				$service = $reflector->newInstance();
58
+				break;
59
+			case 'newInstanceArgs' :
60
+			default :
61
+				$service = $reflector->newInstanceArgs(
62
+					$this->injector()->resolveDependencies($recipe, $reflector, $arguments)
63
+				);
64
+		}
65
+		return $this->coffeePot()->addService($recipe->identifier(), $service);
66
+	}
67 67
 
68 68
 }
69 69
 // End of file SharedCoffeeMaker.php
Please login to merge, or discard this patch.
core/services/container/NewCoffeeMaker.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -25,54 +25,54 @@  discard block
 block discarded – undo
25 25
 {
26 26
 
27 27
 
28
-    /**
29
-     * @return string
30
-     */
31
-    public function type()
32
-    {
33
-        return CoffeeMaker::BREW_NEW;
34
-    }
28
+	/**
29
+	 * @return string
30
+	 */
31
+	public function type()
32
+	{
33
+		return CoffeeMaker::BREW_NEW;
34
+	}
35 35
 
36 36
 
37 37
 
38
-    /**
39
-     * @param RecipeInterface $recipe
40
-     * @param array           $arguments
41
-     * @return mixed
42
-     */
43
-    public function brew(RecipeInterface $recipe, $arguments = array())
44
-    {
45
-        $this->resolveClassAndFilepath($recipe);
46
-        $reflector = $this->injector()->getReflectionClass($recipe->fqcn());
47
-        $method = $this->resolveInstantiationMethod($reflector);
48
-        switch ($method) {
49
-            case 'instance' :
50
-            case 'new_instance' :
51
-            case 'new_instance_from_db';
52
-                $injector = $this->injector();
53
-                $closure = function ($arguments) use ($recipe, $reflector, $method, $injector) {
54
-                    return call_user_func_array(
55
-                        array($reflector->getName(), $method),
56
-                        $injector->resolveDependencies($recipe, $reflector, $arguments)
57
-                    );
58
-                };
59
-                break;
60
-            case 'newInstance' :
61
-                $closure = function () use ($reflector) {
62
-                    return $reflector->newInstance();
63
-                };
64
-                break;
65
-            case 'newInstanceArgs' :
66
-            default :
67
-                $injector = $this->injector();
68
-                $closure = function ($arguments) use ($recipe, $reflector, $injector) {
69
-                    return $reflector->newInstanceArgs(
70
-                        $injector->resolveDependencies($recipe, $reflector, $arguments)
71
-                    );
72
-                };
73
-        }
74
-        return $this->coffeePot()->addClosure($recipe->identifier(), $closure);
75
-    }
38
+	/**
39
+	 * @param RecipeInterface $recipe
40
+	 * @param array           $arguments
41
+	 * @return mixed
42
+	 */
43
+	public function brew(RecipeInterface $recipe, $arguments = array())
44
+	{
45
+		$this->resolveClassAndFilepath($recipe);
46
+		$reflector = $this->injector()->getReflectionClass($recipe->fqcn());
47
+		$method = $this->resolveInstantiationMethod($reflector);
48
+		switch ($method) {
49
+			case 'instance' :
50
+			case 'new_instance' :
51
+			case 'new_instance_from_db';
52
+				$injector = $this->injector();
53
+				$closure = function ($arguments) use ($recipe, $reflector, $method, $injector) {
54
+					return call_user_func_array(
55
+						array($reflector->getName(), $method),
56
+						$injector->resolveDependencies($recipe, $reflector, $arguments)
57
+					);
58
+				};
59
+				break;
60
+			case 'newInstance' :
61
+				$closure = function () use ($reflector) {
62
+					return $reflector->newInstance();
63
+				};
64
+				break;
65
+			case 'newInstanceArgs' :
66
+			default :
67
+				$injector = $this->injector();
68
+				$closure = function ($arguments) use ($recipe, $reflector, $injector) {
69
+					return $reflector->newInstanceArgs(
70
+						$injector->resolveDependencies($recipe, $reflector, $arguments)
71
+					);
72
+				};
73
+		}
74
+		return $this->coffeePot()->addClosure($recipe->identifier(), $closure);
75
+	}
76 76
 
77 77
 
78 78
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             case 'new_instance' :
51 51
             case 'new_instance_from_db';
52 52
                 $injector = $this->injector();
53
-                $closure = function ($arguments) use ($recipe, $reflector, $method, $injector) {
53
+                $closure = function($arguments) use ($recipe, $reflector, $method, $injector) {
54 54
                     return call_user_func_array(
55 55
                         array($reflector->getName(), $method),
56 56
                         $injector->resolveDependencies($recipe, $reflector, $arguments)
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
                 };
59 59
                 break;
60 60
             case 'newInstance' :
61
-                $closure = function () use ($reflector) {
61
+                $closure = function() use ($reflector) {
62 62
                     return $reflector->newInstance();
63 63
                 };
64 64
                 break;
65 65
             case 'newInstanceArgs' :
66 66
             default :
67 67
                 $injector = $this->injector();
68
-                $closure = function ($arguments) use ($recipe, $reflector, $injector) {
68
+                $closure = function($arguments) use ($recipe, $reflector, $injector) {
69 69
                     return $reflector->newInstanceArgs(
70 70
                         $injector->resolveDependencies($recipe, $reflector, $arguments)
71 71
                     );
Please login to merge, or discard this patch.
core/services/container/RecipeInterface.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -17,84 +17,84 @@  discard block
 block discarded – undo
17 17
 interface RecipeInterface
18 18
 {
19 19
 
20
-    /**
21
-     * @return string
22
-     */
23
-    public function identifier();
24
-
25
-    /**
26
-     * @return string
27
-     */
28
-    public function fqcn();
29
-
30
-    /**
31
-     * @return array
32
-     */
33
-    public function ingredients();
34
-
35
-    /**
36
-     * @return string
37
-     */
38
-    public function type();
39
-
40
-    /**
41
-     * @return array
42
-     */
43
-    public function filters();
44
-
45
-    /**
46
-     * @return array
47
-     */
48
-    public function paths();
49
-
50
-    /**
51
-     * @param  string $identifier Identifier for the entity class that the Recipe applies to
52
-     *                            Typically a Fully Qualified Class Name
53
-     */
54
-    public function setIdentifier($identifier);
55
-
56
-    /**
57
-     * Ensures incoming string is a valid Fully Qualified Class Name,
58
-     * except if this is the default wildcard Recipe ( * ),
59
-     * or it's NOT an actual FQCN because the Recipe is using filepaths
60
-     * for classes that are not PSR-4 compatible
61
-     * PLZ NOTE:
62
-     *  Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not,
63
-     *  therefore you should always call Recipe::setPaths() before Recipe::setFqcn()
64
-     *
65
-     * @param string $fqcn
66
-     */
67
-    public function setFqcn($fqcn);
68
-
69
-    /**
70
-     * @param array $ingredients    an array of dependencies where keys are the aliases and values are the FQCNs
71
-     *                              example:
72
-     *                              array( 'ClassInterface' => 'Fully\Qualified\ClassName' )
73
-     */
74
-    public function setIngredients(array $ingredients);
75
-
76
-    /**
77
-     * @param string $type one of the class constants returned from CoffeeMaker::getTypes()
78
-     */
79
-    public function setType($type = CoffeeMaker::BREW_NEW);
80
-
81
-    /**
82
-     * @param array $filters    an array of filters where keys are the aliases and values are the FQCNs
83
-     *                          example:
84
-     *                          array( 'ClassInterface' => 'Fully\Qualified\ClassName' )
85
-     */
86
-    public function setFilters(array $filters);
87
-
88
-    /**
89
-     * Ensures incoming paths is a valid filepath, or array of valid filepaths,
90
-     * and merges them in with any existing filepaths
91
-     * PLZ NOTE:
92
-     *  Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not,
93
-     *  therefore you should always call Recipe::setPaths() before Recipe::setFqcn()
94
-     *
95
-     * @param string|array $paths
96
-     */
97
-    public function setPaths($paths = array());
20
+	/**
21
+	 * @return string
22
+	 */
23
+	public function identifier();
24
+
25
+	/**
26
+	 * @return string
27
+	 */
28
+	public function fqcn();
29
+
30
+	/**
31
+	 * @return array
32
+	 */
33
+	public function ingredients();
34
+
35
+	/**
36
+	 * @return string
37
+	 */
38
+	public function type();
39
+
40
+	/**
41
+	 * @return array
42
+	 */
43
+	public function filters();
44
+
45
+	/**
46
+	 * @return array
47
+	 */
48
+	public function paths();
49
+
50
+	/**
51
+	 * @param  string $identifier Identifier for the entity class that the Recipe applies to
52
+	 *                            Typically a Fully Qualified Class Name
53
+	 */
54
+	public function setIdentifier($identifier);
55
+
56
+	/**
57
+	 * Ensures incoming string is a valid Fully Qualified Class Name,
58
+	 * except if this is the default wildcard Recipe ( * ),
59
+	 * or it's NOT an actual FQCN because the Recipe is using filepaths
60
+	 * for classes that are not PSR-4 compatible
61
+	 * PLZ NOTE:
62
+	 *  Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not,
63
+	 *  therefore you should always call Recipe::setPaths() before Recipe::setFqcn()
64
+	 *
65
+	 * @param string $fqcn
66
+	 */
67
+	public function setFqcn($fqcn);
68
+
69
+	/**
70
+	 * @param array $ingredients    an array of dependencies where keys are the aliases and values are the FQCNs
71
+	 *                              example:
72
+	 *                              array( 'ClassInterface' => 'Fully\Qualified\ClassName' )
73
+	 */
74
+	public function setIngredients(array $ingredients);
75
+
76
+	/**
77
+	 * @param string $type one of the class constants returned from CoffeeMaker::getTypes()
78
+	 */
79
+	public function setType($type = CoffeeMaker::BREW_NEW);
80
+
81
+	/**
82
+	 * @param array $filters    an array of filters where keys are the aliases and values are the FQCNs
83
+	 *                          example:
84
+	 *                          array( 'ClassInterface' => 'Fully\Qualified\ClassName' )
85
+	 */
86
+	public function setFilters(array $filters);
87
+
88
+	/**
89
+	 * Ensures incoming paths is a valid filepath, or array of valid filepaths,
90
+	 * and merges them in with any existing filepaths
91
+	 * PLZ NOTE:
92
+	 *  Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not,
93
+	 *  therefore you should always call Recipe::setPaths() before Recipe::setFqcn()
94
+	 *
95
+	 * @param string|array $paths
96
+	 */
97
+	public function setPaths($paths = array());
98 98
 
99 99
 }
100 100
 // End of file RecipeInterface.php
Please login to merge, or discard this patch.
core/domain/services/capabilities/CapCheck.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
 
40 40
     /**
41
-     * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations',
41
+     * @param string $capability - the capability to be checked, like: 'ee_edit_registrations',
42 42
      *                                   or an array of capability strings
43 43
      * @param string       $context    - what the user is attempting to do, like: 'Edit Registration'
44 44
      * @param int          $ID         - (optional) ID for item where current_user_can is being called from
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use EventEspresso\core\exceptions\InvalidDataTypeException;
5 5
 
6 6
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
-    exit('No direct script access allowed');
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -20,71 +20,71 @@  discard block
 block discarded – undo
20 20
 class CapCheck implements CapCheckInterface
21 21
 {
22 22
 
23
-    /**
24
-     * @var string|array $capability
25
-     */
26
-    private $capability;
27
-
28
-    /**
29
-     * @var string $context
30
-     */
31
-    private $context;
32
-
33
-    /**
34
-     * @var int|string $ID
35
-     */
36
-    private $ID;
37
-
38
-
39
-
40
-    /**
41
-     * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations',
42
-     *                                   or an array of capability strings
43
-     * @param string       $context    - what the user is attempting to do, like: 'Edit Registration'
44
-     * @param int          $ID         - (optional) ID for item where current_user_can is being called from
45
-     */
46
-    public function __construct($capability, $context, $ID = 0)
47
-    {
48
-        if ( ! is_string($capability)) {
49
-            throw new InvalidDataTypeException('$capability', $capability, 'string');
50
-        }
51
-        if ( ! is_string($context)) {
52
-            throw new InvalidDataTypeException('$context', $context, 'string');
53
-        }
54
-        $this->capability = $capability;
55
-        $this->context = strtolower(str_replace(' ', '_', $context));
56
-        $this->ID = $ID;
57
-    }
58
-
59
-
60
-
61
-    /**
62
-     * @return string|array
63
-     */
64
-    public function capability()
65
-    {
66
-        return $this->capability;
67
-    }
68
-
69
-
70
-
71
-    /**
72
-     * @return string
73
-     */
74
-    public function context()
75
-    {
76
-        return $this->context;
77
-    }
78
-
79
-
80
-
81
-    /**
82
-     * @return int|string
83
-     */
84
-    public function ID()
85
-    {
86
-        return $this->ID;
87
-    }
23
+	/**
24
+	 * @var string|array $capability
25
+	 */
26
+	private $capability;
27
+
28
+	/**
29
+	 * @var string $context
30
+	 */
31
+	private $context;
32
+
33
+	/**
34
+	 * @var int|string $ID
35
+	 */
36
+	private $ID;
37
+
38
+
39
+
40
+	/**
41
+	 * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations',
42
+	 *                                   or an array of capability strings
43
+	 * @param string       $context    - what the user is attempting to do, like: 'Edit Registration'
44
+	 * @param int          $ID         - (optional) ID for item where current_user_can is being called from
45
+	 */
46
+	public function __construct($capability, $context, $ID = 0)
47
+	{
48
+		if ( ! is_string($capability)) {
49
+			throw new InvalidDataTypeException('$capability', $capability, 'string');
50
+		}
51
+		if ( ! is_string($context)) {
52
+			throw new InvalidDataTypeException('$context', $context, 'string');
53
+		}
54
+		$this->capability = $capability;
55
+		$this->context = strtolower(str_replace(' ', '_', $context));
56
+		$this->ID = $ID;
57
+	}
58
+
59
+
60
+
61
+	/**
62
+	 * @return string|array
63
+	 */
64
+	public function capability()
65
+	{
66
+		return $this->capability;
67
+	}
68
+
69
+
70
+
71
+	/**
72
+	 * @return string
73
+	 */
74
+	public function context()
75
+	{
76
+		return $this->context;
77
+	}
78
+
79
+
80
+
81
+	/**
82
+	 * @return int|string
83
+	 */
84
+	public function ID()
85
+	{
86
+		return $this->ID;
87
+	}
88 88
 
89 89
 
90 90
 }
Please login to merge, or discard this patch.
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -820,12 +820,12 @@  discard block
 block discarded – undo
820 820
 			if ( $registration instanceof EE_Registration ) {
821 821
 				// we display all attendee info for the primary registrant
822 822
 				if ( $this->checkout->reg_url_link === $registration->reg_url_link()
823
-				     && $registration->is_primary_registrant()
823
+					 && $registration->is_primary_registrant()
824 824
 				) {
825 825
 					$this->checkout->primary_revisit = true;
826 826
 					break;
827 827
 				} else if ( $this->checkout->revisit
828
-				            && $this->checkout->reg_url_link !== $registration->reg_url_link()
828
+							&& $this->checkout->reg_url_link !== $registration->reg_url_link()
829 829
 				) {
830 830
 					// but hide info if it doesn't belong to you
831 831
 					$transaction->clear_cache( 'Registration', $registration->ID() );
@@ -857,24 +857,24 @@  discard block
 block discarded – undo
857 857
 				//do the following for each ticket of this type they selected
858 858
 				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
859 859
 					$att_nmbr++;
860
-                    /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */
861
-                    $CreateRegistrationCommand = EE_Registry::instance()
862
-                        ->create(
863
-                           'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
864
-                           array(
865
-	                           $transaction,
866
-	                           $line_item,
867
-	                           $att_nmbr,
868
-	                           $this->checkout->total_ticket_count
869
-                           )
870
-                        );
871
-                    // override capabilities for frontend registrations
872
-                    if ( ! is_admin()) {
873
-                        $CreateRegistrationCommand->setCapCheck(
874
-                            new \EventEspresso\core\domain\services\capabilities\PublicCapabilities('',
875
-                                'create_new_registration')
876
-                        );
877
-                    }
860
+					/** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */
861
+					$CreateRegistrationCommand = EE_Registry::instance()
862
+						->create(
863
+						   'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
864
+						   array(
865
+							   $transaction,
866
+							   $line_item,
867
+							   $att_nmbr,
868
+							   $this->checkout->total_ticket_count
869
+						   )
870
+						);
871
+					// override capabilities for frontend registrations
872
+					if ( ! is_admin()) {
873
+						$CreateRegistrationCommand->setCapCheck(
874
+							new \EventEspresso\core\domain\services\capabilities\PublicCapabilities('',
875
+								'create_new_registration')
876
+						);
877
+					}
878 878
 					$registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand );
879 879
 					if ( ! $registration instanceof EE_Registration ) {
880 880
 						throw new InvalidEntityException(
Please login to merge, or discard this patch.
Spacing   +279 added lines, -279 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\InvalidEntityException;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
4 4
 /**
5 5
  * Single Page Checkout (SPCO)
6 6
  *
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	 * @return EED_Single_Page_Checkout
50 50
 	 */
51 51
 	public static function instance() {
52
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
53
-		return parent::get_instance( __CLASS__ );
52
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
53
+		return parent::get_instance(__CLASS__);
54 54
 	}
55 55
 
56 56
 
@@ -95,22 +95,22 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public static function set_hooks_admin() {
97 97
 		EED_Single_Page_Checkout::set_definitions();
98
-		if ( defined( 'DOING_AJAX' )) {
98
+		if (defined('DOING_AJAX')) {
99 99
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
100 100
 			ob_start();
101 101
 			EED_Single_Page_Checkout::load_request_handler();
102 102
 			EED_Single_Page_Checkout::load_reg_steps();
103 103
 		} else {
104 104
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
105
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
105
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
106 106
 		}
107 107
 		// set ajax hooks
108
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
109
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
110
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
111
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
112
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
113
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
108
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
109
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
110
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
111
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
112
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
113
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
114 114
 	}
115 115
 
116 116
 
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param string $ajax_action
122 122
 	 * @throws \EE_Error
123 123
 	 */
124
-	public static function process_ajax_request( $ajax_action ) {
125
-		EE_Registry::instance()->REQ->set( 'action', $ajax_action );
124
+	public static function process_ajax_request($ajax_action) {
125
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
126 126
 		EED_Single_Page_Checkout::instance()->_initialize();
127 127
 	}
128 128
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @throws \EE_Error
135 135
 	 */
136 136
 	public static function display_reg_step() {
137
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
137
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
138 138
 	}
139 139
 
140 140
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @throws \EE_Error
146 146
 	 */
147 147
 	public static function process_reg_step() {
148
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
148
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
149 149
 	}
150 150
 
151 151
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * @throws \EE_Error
157 157
 	 */
158 158
 	public static function update_reg_step() {
159
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
159
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
160 160
 	}
161 161
 
162 162
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @throws \EE_Error
170 170
 	 */
171 171
 	public static function update_checkout() {
172
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
172
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
173 173
 	}
174 174
 
175 175
 
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public static function load_request_handler() {
184 184
 		// load core Request_Handler class
185
-		if ( ! isset( EE_Registry::instance()->REQ )) {
186
-			EE_Registry::instance()->load_core( 'Request_Handler' );
185
+		if ( ! isset(EE_Registry::instance()->REQ)) {
186
+			EE_Registry::instance()->load_core('Request_Handler');
187 187
 		}
188 188
 	}
189 189
 
@@ -197,21 +197,21 @@  discard block
 block discarded – undo
197 197
 	 * @throws \EE_Error
198 198
 	 */
199 199
 	public static function set_definitions() {
200
-		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
201
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
202
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
203
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
204
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
205
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
206
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
207
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
208
-		EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ] = sprintf(
209
-			__( '%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
200
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
201
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
202
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
203
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
204
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
205
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
206
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
207
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
208
+		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
209
+			__('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
210 210
 			'<h4 class="important-notice">',
211 211
 			'</h4>',
212 212
 			'<br />',
213 213
 			'<p>',
214
-			'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
214
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
215 215
 			'">',
216 216
 			'</a>',
217 217
 			'</p>'
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	public static function load_reg_steps() {
232 232
 		static $reg_steps_loaded = FALSE;
233
-		if ( $reg_steps_loaded ) {
233
+		if ($reg_steps_loaded) {
234 234
 			return;
235 235
 		}
236 236
 		// filter list of reg_steps
@@ -239,24 +239,24 @@  discard block
 block discarded – undo
239 239
 			EED_Single_Page_Checkout::get_reg_steps()
240 240
 		);
241 241
 		// sort by key (order)
242
-		ksort( $reg_steps_to_load );
242
+		ksort($reg_steps_to_load);
243 243
 		// loop through folders
244
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
244
+		foreach ($reg_steps_to_load as $order => $reg_step) {
245 245
 			// we need a
246
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
246
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
247 247
 				// copy over to the reg_steps_array
248
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
248
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
249 249
 				// register custom key route for each reg step
250 250
 				// ie: step=>"slug" - this is the entire reason we load the reg steps array now
251
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
251
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
252 252
 				// add AJAX or other hooks
253
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
253
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
254 254
 					// setup autoloaders if necessary
255
-					if ( ! class_exists( $reg_step['class_name'] )) {
256
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
255
+					if ( ! class_exists($reg_step['class_name'])) {
256
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
257 257
 					}
258
-					if ( is_callable( $reg_step['class_name'], 'set_hooks' )) {
259
-						call_user_func( array( $reg_step['class_name'], 'set_hooks' ));
258
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
259
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
260 260
 					}
261 261
 				}
262 262
 			}
@@ -275,28 +275,28 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	public static function get_reg_steps() {
277 277
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
278
-		if ( empty( $reg_steps )) {
278
+		if (empty($reg_steps)) {
279 279
 			$reg_steps = array(
280 280
 				10 => array(
281
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
281
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
282 282
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
283 283
 					'slug' => 'attendee_information',
284 284
 					'has_hooks' => FALSE
285 285
 				),
286 286
 				20 => array(
287
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
287
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
288 288
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
289 289
 					'slug' => 'registration_confirmation',
290 290
 					'has_hooks' => FALSE
291 291
 				),
292 292
 				30 => array(
293
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
293
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
294 294
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
295 295
 					'slug' => 'payment_options',
296 296
 					'has_hooks' => TRUE
297 297
 				),
298 298
 				999 => array(
299
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
299
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
300 300
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
301 301
 					'slug' => 'finalize_registration',
302 302
 					'has_hooks' => FALSE
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public static function registration_checkout_for_admin() {
319 319
 		EED_Single_Page_Checkout::load_reg_steps();
320
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
321
-		EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' );
322
-		EE_Registry::instance()->REQ->set( 'process_form_submission', false );
320
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
321
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
322
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
323 323
 		EED_Single_Page_Checkout::instance()->_initialize();
324 324
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
325 325
 		return EE_Registry::instance()->REQ->get_output();
@@ -336,15 +336,15 @@  discard block
 block discarded – undo
336 336
 	 */
337 337
 	public static function process_registration_from_admin() {
338 338
 		EED_Single_Page_Checkout::load_reg_steps();
339
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
340
-		EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' );
341
-		EE_Registry::instance()->REQ->set( 'process_form_submission', true );
339
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
340
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
341
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
342 342
 		EED_Single_Page_Checkout::instance()->_initialize();
343
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
344
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
345
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
346
-				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step );
347
-				if ( $final_reg_step->process_reg_step() ) {
343
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
344
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
345
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
346
+				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step);
347
+				if ($final_reg_step->process_reg_step()) {
348 348
 					$final_reg_step->set_completed();
349 349
 					EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array();
350 350
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
@@ -364,11 +364,11 @@  discard block
 block discarded – undo
364 364
 	 * @return    void
365 365
 	 * @throws \EE_Error
366 366
 	 */
367
-	public function run( $WP_Query ) {
367
+	public function run($WP_Query) {
368 368
 		if (
369 369
 			$WP_Query instanceof WP_Query
370 370
 			&& $WP_Query->is_main_query()
371
-			&& apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )
371
+			&& apply_filters('FHEE__EED_Single_Page_Checkout__run', true)
372 372
 		) {
373 373
 			$this->_initialize();
374 374
 		}
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
 	 * @return    void
385 385
 	 * @throws \EE_Error
386 386
 	 */
387
-	public static function init( $WP_Query ) {
388
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
387
+	public static function init($WP_Query) {
388
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
389 389
 	}
390 390
 
391 391
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	 */
400 400
 	private function _initialize() {
401 401
 		// ensure SPCO doesn't run twice
402
-		if ( EED_Single_Page_Checkout::$_initialized ) {
402
+		if (EED_Single_Page_Checkout::$_initialized) {
403 403
 			return;
404 404
 		}
405 405
 		try {
@@ -407,22 +407,22 @@  discard block
 block discarded – undo
407 407
 			// setup the EE_Checkout object
408 408
 			$this->checkout = $this->_initialize_checkout();
409 409
 			// filter checkout
410
-			$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
410
+			$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
411 411
 			// get the $_GET
412 412
 			$this->_get_request_vars();
413 413
 			// filter continue_reg
414
-			$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
414
+			$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
415 415
 			// load the reg steps array
416
-			if ( ! $this->_load_and_instantiate_reg_steps() ) {
416
+			if ( ! $this->_load_and_instantiate_reg_steps()) {
417 417
 				EED_Single_Page_Checkout::$_initialized = true;
418 418
 				return;
419 419
 			}
420 420
 			// set the current step
421
-			$this->checkout->set_current_step( $this->checkout->step );
421
+			$this->checkout->set_current_step($this->checkout->step);
422 422
 			// and the next step
423 423
 			$this->checkout->set_next_step();
424 424
 			// verify that everything has been setup correctly
425
-			if ( ! ( $this->_verify_transaction_and_get_registrations() && $this->_final_verifications() ) ) {
425
+			if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) {
426 426
 				EED_Single_Page_Checkout::$_initialized = true;
427 427
 				return;
428 428
 			}
@@ -447,11 +447,11 @@  discard block
 block discarded – undo
447 447
 			// set no cache headers and constants
448 448
 			EE_System::do_not_cache();
449 449
 			// add anchor
450
-			add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
450
+			add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
451 451
 			// remove transaction lock
452
-			add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 );
453
-		} catch ( Exception $e ) {
454
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
452
+			add_action('shutdown', array($this, 'unlock_transaction'), 1);
453
+		} catch (Exception $e) {
454
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
455 455
 		}
456 456
 	}
457 457
 
@@ -465,16 +465,16 @@  discard block
 block discarded – undo
465 465
 	 * @throws EE_Error
466 466
 	 */
467 467
 	private function _verify_session() {
468
-		if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) {
469
-			throw new EE_Error( __( 'The EE_Session class could not be loaded.', 'event_espresso' ) );
468
+		if ( ! EE_Registry::instance()->SSN instanceof EE_Session) {
469
+			throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso'));
470 470
 		}
471 471
 		// is session still valid ?
472
-		if ( EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) === '' ) {
472
+		if (EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '') {
473 473
 			$this->checkout = new EE_Checkout();
474 474
 			EE_Registry::instance()->SSN->reset_cart();
475 475
 			EE_Registry::instance()->SSN->reset_checkout();
476 476
 			EE_Registry::instance()->SSN->reset_transaction();
477
-			EE_Error::add_attention( EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ], __FILE__, __FUNCTION__, __LINE__ );
477
+			EE_Error::add_attention(EE_Registry::$i18n_js_strings['registration_expiration_notice'], __FILE__, __FUNCTION__, __LINE__);
478 478
 			EE_Registry::instance()->SSN->reset_expired();
479 479
 		}
480 480
 	}
@@ -494,20 +494,20 @@  discard block
 block discarded – undo
494 494
 		/** @type EE_Checkout $checkout */
495 495
 		$checkout = EE_Registry::instance()->SSN->checkout();
496 496
 		// verify
497
-		if ( ! $checkout instanceof EE_Checkout ) {
497
+		if ( ! $checkout instanceof EE_Checkout) {
498 498
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
499
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
499
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
500 500
 		} else {
501
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
501
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
502 502
 				$this->unlock_transaction();
503
-				wp_safe_redirect( $checkout->redirect_url );
503
+				wp_safe_redirect($checkout->redirect_url);
504 504
 				exit();
505 505
 			}
506 506
 		}
507
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
507
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
508 508
 		// verify again
509
-		if ( ! $checkout instanceof EE_Checkout ) {
510
-			throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
509
+		if ( ! $checkout instanceof EE_Checkout) {
510
+			throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
511 511
 		}
512 512
 		// reset anything that needs a clean slate for each request
513 513
 		$checkout->reset_for_current_request();
@@ -527,24 +527,24 @@  discard block
 block discarded – undo
527 527
 		// load classes
528 528
 		EED_Single_Page_Checkout::load_request_handler();
529 529
 		//make sure this request is marked as belonging to EE
530
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
530
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
531 531
 		// which step is being requested ?
532
-		$this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() );
532
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
533 533
 		// which step is being edited ?
534
-		$this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' );
534
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
535 535
 		// and what we're doing on the current step
536
-		$this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' );
536
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
537 537
 		// returning to edit ?
538
-		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' );
538
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
539 539
 		// or some other kind of revisit ?
540
-		$this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
540
+		$this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE);
541 541
 		// and whether or not to generate a reg form for this request
542
-		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
542
+		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE 	FALSE
543 543
 		// and whether or not to process a reg form submission for this request
544
-		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
544
+		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE 	FALSE
545 545
 		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step'
546 546
 			? $this->checkout->process_form_submission
547
-			: FALSE; 		// TRUE 	FALSE
547
+			: FALSE; // TRUE 	FALSE
548 548
 		// $this->_display_request_vars();
549 549
 	}
550 550
 
@@ -557,17 +557,17 @@  discard block
 block discarded – undo
557 557
 	 * @return    void
558 558
 	 */
559 559
 	protected function _display_request_vars() {
560
-		if ( ! WP_DEBUG ) {
560
+		if ( ! WP_DEBUG) {
561 561
 			return;
562 562
 		}
563
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
564
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
565
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
566
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
567
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
568
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
569
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
570
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
563
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
564
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
565
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
566
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
567
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
568
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
569
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
570
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
571 571
 	}
572 572
 
573 573
 
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 	 * @return    array
582 582
 	 */
583 583
 	private function _get_first_step() {
584
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
585
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
584
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
585
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
586 586
 	}
587 587
 
588 588
 
@@ -598,27 +598,27 @@  discard block
 block discarded – undo
598 598
 	private function _load_and_instantiate_reg_steps() {
599 599
 		// have reg_steps already been instantiated ?
600 600
 		if (
601
-			empty( $this->checkout->reg_steps ) ||
602
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
601
+			empty($this->checkout->reg_steps) ||
602
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
603 603
 		) {
604 604
 			// if not, then loop through raw reg steps array
605
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
606
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
605
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
606
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
607 607
 					return false;
608 608
 				}
609 609
 			}
610 610
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
611 611
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
612 612
 			// skip the registration_confirmation page ?
613
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
613
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
614 614
 				// just remove it from the reg steps array
615
-				$this->checkout->remove_reg_step( 'registration_confirmation', false );
615
+				$this->checkout->remove_reg_step('registration_confirmation', false);
616 616
 			} else if (
617
-				isset( $this->checkout->reg_steps['registration_confirmation'] )
617
+				isset($this->checkout->reg_steps['registration_confirmation'])
618 618
 				&& EE_Registry::instance()->CFG->registration->reg_confirmation_last
619 619
 			) {
620 620
 				// set the order to something big like 100
621
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
621
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
622 622
 			}
623 623
 			// filter the array for good luck
624 624
 			$this->checkout->reg_steps = apply_filters(
@@ -628,13 +628,13 @@  discard block
 block discarded – undo
628 628
 			// finally re-sort based on the reg step class order properties
629 629
 			$this->checkout->sort_reg_steps();
630 630
 		} else {
631
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
631
+			foreach ($this->checkout->reg_steps as $reg_step) {
632 632
 				// set all current step stati to FALSE
633
-				$reg_step->set_is_current_step( FALSE );
633
+				$reg_step->set_is_current_step(FALSE);
634 634
 			}
635 635
 		}
636
-		if ( empty( $this->checkout->reg_steps )) {
637
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
636
+		if (empty($this->checkout->reg_steps)) {
637
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
638 638
 			return false;
639 639
 		}
640 640
 			// make reg step details available to JS
@@ -652,10 +652,10 @@  discard block
 block discarded – undo
652 652
 	 * @param int   $order
653 653
 	 * @return bool
654 654
 	 */
655
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
655
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
656 656
 
657 657
 		// we need a file_path, class_name, and slug to add a reg step
658
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
658
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
659 659
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
660 660
 			if (
661 661
 				$this->checkout->reg_url_link
@@ -673,26 +673,26 @@  discard block
 block discarded – undo
673 673
 				FALSE
674 674
 			);
675 675
 			// did we gets the goods ?
676
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
676
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
677 677
 				// set reg step order based on config
678
-				$reg_step_obj->set_order( $order );
678
+				$reg_step_obj->set_order($order);
679 679
 				// add instantiated reg step object to the master reg steps array
680
-				$this->checkout->add_reg_step( $reg_step_obj );
680
+				$this->checkout->add_reg_step($reg_step_obj);
681 681
 			} else {
682 682
 				EE_Error::add_error(
683
-					__( 'The current step could not be set.', 'event_espresso' ),
683
+					__('The current step could not be set.', 'event_espresso'),
684 684
 					__FILE__, __FUNCTION__, __LINE__
685 685
 				);
686 686
 				return false;
687 687
 			}
688 688
 		} else {
689
-			if ( WP_DEBUG ) {
689
+			if (WP_DEBUG) {
690 690
 				EE_Error::add_error(
691 691
 					sprintf(
692
-						__( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ),
693
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
694
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
695
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
692
+						__('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'),
693
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
694
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
695
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
696 696
 						'<ul>',
697 697
 						'<li>',
698 698
 						'</li>',
@@ -716,15 +716,15 @@  discard block
 block discarded – undo
716 716
 	 */
717 717
 	private function _verify_transaction_and_get_registrations() {
718 718
 		// was there already a valid transaction in the checkout from the session ?
719
-		if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
719
+		if ( ! $this->checkout->transaction instanceof EE_Transaction) {
720 720
 			// get transaction from db or session
721 721
 			$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin()
722 722
 				? $this->_get_transaction_and_cart_for_previous_visit()
723 723
 				: $this->_get_cart_for_current_session_and_setup_new_transaction();
724 724
 
725
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
725
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
726 726
 				EE_Error::add_error(
727
-					__( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ),
727
+					__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'),
728 728
 					__FILE__, __FUNCTION__, __LINE__
729 729
 				);
730 730
 				$this->checkout->transaction = EE_Transaction::new_instance();
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 				return false;
735 735
 			}
736 736
 			// and the registrations for the transaction
737
-			$this->_get_registrations( $this->checkout->transaction );
737
+			$this->_get_registrations($this->checkout->transaction);
738 738
 		}
739 739
 		return true;
740 740
 	}
@@ -749,16 +749,16 @@  discard block
 block discarded – undo
749 749
 	 */
750 750
 	private function _get_transaction_and_cart_for_previous_visit() {
751 751
 		/** @var $TXN_model EEM_Transaction */
752
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
752
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
753 753
 		// because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
754
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
754
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
755 755
 		// verify transaction
756
-		if ( $transaction instanceof EE_Transaction ) {
756
+		if ($transaction instanceof EE_Transaction) {
757 757
 			// and get the cart that was used for that transaction
758
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
758
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
759 759
 			return $transaction;
760 760
 		} else {
761
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
761
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
762 762
 			return NULL;
763 763
 		}
764 764
 	}
@@ -772,8 +772,8 @@  discard block
 block discarded – undo
772 772
 	 * @param EE_Transaction $transaction
773 773
 	 * @return EE_Cart
774 774
 	 */
775
-	private function _get_cart_for_transaction( $transaction ) {
776
-		return $this->checkout->get_cart_for_transaction( $transaction );
775
+	private function _get_cart_for_transaction($transaction) {
776
+		return $this->checkout->get_cart_for_transaction($transaction);
777 777
 	}
778 778
 
779 779
 
@@ -785,8 +785,8 @@  discard block
 block discarded – undo
785 785
 	 * @param EE_Transaction $transaction
786 786
 	 * @return EE_Cart
787 787
 	 */
788
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
789
-		return $this->checkout->get_cart_for_transaction( $transaction );
788
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
789
+		return $this->checkout->get_cart_for_transaction($transaction);
790 790
 	}
791 791
 
792 792
 
@@ -802,15 +802,15 @@  discard block
 block discarded – undo
802 802
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
803 803
 		//  if there's no transaction, then this is the FIRST visit to SPCO
804 804
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
805
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
805
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
806 806
 		// and then create a new transaction
807 807
 		$transaction = $this->_initialize_transaction();
808 808
 		// verify transaction
809
-		if ( $transaction instanceof EE_Transaction ) {
809
+		if ($transaction instanceof EE_Transaction) {
810 810
 			// and save TXN data to the cart
811
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
811
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
812 812
 		} else {
813
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
813
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
814 814
 		}
815 815
 		return $transaction;
816 816
 	}
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 			// grab the cart grand total
831 831
 			$cart_total = $this->checkout->cart->get_cart_grand_total();
832 832
 			// create new TXN
833
-			$transaction = EE_Transaction::new_instance( array(
833
+			$transaction = EE_Transaction::new_instance(array(
834 834
 				'TXN_timestamp' 	=> time(),
835 835
 				'TXN_reg_steps' 		=> $this->checkout->initialize_txn_reg_steps_array(),
836 836
 				'TXN_total' 				=> $cart_total > 0 ? $cart_total : 0,
@@ -845,8 +845,8 @@  discard block
 block discarded – undo
845 845
 				$transaction->ID()
846 846
 			);
847 847
 			return $transaction;
848
-		} catch( Exception $e ) {
849
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
848
+		} catch (Exception $e) {
849
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
850 850
 		}
851 851
 		return NULL;
852 852
 	}
@@ -861,38 +861,38 @@  discard block
 block discarded – undo
861 861
 	 * @return EE_Cart
862 862
 	 * @throws \EE_Error
863 863
 	 */
864
-	private function _get_registrations( EE_Transaction $transaction ) {
864
+	private function _get_registrations(EE_Transaction $transaction) {
865 865
 		// first step: grab the registrants  { : o
866
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
866
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
867 867
 		// verify registrations have been set
868
-		if ( empty( $registrations )) {
868
+		if (empty($registrations)) {
869 869
 			// if no cached registrations, then check the db
870
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
870
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
871 871
 			// still nothing ? well as long as this isn't a revisit
872
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
872
+			if (empty($registrations) && ! $this->checkout->revisit) {
873 873
 				// generate new registrations from scratch
874
-				$registrations = $this->_initialize_registrations( $transaction );
874
+				$registrations = $this->_initialize_registrations($transaction);
875 875
 			}
876 876
 		}
877 877
 		// sort by their original registration order
878
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
878
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
879 879
 		// then loop thru the array
880
-		foreach ( $registrations as $registration ) {
880
+		foreach ($registrations as $registration) {
881 881
 			// verify each registration
882
-			if ( $registration instanceof EE_Registration ) {
882
+			if ($registration instanceof EE_Registration) {
883 883
 				// we display all attendee info for the primary registrant
884
-				if ( $this->checkout->reg_url_link === $registration->reg_url_link()
884
+				if ($this->checkout->reg_url_link === $registration->reg_url_link()
885 885
 				     && $registration->is_primary_registrant()
886 886
 				) {
887 887
 					$this->checkout->primary_revisit = true;
888 888
 					break;
889
-				} else if ( $this->checkout->revisit
889
+				} else if ($this->checkout->revisit
890 890
 				            && $this->checkout->reg_url_link !== $registration->reg_url_link()
891 891
 				) {
892 892
 					// but hide info if it doesn't belong to you
893
-					$transaction->clear_cache( 'Registration', $registration->ID() );
893
+					$transaction->clear_cache('Registration', $registration->ID());
894 894
 				}
895
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
895
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
896 896
 			}
897 897
 		}
898 898
 	}
@@ -907,17 +907,17 @@  discard block
 block discarded – undo
907 907
 	 * @return    array
908 908
 	 * @throws \EE_Error
909 909
 	 */
910
-	private function _initialize_registrations( EE_Transaction $transaction ) {
910
+	private function _initialize_registrations(EE_Transaction $transaction) {
911 911
 		$att_nmbr = 0;
912 912
 		$registrations = array();
913
-		if ( $transaction instanceof EE_Transaction ) {
913
+		if ($transaction instanceof EE_Transaction) {
914 914
 			/** @type EE_Registration_Processor $registration_processor */
915
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
915
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
916 916
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
917 917
 			// now let's add the cart items to the $transaction
918
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
918
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
919 919
 				//do the following for each ticket of this type they selected
920
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
920
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
921 921
 					$att_nmbr++;
922 922
                     /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */
923 923
                     $CreateRegistrationCommand = EE_Registry::instance()
@@ -937,17 +937,17 @@  discard block
 block discarded – undo
937 937
                                 'create_new_registration')
938 938
                         );
939 939
                     }
940
-					$registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand );
941
-					if ( ! $registration instanceof EE_Registration ) {
940
+					$registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand);
941
+					if ( ! $registration instanceof EE_Registration) {
942 942
 						throw new InvalidEntityException(
943
-							is_object( $registration ) ? get_class( $registration ) : gettype( $registration ),
943
+							is_object($registration) ? get_class($registration) : gettype($registration),
944 944
 							'EE_Registration'
945 945
 						);
946 946
 					}
947
-					$registrations[ $registration->ID() ] = $registration;
947
+					$registrations[$registration->ID()] = $registration;
948 948
 				}
949 949
 			}
950
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
950
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
951 951
 		}
952 952
 		return $registrations;
953 953
 	}
@@ -962,12 +962,12 @@  discard block
 block discarded – undo
962 962
 	 * @param EE_Registration $reg_B
963 963
 	 * @return int
964 964
 	 */
965
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
965
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
966 966
 		// this shouldn't ever happen within the same TXN, but oh well
967
-		if ( $reg_A->count() === $reg_B->count() ) {
967
+		if ($reg_A->count() === $reg_B->count()) {
968 968
 			return 0;
969 969
 		}
970
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
970
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
971 971
 	}
972 972
 
973 973
 
@@ -982,21 +982,21 @@  discard block
 block discarded – undo
982 982
 	 */
983 983
 	private function _final_verifications() {
984 984
 		// filter checkout
985
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
985
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
986 986
 		//verify that current step is still set correctly
987
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
988
-			EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
987
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
988
+			EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
989 989
 			return false;
990 990
 		}
991 991
 		// if returning to SPCO, then verify that primary registrant is set
992
-		if ( ! empty( $this->checkout->reg_url_link )) {
992
+		if ( ! empty($this->checkout->reg_url_link)) {
993 993
 			$valid_registrant = $this->checkout->transaction->primary_registration();
994
-			if ( ! $valid_registrant instanceof EE_Registration ) {
995
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
994
+			if ( ! $valid_registrant instanceof EE_Registration) {
995
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
996 996
 				return false;
997 997
 			}
998 998
 			$valid_registrant = null;
999
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
999
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
1000 1000
 				if (
1001 1001
 					$registration instanceof EE_Registration
1002 1002
 					&& $registration->reg_url_link() === $this->checkout->reg_url_link
@@ -1004,9 +1004,9 @@  discard block
 block discarded – undo
1004 1004
 					$valid_registrant = $registration;
1005 1005
 				}
1006 1006
 			}
1007
-			if ( ! $valid_registrant instanceof EE_Registration ) {
1007
+			if ( ! $valid_registrant instanceof EE_Registration) {
1008 1008
 				// hmmm... maybe we have the wrong session because the user is opening multiple tabs ?
1009
-				if ( EED_Single_Page_Checkout::$_checkout_verified ) {
1009
+				if (EED_Single_Page_Checkout::$_checkout_verified) {
1010 1010
 					// clear the session, mark the checkout as unverified, and try again
1011 1011
 					EE_Registry::instance()->SSN->clear_session();
1012 1012
 					EED_Single_Page_Checkout::$_initialized = false;
@@ -1015,13 +1015,13 @@  discard block
 block discarded – undo
1015 1015
 					EE_Error::reset_notices();
1016 1016
 					return false;
1017 1017
 				}
1018
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1018
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1019 1019
 				return false;
1020 1020
 			}
1021 1021
 		}
1022 1022
 		// now that things have been kinda sufficiently verified,
1023 1023
 		// let's add the checkout to the session so that's available other systems
1024
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
1024
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
1025 1025
 		return true;
1026 1026
 	}
1027 1027
 
@@ -1036,15 +1036,15 @@  discard block
 block discarded – undo
1036 1036
 	 * @param bool $reinitializing
1037 1037
 	 * @throws \EE_Error
1038 1038
 	 */
1039
-	private function _initialize_reg_steps( $reinitializing = false ) {
1040
-		$this->checkout->set_reg_step_initiated( $this->checkout->current_step );
1039
+	private function _initialize_reg_steps($reinitializing = false) {
1040
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
1041 1041
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
1042
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
1043
-			if ( ! $reg_step->initialize_reg_step() ) {
1042
+		foreach ($this->checkout->reg_steps as $reg_step) {
1043
+			if ( ! $reg_step->initialize_reg_step()) {
1044 1044
 				// if not initialized then maybe this step is being removed...
1045
-				if ( ! $reinitializing && $reg_step->is_current_step() ) {
1045
+				if ( ! $reinitializing && $reg_step->is_current_step()) {
1046 1046
 					// if it was the current step, then we need to start over here
1047
-					$this->_initialize_reg_steps( true );
1047
+					$this->_initialize_reg_steps(true);
1048 1048
 					return;
1049 1049
 				}
1050 1050
 				continue;
@@ -1053,13 +1053,13 @@  discard block
 block discarded – undo
1053 1053
 			$reg_step->enqueue_styles_and_scripts();
1054 1054
 			// i18n
1055 1055
 			$reg_step->translate_js_strings();
1056
-			if ( $reg_step->is_current_step() ) {
1056
+			if ($reg_step->is_current_step()) {
1057 1057
 				// the text that appears on the reg step form submit button
1058 1058
 				$reg_step->set_submit_button_text();
1059 1059
 			}
1060 1060
 		}
1061 1061
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
1062
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
1062
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
1063 1063
 	}
1064 1064
 
1065 1065
 
@@ -1072,43 +1072,43 @@  discard block
 block discarded – undo
1072 1072
 	 */
1073 1073
 	private function _check_form_submission() {
1074 1074
 		//does this request require the reg form to be generated ?
1075
-		if ( $this->checkout->generate_reg_form ) {
1075
+		if ($this->checkout->generate_reg_form) {
1076 1076
 			// ever heard that song by Blue Rodeo ?
1077 1077
 			try {
1078 1078
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
1079 1079
 				// if not displaying a form, then check for form submission
1080
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
1080
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
1081 1081
 					// clear out any old data in case this step is being run again
1082
-					$this->checkout->current_step->set_valid_data( array() );
1082
+					$this->checkout->current_step->set_valid_data(array());
1083 1083
 					// capture submitted form data
1084 1084
 					$this->checkout->current_step->reg_form->receive_form_submission(
1085
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout )
1085
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout)
1086 1086
 					);
1087 1087
 					// validate submitted form data
1088
-					if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) {
1088
+					if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) {
1089 1089
 						// thou shall not pass !!!
1090 1090
 						$this->checkout->continue_reg = FALSE;
1091 1091
 						// any form validation errors?
1092
-						if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) {
1092
+						if ($this->checkout->current_step->reg_form->submission_error_message() !== '') {
1093 1093
 							$submission_error_messages = array();
1094 1094
 							// bad, bad, bad registrant
1095
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
1096
-								if ( $validation_error instanceof EE_Validation_Error ) {
1095
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
1096
+								if ($validation_error instanceof EE_Validation_Error) {
1097 1097
 									$submission_error_messages[] = sprintf(
1098
-										__( '%s : %s', 'event_espresso' ),
1098
+										__('%s : %s', 'event_espresso'),
1099 1099
 										$validation_error->get_form_section()->html_label_text(),
1100 1100
 										$validation_error->getMessage()
1101 1101
 									);
1102 1102
 								}
1103 1103
 							}
1104
-							EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1104
+							EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1105 1105
 						}
1106 1106
 						// well not really... what will happen is we'll just get redirected back to redo the current step
1107 1107
 						$this->go_to_next_step();
1108 1108
 						return;
1109 1109
 					}
1110 1110
 				}
1111
-			} catch( EE_Error $e ) {
1111
+			} catch (EE_Error $e) {
1112 1112
 				$e->get_error();
1113 1113
 			}
1114 1114
 		}
@@ -1125,22 +1125,22 @@  discard block
 block discarded – undo
1125 1125
 	 */
1126 1126
 	private function _process_form_action() {
1127 1127
 		// what cha wanna do?
1128
-		switch( $this->checkout->action ) {
1128
+		switch ($this->checkout->action) {
1129 1129
 			// AJAX next step reg form
1130 1130
 			case 'display_spco_reg_step' :
1131 1131
 				$this->checkout->redirect = FALSE;
1132
-				if ( EE_Registry::instance()->REQ->ajax ) {
1133
-					$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
1132
+				if (EE_Registry::instance()->REQ->ajax) {
1133
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
1134 1134
 				}
1135 1135
 				break;
1136 1136
 
1137 1137
 			default :
1138 1138
 				// meh... do one of those other steps first
1139
-				if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
1139
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
1140 1140
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
1141
-					do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1141
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1142 1142
 					// call action on current step
1143
-					if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) {
1143
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
1144 1144
 						// good registrant, you get to proceed
1145 1145
 						if (
1146 1146
 							$this->checkout->current_step->success_message() !== ''
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
 						) {
1152 1152
 								EE_Error::add_success(
1153 1153
 									$this->checkout->current_step->success_message()
1154
-									. '<br />' . $this->checkout->next_step->_instructions()
1154
+									. '<br />'.$this->checkout->next_step->_instructions()
1155 1155
 								);
1156 1156
 
1157 1157
 						}
@@ -1159,12 +1159,12 @@  discard block
 block discarded – undo
1159 1159
 						$this->_setup_redirect();
1160 1160
 					}
1161 1161
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
1162
-					do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1162
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1163 1163
 
1164 1164
 				} else {
1165 1165
 					EE_Error::add_error(
1166 1166
 						sprintf(
1167
-							__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1167
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1168 1168
 							$this->checkout->action,
1169 1169
 							$this->checkout->current_step->name()
1170 1170
 						),
@@ -1190,10 +1190,10 @@  discard block
 block discarded – undo
1190 1190
 	public function add_styles_and_scripts() {
1191 1191
 		// i18n
1192 1192
 		$this->translate_js_strings();
1193
-		if ( $this->checkout->admin_request ) {
1194
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1193
+		if ($this->checkout->admin_request) {
1194
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1195 1195
 		} else {
1196
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1196
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1197 1197
 		}
1198 1198
 	}
1199 1199
 
@@ -1209,50 +1209,50 @@  discard block
 block discarded – undo
1209 1209
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1210 1210
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1211 1211
 		EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1212
-		EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' );
1213
-		EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' );
1214
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' );
1212
+		EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1213
+		EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso');
1214
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso');
1215 1215
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1216 1216
 		EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso');
1217 1217
 		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(
1218
-			__( 'Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso' ),
1218
+			__('Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso'),
1219 1219
 			'<br/>'
1220 1220
 		);
1221
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1221
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1222 1222
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1223 1223
 		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1224 1224
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1225
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1226
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1227
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1228
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1229
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1230
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1231
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1232
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1233
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1234
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1235
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1236
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1237
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1238
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1225
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1226
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1227
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1228
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1229
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1230
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1231
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1232
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1233
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1234
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1235
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1236
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1237
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1238
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1239 1239
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1240
-			__( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
1240
+			__('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
1241 1241
 			'<h4 class="important-notice">',
1242 1242
 			'</h4>',
1243 1243
 			'<br />',
1244 1244
 			'<p>',
1245
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1245
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1246 1246
 			'">',
1247 1247
 			'</a>',
1248 1248
 			'</p>'
1249 1249
 		);
1250
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1251
-		EE_Registry::$i18n_js_strings[ 'session_extension' ] = absint(
1252
-			apply_filters( 'FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS )
1250
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1251
+		EE_Registry::$i18n_js_strings['session_extension'] = absint(
1252
+			apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS)
1253 1253
 		);
1254
-		EE_Registry::$i18n_js_strings[ 'session_expiration' ] = gmdate(
1255
-			'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS )
1254
+		EE_Registry::$i18n_js_strings['session_expiration'] = gmdate(
1255
+			'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)
1256 1256
 		);
1257 1257
 
1258 1258
 
@@ -1268,31 +1268,31 @@  discard block
 block discarded – undo
1268 1268
 	 */
1269 1269
 	public function enqueue_styles_and_scripts() {
1270 1270
 		// load css
1271
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1272
-		wp_enqueue_style( 'single_page_checkout' );
1271
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1272
+		wp_enqueue_style('single_page_checkout');
1273 1273
 		// load JS
1274
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1275
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1274
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1275
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1276 1276
 		wp_register_script(
1277 1277
 			'single_page_checkout',
1278
-			SPCO_JS_URL . 'single_page_checkout.js',
1279
-			array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ),
1278
+			SPCO_JS_URL.'single_page_checkout.js',
1279
+			array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'),
1280 1280
 			EVENT_ESPRESSO_VERSION,
1281 1281
 			TRUE
1282 1282
 		);
1283
-		wp_enqueue_script( 'single_page_checkout' );
1283
+		wp_enqueue_script('single_page_checkout');
1284 1284
 
1285 1285
 		/**
1286 1286
 		 * global action hook for enqueueing styles and scripts with
1287 1287
 		 * spco calls.
1288 1288
 		 */
1289
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1289
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1290 1290
 
1291 1291
 		/**
1292 1292
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1293 1293
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1294 1294
 		 */
1295
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1295
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1296 1296
 
1297 1297
 	}
1298 1298
 
@@ -1307,20 +1307,20 @@  discard block
 block discarded – undo
1307 1307
 	 */
1308 1308
 	private function _display_spco_reg_form() {
1309 1309
 		// if registering via the admin, just display the reg form for the current step
1310
-		if ( $this->checkout->admin_request ) {
1311
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1310
+		if ($this->checkout->admin_request) {
1311
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1312 1312
 		} else {
1313 1313
 			// add powered by EE msg
1314
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1314
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1315 1315
 
1316
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1317
-			EE_Registry::$i18n_js_strings[ 'empty_cart' ] = $empty_cart;
1316
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1317
+			EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart;
1318 1318
 			$cookies_not_set_msg = '';
1319
-			if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1319
+			if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) {
1320 1320
 				$cookies_not_set_msg = apply_filters(
1321 1321
 					'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1322 1322
 					sprintf(
1323
-						__( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ),
1323
+						__('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'),
1324 1324
 						'<div class="ee-attention">',
1325 1325
 						'</div>',
1326 1326
 						'<h6 class="important-notice">',
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
 					'layout_strategy' =>
1341 1341
 						new EE_Template_Layout(
1342 1342
 							array(
1343
-								'layout_template_file' 			=> SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1343
+								'layout_template_file' 			=> SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1344 1344
 								'template_args' => array(
1345 1345
 									'empty_cart' 		=> $empty_cart,
1346 1346
 									'revisit' 				=> $this->checkout->revisit,
@@ -1349,8 +1349,8 @@  discard block
 block discarded – undo
1349 1349
 									'empty_msg' 		=> apply_filters(
1350 1350
 										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1351 1351
 										sprintf(
1352
-											__( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ),
1353
-											'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1352
+											__('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'),
1353
+											'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1354 1354
 											'">',
1355 1355
 											'</a>'
1356 1356
 										)
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
 				)
1369 1369
 			);
1370 1370
 			// load template and add to output sent that gets filtered into the_content()
1371
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() );
1371
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js());
1372 1372
 		}
1373 1373
 	}
1374 1374
 
@@ -1382,8 +1382,8 @@  discard block
 block discarded – undo
1382 1382
 	 * @internal  param string $label
1383 1383
 	 * @return        string
1384 1384
 	 */
1385
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1386
-		if ( $next_step === 'finalize_registration' ) {
1385
+	public function add_extra_finalize_registration_inputs($next_step) {
1386
+		if ($next_step === 'finalize_registration') {
1387 1387
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1388 1388
 		}
1389 1389
 	}
@@ -1397,18 +1397,18 @@  discard block
 block discarded – undo
1397 1397
 	 *  @return 	string
1398 1398
 	 */
1399 1399
 	public static function display_registration_footer() {
1400
-		if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) {
1401
-			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1402
-			$url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' );
1403
-			$url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1400
+		if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) {
1401
+			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1402
+			$url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/');
1403
+			$url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1404 1404
 			echo apply_filters(
1405 1405
 				'FHEE__EE_Front_Controller__display_registration_footer',
1406 1406
 				sprintf(
1407
-					__( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ),
1408
-					'<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="',
1407
+					__('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'),
1408
+					'<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="',
1409 1409
 					'" target="_blank">',
1410 1410
 					'</a>',
1411
-					'<a href="' . $url . '" title="',
1411
+					'<a href="'.$url.'" title="',
1412 1412
 					'" target="_blank">',
1413 1413
 					'</a></div>'
1414 1414
 				)
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
 	 * @throws \EE_Error
1427 1427
 	 */
1428 1428
 	public function unlock_transaction() {
1429
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1429
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1430 1430
 			$this->checkout->transaction->unlock();
1431 1431
 		}
1432 1432
 	}
@@ -1441,12 +1441,12 @@  discard block
 block discarded – undo
1441 1441
 	 * @return 	array
1442 1442
 	 */
1443 1443
 	private function _setup_redirect() {
1444
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1444
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1445 1445
 			$this->checkout->redirect = TRUE;
1446
-			if ( empty( $this->checkout->redirect_url )) {
1446
+			if (empty($this->checkout->redirect_url)) {
1447 1447
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1448 1448
 			}
1449
-			$this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout );
1449
+			$this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout);
1450 1450
 		}
1451 1451
 	}
1452 1452
 
@@ -1460,9 +1460,9 @@  discard block
 block discarded – undo
1460 1460
 	 * @throws \EE_Error
1461 1461
 	 */
1462 1462
 	public function go_to_next_step() {
1463
-		if ( EE_Registry::instance()->REQ->ajax ) {
1463
+		if (EE_Registry::instance()->REQ->ajax) {
1464 1464
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1465
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1465
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1466 1466
 		}
1467 1467
 		$this->unlock_transaction();
1468 1468
 		// just return for these conditions
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
 	 */
1492 1492
 	protected function _handle_json_response() {
1493 1493
 		// if this is an ajax request
1494
-		if ( EE_Registry::instance()->REQ->ajax ) {
1494
+		if (EE_Registry::instance()->REQ->ajax) {
1495 1495
 			// DEBUG LOG
1496 1496
 			//$this->checkout->log(
1497 1497
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1504,7 +1504,7 @@  discard block
 block discarded – undo
1504 1504
 			$this->checkout->json_response->set_registration_time_limit(
1505 1505
 				$this->checkout->get_registration_time_limit()
1506 1506
 			);
1507
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1507
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1508 1508
 			// just send the ajax (
1509 1509
 			$json_response = apply_filters(
1510 1510
 				'FHEE__EE_Single_Page_Checkout__JSON_response',
@@ -1525,9 +1525,9 @@  discard block
 block discarded – undo
1525 1525
 	 */
1526 1526
 	protected function _handle_html_redirects() {
1527 1527
 		// going somewhere ?
1528
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1528
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1529 1529
 			// store notices in a transient
1530
-			EE_Error::get_notices( false, true, true );
1530
+			EE_Error::get_notices(false, true, true);
1531 1531
 			// DEBUG LOG
1532 1532
 			//$this->checkout->log(
1533 1533
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 			//		'headers_list'    => headers_list(),
1538 1538
 			//	)
1539 1539
 			//);
1540
-			wp_safe_redirect( $this->checkout->redirect_url );
1540
+			wp_safe_redirect($this->checkout->redirect_url);
1541 1541
 			exit();
1542 1542
 		}
1543 1543
 	}
Please login to merge, or discard this patch.
core/EE_Network_Config.core.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public static function instance() {
60 60
 		// check if class object is instantiated, and instantiated properly
61
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Network_Config )) {
61
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Network_Config)) {
62 62
 			self::$_instance = new self();
63 63
 		}
64 64
 		return self::$_instance;
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 	 *  @access 	private
74 74
 	 */
75 75
 	private function __construct() {
76
-		do_action( 'AHEE__EE_Network_Config__construct__begin',$this );
76
+		do_action('AHEE__EE_Network_Config__construct__begin', $this);
77 77
 		//set defaults
78
-		$this->core = apply_filters( 'FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config() );
78
+		$this->core = apply_filters('FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config());
79 79
 		$this->addons = array();
80 80
 
81 81
 		$this->_load_config();
82 82
 
83 83
 		// construct__end hook
84
-		do_action( 'AHEE__EE_Network_Config__construct__end',$this );
84
+		do_action('AHEE__EE_Network_Config__construct__end', $this);
85 85
 	}
86 86
 
87 87
 
@@ -94,25 +94,25 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	private function _load_config() {
96 96
 		//load network config start hook
97
-		do_action( 'AHEE__EE_Network_Config___load_config__start', $this );
97
+		do_action('AHEE__EE_Network_Config___load_config__start', $this);
98 98
 		$config = $this->get_config();
99
-		foreach ( $config as $config_prop => $settings ) {
100
-			if ( is_object( $settings ) && property_exists( $this, $config_prop ) ) {
101
-				$this->{$config_prop} = apply_filters( 'FHEE__EE_Network_Config___load_config__config_settings', $settings, $config_prop, $this );
102
-				if ( method_exists( $settings, 'populate' ) ) {
99
+		foreach ($config as $config_prop => $settings) {
100
+			if (is_object($settings) && property_exists($this, $config_prop)) {
101
+				$this->{$config_prop} = apply_filters('FHEE__EE_Network_Config___load_config__config_settings', $settings, $config_prop, $this);
102
+				if (method_exists($settings, 'populate')) {
103 103
 					$this->{$config_prop}->populate();
104 104
 				}
105
-				if ( method_exists( $settings, 'do_hooks' ) ) {
105
+				if (method_exists($settings, 'do_hooks')) {
106 106
 					$this->{$config_prop}->do_hooks();
107 107
 				}
108 108
 			}
109 109
 		}
110
-		if ( apply_filters( 'FHEE__EE_Network_Config___load_config__update_network_config', false ) ) {
110
+		if (apply_filters('FHEE__EE_Network_Config___load_config__update_network_config', false)) {
111 111
 			$this->update_config();
112 112
 		}
113 113
 
114 114
 		//load network config end hook
115
-		do_action( 'AHEE__EE_Network_Config___load_config__end', $this );
115
+		do_action('AHEE__EE_Network_Config___load_config__end', $this);
116 116
 	}
117 117
 
118 118
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function get_config() {
128 128
 		// grab network configuration
129
-		$CFG = get_site_option( 'ee_network_config', array() );
130
-		$CFG = apply_filters( 'FHEE__EE_Network_Config__get_config__CFG', $CFG );
129
+		$CFG = get_site_option('ee_network_config', array());
130
+		$CFG = apply_filters('FHEE__EE_Network_Config__get_config__CFG', $CFG);
131 131
 		return $CFG;
132 132
 	}
133 133
 
@@ -141,39 +141,39 @@  discard block
 block discarded – undo
141 141
 	 * @param bool $add_error
142 142
 	 * @return bool success
143 143
 	 */
144
-	public function update_config( $add_success = FALSE, $add_error = TRUE ) {
145
-		do_action( 'AHEE__EE_Network_Config__update_config__begin',$this );
144
+	public function update_config($add_success = FALSE, $add_error = TRUE) {
145
+		do_action('AHEE__EE_Network_Config__update_config__begin', $this);
146 146
 
147 147
 		//need to bust cache for comparing original if this is a multisite install
148
-		if ( is_multisite() ) {
148
+		if (is_multisite()) {
149 149
 			global $current_site;
150
-			$cache_key = $current_site->id . ':ee_network_config';
151
-			wp_cache_delete( $cache_key, 'site-options' );
150
+			$cache_key = $current_site->id.':ee_network_config';
151
+			wp_cache_delete($cache_key, 'site-options');
152 152
 		}
153 153
 
154 154
 		//we have to compare existing saved config with config in memory because if there is no difference that means
155 155
 		//that the method executed fine but there just was no update.  WordPress doesn't distinguish between false because
156 156
 		//there were 0 records updated because of no change vs false because some error produced problems with the update.
157
-		$original = get_site_option( 'ee_network_config' );
157
+		$original = get_site_option('ee_network_config');
158 158
 
159
-		if ( $original == $this ) {
159
+		if ($original == $this) {
160 160
 			return true;
161 161
 		}
162 162
 		// update
163
-		$saved = update_site_option( 'ee_network_config', $this );
163
+		$saved = update_site_option('ee_network_config', $this);
164 164
 
165
-		do_action( 'AHEE__EE_Network_Config__update_config__end', $this, $saved );
165
+		do_action('AHEE__EE_Network_Config__update_config__end', $this, $saved);
166 166
 		// if config remains the same or was updated successfully
167
-		if ( $saved ) {
168
-			if ( $add_success ) {
169
-				$msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso' ) : __( 'Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso' );
170
-				EE_Error::add_success( $msg );
167
+		if ($saved) {
168
+			if ($add_success) {
169
+				$msg = is_multisite() ? __('The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso') : __('Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso');
170
+				EE_Error::add_success($msg);
171 171
 			}
172 172
 			return true;
173 173
 		} else {
174
-			if ( $add_error ) {
175
-				$msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings were not updated.', 'event_espresso' ) : __( 'Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso' );
176
-				EE_Error::add_error( $msg , __FILE__, __FUNCTION__, __LINE__ );
174
+			if ($add_error) {
175
+				$msg = is_multisite() ? __('The Event Espresso Network Configuration Settings were not updated.', 'event_espresso') : __('Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso');
176
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
177 177
 			}
178 178
 			return false;
179 179
 		}
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 	 *  @return 	array
188 188
 	 */
189 189
 	public function __sleep() {
190
-		return apply_filters( 'FHEE__EE_Network_Config__sleep',array(
190
+		return apply_filters('FHEE__EE_Network_Config__sleep', array(
191 191
 			'core',
192
-		) );
192
+		));
193 193
 	}
194 194
 
195 195
 } //end EE_Network_Config.
Please login to merge, or discard this patch.
core/domain/services/capabilities/PublicCapabilities.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@
 block discarded – undo
20 20
 {
21 21
 
22 22
 
23
-    /**
24
-     * @return string
25
-     */
26
-    public function capability()
27
-    {
28
-        return '';
29
-    }
23
+	/**
24
+	 * @return string
25
+	 */
26
+	public function capability()
27
+	{
28
+		return '';
29
+	}
30 30
 
31 31
 
32 32
 }
Please login to merge, or discard this patch.