Completed
Pull Request — master (#378)
by Darren
21:48
created
core/services/container/SharedCoffeeMaker.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     /**
31 31
      * @param RecipeInterface $recipe
32 32
      * @param array           $arguments
33
-     * @return mixed
33
+     * @return boolean
34 34
      */
35 35
     public function brew(RecipeInterface $recipe, $arguments = array())
36 36
     {
Please login to merge, or discard this patch.
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -18,43 +18,43 @@
 block discarded – undo
18 18
 {
19 19
 
20 20
 
21
-    /**
22
-     * @return string
23
-     */
24
-    public function type()
25
-    {
26
-        return CoffeeMaker::BREW_SHARED;
27
-    }
21
+	/**
22
+	 * @return string
23
+	 */
24
+	public function type()
25
+	{
26
+		return CoffeeMaker::BREW_SHARED;
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * @param RecipeInterface $recipe
32
-     * @param array           $arguments
33
-     * @return mixed
34
-     */
35
-    public function brew(RecipeInterface $recipe, $arguments = array())
36
-    {
37
-        $this->resolveClassAndFilepath($recipe);
38
-        $reflector = $this->injector()->getReflectionClass($recipe->fqcn());
39
-        $method = $this->resolveInstantiationMethod($reflector);
40
-        switch ($method) {
41
-            case 'instance':
42
-            case 'new_instance':
43
-            case 'new_instance_from_db':
44
-                $service = call_user_func_array(
45
-                    array($reflector->getName(), $method),
46
-                    $this->injector()->resolveDependencies($recipe, $reflector, $arguments)
47
-                );
48
-                break;
49
-            case 'newInstance':
50
-                $service = $reflector->newInstance();
51
-                break;
52
-            case 'newInstanceArgs':
53
-            default:
54
-                $service = $reflector->newInstanceArgs(
55
-                    $this->injector()->resolveDependencies($recipe, $reflector, $arguments)
56
-                );
57
-        }
58
-        return $this->coffeePot()->addService($recipe->identifier(), $service);
59
-    }
30
+	/**
31
+	 * @param RecipeInterface $recipe
32
+	 * @param array           $arguments
33
+	 * @return mixed
34
+	 */
35
+	public function brew(RecipeInterface $recipe, $arguments = array())
36
+	{
37
+		$this->resolveClassAndFilepath($recipe);
38
+		$reflector = $this->injector()->getReflectionClass($recipe->fqcn());
39
+		$method = $this->resolveInstantiationMethod($reflector);
40
+		switch ($method) {
41
+			case 'instance':
42
+			case 'new_instance':
43
+			case 'new_instance_from_db':
44
+				$service = call_user_func_array(
45
+					array($reflector->getName(), $method),
46
+					$this->injector()->resolveDependencies($recipe, $reflector, $arguments)
47
+				);
48
+				break;
49
+			case 'newInstance':
50
+				$service = $reflector->newInstance();
51
+				break;
52
+			case 'newInstanceArgs':
53
+			default:
54
+				$service = $reflector->newInstanceArgs(
55
+					$this->injector()->resolveDependencies($recipe, $reflector, $arguments)
56
+				);
57
+		}
58
+		return $this->coffeePot()->addService($recipe->identifier(), $service);
59
+	}
60 60
 }
Please login to merge, or discard this patch.
core/services/formatters/AsciiOnly.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
     /**
34 34
      * Taken from https://gist.github.com/jaywilliams/119517
35 35
      *
36
-     * @param $string
36
+     * @param string $string
37 37
      * @return string
38 38
      */
39 39
     protected function convertAscii($string)
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace EventEspresso\core\services\formatters;
4 4
 
5
-use EventEspresso\core\exceptions\InvalidDataTypeException;
6
-
7 5
 /**
8 6
  * Class AsciiOnly
9 7
  * Removes all non-ascii characters from the string
Please login to merge, or discard this patch.
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -15,58 +15,58 @@
 block discarded – undo
15 15
 class AsciiOnly extends FormatterBase
16 16
 {
17 17
 
18
-    /**
19
-     * Removes all non Ascii characters from string
20
-     *
21
-     * @param string|int|float $input anything easily cast into a string
22
-     * @return string
23
-     */
24
-    public function format($input)
25
-    {
26
-        // in case an int or float etc was passed in
27
-        $input = (string)$input;
28
-        $input = $this->convertAscii($input);
29
-        return $input;
30
-    }
18
+	/**
19
+	 * Removes all non Ascii characters from string
20
+	 *
21
+	 * @param string|int|float $input anything easily cast into a string
22
+	 * @return string
23
+	 */
24
+	public function format($input)
25
+	{
26
+		// in case an int or float etc was passed in
27
+		$input = (string)$input;
28
+		$input = $this->convertAscii($input);
29
+		return $input;
30
+	}
31 31
 
32 32
 
33
-    /**
34
-     * Taken from https://gist.github.com/jaywilliams/119517
35
-     *
36
-     * @param $string
37
-     * @return string
38
-     */
39
-    protected function convertAscii($string)
40
-    {
41
-        // Replace Single Curly Quotes
42
-        $search[] = chr(226) . chr(128) . chr(152);
43
-        $replace[] = "'";
44
-        $search[] = chr(226) . chr(128) . chr(153);
45
-        $replace[] = "'";
46
-        // Replace Smart Double Curly Quotes
47
-        $search[] = chr(226) . chr(128) . chr(156);
48
-        $replace[] = '"';
49
-        $search[] = chr(226) . chr(128) . chr(157);
50
-        $replace[] = '"';
51
-        // Replace En Dash
52
-        $search[] = chr(226) . chr(128) . chr(147);
53
-        $replace[] = '--';
54
-        // Replace Em Dash
55
-        $search[] = chr(226) . chr(128) . chr(148);
56
-        $replace[] = '---';
57
-        // Replace Bullet
58
-        $search[] = chr(226) . chr(128) . chr(162);
59
-        $replace[] = '*';
60
-        // Replace Middle Dot
61
-        $search[] = chr(194) . chr(183);
62
-        $replace[] = '*';
63
-        // Replace Ellipsis with three consecutive dots
64
-        $search[] = chr(226) . chr(128) . chr(166);
65
-        $replace[] = '...';
66
-        // Apply Replacements
67
-        $string = str_replace($search, $replace, $string);
68
-        // Remove any non-ASCII Characters
69
-        $string = preg_replace("/[^\x01-\x7F]/", "", $string);
70
-        return $string;
71
-    }
33
+	/**
34
+	 * Taken from https://gist.github.com/jaywilliams/119517
35
+	 *
36
+	 * @param $string
37
+	 * @return string
38
+	 */
39
+	protected function convertAscii($string)
40
+	{
41
+		// Replace Single Curly Quotes
42
+		$search[] = chr(226) . chr(128) . chr(152);
43
+		$replace[] = "'";
44
+		$search[] = chr(226) . chr(128) . chr(153);
45
+		$replace[] = "'";
46
+		// Replace Smart Double Curly Quotes
47
+		$search[] = chr(226) . chr(128) . chr(156);
48
+		$replace[] = '"';
49
+		$search[] = chr(226) . chr(128) . chr(157);
50
+		$replace[] = '"';
51
+		// Replace En Dash
52
+		$search[] = chr(226) . chr(128) . chr(147);
53
+		$replace[] = '--';
54
+		// Replace Em Dash
55
+		$search[] = chr(226) . chr(128) . chr(148);
56
+		$replace[] = '---';
57
+		// Replace Bullet
58
+		$search[] = chr(226) . chr(128) . chr(162);
59
+		$replace[] = '*';
60
+		// Replace Middle Dot
61
+		$search[] = chr(194) . chr(183);
62
+		$replace[] = '*';
63
+		// Replace Ellipsis with three consecutive dots
64
+		$search[] = chr(226) . chr(128) . chr(166);
65
+		$replace[] = '...';
66
+		// Apply Replacements
67
+		$string = str_replace($search, $replace, $string);
68
+		// Remove any non-ASCII Characters
69
+		$string = preg_replace("/[^\x01-\x7F]/", "", $string);
70
+		return $string;
71
+	}
72 72
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     public function format($input)
25 25
     {
26 26
         // in case an int or float etc was passed in
27
-        $input = (string)$input;
27
+        $input = (string) $input;
28 28
         $input = $this->convertAscii($input);
29 29
         return $input;
30 30
     }
@@ -39,29 +39,29 @@  discard block
 block discarded – undo
39 39
     protected function convertAscii($string)
40 40
     {
41 41
         // Replace Single Curly Quotes
42
-        $search[] = chr(226) . chr(128) . chr(152);
42
+        $search[] = chr(226).chr(128).chr(152);
43 43
         $replace[] = "'";
44
-        $search[] = chr(226) . chr(128) . chr(153);
44
+        $search[] = chr(226).chr(128).chr(153);
45 45
         $replace[] = "'";
46 46
         // Replace Smart Double Curly Quotes
47
-        $search[] = chr(226) . chr(128) . chr(156);
47
+        $search[] = chr(226).chr(128).chr(156);
48 48
         $replace[] = '"';
49
-        $search[] = chr(226) . chr(128) . chr(157);
49
+        $search[] = chr(226).chr(128).chr(157);
50 50
         $replace[] = '"';
51 51
         // Replace En Dash
52
-        $search[] = chr(226) . chr(128) . chr(147);
52
+        $search[] = chr(226).chr(128).chr(147);
53 53
         $replace[] = '--';
54 54
         // Replace Em Dash
55
-        $search[] = chr(226) . chr(128) . chr(148);
55
+        $search[] = chr(226).chr(128).chr(148);
56 56
         $replace[] = '---';
57 57
         // Replace Bullet
58
-        $search[] = chr(226) . chr(128) . chr(162);
58
+        $search[] = chr(226).chr(128).chr(162);
59 59
         $replace[] = '*';
60 60
         // Replace Middle Dot
61
-        $search[] = chr(194) . chr(183);
61
+        $search[] = chr(194).chr(183);
62 62
         $replace[] = '*';
63 63
         // Replace Ellipsis with three consecutive dots
64
-        $search[] = chr(226) . chr(128) . chr(166);
64
+        $search[] = chr(226).chr(128).chr(166);
65 65
         $replace[] = '...';
66 66
         // Apply Replacements
67 67
         $string = str_replace($search, $replace, $string);
Please login to merge, or discard this patch.
core/services/locators/FqcnLocator.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
      * given a valid namespace, will find all files that match the provided mask
71 71
      *
72 72
      * @access public
73
-     * @param string|array $namespaces
73
+     * @param string $namespaces
74 74
      * @return FilesystemIterator
75 75
      * @throws \EventEspresso\core\exceptions\InvalidClassException
76 76
      * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
Please login to merge, or discard this patch.
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -17,146 +17,146 @@
 block discarded – undo
17 17
 class FqcnLocator extends Locator
18 18
 {
19 19
 
20
-    /**
21
-     * @var array $FQCNs
22
-     */
23
-    protected $FQCNs = array();
24
-
25
-    /**
26
-     * @var array $namespaces
27
-     */
28
-    protected $namespaces = array();
29
-
30
-
31
-    /**
32
-     * @access protected
33
-     * @param string $namespace
34
-     * @param string $namespace_base_dir
35
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
36
-     */
37
-    protected function setNamespace($namespace, $namespace_base_dir)
38
-    {
39
-        if (! is_string($namespace)) {
40
-            throw new InvalidDataTypeException('$namespace', $namespace, 'string');
41
-        }
42
-        if (! is_string($namespace_base_dir)) {
43
-            throw new InvalidDataTypeException('$namespace_base_dir', $namespace_base_dir, 'string');
44
-        }
45
-        $this->namespaces[$namespace] = $namespace_base_dir;
46
-    }
47
-
48
-
49
-    /**
50
-     * @access public
51
-     * @return array
52
-     */
53
-    public function getFQCNs()
54
-    {
55
-        return $this->FQCNs;
56
-    }
57
-
58
-
59
-    /**
60
-     * @access public
61
-     * @return int
62
-     */
63
-    public function count()
64
-    {
65
-        return count($this->FQCNs);
66
-    }
67
-
68
-
69
-    /**
70
-     * given a valid namespace, will find all files that match the provided mask
71
-     *
72
-     * @access public
73
-     * @param string|array $namespaces
74
-     * @return FilesystemIterator
75
-     * @throws \EventEspresso\core\exceptions\InvalidClassException
76
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
77
-     */
78
-    public function locate($namespaces)
79
-    {
80
-        if (! (is_string($namespaces) || is_array($namespaces))) {
81
-            throw new InvalidDataTypeException('$namespaces', $namespaces, 'string or array');
82
-        }
83
-        foreach ((array)$namespaces as $namespace) {
84
-            foreach ($this->FindFQCNsByNamespace($namespace) as $key => $file) {
85
-                $this->FQCNs[$key] = $file;
86
-            }
87
-        }
88
-        return $this->FQCNs;
89
-    }
90
-
91
-
92
-    // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
93
-    /**
94
-     * given a partial namespace, will find all files in that folder
95
-     * ** PLZ NOTE **
96
-     * This assumes that all files within the specified folder should be loaded
97
-     *
98
-     * @access protected
99
-     * @param array $partial_namespace
100
-     * @return FilesystemIterator
101
-     * @throws \EventEspresso\core\exceptions\InvalidClassException
102
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
103
-     */
104
-    protected function FindFQCNsByNamespace($partial_namespace)
105
-    {
106
-        $iterator = new FilesystemIterator(
107
-            $this->getDirectoryFromPartialNamespace($partial_namespace)
108
-        );
109
-        foreach ($this->flags as $flag) {
110
-            $iterator->setFlags($flag);
111
-        }
112
-        if (iterator_count($iterator) === 0) {
113
-            return array();
114
-        }
115
-        foreach ($iterator as $file) {
116
-            $file = \EEH_File::standardise_directory_separators($file);
117
-            foreach ($this->namespaces as $namespace => $base_dir) {
118
-                $namespace .= Psr4Autoloader::NS;
119
-                if (strpos($file, $base_dir) === 0) {
120
-                    $this->FQCNs[] = Psr4Autoloader::NS . str_replace(
121
-                        array($base_dir, DS, '.php'),
122
-                        array($namespace, Psr4Autoloader::NS, ''),
123
-                        $file
124
-                    );
125
-                }
126
-            }
127
-        }
128
-        return $this->FQCNs;
129
-    }
130
-
131
-
132
-    /**
133
-     * getDirectoryFromPartialNamespace
134
-     *
135
-     * @access protected
136
-     * @param  string $partial_namespace almost fully qualified class name ?
137
-     * @return string
138
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
139
-     * @throws \EventEspresso\core\exceptions\InvalidClassException
140
-     */
141
-    protected function getDirectoryFromPartialNamespace($partial_namespace)
142
-    {
143
-        if (empty($partial_namespace)) {
144
-            throw new InvalidClassException($partial_namespace);
145
-        }
146
-        // load our PSR-4 Autoloader so we can get the list of registered namespaces from it
147
-        $psr4_loader = \EE_Psr4AutoloaderInit::psr4_loader();
148
-        // breakup the incoming namespace into segments then loop thru them
149
-        $namespace_segments = explode(Psr4Autoloader::NS, trim($partial_namespace, Psr4Autoloader::NS));
150
-        // we're only interested in the first element, so pull that from the array
151
-        $namespace = array_shift($namespace_segments);
152
-        // check if there's a base directory registered for that namespace
153
-        $prefix = $psr4_loader->prefixes($namespace . Psr4Autoloader::NS);
154
-        // nope? then the incoming namespace is invalid
155
-        if (empty($prefix) || empty($prefix[0])) {
156
-            throw new InvalidClassException($partial_namespace);
157
-        }
158
-        $this->setNamespace($namespace, $prefix[0]);
159
-        // but if it's good, add that base directory to the rest of the path, and return it
160
-        return $prefix[0] . implode(DS, $namespace_segments) . DS;
161
-    }
20
+	/**
21
+	 * @var array $FQCNs
22
+	 */
23
+	protected $FQCNs = array();
24
+
25
+	/**
26
+	 * @var array $namespaces
27
+	 */
28
+	protected $namespaces = array();
29
+
30
+
31
+	/**
32
+	 * @access protected
33
+	 * @param string $namespace
34
+	 * @param string $namespace_base_dir
35
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
36
+	 */
37
+	protected function setNamespace($namespace, $namespace_base_dir)
38
+	{
39
+		if (! is_string($namespace)) {
40
+			throw new InvalidDataTypeException('$namespace', $namespace, 'string');
41
+		}
42
+		if (! is_string($namespace_base_dir)) {
43
+			throw new InvalidDataTypeException('$namespace_base_dir', $namespace_base_dir, 'string');
44
+		}
45
+		$this->namespaces[$namespace] = $namespace_base_dir;
46
+	}
47
+
48
+
49
+	/**
50
+	 * @access public
51
+	 * @return array
52
+	 */
53
+	public function getFQCNs()
54
+	{
55
+		return $this->FQCNs;
56
+	}
57
+
58
+
59
+	/**
60
+	 * @access public
61
+	 * @return int
62
+	 */
63
+	public function count()
64
+	{
65
+		return count($this->FQCNs);
66
+	}
67
+
68
+
69
+	/**
70
+	 * given a valid namespace, will find all files that match the provided mask
71
+	 *
72
+	 * @access public
73
+	 * @param string|array $namespaces
74
+	 * @return FilesystemIterator
75
+	 * @throws \EventEspresso\core\exceptions\InvalidClassException
76
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
77
+	 */
78
+	public function locate($namespaces)
79
+	{
80
+		if (! (is_string($namespaces) || is_array($namespaces))) {
81
+			throw new InvalidDataTypeException('$namespaces', $namespaces, 'string or array');
82
+		}
83
+		foreach ((array)$namespaces as $namespace) {
84
+			foreach ($this->FindFQCNsByNamespace($namespace) as $key => $file) {
85
+				$this->FQCNs[$key] = $file;
86
+			}
87
+		}
88
+		return $this->FQCNs;
89
+	}
90
+
91
+
92
+	// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
93
+	/**
94
+	 * given a partial namespace, will find all files in that folder
95
+	 * ** PLZ NOTE **
96
+	 * This assumes that all files within the specified folder should be loaded
97
+	 *
98
+	 * @access protected
99
+	 * @param array $partial_namespace
100
+	 * @return FilesystemIterator
101
+	 * @throws \EventEspresso\core\exceptions\InvalidClassException
102
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
103
+	 */
104
+	protected function FindFQCNsByNamespace($partial_namespace)
105
+	{
106
+		$iterator = new FilesystemIterator(
107
+			$this->getDirectoryFromPartialNamespace($partial_namespace)
108
+		);
109
+		foreach ($this->flags as $flag) {
110
+			$iterator->setFlags($flag);
111
+		}
112
+		if (iterator_count($iterator) === 0) {
113
+			return array();
114
+		}
115
+		foreach ($iterator as $file) {
116
+			$file = \EEH_File::standardise_directory_separators($file);
117
+			foreach ($this->namespaces as $namespace => $base_dir) {
118
+				$namespace .= Psr4Autoloader::NS;
119
+				if (strpos($file, $base_dir) === 0) {
120
+					$this->FQCNs[] = Psr4Autoloader::NS . str_replace(
121
+						array($base_dir, DS, '.php'),
122
+						array($namespace, Psr4Autoloader::NS, ''),
123
+						$file
124
+					);
125
+				}
126
+			}
127
+		}
128
+		return $this->FQCNs;
129
+	}
130
+
131
+
132
+	/**
133
+	 * getDirectoryFromPartialNamespace
134
+	 *
135
+	 * @access protected
136
+	 * @param  string $partial_namespace almost fully qualified class name ?
137
+	 * @return string
138
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
139
+	 * @throws \EventEspresso\core\exceptions\InvalidClassException
140
+	 */
141
+	protected function getDirectoryFromPartialNamespace($partial_namespace)
142
+	{
143
+		if (empty($partial_namespace)) {
144
+			throw new InvalidClassException($partial_namespace);
145
+		}
146
+		// load our PSR-4 Autoloader so we can get the list of registered namespaces from it
147
+		$psr4_loader = \EE_Psr4AutoloaderInit::psr4_loader();
148
+		// breakup the incoming namespace into segments then loop thru them
149
+		$namespace_segments = explode(Psr4Autoloader::NS, trim($partial_namespace, Psr4Autoloader::NS));
150
+		// we're only interested in the first element, so pull that from the array
151
+		$namespace = array_shift($namespace_segments);
152
+		// check if there's a base directory registered for that namespace
153
+		$prefix = $psr4_loader->prefixes($namespace . Psr4Autoloader::NS);
154
+		// nope? then the incoming namespace is invalid
155
+		if (empty($prefix) || empty($prefix[0])) {
156
+			throw new InvalidClassException($partial_namespace);
157
+		}
158
+		$this->setNamespace($namespace, $prefix[0]);
159
+		// but if it's good, add that base directory to the rest of the path, and return it
160
+		return $prefix[0] . implode(DS, $namespace_segments) . DS;
161
+	}
162 162
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
      */
37 37
     protected function setNamespace($namespace, $namespace_base_dir)
38 38
     {
39
-        if (! is_string($namespace)) {
39
+        if ( ! is_string($namespace)) {
40 40
             throw new InvalidDataTypeException('$namespace', $namespace, 'string');
41 41
         }
42
-        if (! is_string($namespace_base_dir)) {
42
+        if ( ! is_string($namespace_base_dir)) {
43 43
             throw new InvalidDataTypeException('$namespace_base_dir', $namespace_base_dir, 'string');
44 44
         }
45 45
         $this->namespaces[$namespace] = $namespace_base_dir;
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function locate($namespaces)
79 79
     {
80
-        if (! (is_string($namespaces) || is_array($namespaces))) {
80
+        if ( ! (is_string($namespaces) || is_array($namespaces))) {
81 81
             throw new InvalidDataTypeException('$namespaces', $namespaces, 'string or array');
82 82
         }
83
-        foreach ((array)$namespaces as $namespace) {
83
+        foreach ((array) $namespaces as $namespace) {
84 84
             foreach ($this->FindFQCNsByNamespace($namespace) as $key => $file) {
85 85
                 $this->FQCNs[$key] = $file;
86 86
             }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             foreach ($this->namespaces as $namespace => $base_dir) {
118 118
                 $namespace .= Psr4Autoloader::NS;
119 119
                 if (strpos($file, $base_dir) === 0) {
120
-                    $this->FQCNs[] = Psr4Autoloader::NS . str_replace(
120
+                    $this->FQCNs[] = Psr4Autoloader::NS.str_replace(
121 121
                         array($base_dir, DS, '.php'),
122 122
                         array($namespace, Psr4Autoloader::NS, ''),
123 123
                         $file
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
         // we're only interested in the first element, so pull that from the array
151 151
         $namespace = array_shift($namespace_segments);
152 152
         // check if there's a base directory registered for that namespace
153
-        $prefix = $psr4_loader->prefixes($namespace . Psr4Autoloader::NS);
153
+        $prefix = $psr4_loader->prefixes($namespace.Psr4Autoloader::NS);
154 154
         // nope? then the incoming namespace is invalid
155 155
         if (empty($prefix) || empty($prefix[0])) {
156 156
             throw new InvalidClassException($partial_namespace);
157 157
         }
158 158
         $this->setNamespace($namespace, $prefix[0]);
159 159
         // but if it's good, add that base directory to the rest of the path, and return it
160
-        return $prefix[0] . implode(DS, $namespace_segments) . DS;
160
+        return $prefix[0].implode(DS, $namespace_segments).DS;
161 161
     }
162 162
 }
Please login to merge, or discard this patch.
core/services/orm/ModelFieldFactory.php 2 patches
Doc Comments   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -125,7 +125,6 @@  discard block
 block discarded – undo
125 125
     /**
126 126
      * @param string $table_column
127 127
      * @param string $nice_name
128
-     * @param string $timezone_string
129 128
      * @param bool   $nullable
130 129
      * @param string $default_value
131 130
      * @throws EE_Error
@@ -170,7 +169,7 @@  discard block
 block discarded – undo
170 169
      * @param string $table_column
171 170
      * @param string $nice_name
172 171
      * @param bool   $nullable
173
-     * @param null   $default_value
172
+     * @param integer   $default_value
174 173
      * @return EE_DB_Only_Int_Field
175 174
      */
176 175
     public function createDbOnlyIntField($table_column, $nice_name, $nullable, $default_value = null)
@@ -280,7 +279,7 @@  discard block
 block discarded – undo
280 279
      * @param string $table_column
281 280
      * @param string $nice_name
282 281
      * @param bool   $nullable
283
-     * @param null   $default_value
282
+     * @param integer   $default_value
284 283
      * @param string $model_name
285 284
      * @return EE_Foreign_Key_Int_Field
286 285
      */
@@ -297,7 +296,7 @@  discard block
 block discarded – undo
297 296
      * @param string $table_column
298 297
      * @param string $nice_name
299 298
      * @param bool   $nullable
300
-     * @param null   $default_value
299
+     * @param string   $default_value
301 300
      * @param string $model_name
302 301
      * @return EE_Foreign_Key_String_Field
303 302
      */
@@ -533,7 +532,7 @@  discard block
 block discarded – undo
533 532
      * @param string $table_column
534 533
      * @param string $nice_name
535 534
      * @param bool   $nullable
536
-     * @param mixed  $default_value
535
+     * @param string  $default_value
537 536
      * @param array  $values                            If additional stati are to be used other than the default WP
538 537
      *                                                  statuses, then they can be registered via this property. The
539 538
      *                                                  format of the array should be as follows: array(
Please login to merge, or discard this patch.
Indentation   +543 added lines, -543 removed lines patch added patch discarded remove patch
@@ -51,547 +51,547 @@
 block discarded – undo
51 51
 class ModelFieldFactory
52 52
 {
53 53
 
54
-    /**
55
-     * @var LoaderInterface $loader
56
-     */
57
-    private $loader;
58
-
59
-
60
-    /**
61
-     * ModelFieldFactory constructor.
62
-     *
63
-     * @param LoaderInterface $loader
64
-     */
65
-    public function __construct(LoaderInterface $loader)
66
-    {
67
-        $this->loader = $loader;
68
-    }
69
-
70
-
71
-    /**
72
-     * @param string $table_column
73
-     * @param string $nice_name
74
-     * @param bool   $nullable
75
-     * @param null   $default_value
76
-     * @return EE_All_Caps_Text_Field
77
-     */
78
-    public function createAllCapsTextField($table_column, $nice_name, $nullable, $default_value = null)
79
-    {
80
-        return $this->loader->getNew(
81
-            'EE_All_Caps_Text_Field',
82
-            array($table_column, $nice_name, $nullable, $default_value)
83
-        );
84
-    }
85
-
86
-
87
-    /**
88
-     * @param string $table_column
89
-     * @param string $nice_name
90
-     * @param bool   $nullable
91
-     * @param null   $default_value
92
-     * @param string $model_name
93
-     * @return EE_Any_Foreign_Model_Name_Field
94
-     */
95
-    public function createAnyForeignModelNameField(
96
-        $table_column,
97
-        $nice_name,
98
-        $nullable,
99
-        $default_value = null,
100
-        $model_name
101
-    ) {
102
-        return $this->loader->getNew(
103
-            'EE_Any_Foreign_Model_Name_Field',
104
-            array($table_column, $nice_name, $nullable, $default_value, $model_name)
105
-        );
106
-    }
107
-
108
-
109
-    /**
110
-     * @param string $table_column
111
-     * @param string $nice_name
112
-     * @param bool   $nullable
113
-     * @param null   $default_value
114
-     * @return EE_Boolean_Field
115
-     */
116
-    public function createBooleanField($table_column, $nice_name, $nullable, $default_value = null)
117
-    {
118
-        return $this->loader->getNew(
119
-            'EE_Boolean_Field',
120
-            array($table_column, $nice_name, $nullable, $default_value)
121
-        );
122
-    }
123
-
124
-
125
-    /**
126
-     * @param string $table_column
127
-     * @param string $nice_name
128
-     * @param string $timezone_string
129
-     * @param bool   $nullable
130
-     * @param string $default_value
131
-     * @throws EE_Error
132
-     * @throws InvalidArgumentException
133
-     * @return EE_Datetime_Field
134
-     */
135
-    public function createDatetimeField(
136
-        $table_column,
137
-        $nice_name,
138
-        $nullable = false,
139
-        $default_value = EE_Datetime_Field::now
140
-    ) {
141
-        return $this->loader->getNew(
142
-            'EE_Datetime_Field',
143
-            array(
144
-                $table_column,
145
-                $nice_name,
146
-                $nullable,
147
-                $default_value,
148
-            )
149
-        );
150
-    }
151
-
152
-
153
-    /**
154
-     * @param string $table_column
155
-     * @param string $nice_name
156
-     * @param bool   $nullable
157
-     * @param null   $default_value
158
-     * @return EE_DB_Only_Float_Field
159
-     */
160
-    public function createDbOnlyFloatField($table_column, $nice_name, $nullable, $default_value = null)
161
-    {
162
-        return $this->loader->getNew(
163
-            'EE_DB_Only_Float_Field',
164
-            array($table_column, $nice_name, $nullable, $default_value)
165
-        );
166
-    }
167
-
168
-
169
-    /**
170
-     * @param string $table_column
171
-     * @param string $nice_name
172
-     * @param bool   $nullable
173
-     * @param null   $default_value
174
-     * @return EE_DB_Only_Int_Field
175
-     */
176
-    public function createDbOnlyIntField($table_column, $nice_name, $nullable, $default_value = null)
177
-    {
178
-        return $this->loader->getNew(
179
-            'EE_DB_Only_Int_Field',
180
-            array($table_column, $nice_name, $nullable, $default_value)
181
-        );
182
-    }
183
-
184
-
185
-    /**
186
-     * @param string $table_column
187
-     * @param string $nice_name
188
-     * @param bool   $nullable
189
-     * @param null   $default_value
190
-     * @return EE_DB_Only_Text_Field
191
-     */
192
-    public function createDbOnlyTextField($table_column, $nice_name, $nullable, $default_value = null)
193
-    {
194
-        return $this->loader->getNew(
195
-            'EE_DB_Only_Text_Field',
196
-            array($table_column, $nice_name, $nullable, $default_value)
197
-        );
198
-    }
199
-
200
-
201
-    /**
202
-     * @param string $table_column
203
-     * @param string $nice_name
204
-     * @param bool   $nullable
205
-     * @param string $default_value
206
-     * @return EE_Email_Field
207
-     */
208
-    public function createEmailField($table_column, $nice_name, $nullable = true, $default_value = '')
209
-    {
210
-        return $this->loader->getNew(
211
-            'EE_Email_Field',
212
-            array($table_column, $nice_name, $nullable, $default_value)
213
-        );
214
-    }
215
-
216
-
217
-    /**
218
-     * @param string $table_column
219
-     * @param string $nice_name
220
-     * @param bool   $nullable
221
-     * @param null   $default_value
222
-     * @param array  $allowed_enum_values keys are values to be used in the DB,
223
-     *                                    values are how they should be displayed
224
-     * @return EE_Enum_Integer_Field
225
-     */
226
-    public function createEnumIntegerField(
227
-        $table_column,
228
-        $nice_name,
229
-        $nullable,
230
-        $default_value = null,
231
-        array $allowed_enum_values
232
-    ) {
233
-        return $this->loader->getNew(
234
-            'EE_Enum_Integer_Field',
235
-            array($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values)
236
-        );
237
-    }
238
-
239
-
240
-    /**
241
-     * @param string $table_column
242
-     * @param string $nice_name
243
-     * @param bool   $nullable
244
-     * @param null   $default_value
245
-     * @param array  $allowed_enum_values keys are values to be used in the DB,
246
-     *                                    values are how they should be displayed
247
-     * @return EE_Enum_Text_Field
248
-     */
249
-    public function createEnumTextField(
250
-        $table_column,
251
-        $nice_name,
252
-        $nullable,
253
-        $default_value,
254
-        array $allowed_enum_values
255
-    ) {
256
-        return $this->loader->getNew(
257
-            'EE_Enum_Text_Field',
258
-            array($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values)
259
-        );
260
-    }
261
-
262
-
263
-    /**
264
-     * @param string $table_column
265
-     * @param string $nice_name
266
-     * @param bool   $nullable
267
-     * @param null   $default_value
268
-     * @return EE_Float_Field
269
-     */
270
-    public function createFloatField($table_column, $nice_name, $nullable, $default_value = null)
271
-    {
272
-        return $this->loader->getNew(
273
-            'EE_Float_Field',
274
-            array($table_column, $nice_name, $nullable, $default_value)
275
-        );
276
-    }
277
-
278
-
279
-    /**
280
-     * @param string $table_column
281
-     * @param string $nice_name
282
-     * @param bool   $nullable
283
-     * @param null   $default_value
284
-     * @param string $model_name
285
-     * @return EE_Foreign_Key_Int_Field
286
-     */
287
-    public function createForeignKeyIntField($table_column, $nice_name, $nullable, $default_value, $model_name)
288
-    {
289
-        return $this->loader->getNew(
290
-            'EE_Foreign_Key_Int_Field',
291
-            array($table_column, $nice_name, $nullable, $default_value, $model_name)
292
-        );
293
-    }
294
-
295
-
296
-    /**
297
-     * @param string $table_column
298
-     * @param string $nice_name
299
-     * @param bool   $nullable
300
-     * @param null   $default_value
301
-     * @param string $model_name
302
-     * @return EE_Foreign_Key_String_Field
303
-     */
304
-    public function createForeignKeyStringField(
305
-        $table_column,
306
-        $nice_name,
307
-        $nullable,
308
-        $default_value,
309
-        $model_name
310
-    ) {
311
-        return $this->loader->getNew(
312
-            'EE_Foreign_Key_String_Field',
313
-            array($table_column, $nice_name, $nullable, $default_value, $model_name)
314
-        );
315
-    }
316
-
317
-
318
-    /**
319
-     * @param string $table_column
320
-     * @param string $nice_name
321
-     * @param bool   $nullable
322
-     * @param null   $default_value
323
-     * @return EE_Full_HTML_Field
324
-     */
325
-    public function createFullHtmlField($table_column, $nice_name, $nullable, $default_value = null)
326
-    {
327
-        return $this->loader->getNew(
328
-            'EE_Full_HTML_Field',
329
-            array($table_column, $nice_name, $nullable, $default_value)
330
-        );
331
-    }
332
-
333
-
334
-    /**
335
-     * @param string $table_column
336
-     * @param string $nice_name
337
-     * @param bool   $nullable
338
-     * @param null   $default_value
339
-     * @return EE_Infinite_Integer_Field
340
-     */
341
-    public function createInfiniteIntegerField($table_column, $nice_name, $nullable, $default_value = null)
342
-    {
343
-        return $this->loader->getNew(
344
-            'EE_Infinite_Integer_Field',
345
-            array($table_column, $nice_name, $nullable, $default_value)
346
-        );
347
-    }
348
-
349
-
350
-    /**
351
-     * @param string  $table_column
352
-     * @param string  $nice_name
353
-     * @param bool    $nullable
354
-     * @param integer $default_value
355
-     * @return EE_Integer_Field
356
-     */
357
-    public function createIntegerField($table_column, $nice_name, $nullable = false, $default_value = 0)
358
-    {
359
-        return $this->loader->getNew(
360
-            'EE_Integer_Field',
361
-            array($table_column, $nice_name, $nullable, $default_value)
362
-        );
363
-    }
364
-
365
-
366
-    /**
367
-     * @param string $table_column
368
-     * @param string $nice_name
369
-     * @param bool   $nullable
370
-     * @param null   $default_value
371
-     * @return EE_Maybe_Serialized_Simple_HTML_Field
372
-     */
373
-    public function createMaybeSerializedSimpleHtmlField($table_column, $nice_name, $nullable, $default_value = null)
374
-    {
375
-        return $this->loader->getNew(
376
-            'EE_Maybe_Serialized_Simple_HTML_Field',
377
-            array($table_column, $nice_name, $nullable, $default_value)
378
-        );
379
-    }
380
-
381
-
382
-    /**
383
-     * @param string $table_column
384
-     * @param string $nice_name
385
-     * @param bool   $nullable
386
-     * @param null   $default_value
387
-     * @return EE_Maybe_Serialized_Text_Field
388
-     */
389
-    public function createMaybeSerializedTextField($table_column, $nice_name, $nullable, $default_value = null)
390
-    {
391
-        return $this->loader->getNew(
392
-            'EE_Maybe_Serialized_Text_Field',
393
-            array($table_column, $nice_name, $nullable, $default_value)
394
-        );
395
-    }
396
-
397
-
398
-    /**
399
-     * @param string $table_column
400
-     * @param string $nice_name
401
-     * @param bool   $nullable
402
-     * @param null   $default_value
403
-     * @return EE_Money_Field
404
-     */
405
-    public function createMoneyField($table_column, $nice_name, $nullable, $default_value = null)
406
-    {
407
-        return $this->loader->getNew(
408
-            'EE_Money_Field',
409
-            array($table_column, $nice_name, $nullable, $default_value)
410
-        );
411
-    }
412
-
413
-
414
-    /**
415
-     * @param string $table_column
416
-     * @param string $nice_name
417
-     * @param bool   $nullable
418
-     * @param string $default_value
419
-     * @return EE_Plain_Text_Field
420
-     */
421
-    public function createPlainTextField($table_column, $nice_name, $nullable = true, $default_value = '')
422
-    {
423
-        return $this->loader->getNew(
424
-            'EE_Plain_Text_Field',
425
-            array($table_column, $nice_name, $nullable, $default_value)
426
-        );
427
-    }
428
-
429
-
430
-    /**
431
-     * @param string $table_column
432
-     * @param string $nice_name
433
-     * @param bool   $nullable
434
-     * @param null   $default_value
435
-     * @return EE_Post_Content_Field
436
-     */
437
-    public function createPostContentField($table_column, $nice_name, $nullable, $default_value = null)
438
-    {
439
-        return $this->loader->getNew(
440
-            'EE_Post_Content_Field',
441
-            array($table_column, $nice_name, $nullable, $default_value)
442
-        );
443
-    }
444
-
445
-
446
-    /**
447
-     * @param string $table_column
448
-     * @param string $nice_name
449
-     * @return EE_Primary_Key_Int_Field
450
-     */
451
-    public function createPrimaryKeyIntField($table_column, $nice_name)
452
-    {
453
-        return $this->loader->getNew('EE_Primary_Key_Int_Field', array($table_column, $nice_name));
454
-    }
455
-
456
-
457
-    /**
458
-     * @param string $table_column
459
-     * @param string $nice_name
460
-     * @return EE_Primary_Key_String_Field
461
-     */
462
-    public function createPrimaryKeyStringField($table_column, $nice_name)
463
-    {
464
-        return $this->loader->getNew('EE_Primary_Key_String_Field', array($table_column, $nice_name));
465
-    }
466
-
467
-
468
-    /**
469
-     * @param string $table_column
470
-     * @param string $nice_name
471
-     * @param bool   $nullable
472
-     * @param null   $default_value
473
-     * @return EE_Serialized_Text_Field
474
-     */
475
-    public function createSerializedTextField($table_column, $nice_name, $nullable, $default_value = null)
476
-    {
477
-        return $this->loader->getNew(
478
-            'EE_Serialized_Text_Field',
479
-            array($table_column, $nice_name, $nullable, $default_value)
480
-        );
481
-    }
482
-
483
-
484
-    /**
485
-     * @param string $table_column
486
-     * @param string $nice_name
487
-     * @param bool   $nullable
488
-     * @param null   $default_value
489
-     * @return EE_Simple_HTML_Field
490
-     */
491
-    public function createSimpleHtmlField($table_column, $nice_name, $nullable, $default_value = null)
492
-    {
493
-        return $this->loader->getNew(
494
-            'EE_Simple_HTML_Field',
495
-            array($table_column, $nice_name, $nullable, $default_value)
496
-        );
497
-    }
498
-
499
-
500
-    /**
501
-     * @param string $table_column
502
-     * @param string $nice_name
503
-     * @param bool   $nullable
504
-     * @param null   $default_value
505
-     * @return EE_Slug_Field
506
-     */
507
-    public function createSlugField($table_column, $nice_name, $nullable = false, $default_value = null)
508
-    {
509
-        return $this->loader->getNew(
510
-            'EE_Slug_Field',
511
-            array($table_column, $nice_name, $nullable, $default_value)
512
-        );
513
-    }
514
-
515
-
516
-    /**
517
-     * @param string $table_column
518
-     * @param string $nice_name
519
-     * @param bool   $nullable
520
-     * @param null   $default_value
521
-     * @return EE_Trashed_Flag_Field
522
-     */
523
-    public function createTrashedFlagField($table_column, $nice_name, $nullable, $default_value = null)
524
-    {
525
-        return $this->loader->getNew(
526
-            'EE_Trashed_Flag_Field',
527
-            array($table_column, $nice_name, $nullable, $default_value)
528
-        );
529
-    }
530
-
531
-
532
-    /**
533
-     * @param string $table_column
534
-     * @param string $nice_name
535
-     * @param bool   $nullable
536
-     * @param mixed  $default_value
537
-     * @param array  $values                            If additional stati are to be used other than the default WP
538
-     *                                                  statuses, then they can be registered via this property. The
539
-     *                                                  format of the array should be as follows: array(
540
-     *                                                  'status_reference' => array(
541
-     *                                                  'label' => __('Status Reference Label', 'event_espresso'),
542
-     *                                                  'public' => true,                 // whether this status should
543
-     *                                                  be shown on the frontend of the site
544
-     *                                                  'exclude_from_search' => false,   // whether this status should
545
-     *                                                  be excluded from wp searches
546
-     *                                                  'show_in_admin_all_list' => true, // whether this status is
547
-     *                                                  included in queries for the admin "all" view in list table
548
-     *                                                  views.
549
-     *                                                  'show_in_admin_status_list' => true, // show in the list of
550
-     *                                                  statuses with post counts at the top of the admin list tables
551
-     *                                                  (i.e. Status Reference(2) )
552
-     *                                                  'label_count' => _n_noop(
553
-     *                                                  'Status Reference <span class="count">(%s)</span>',
554
-     *                                                  'Status References <span class="count">(%s)</span>'
555
-     *                                                  ),                                   // the text to display on
556
-     *                                                  the admin screen
557
-     *                                                  ( or you won't see your status count ).
558
-     *                                                  )
559
-     *                                                  )
560
-     * @link http://codex.wordpress.org/Function_Reference/register_post_status for more info
561
-     * @return EE_WP_Post_Status_Field
562
-     */
563
-    public function createWpPostStatusField(
564
-        $table_column,
565
-        $nice_name,
566
-        $nullable,
567
-        $default_value = null,
568
-        array $values = array()
569
-    ) {
570
-        return $this->loader->getNew(
571
-            'EE_WP_Post_Status_Field',
572
-            array($table_column, $nice_name, $nullable, $default_value, $values)
573
-        );
574
-    }
575
-
576
-
577
-    /**
578
-     * @param string $post_type
579
-     * @return EE_WP_Post_Type_Field
580
-     */
581
-    public function createWpPostTypeField($post_type)
582
-    {
583
-        return $this->loader->getNew('EE_WP_Post_Type_Field', array($post_type));
584
-    }
585
-
586
-
587
-    /**
588
-     * @param string $table_column
589
-     * @param string $nice_name
590
-     * @param bool   $nullable
591
-     * @return EE_WP_User_Field
592
-     */
593
-    public function createWpUserField($table_column, $nice_name, $nullable)
594
-    {
595
-        return $this->loader->getNew('EE_WP_User_Field', array($table_column, $nice_name, $nullable));
596
-    }
54
+	/**
55
+	 * @var LoaderInterface $loader
56
+	 */
57
+	private $loader;
58
+
59
+
60
+	/**
61
+	 * ModelFieldFactory constructor.
62
+	 *
63
+	 * @param LoaderInterface $loader
64
+	 */
65
+	public function __construct(LoaderInterface $loader)
66
+	{
67
+		$this->loader = $loader;
68
+	}
69
+
70
+
71
+	/**
72
+	 * @param string $table_column
73
+	 * @param string $nice_name
74
+	 * @param bool   $nullable
75
+	 * @param null   $default_value
76
+	 * @return EE_All_Caps_Text_Field
77
+	 */
78
+	public function createAllCapsTextField($table_column, $nice_name, $nullable, $default_value = null)
79
+	{
80
+		return $this->loader->getNew(
81
+			'EE_All_Caps_Text_Field',
82
+			array($table_column, $nice_name, $nullable, $default_value)
83
+		);
84
+	}
85
+
86
+
87
+	/**
88
+	 * @param string $table_column
89
+	 * @param string $nice_name
90
+	 * @param bool   $nullable
91
+	 * @param null   $default_value
92
+	 * @param string $model_name
93
+	 * @return EE_Any_Foreign_Model_Name_Field
94
+	 */
95
+	public function createAnyForeignModelNameField(
96
+		$table_column,
97
+		$nice_name,
98
+		$nullable,
99
+		$default_value = null,
100
+		$model_name
101
+	) {
102
+		return $this->loader->getNew(
103
+			'EE_Any_Foreign_Model_Name_Field',
104
+			array($table_column, $nice_name, $nullable, $default_value, $model_name)
105
+		);
106
+	}
107
+
108
+
109
+	/**
110
+	 * @param string $table_column
111
+	 * @param string $nice_name
112
+	 * @param bool   $nullable
113
+	 * @param null   $default_value
114
+	 * @return EE_Boolean_Field
115
+	 */
116
+	public function createBooleanField($table_column, $nice_name, $nullable, $default_value = null)
117
+	{
118
+		return $this->loader->getNew(
119
+			'EE_Boolean_Field',
120
+			array($table_column, $nice_name, $nullable, $default_value)
121
+		);
122
+	}
123
+
124
+
125
+	/**
126
+	 * @param string $table_column
127
+	 * @param string $nice_name
128
+	 * @param string $timezone_string
129
+	 * @param bool   $nullable
130
+	 * @param string $default_value
131
+	 * @throws EE_Error
132
+	 * @throws InvalidArgumentException
133
+	 * @return EE_Datetime_Field
134
+	 */
135
+	public function createDatetimeField(
136
+		$table_column,
137
+		$nice_name,
138
+		$nullable = false,
139
+		$default_value = EE_Datetime_Field::now
140
+	) {
141
+		return $this->loader->getNew(
142
+			'EE_Datetime_Field',
143
+			array(
144
+				$table_column,
145
+				$nice_name,
146
+				$nullable,
147
+				$default_value,
148
+			)
149
+		);
150
+	}
151
+
152
+
153
+	/**
154
+	 * @param string $table_column
155
+	 * @param string $nice_name
156
+	 * @param bool   $nullable
157
+	 * @param null   $default_value
158
+	 * @return EE_DB_Only_Float_Field
159
+	 */
160
+	public function createDbOnlyFloatField($table_column, $nice_name, $nullable, $default_value = null)
161
+	{
162
+		return $this->loader->getNew(
163
+			'EE_DB_Only_Float_Field',
164
+			array($table_column, $nice_name, $nullable, $default_value)
165
+		);
166
+	}
167
+
168
+
169
+	/**
170
+	 * @param string $table_column
171
+	 * @param string $nice_name
172
+	 * @param bool   $nullable
173
+	 * @param null   $default_value
174
+	 * @return EE_DB_Only_Int_Field
175
+	 */
176
+	public function createDbOnlyIntField($table_column, $nice_name, $nullable, $default_value = null)
177
+	{
178
+		return $this->loader->getNew(
179
+			'EE_DB_Only_Int_Field',
180
+			array($table_column, $nice_name, $nullable, $default_value)
181
+		);
182
+	}
183
+
184
+
185
+	/**
186
+	 * @param string $table_column
187
+	 * @param string $nice_name
188
+	 * @param bool   $nullable
189
+	 * @param null   $default_value
190
+	 * @return EE_DB_Only_Text_Field
191
+	 */
192
+	public function createDbOnlyTextField($table_column, $nice_name, $nullable, $default_value = null)
193
+	{
194
+		return $this->loader->getNew(
195
+			'EE_DB_Only_Text_Field',
196
+			array($table_column, $nice_name, $nullable, $default_value)
197
+		);
198
+	}
199
+
200
+
201
+	/**
202
+	 * @param string $table_column
203
+	 * @param string $nice_name
204
+	 * @param bool   $nullable
205
+	 * @param string $default_value
206
+	 * @return EE_Email_Field
207
+	 */
208
+	public function createEmailField($table_column, $nice_name, $nullable = true, $default_value = '')
209
+	{
210
+		return $this->loader->getNew(
211
+			'EE_Email_Field',
212
+			array($table_column, $nice_name, $nullable, $default_value)
213
+		);
214
+	}
215
+
216
+
217
+	/**
218
+	 * @param string $table_column
219
+	 * @param string $nice_name
220
+	 * @param bool   $nullable
221
+	 * @param null   $default_value
222
+	 * @param array  $allowed_enum_values keys are values to be used in the DB,
223
+	 *                                    values are how they should be displayed
224
+	 * @return EE_Enum_Integer_Field
225
+	 */
226
+	public function createEnumIntegerField(
227
+		$table_column,
228
+		$nice_name,
229
+		$nullable,
230
+		$default_value = null,
231
+		array $allowed_enum_values
232
+	) {
233
+		return $this->loader->getNew(
234
+			'EE_Enum_Integer_Field',
235
+			array($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values)
236
+		);
237
+	}
238
+
239
+
240
+	/**
241
+	 * @param string $table_column
242
+	 * @param string $nice_name
243
+	 * @param bool   $nullable
244
+	 * @param null   $default_value
245
+	 * @param array  $allowed_enum_values keys are values to be used in the DB,
246
+	 *                                    values are how they should be displayed
247
+	 * @return EE_Enum_Text_Field
248
+	 */
249
+	public function createEnumTextField(
250
+		$table_column,
251
+		$nice_name,
252
+		$nullable,
253
+		$default_value,
254
+		array $allowed_enum_values
255
+	) {
256
+		return $this->loader->getNew(
257
+			'EE_Enum_Text_Field',
258
+			array($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values)
259
+		);
260
+	}
261
+
262
+
263
+	/**
264
+	 * @param string $table_column
265
+	 * @param string $nice_name
266
+	 * @param bool   $nullable
267
+	 * @param null   $default_value
268
+	 * @return EE_Float_Field
269
+	 */
270
+	public function createFloatField($table_column, $nice_name, $nullable, $default_value = null)
271
+	{
272
+		return $this->loader->getNew(
273
+			'EE_Float_Field',
274
+			array($table_column, $nice_name, $nullable, $default_value)
275
+		);
276
+	}
277
+
278
+
279
+	/**
280
+	 * @param string $table_column
281
+	 * @param string $nice_name
282
+	 * @param bool   $nullable
283
+	 * @param null   $default_value
284
+	 * @param string $model_name
285
+	 * @return EE_Foreign_Key_Int_Field
286
+	 */
287
+	public function createForeignKeyIntField($table_column, $nice_name, $nullable, $default_value, $model_name)
288
+	{
289
+		return $this->loader->getNew(
290
+			'EE_Foreign_Key_Int_Field',
291
+			array($table_column, $nice_name, $nullable, $default_value, $model_name)
292
+		);
293
+	}
294
+
295
+
296
+	/**
297
+	 * @param string $table_column
298
+	 * @param string $nice_name
299
+	 * @param bool   $nullable
300
+	 * @param null   $default_value
301
+	 * @param string $model_name
302
+	 * @return EE_Foreign_Key_String_Field
303
+	 */
304
+	public function createForeignKeyStringField(
305
+		$table_column,
306
+		$nice_name,
307
+		$nullable,
308
+		$default_value,
309
+		$model_name
310
+	) {
311
+		return $this->loader->getNew(
312
+			'EE_Foreign_Key_String_Field',
313
+			array($table_column, $nice_name, $nullable, $default_value, $model_name)
314
+		);
315
+	}
316
+
317
+
318
+	/**
319
+	 * @param string $table_column
320
+	 * @param string $nice_name
321
+	 * @param bool   $nullable
322
+	 * @param null   $default_value
323
+	 * @return EE_Full_HTML_Field
324
+	 */
325
+	public function createFullHtmlField($table_column, $nice_name, $nullable, $default_value = null)
326
+	{
327
+		return $this->loader->getNew(
328
+			'EE_Full_HTML_Field',
329
+			array($table_column, $nice_name, $nullable, $default_value)
330
+		);
331
+	}
332
+
333
+
334
+	/**
335
+	 * @param string $table_column
336
+	 * @param string $nice_name
337
+	 * @param bool   $nullable
338
+	 * @param null   $default_value
339
+	 * @return EE_Infinite_Integer_Field
340
+	 */
341
+	public function createInfiniteIntegerField($table_column, $nice_name, $nullable, $default_value = null)
342
+	{
343
+		return $this->loader->getNew(
344
+			'EE_Infinite_Integer_Field',
345
+			array($table_column, $nice_name, $nullable, $default_value)
346
+		);
347
+	}
348
+
349
+
350
+	/**
351
+	 * @param string  $table_column
352
+	 * @param string  $nice_name
353
+	 * @param bool    $nullable
354
+	 * @param integer $default_value
355
+	 * @return EE_Integer_Field
356
+	 */
357
+	public function createIntegerField($table_column, $nice_name, $nullable = false, $default_value = 0)
358
+	{
359
+		return $this->loader->getNew(
360
+			'EE_Integer_Field',
361
+			array($table_column, $nice_name, $nullable, $default_value)
362
+		);
363
+	}
364
+
365
+
366
+	/**
367
+	 * @param string $table_column
368
+	 * @param string $nice_name
369
+	 * @param bool   $nullable
370
+	 * @param null   $default_value
371
+	 * @return EE_Maybe_Serialized_Simple_HTML_Field
372
+	 */
373
+	public function createMaybeSerializedSimpleHtmlField($table_column, $nice_name, $nullable, $default_value = null)
374
+	{
375
+		return $this->loader->getNew(
376
+			'EE_Maybe_Serialized_Simple_HTML_Field',
377
+			array($table_column, $nice_name, $nullable, $default_value)
378
+		);
379
+	}
380
+
381
+
382
+	/**
383
+	 * @param string $table_column
384
+	 * @param string $nice_name
385
+	 * @param bool   $nullable
386
+	 * @param null   $default_value
387
+	 * @return EE_Maybe_Serialized_Text_Field
388
+	 */
389
+	public function createMaybeSerializedTextField($table_column, $nice_name, $nullable, $default_value = null)
390
+	{
391
+		return $this->loader->getNew(
392
+			'EE_Maybe_Serialized_Text_Field',
393
+			array($table_column, $nice_name, $nullable, $default_value)
394
+		);
395
+	}
396
+
397
+
398
+	/**
399
+	 * @param string $table_column
400
+	 * @param string $nice_name
401
+	 * @param bool   $nullable
402
+	 * @param null   $default_value
403
+	 * @return EE_Money_Field
404
+	 */
405
+	public function createMoneyField($table_column, $nice_name, $nullable, $default_value = null)
406
+	{
407
+		return $this->loader->getNew(
408
+			'EE_Money_Field',
409
+			array($table_column, $nice_name, $nullable, $default_value)
410
+		);
411
+	}
412
+
413
+
414
+	/**
415
+	 * @param string $table_column
416
+	 * @param string $nice_name
417
+	 * @param bool   $nullable
418
+	 * @param string $default_value
419
+	 * @return EE_Plain_Text_Field
420
+	 */
421
+	public function createPlainTextField($table_column, $nice_name, $nullable = true, $default_value = '')
422
+	{
423
+		return $this->loader->getNew(
424
+			'EE_Plain_Text_Field',
425
+			array($table_column, $nice_name, $nullable, $default_value)
426
+		);
427
+	}
428
+
429
+
430
+	/**
431
+	 * @param string $table_column
432
+	 * @param string $nice_name
433
+	 * @param bool   $nullable
434
+	 * @param null   $default_value
435
+	 * @return EE_Post_Content_Field
436
+	 */
437
+	public function createPostContentField($table_column, $nice_name, $nullable, $default_value = null)
438
+	{
439
+		return $this->loader->getNew(
440
+			'EE_Post_Content_Field',
441
+			array($table_column, $nice_name, $nullable, $default_value)
442
+		);
443
+	}
444
+
445
+
446
+	/**
447
+	 * @param string $table_column
448
+	 * @param string $nice_name
449
+	 * @return EE_Primary_Key_Int_Field
450
+	 */
451
+	public function createPrimaryKeyIntField($table_column, $nice_name)
452
+	{
453
+		return $this->loader->getNew('EE_Primary_Key_Int_Field', array($table_column, $nice_name));
454
+	}
455
+
456
+
457
+	/**
458
+	 * @param string $table_column
459
+	 * @param string $nice_name
460
+	 * @return EE_Primary_Key_String_Field
461
+	 */
462
+	public function createPrimaryKeyStringField($table_column, $nice_name)
463
+	{
464
+		return $this->loader->getNew('EE_Primary_Key_String_Field', array($table_column, $nice_name));
465
+	}
466
+
467
+
468
+	/**
469
+	 * @param string $table_column
470
+	 * @param string $nice_name
471
+	 * @param bool   $nullable
472
+	 * @param null   $default_value
473
+	 * @return EE_Serialized_Text_Field
474
+	 */
475
+	public function createSerializedTextField($table_column, $nice_name, $nullable, $default_value = null)
476
+	{
477
+		return $this->loader->getNew(
478
+			'EE_Serialized_Text_Field',
479
+			array($table_column, $nice_name, $nullable, $default_value)
480
+		);
481
+	}
482
+
483
+
484
+	/**
485
+	 * @param string $table_column
486
+	 * @param string $nice_name
487
+	 * @param bool   $nullable
488
+	 * @param null   $default_value
489
+	 * @return EE_Simple_HTML_Field
490
+	 */
491
+	public function createSimpleHtmlField($table_column, $nice_name, $nullable, $default_value = null)
492
+	{
493
+		return $this->loader->getNew(
494
+			'EE_Simple_HTML_Field',
495
+			array($table_column, $nice_name, $nullable, $default_value)
496
+		);
497
+	}
498
+
499
+
500
+	/**
501
+	 * @param string $table_column
502
+	 * @param string $nice_name
503
+	 * @param bool   $nullable
504
+	 * @param null   $default_value
505
+	 * @return EE_Slug_Field
506
+	 */
507
+	public function createSlugField($table_column, $nice_name, $nullable = false, $default_value = null)
508
+	{
509
+		return $this->loader->getNew(
510
+			'EE_Slug_Field',
511
+			array($table_column, $nice_name, $nullable, $default_value)
512
+		);
513
+	}
514
+
515
+
516
+	/**
517
+	 * @param string $table_column
518
+	 * @param string $nice_name
519
+	 * @param bool   $nullable
520
+	 * @param null   $default_value
521
+	 * @return EE_Trashed_Flag_Field
522
+	 */
523
+	public function createTrashedFlagField($table_column, $nice_name, $nullable, $default_value = null)
524
+	{
525
+		return $this->loader->getNew(
526
+			'EE_Trashed_Flag_Field',
527
+			array($table_column, $nice_name, $nullable, $default_value)
528
+		);
529
+	}
530
+
531
+
532
+	/**
533
+	 * @param string $table_column
534
+	 * @param string $nice_name
535
+	 * @param bool   $nullable
536
+	 * @param mixed  $default_value
537
+	 * @param array  $values                            If additional stati are to be used other than the default WP
538
+	 *                                                  statuses, then they can be registered via this property. The
539
+	 *                                                  format of the array should be as follows: array(
540
+	 *                                                  'status_reference' => array(
541
+	 *                                                  'label' => __('Status Reference Label', 'event_espresso'),
542
+	 *                                                  'public' => true,                 // whether this status should
543
+	 *                                                  be shown on the frontend of the site
544
+	 *                                                  'exclude_from_search' => false,   // whether this status should
545
+	 *                                                  be excluded from wp searches
546
+	 *                                                  'show_in_admin_all_list' => true, // whether this status is
547
+	 *                                                  included in queries for the admin "all" view in list table
548
+	 *                                                  views.
549
+	 *                                                  'show_in_admin_status_list' => true, // show in the list of
550
+	 *                                                  statuses with post counts at the top of the admin list tables
551
+	 *                                                  (i.e. Status Reference(2) )
552
+	 *                                                  'label_count' => _n_noop(
553
+	 *                                                  'Status Reference <span class="count">(%s)</span>',
554
+	 *                                                  'Status References <span class="count">(%s)</span>'
555
+	 *                                                  ),                                   // the text to display on
556
+	 *                                                  the admin screen
557
+	 *                                                  ( or you won't see your status count ).
558
+	 *                                                  )
559
+	 *                                                  )
560
+	 * @link http://codex.wordpress.org/Function_Reference/register_post_status for more info
561
+	 * @return EE_WP_Post_Status_Field
562
+	 */
563
+	public function createWpPostStatusField(
564
+		$table_column,
565
+		$nice_name,
566
+		$nullable,
567
+		$default_value = null,
568
+		array $values = array()
569
+	) {
570
+		return $this->loader->getNew(
571
+			'EE_WP_Post_Status_Field',
572
+			array($table_column, $nice_name, $nullable, $default_value, $values)
573
+		);
574
+	}
575
+
576
+
577
+	/**
578
+	 * @param string $post_type
579
+	 * @return EE_WP_Post_Type_Field
580
+	 */
581
+	public function createWpPostTypeField($post_type)
582
+	{
583
+		return $this->loader->getNew('EE_WP_Post_Type_Field', array($post_type));
584
+	}
585
+
586
+
587
+	/**
588
+	 * @param string $table_column
589
+	 * @param string $nice_name
590
+	 * @param bool   $nullable
591
+	 * @return EE_WP_User_Field
592
+	 */
593
+	public function createWpUserField($table_column, $nice_name, $nullable)
594
+	{
595
+		return $this->loader->getNew('EE_WP_User_Field', array($table_column, $nice_name, $nullable));
596
+	}
597 597
 }
Please login to merge, or discard this patch.
modules/ticket_selector/ProcessTicketSelector.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -473,7 +473,7 @@
 block discarded – undo
473 473
      *
474 474
      * @param EE_Ticket $ticket
475 475
      * @param int       $qty
476
-     * @return TRUE on success, FALSE on fail
476
+     * @return boolean on success, FALSE on fail
477 477
      * @throws InvalidArgumentException
478 478
      * @throws InvalidInterfaceException
479 479
      * @throws InvalidDataTypeException
Please login to merge, or discard this patch.
Indentation   +497 added lines, -497 removed lines patch added patch discarded remove patch
@@ -32,526 +32,526 @@
 block discarded – undo
32 32
 class ProcessTicketSelector
33 33
 {
34 34
 
35
-    /**
36
-     * @var EE_Cart $cart
37
-     */
38
-    private $cart;
35
+	/**
36
+	 * @var EE_Cart $cart
37
+	 */
38
+	private $cart;
39 39
 
40
-    /**
41
-     * @var EE_Core_Config $core_config
42
-     */
43
-    private $core_config;
40
+	/**
41
+	 * @var EE_Core_Config $core_config
42
+	 */
43
+	private $core_config;
44 44
 
45
-    /**
46
-     * @var Request $request
47
-     */
48
-    private $request;
45
+	/**
46
+	 * @var Request $request
47
+	 */
48
+	private $request;
49 49
 
50
-    /**
51
-     * @var EE_Session $session
52
-     */
53
-    private $session;
50
+	/**
51
+	 * @var EE_Session $session
52
+	 */
53
+	private $session;
54 54
 
55
-    /**
56
-     * @var EEM_Ticket $ticket_model
57
-     */
58
-    private $ticket_model;
55
+	/**
56
+	 * @var EEM_Ticket $ticket_model
57
+	 */
58
+	private $ticket_model;
59 59
 
60
-    /**
61
-     * @var TicketDatetimeAvailabilityTracker $tracker
62
-     */
63
-    private $tracker;
60
+	/**
61
+	 * @var TicketDatetimeAvailabilityTracker $tracker
62
+	 */
63
+	private $tracker;
64 64
 
65 65
 
66
-    /**
67
-     * ProcessTicketSelector constructor.
68
-     * NOTE: PLZ use the Loader to instantiate this class if need be
69
-     * so that all dependencies get injected correctly (which will happen automatically)
70
-     * Null values for parameters are only for backwards compatibility but will be removed later on.
71
-     *
72
-     * @param EE_Core_Config                    $core_config
73
-     * @param Request                           $request
74
-     * @param EE_Session                        $session
75
-     * @param EEM_Ticket                        $ticket_model
76
-     * @param TicketDatetimeAvailabilityTracker $tracker
77
-     * @throws InvalidArgumentException
78
-     * @throws InvalidDataTypeException
79
-     * @throws InvalidInterfaceException
80
-     */
81
-    public function __construct(
82
-        EE_Core_Config $core_config = null,
83
-        Request $request = null,
84
-        EE_Session $session = null,
85
-        EEM_Ticket $ticket_model = null,
86
-        TicketDatetimeAvailabilityTracker $tracker = null
87
-    ) {
88
-        /** @var LoaderInterface $loader */
89
-        $loader = LoaderFactory::getLoader();
90
-        $this->core_config = $core_config instanceof EE_Core_Config
91
-            ? $core_config
92
-            : $loader->getShared('EE_Core_Config');
93
-        $this->request = $request instanceof Request
94
-            ? $request
95
-            : $loader->getShared('EventEspresso\core\services\request\Request');
96
-        $this->session = $session instanceof EE_Session
97
-            ? $session
98
-            : $loader->getShared('EE_Session');
99
-        $this->ticket_model = $ticket_model instanceof EEM_Ticket
100
-            ? $ticket_model
101
-            : $loader->getShared('EEM_Ticket');
102
-        $this->tracker = $tracker instanceof TicketDatetimeAvailabilityTracker
103
-            ? $tracker
104
-            : $loader->getShared('EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker');
105
-    }
66
+	/**
67
+	 * ProcessTicketSelector constructor.
68
+	 * NOTE: PLZ use the Loader to instantiate this class if need be
69
+	 * so that all dependencies get injected correctly (which will happen automatically)
70
+	 * Null values for parameters are only for backwards compatibility but will be removed later on.
71
+	 *
72
+	 * @param EE_Core_Config                    $core_config
73
+	 * @param Request                           $request
74
+	 * @param EE_Session                        $session
75
+	 * @param EEM_Ticket                        $ticket_model
76
+	 * @param TicketDatetimeAvailabilityTracker $tracker
77
+	 * @throws InvalidArgumentException
78
+	 * @throws InvalidDataTypeException
79
+	 * @throws InvalidInterfaceException
80
+	 */
81
+	public function __construct(
82
+		EE_Core_Config $core_config = null,
83
+		Request $request = null,
84
+		EE_Session $session = null,
85
+		EEM_Ticket $ticket_model = null,
86
+		TicketDatetimeAvailabilityTracker $tracker = null
87
+	) {
88
+		/** @var LoaderInterface $loader */
89
+		$loader = LoaderFactory::getLoader();
90
+		$this->core_config = $core_config instanceof EE_Core_Config
91
+			? $core_config
92
+			: $loader->getShared('EE_Core_Config');
93
+		$this->request = $request instanceof Request
94
+			? $request
95
+			: $loader->getShared('EventEspresso\core\services\request\Request');
96
+		$this->session = $session instanceof EE_Session
97
+			? $session
98
+			: $loader->getShared('EE_Session');
99
+		$this->ticket_model = $ticket_model instanceof EEM_Ticket
100
+			? $ticket_model
101
+			: $loader->getShared('EEM_Ticket');
102
+		$this->tracker = $tracker instanceof TicketDatetimeAvailabilityTracker
103
+			? $tracker
104
+			: $loader->getShared('EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker');
105
+	}
106 106
 
107 107
 
108
-    /**
109
-     * cancelTicketSelections
110
-     *
111
-     * @return bool
112
-     * @throws EE_Error
113
-     * @throws InvalidArgumentException
114
-     * @throws InvalidInterfaceException
115
-     * @throws InvalidDataTypeException
116
-     */
117
-    public function cancelTicketSelections()
118
-    {
119
-        // check nonce
120
-        if (! $this->processTicketSelectorNonce('cancel_ticket_selections')) {
121
-            return false;
122
-        }
123
-        $this->session->clear_session(__CLASS__, __FUNCTION__);
124
-        if ($this->request->requestParamIsSet('event_id')) {
125
-            EEH_URL::safeRedirectAndExit(
126
-                EEH_Event_View::event_link_url(
127
-                    $this->request->getRequestParam('event_id')
128
-                )
129
-            );
130
-        }
131
-        EEH_URL::safeRedirectAndExit(
132
-            site_url('/' . $this->core_config->event_cpt_slug . '/')
133
-        );
134
-        return true;
135
-    }
108
+	/**
109
+	 * cancelTicketSelections
110
+	 *
111
+	 * @return bool
112
+	 * @throws EE_Error
113
+	 * @throws InvalidArgumentException
114
+	 * @throws InvalidInterfaceException
115
+	 * @throws InvalidDataTypeException
116
+	 */
117
+	public function cancelTicketSelections()
118
+	{
119
+		// check nonce
120
+		if (! $this->processTicketSelectorNonce('cancel_ticket_selections')) {
121
+			return false;
122
+		}
123
+		$this->session->clear_session(__CLASS__, __FUNCTION__);
124
+		if ($this->request->requestParamIsSet('event_id')) {
125
+			EEH_URL::safeRedirectAndExit(
126
+				EEH_Event_View::event_link_url(
127
+					$this->request->getRequestParam('event_id')
128
+				)
129
+			);
130
+		}
131
+		EEH_URL::safeRedirectAndExit(
132
+			site_url('/' . $this->core_config->event_cpt_slug . '/')
133
+		);
134
+		return true;
135
+	}
136 136
 
137 137
 
138
-    /**
139
-     * processTicketSelectorNonce
140
-     *
141
-     * @param  string $nonce_name
142
-     * @param string  $id
143
-     * @return bool
144
-     */
145
-    private function processTicketSelectorNonce($nonce_name, $id = '')
146
-    {
147
-        $nonce_name_with_id = ! empty($id) ? "{$nonce_name}_nonce_{$id}" : "{$nonce_name}_nonce";
148
-        if (! $this->request->isAdmin()
149
-            && (
150
-                ! $this->request->is_set($nonce_name_with_id)
151
-                || ! wp_verify_nonce(
152
-                    $this->request->get($nonce_name_with_id),
153
-                    $nonce_name
154
-                )
155
-            )
156
-        ) {
157
-            EE_Error::add_error(
158
-                sprintf(
159
-                    esc_html__(
160
-                        'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.',
161
-                        'event_espresso'
162
-                    ),
163
-                    '<br/>'
164
-                ),
165
-                __FILE__,
166
-                __FUNCTION__,
167
-                __LINE__
168
-            );
169
-            return false;
170
-        }
171
-        return true;
172
-    }
138
+	/**
139
+	 * processTicketSelectorNonce
140
+	 *
141
+	 * @param  string $nonce_name
142
+	 * @param string  $id
143
+	 * @return bool
144
+	 */
145
+	private function processTicketSelectorNonce($nonce_name, $id = '')
146
+	{
147
+		$nonce_name_with_id = ! empty($id) ? "{$nonce_name}_nonce_{$id}" : "{$nonce_name}_nonce";
148
+		if (! $this->request->isAdmin()
149
+			&& (
150
+				! $this->request->is_set($nonce_name_with_id)
151
+				|| ! wp_verify_nonce(
152
+					$this->request->get($nonce_name_with_id),
153
+					$nonce_name
154
+				)
155
+			)
156
+		) {
157
+			EE_Error::add_error(
158
+				sprintf(
159
+					esc_html__(
160
+						'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.',
161
+						'event_espresso'
162
+					),
163
+					'<br/>'
164
+				),
165
+				__FILE__,
166
+				__FUNCTION__,
167
+				__LINE__
168
+			);
169
+			return false;
170
+		}
171
+		return true;
172
+	}
173 173
 
174 174
 
175
-    /**
176
-     * process_ticket_selections
177
-     *
178
-     * @return array|bool
179
-     * @throws EE_Error
180
-     * @throws InvalidArgumentException
181
-     * @throws InvalidDataTypeException
182
-     * @throws InvalidInterfaceException
183
-     */
184
-    public function processTicketSelections()
185
-    {
186
-        do_action('EED_Ticket_Selector__process_ticket_selections__before');
187
-        if ($this->request->isBot()) {
188
-            EEH_URL::safeRedirectAndExit(
189
-                apply_filters(
190
-                    'FHEE__EE_Ticket_Selector__process_ticket_selections__bot_redirect_url',
191
-                    site_url()
192
-                )
193
-            );
194
-        }
195
-        // do we have an event id?
196
-        $id = $this->getEventId();
197
-        // we should really only have 1 registration in the works now
198
-        // (ie, no MER) so unless otherwise requested, clear the session
199
-        if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', true)) {
200
-            $this->session->clear_session(__CLASS__, __FUNCTION__);
201
-        }
202
-        // validate/sanitize/filter data
203
-        $valid = apply_filters(
204
-            'FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data',
205
-            $this->validatePostData($id)
206
-        );
207
-        // check total tickets ordered vs max number of attendees that can register
208
-        if ($valid['total_tickets'] > $valid['max_atndz']) {
209
-            $this->maxAttendeesViolation($valid);
210
-        } else {
211
-            // all data appears to be valid
212
-            if ($this->processSuccessfulCart($this->addTicketsToCart($valid))) {
213
-                return true;
214
-            }
215
-        }
216
-        // die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
217
-        // at this point, just return if registration is being made from admin
218
-        if ($this->request->isAdmin() || $this->request->isFrontAjax()) {
219
-            return false;
220
-        }
221
-        if ($valid['return_url']) {
222
-            EEH_URL::safeRedirectAndExit($valid['return_url']);
223
-        }
224
-        if ($id) {
225
-            EEH_URL::safeRedirectAndExit(get_permalink($id));
226
-        }
227
-        echo EE_Error::get_notices();
228
-        return false;
229
-    }
175
+	/**
176
+	 * process_ticket_selections
177
+	 *
178
+	 * @return array|bool
179
+	 * @throws EE_Error
180
+	 * @throws InvalidArgumentException
181
+	 * @throws InvalidDataTypeException
182
+	 * @throws InvalidInterfaceException
183
+	 */
184
+	public function processTicketSelections()
185
+	{
186
+		do_action('EED_Ticket_Selector__process_ticket_selections__before');
187
+		if ($this->request->isBot()) {
188
+			EEH_URL::safeRedirectAndExit(
189
+				apply_filters(
190
+					'FHEE__EE_Ticket_Selector__process_ticket_selections__bot_redirect_url',
191
+					site_url()
192
+				)
193
+			);
194
+		}
195
+		// do we have an event id?
196
+		$id = $this->getEventId();
197
+		// we should really only have 1 registration in the works now
198
+		// (ie, no MER) so unless otherwise requested, clear the session
199
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', true)) {
200
+			$this->session->clear_session(__CLASS__, __FUNCTION__);
201
+		}
202
+		// validate/sanitize/filter data
203
+		$valid = apply_filters(
204
+			'FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data',
205
+			$this->validatePostData($id)
206
+		);
207
+		// check total tickets ordered vs max number of attendees that can register
208
+		if ($valid['total_tickets'] > $valid['max_atndz']) {
209
+			$this->maxAttendeesViolation($valid);
210
+		} else {
211
+			// all data appears to be valid
212
+			if ($this->processSuccessfulCart($this->addTicketsToCart($valid))) {
213
+				return true;
214
+			}
215
+		}
216
+		// die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
217
+		// at this point, just return if registration is being made from admin
218
+		if ($this->request->isAdmin() || $this->request->isFrontAjax()) {
219
+			return false;
220
+		}
221
+		if ($valid['return_url']) {
222
+			EEH_URL::safeRedirectAndExit($valid['return_url']);
223
+		}
224
+		if ($id) {
225
+			EEH_URL::safeRedirectAndExit(get_permalink($id));
226
+		}
227
+		echo EE_Error::get_notices();
228
+		return false;
229
+	}
230 230
 
231 231
 
232
-    /**
233
-     * @return int
234
-     */
235
-    private function getEventId()
236
-    {
237
-        // do we have an event id?
238
-        if (! $this->request->requestParamIsSet('tkt-slctr-event-id')) {
239
-            // $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
240
-            EE_Error::add_error(
241
-                sprintf(
242
-                    esc_html__(
243
-                        'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.',
244
-                        'event_espresso'
245
-                    ),
246
-                    '<br/>'
247
-                ),
248
-                __FILE__,
249
-                __FUNCTION__,
250
-                __LINE__
251
-            );
252
-        }
253
-        // if event id is valid
254
-        return absint($this->request->getRequestParam('tkt-slctr-event-id'));
255
-    }
232
+	/**
233
+	 * @return int
234
+	 */
235
+	private function getEventId()
236
+	{
237
+		// do we have an event id?
238
+		if (! $this->request->requestParamIsSet('tkt-slctr-event-id')) {
239
+			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
240
+			EE_Error::add_error(
241
+				sprintf(
242
+					esc_html__(
243
+						'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.',
244
+						'event_espresso'
245
+					),
246
+					'<br/>'
247
+				),
248
+				__FILE__,
249
+				__FUNCTION__,
250
+				__LINE__
251
+			);
252
+		}
253
+		// if event id is valid
254
+		return absint($this->request->getRequestParam('tkt-slctr-event-id'));
255
+	}
256 256
 
257 257
 
258
-    /**
259
-     * validate_post_data
260
-     *
261
-     * @param int $id
262
-     * @return array|FALSE
263
-     */
264
-    private function validatePostData($id = 0)
265
-    {
266
-        if (! $id) {
267
-            EE_Error::add_error(
268
-                esc_html__('The event id provided was not valid.', 'event_espresso'),
269
-                __FILE__,
270
-                __FUNCTION__,
271
-                __LINE__
272
-            );
273
-            return false;
274
-        }
275
-        // start with an empty array()
276
-        $valid_data = array();
277
-        // grab valid id
278
-        $valid_data['id'] = $id;
279
-        // array of other form names
280
-        $inputs_to_clean = array(
281
-            'event_id'   => 'tkt-slctr-event-id',
282
-            'max_atndz'  => 'tkt-slctr-max-atndz-',
283
-            'rows'       => 'tkt-slctr-rows-',
284
-            'qty'        => 'tkt-slctr-qty-',
285
-            'ticket_id'  => 'tkt-slctr-ticket-id-',
286
-            'return_url' => 'tkt-slctr-return-url-',
287
-        );
288
-        // let's track the total number of tickets ordered.'
289
-        $valid_data['total_tickets'] = 0;
290
-        // cycle through $inputs_to_clean array
291
-        foreach ($inputs_to_clean as $what => $input_to_clean) {
292
-            // check for POST data
293
-            if ($this->request->requestParamIsSet($input_to_clean . $id)) {
294
-                // grab value
295
-                $input_value = $this->request->getRequestParam($input_to_clean . $id);
296
-                switch ($what) {
297
-                    // integers
298
-                    case 'event_id':
299
-                        $valid_data[$what] = absint($input_value);
300
-                        // get event via the event id we put in the form
301
-                        break;
302
-                    case 'rows':
303
-                    case 'max_atndz':
304
-                        $valid_data[$what] = absint($input_value);
305
-                        break;
306
-                    // arrays of integers
307
-                    case 'qty':
308
-                        /** @var array $row_qty */
309
-                        $row_qty = $input_value;
310
-                        // if qty is coming from a radio button input, then we need to assemble an array of rows
311
-                        if (! is_array($row_qty)) {
312
-                            /** @var string $row_qty */
313
-                            // get number of rows
314
-                            $rows = $this->request->requestParamIsSet('tkt-slctr-rows-' . $id)
315
-                                ? absint($this->request->getRequestParam('tkt-slctr-rows-' . $id))
316
-                                : 1;
317
-                            // explode integers by the dash
318
-                            $row_qty = explode('-', $row_qty);
319
-                            $row = isset($row_qty[0]) ? absint($row_qty[0]) : 1;
320
-                            $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
321
-                            $row_qty = array($row => $qty);
322
-                            for ($x = 1; $x <= $rows; $x++) {
323
-                                if (! isset($row_qty[$x])) {
324
-                                    $row_qty[$x] = 0;
325
-                                }
326
-                            }
327
-                        }
328
-                        ksort($row_qty);
329
-                        // cycle thru values
330
-                        foreach ($row_qty as $qty) {
331
-                            $qty = absint($qty);
332
-                            // sanitize as integers
333
-                            $valid_data[$what][] = $qty;
334
-                            $valid_data['total_tickets'] += $qty;
335
-                        }
336
-                        break;
337
-                    // array of integers
338
-                    case 'ticket_id':
339
-                        // cycle thru values
340
-                        foreach ((array)$input_value as $key => $value) {
341
-                            // allow only integers
342
-                            $valid_data[$what][$key] = absint($value);
343
-                        }
344
-                        break;
345
-                    case 'return_url':
346
-                        // grab and sanitize return-url
347
-                        $input_value = esc_url_raw($input_value);
348
-                        // was the request coming from an iframe ? if so, then:
349
-                        if (strpos($input_value, 'event_list=iframe')) {
350
-                            // get anchor fragment
351
-                            $input_value = explode('#', $input_value);
352
-                            $input_value = end($input_value);
353
-                            // use event list url instead, but append anchor
354
-                            $input_value = EEH_Event_View::event_archive_url() . '#' . $input_value;
355
-                        }
356
-                        $valid_data[$what] = $input_value;
357
-                        break;
358
-                }    // end switch $what
359
-            }
360
-        }    // end foreach $inputs_to_clean
361
-        return $valid_data;
362
-    }
258
+	/**
259
+	 * validate_post_data
260
+	 *
261
+	 * @param int $id
262
+	 * @return array|FALSE
263
+	 */
264
+	private function validatePostData($id = 0)
265
+	{
266
+		if (! $id) {
267
+			EE_Error::add_error(
268
+				esc_html__('The event id provided was not valid.', 'event_espresso'),
269
+				__FILE__,
270
+				__FUNCTION__,
271
+				__LINE__
272
+			);
273
+			return false;
274
+		}
275
+		// start with an empty array()
276
+		$valid_data = array();
277
+		// grab valid id
278
+		$valid_data['id'] = $id;
279
+		// array of other form names
280
+		$inputs_to_clean = array(
281
+			'event_id'   => 'tkt-slctr-event-id',
282
+			'max_atndz'  => 'tkt-slctr-max-atndz-',
283
+			'rows'       => 'tkt-slctr-rows-',
284
+			'qty'        => 'tkt-slctr-qty-',
285
+			'ticket_id'  => 'tkt-slctr-ticket-id-',
286
+			'return_url' => 'tkt-slctr-return-url-',
287
+		);
288
+		// let's track the total number of tickets ordered.'
289
+		$valid_data['total_tickets'] = 0;
290
+		// cycle through $inputs_to_clean array
291
+		foreach ($inputs_to_clean as $what => $input_to_clean) {
292
+			// check for POST data
293
+			if ($this->request->requestParamIsSet($input_to_clean . $id)) {
294
+				// grab value
295
+				$input_value = $this->request->getRequestParam($input_to_clean . $id);
296
+				switch ($what) {
297
+					// integers
298
+					case 'event_id':
299
+						$valid_data[$what] = absint($input_value);
300
+						// get event via the event id we put in the form
301
+						break;
302
+					case 'rows':
303
+					case 'max_atndz':
304
+						$valid_data[$what] = absint($input_value);
305
+						break;
306
+					// arrays of integers
307
+					case 'qty':
308
+						/** @var array $row_qty */
309
+						$row_qty = $input_value;
310
+						// if qty is coming from a radio button input, then we need to assemble an array of rows
311
+						if (! is_array($row_qty)) {
312
+							/** @var string $row_qty */
313
+							// get number of rows
314
+							$rows = $this->request->requestParamIsSet('tkt-slctr-rows-' . $id)
315
+								? absint($this->request->getRequestParam('tkt-slctr-rows-' . $id))
316
+								: 1;
317
+							// explode integers by the dash
318
+							$row_qty = explode('-', $row_qty);
319
+							$row = isset($row_qty[0]) ? absint($row_qty[0]) : 1;
320
+							$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
321
+							$row_qty = array($row => $qty);
322
+							for ($x = 1; $x <= $rows; $x++) {
323
+								if (! isset($row_qty[$x])) {
324
+									$row_qty[$x] = 0;
325
+								}
326
+							}
327
+						}
328
+						ksort($row_qty);
329
+						// cycle thru values
330
+						foreach ($row_qty as $qty) {
331
+							$qty = absint($qty);
332
+							// sanitize as integers
333
+							$valid_data[$what][] = $qty;
334
+							$valid_data['total_tickets'] += $qty;
335
+						}
336
+						break;
337
+					// array of integers
338
+					case 'ticket_id':
339
+						// cycle thru values
340
+						foreach ((array)$input_value as $key => $value) {
341
+							// allow only integers
342
+							$valid_data[$what][$key] = absint($value);
343
+						}
344
+						break;
345
+					case 'return_url':
346
+						// grab and sanitize return-url
347
+						$input_value = esc_url_raw($input_value);
348
+						// was the request coming from an iframe ? if so, then:
349
+						if (strpos($input_value, 'event_list=iframe')) {
350
+							// get anchor fragment
351
+							$input_value = explode('#', $input_value);
352
+							$input_value = end($input_value);
353
+							// use event list url instead, but append anchor
354
+							$input_value = EEH_Event_View::event_archive_url() . '#' . $input_value;
355
+						}
356
+						$valid_data[$what] = $input_value;
357
+						break;
358
+				}    // end switch $what
359
+			}
360
+		}    // end foreach $inputs_to_clean
361
+		return $valid_data;
362
+	}
363 363
 
364 364
 
365
-    /**
366
-     * @param array $valid
367
-     */
368
-    private function maxAttendeesViolation(array $valid)
369
-    {
370
-        // ordering too many tickets !!!
371
-        $total_tickets_string = esc_html(
372
-            _n(
373
-                'You have attempted to purchase %s ticket.',
374
-                'You have attempted to purchase %s tickets.',
375
-                $valid['total_tickets'],
376
-                'event_espresso'
377
-            )
378
-        );
379
-        $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
380
-        // dev only message
381
-        $max_attendees_string = esc_html(
382
-            _n(
383
-                'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.',
384
-                'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.',
385
-                $valid['max_atndz'],
386
-                'event_espresso'
387
-            )
388
-        );
389
-        $limit_error_2 = sprintf($max_attendees_string, $valid['max_atndz'], $valid['max_atndz']);
390
-        EE_Error::add_error($limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__);
391
-    }
365
+	/**
366
+	 * @param array $valid
367
+	 */
368
+	private function maxAttendeesViolation(array $valid)
369
+	{
370
+		// ordering too many tickets !!!
371
+		$total_tickets_string = esc_html(
372
+			_n(
373
+				'You have attempted to purchase %s ticket.',
374
+				'You have attempted to purchase %s tickets.',
375
+				$valid['total_tickets'],
376
+				'event_espresso'
377
+			)
378
+		);
379
+		$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
380
+		// dev only message
381
+		$max_attendees_string = esc_html(
382
+			_n(
383
+				'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.',
384
+				'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.',
385
+				$valid['max_atndz'],
386
+				'event_espresso'
387
+			)
388
+		);
389
+		$limit_error_2 = sprintf($max_attendees_string, $valid['max_atndz'], $valid['max_atndz']);
390
+		EE_Error::add_error($limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__);
391
+	}
392 392
 
393 393
 
394
-    /**
395
-     * @param array $valid
396
-     * @return int|TRUE
397
-     * @throws EE_Error
398
-     * @throws InvalidArgumentException
399
-     * @throws InvalidDataTypeException
400
-     * @throws InvalidInterfaceException
401
-     */
402
-    private function addTicketsToCart(array $valid)
403
-    {
404
-        $tickets_added = 0;
405
-        $tickets_selected = false;
406
-        if ($valid['total_tickets'] > 0) {
407
-            // load cart using factory because we don't want to do so until actually needed
408
-            $this->cart = CartFactory::getCart();
409
-            // cycle thru the number of data rows sent from the event listing
410
-            for ($x = 0; $x < $valid['rows']; $x++) {
411
-                // does this row actually contain a ticket quantity?
412
-                if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
413
-                    // YES we have a ticket quantity
414
-                    $tickets_selected = true;
415
-                    $valid_ticket = false;
416
-                    // \EEH_Debug_Tools::printr(
417
-                    //     $valid['ticket_id'][ $x ],
418
-                    //     '$valid[\'ticket_id\'][ $x ]',
419
-                    //     __FILE__, __LINE__
420
-                    // );
421
-                    if (isset($valid['ticket_id'][$x])) {
422
-                        // get ticket via the ticket id we put in the form
423
-                        $ticket = $this->ticket_model->get_one_by_ID($valid['ticket_id'][$x]);
424
-                        if ($ticket instanceof EE_Ticket) {
425
-                            $valid_ticket = true;
426
-                            $tickets_added += $this->addTicketToCart(
427
-                                $ticket,
428
-                                $valid['qty'][$x]
429
-                            );
430
-                        }
431
-                    }
432
-                    if ($valid_ticket !== true) {
433
-                        // nothing added to cart retrieved
434
-                        EE_Error::add_error(
435
-                            sprintf(
436
-                                esc_html__(
437
-                                    'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.',
438
-                                    'event_espresso'
439
-                                ),
440
-                                '<br/>'
441
-                            ),
442
-                            __FILE__,
443
-                            __FUNCTION__,
444
-                            __LINE__
445
-                        );
446
-                    }
447
-                    if (EE_Error::has_error()) {
448
-                        break;
449
-                    }
450
-                }
451
-            }
452
-        }
453
-        do_action(
454
-            'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
455
-            $this->cart,
456
-            $this
457
-        );
458
-        if (! apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tickets_selected)) {
459
-            // no ticket quantities were selected
460
-            EE_Error::add_error(
461
-                esc_html__('You need to select a ticket quantity before you can proceed.', 'event_espresso'),
462
-                __FILE__,
463
-                __FUNCTION__,
464
-                __LINE__
465
-            );
466
-        }
467
-        return $tickets_added;
468
-    }
394
+	/**
395
+	 * @param array $valid
396
+	 * @return int|TRUE
397
+	 * @throws EE_Error
398
+	 * @throws InvalidArgumentException
399
+	 * @throws InvalidDataTypeException
400
+	 * @throws InvalidInterfaceException
401
+	 */
402
+	private function addTicketsToCart(array $valid)
403
+	{
404
+		$tickets_added = 0;
405
+		$tickets_selected = false;
406
+		if ($valid['total_tickets'] > 0) {
407
+			// load cart using factory because we don't want to do so until actually needed
408
+			$this->cart = CartFactory::getCart();
409
+			// cycle thru the number of data rows sent from the event listing
410
+			for ($x = 0; $x < $valid['rows']; $x++) {
411
+				// does this row actually contain a ticket quantity?
412
+				if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
413
+					// YES we have a ticket quantity
414
+					$tickets_selected = true;
415
+					$valid_ticket = false;
416
+					// \EEH_Debug_Tools::printr(
417
+					//     $valid['ticket_id'][ $x ],
418
+					//     '$valid[\'ticket_id\'][ $x ]',
419
+					//     __FILE__, __LINE__
420
+					// );
421
+					if (isset($valid['ticket_id'][$x])) {
422
+						// get ticket via the ticket id we put in the form
423
+						$ticket = $this->ticket_model->get_one_by_ID($valid['ticket_id'][$x]);
424
+						if ($ticket instanceof EE_Ticket) {
425
+							$valid_ticket = true;
426
+							$tickets_added += $this->addTicketToCart(
427
+								$ticket,
428
+								$valid['qty'][$x]
429
+							);
430
+						}
431
+					}
432
+					if ($valid_ticket !== true) {
433
+						// nothing added to cart retrieved
434
+						EE_Error::add_error(
435
+							sprintf(
436
+								esc_html__(
437
+									'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.',
438
+									'event_espresso'
439
+								),
440
+								'<br/>'
441
+							),
442
+							__FILE__,
443
+							__FUNCTION__,
444
+							__LINE__
445
+						);
446
+					}
447
+					if (EE_Error::has_error()) {
448
+						break;
449
+					}
450
+				}
451
+			}
452
+		}
453
+		do_action(
454
+			'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
455
+			$this->cart,
456
+			$this
457
+		);
458
+		if (! apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tickets_selected)) {
459
+			// no ticket quantities were selected
460
+			EE_Error::add_error(
461
+				esc_html__('You need to select a ticket quantity before you can proceed.', 'event_espresso'),
462
+				__FILE__,
463
+				__FUNCTION__,
464
+				__LINE__
465
+			);
466
+		}
467
+		return $tickets_added;
468
+	}
469 469
 
470 470
 
471
-    /**
472
-     * adds a ticket to the cart
473
-     *
474
-     * @param EE_Ticket $ticket
475
-     * @param int       $qty
476
-     * @return TRUE on success, FALSE on fail
477
-     * @throws InvalidArgumentException
478
-     * @throws InvalidInterfaceException
479
-     * @throws InvalidDataTypeException
480
-     * @throws EE_Error
481
-     */
482
-    private function addTicketToCart(EE_Ticket $ticket, $qty = 1)
483
-    {
484
-        // get the number of spaces left for this datetime ticket
485
-        $available_spaces = $this->tracker->ticketDatetimeAvailability($ticket);
486
-        // compare available spaces against the number of tickets being purchased
487
-        if ($available_spaces >= $qty) {
488
-            // allow addons to prevent a ticket from being added to cart
489
-            if (! apply_filters(
490
-                'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart',
491
-                true,
492
-                $ticket,
493
-                $qty,
494
-                $available_spaces
495
-            )) {
496
-                return false;
497
-            }
498
-            $qty = absint(apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket));
499
-            // add event to cart
500
-            if ($this->cart->add_ticket_to_cart($ticket, $qty)) {
501
-                $this->tracker->recalculateTicketDatetimeAvailability($ticket, $qty);
502
-                return true;
503
-            }
504
-            return false;
505
-        }
506
-        $this->tracker->processAvailabilityError($ticket, $qty, $this->cart->all_ticket_quantity_count());
507
-        return false;
508
-    }
471
+	/**
472
+	 * adds a ticket to the cart
473
+	 *
474
+	 * @param EE_Ticket $ticket
475
+	 * @param int       $qty
476
+	 * @return TRUE on success, FALSE on fail
477
+	 * @throws InvalidArgumentException
478
+	 * @throws InvalidInterfaceException
479
+	 * @throws InvalidDataTypeException
480
+	 * @throws EE_Error
481
+	 */
482
+	private function addTicketToCart(EE_Ticket $ticket, $qty = 1)
483
+	{
484
+		// get the number of spaces left for this datetime ticket
485
+		$available_spaces = $this->tracker->ticketDatetimeAvailability($ticket);
486
+		// compare available spaces against the number of tickets being purchased
487
+		if ($available_spaces >= $qty) {
488
+			// allow addons to prevent a ticket from being added to cart
489
+			if (! apply_filters(
490
+				'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart',
491
+				true,
492
+				$ticket,
493
+				$qty,
494
+				$available_spaces
495
+			)) {
496
+				return false;
497
+			}
498
+			$qty = absint(apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket));
499
+			// add event to cart
500
+			if ($this->cart->add_ticket_to_cart($ticket, $qty)) {
501
+				$this->tracker->recalculateTicketDatetimeAvailability($ticket, $qty);
502
+				return true;
503
+			}
504
+			return false;
505
+		}
506
+		$this->tracker->processAvailabilityError($ticket, $qty, $this->cart->all_ticket_quantity_count());
507
+		return false;
508
+	}
509 509
 
510 510
 
511
-    /**
512
-     * @param $tickets_added
513
-     * @return bool
514
-     * @throws InvalidInterfaceException
515
-     * @throws InvalidDataTypeException
516
-     * @throws EE_Error
517
-     * @throws InvalidArgumentException
518
-     */
519
-    private function processSuccessfulCart($tickets_added)
520
-    {
521
-        // exit('KILL REDIRECT BEFORE CART UPDATE'); // <<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
522
-        if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) {
523
-            // make sure cart is loaded
524
-            if (! $this->cart instanceof EE_Cart) {
525
-                $this->cart = CartFactory::getCart();
526
-            }
527
-            do_action(
528
-                'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout',
529
-                $this->cart,
530
-                $this
531
-            );
532
-            $this->cart->recalculate_all_cart_totals();
533
-            $this->cart->save_cart(false);
534
-            // exit('KILL REDIRECT AFTER CART UPDATE'); // <<<<<<<<  OR HERE TO KILL REDIRECT AFTER CART UPDATE
535
-            // just return TRUE for registrations being made from admin
536
-            if ($this->request->isAdmin() || $this->request->isFrontAjax()) {
537
-                return true;
538
-            }
539
-            EEH_URL::safeRedirectAndExit(
540
-                apply_filters(
541
-                    'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url',
542
-                    $this->core_config->reg_page_url()
543
-                )
544
-            );
545
-        }
546
-        if (! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) {
547
-            // nothing added to cart
548
-            EE_Error::add_attention(
549
-                esc_html__('No tickets were added for the event', 'event_espresso'),
550
-                __FILE__,
551
-                __FUNCTION__,
552
-                __LINE__
553
-            );
554
-        }
555
-        return false;
556
-    }
511
+	/**
512
+	 * @param $tickets_added
513
+	 * @return bool
514
+	 * @throws InvalidInterfaceException
515
+	 * @throws InvalidDataTypeException
516
+	 * @throws EE_Error
517
+	 * @throws InvalidArgumentException
518
+	 */
519
+	private function processSuccessfulCart($tickets_added)
520
+	{
521
+		// exit('KILL REDIRECT BEFORE CART UPDATE'); // <<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
522
+		if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) {
523
+			// make sure cart is loaded
524
+			if (! $this->cart instanceof EE_Cart) {
525
+				$this->cart = CartFactory::getCart();
526
+			}
527
+			do_action(
528
+				'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout',
529
+				$this->cart,
530
+				$this
531
+			);
532
+			$this->cart->recalculate_all_cart_totals();
533
+			$this->cart->save_cart(false);
534
+			// exit('KILL REDIRECT AFTER CART UPDATE'); // <<<<<<<<  OR HERE TO KILL REDIRECT AFTER CART UPDATE
535
+			// just return TRUE for registrations being made from admin
536
+			if ($this->request->isAdmin() || $this->request->isFrontAjax()) {
537
+				return true;
538
+			}
539
+			EEH_URL::safeRedirectAndExit(
540
+				apply_filters(
541
+					'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url',
542
+					$this->core_config->reg_page_url()
543
+				)
544
+			);
545
+		}
546
+		if (! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) {
547
+			// nothing added to cart
548
+			EE_Error::add_attention(
549
+				esc_html__('No tickets were added for the event', 'event_espresso'),
550
+				__FILE__,
551
+				__FUNCTION__,
552
+				__LINE__
553
+			);
554
+		}
555
+		return false;
556
+	}
557 557
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     public function cancelTicketSelections()
118 118
     {
119 119
         // check nonce
120
-        if (! $this->processTicketSelectorNonce('cancel_ticket_selections')) {
120
+        if ( ! $this->processTicketSelectorNonce('cancel_ticket_selections')) {
121 121
             return false;
122 122
         }
123 123
         $this->session->clear_session(__CLASS__, __FUNCTION__);
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             );
130 130
         }
131 131
         EEH_URL::safeRedirectAndExit(
132
-            site_url('/' . $this->core_config->event_cpt_slug . '/')
132
+            site_url('/'.$this->core_config->event_cpt_slug.'/')
133 133
         );
134 134
         return true;
135 135
     }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     private function processTicketSelectorNonce($nonce_name, $id = '')
146 146
     {
147 147
         $nonce_name_with_id = ! empty($id) ? "{$nonce_name}_nonce_{$id}" : "{$nonce_name}_nonce";
148
-        if (! $this->request->isAdmin()
148
+        if ( ! $this->request->isAdmin()
149 149
             && (
150 150
                 ! $this->request->is_set($nonce_name_with_id)
151 151
                 || ! wp_verify_nonce(
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     private function getEventId()
236 236
     {
237 237
         // do we have an event id?
238
-        if (! $this->request->requestParamIsSet('tkt-slctr-event-id')) {
238
+        if ( ! $this->request->requestParamIsSet('tkt-slctr-event-id')) {
239 239
             // $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
240 240
             EE_Error::add_error(
241 241
                 sprintf(
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
      */
264 264
     private function validatePostData($id = 0)
265 265
     {
266
-        if (! $id) {
266
+        if ( ! $id) {
267 267
             EE_Error::add_error(
268 268
                 esc_html__('The event id provided was not valid.', 'event_espresso'),
269 269
                 __FILE__,
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
         // cycle through $inputs_to_clean array
291 291
         foreach ($inputs_to_clean as $what => $input_to_clean) {
292 292
             // check for POST data
293
-            if ($this->request->requestParamIsSet($input_to_clean . $id)) {
293
+            if ($this->request->requestParamIsSet($input_to_clean.$id)) {
294 294
                 // grab value
295
-                $input_value = $this->request->getRequestParam($input_to_clean . $id);
295
+                $input_value = $this->request->getRequestParam($input_to_clean.$id);
296 296
                 switch ($what) {
297 297
                     // integers
298 298
                     case 'event_id':
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
                         /** @var array $row_qty */
309 309
                         $row_qty = $input_value;
310 310
                         // if qty is coming from a radio button input, then we need to assemble an array of rows
311
-                        if (! is_array($row_qty)) {
311
+                        if ( ! is_array($row_qty)) {
312 312
                             /** @var string $row_qty */
313 313
                             // get number of rows
314
-                            $rows = $this->request->requestParamIsSet('tkt-slctr-rows-' . $id)
315
-                                ? absint($this->request->getRequestParam('tkt-slctr-rows-' . $id))
314
+                            $rows = $this->request->requestParamIsSet('tkt-slctr-rows-'.$id)
315
+                                ? absint($this->request->getRequestParam('tkt-slctr-rows-'.$id))
316 316
                                 : 1;
317 317
                             // explode integers by the dash
318 318
                             $row_qty = explode('-', $row_qty);
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
                             $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
321 321
                             $row_qty = array($row => $qty);
322 322
                             for ($x = 1; $x <= $rows; $x++) {
323
-                                if (! isset($row_qty[$x])) {
323
+                                if ( ! isset($row_qty[$x])) {
324 324
                                     $row_qty[$x] = 0;
325 325
                                 }
326 326
                             }
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
                     // array of integers
338 338
                     case 'ticket_id':
339 339
                         // cycle thru values
340
-                        foreach ((array)$input_value as $key => $value) {
340
+                        foreach ((array) $input_value as $key => $value) {
341 341
                             // allow only integers
342 342
                             $valid_data[$what][$key] = absint($value);
343 343
                         }
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
                             $input_value = explode('#', $input_value);
352 352
                             $input_value = end($input_value);
353 353
                             // use event list url instead, but append anchor
354
-                            $input_value = EEH_Event_View::event_archive_url() . '#' . $input_value;
354
+                            $input_value = EEH_Event_View::event_archive_url().'#'.$input_value;
355 355
                         }
356 356
                         $valid_data[$what] = $input_value;
357 357
                         break;
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
             )
388 388
         );
389 389
         $limit_error_2 = sprintf($max_attendees_string, $valid['max_atndz'], $valid['max_atndz']);
390
-        EE_Error::add_error($limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__);
390
+        EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
391 391
     }
392 392
 
393 393
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
             $this->cart,
456 456
             $this
457 457
         );
458
-        if (! apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tickets_selected)) {
458
+        if ( ! apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tickets_selected)) {
459 459
             // no ticket quantities were selected
460 460
             EE_Error::add_error(
461 461
                 esc_html__('You need to select a ticket quantity before you can proceed.', 'event_espresso'),
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
         // compare available spaces against the number of tickets being purchased
487 487
         if ($available_spaces >= $qty) {
488 488
             // allow addons to prevent a ticket from being added to cart
489
-            if (! apply_filters(
489
+            if ( ! apply_filters(
490 490
                 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart',
491 491
                 true,
492 492
                 $ticket,
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
         // exit('KILL REDIRECT BEFORE CART UPDATE'); // <<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
522 522
         if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) {
523 523
             // make sure cart is loaded
524
-            if (! $this->cart instanceof EE_Cart) {
524
+            if ( ! $this->cart instanceof EE_Cart) {
525 525
                 $this->cart = CartFactory::getCart();
526 526
             }
527 527
             do_action(
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                 )
544 544
             );
545 545
         }
546
-        if (! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) {
546
+        if ( ! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) {
547 547
             // nothing added to cart
548 548
             EE_Error::add_attention(
549 549
                 esc_html__('No tickets were added for the event', 'event_espresso'),
Please login to merge, or discard this patch.
widgets/EspressoWidget.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -13,28 +13,28 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    /**
17
-     * @param string $name
18
-     * @param array  $widget_options
19
-     * @param array  $control_options
20
-     */
21
-    public function __construct($name = '', array $widget_options = array(), array $control_options = array())
22
-    {
23
-        $id_base = EspressoWidget::getIdBase(get_class($this));
24
-        $control_options['id_base'] = $id_base;
25
-        $control_options['height'] = isset($control_options['height']) ? $control_options['height'] : 300;
26
-        $control_options['width'] = isset($control_options['width']) ? $control_options['width'] : 350;
27
-        // Register widget with WordPress
28
-        parent::__construct($id_base, $name, $widget_options, $control_options);
29
-    }
16
+	/**
17
+	 * @param string $name
18
+	 * @param array  $widget_options
19
+	 * @param array  $control_options
20
+	 */
21
+	public function __construct($name = '', array $widget_options = array(), array $control_options = array())
22
+	{
23
+		$id_base = EspressoWidget::getIdBase(get_class($this));
24
+		$control_options['id_base'] = $id_base;
25
+		$control_options['height'] = isset($control_options['height']) ? $control_options['height'] : 300;
26
+		$control_options['width'] = isset($control_options['width']) ? $control_options['width'] : 350;
27
+		// Register widget with WordPress
28
+		parent::__construct($id_base, $name, $widget_options, $control_options);
29
+	}
30 30
 
31 31
 
32
-    /**
33
-     * @param string $widget_class
34
-     * @return string
35
-     */
36
-    public static function getIdBase($widget_class)
37
-    {
38
-        return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget';
39
-    }
32
+	/**
33
+	 * @param string $widget_class
34
+	 * @return string
35
+	 */
36
+	public static function getIdBase($widget_class)
37
+	{
38
+		return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget';
39
+	}
40 40
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,6 +35,6 @@
 block discarded – undo
35 35
      */
36 36
     public static function getIdBase($widget_class)
37 37
     {
38
-        return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget';
38
+        return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)).'-widget';
39 39
     }
40 40
 }
Please login to merge, or discard this patch.
admin_pages/general_settings/AdminOptionsSettings.php 2 patches
Indentation   +220 added lines, -220 removed lines patch added patch discarded remove patch
@@ -25,224 +25,224 @@
 block discarded – undo
25 25
 class AdminOptionsSettings extends FormHandler
26 26
 {
27 27
 
28
-    protected $template_args = array();
29
-
30
-    /**
31
-     * Form constructor.
32
-     *
33
-     * @param \EE_Registry $registry
34
-     */
35
-    public function __construct(\EE_Registry $registry)
36
-    {
37
-        parent::__construct(
38
-            esc_html__('Admin Options', 'event_espresso'),
39
-            esc_html__('Admin Options', 'event_espresso'),
40
-            'admin_option_settings',
41
-            '',
42
-            FormHandler::DO_NOT_SETUP_FORM,
43
-            $registry
44
-        );
45
-    }
46
-
47
-
48
-
49
-    /**
50
-     * @param array $template_args
51
-     */
52
-    public function setTemplateArgs(array $template_args)
53
-    {
54
-        $this->template_args = $template_args;
55
-    }
56
-
57
-
58
-
59
-    /**
60
-     * creates and returns the actual form
61
-     *
62
-     * @return EE_Form_Section_Proper
63
-     * @throws \EE_Error
64
-     */
65
-    public function generate()
66
-    {
67
-        $form = new \EE_Form_Section_Proper(
68
-            array(
69
-                'name'            => 'admin_option_settings',
70
-                'html_id'         => 'admin_option_settings',
71
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
72
-                'subsections'     => array(
73
-                    'help_tour_activation_hdr' => new EE_Form_Section_HTML(
74
-                        EEH_HTML::h2(
75
-                            esc_html__('Help Tour Global Activation', 'event_espresso')
76
-                            . ' '
77
-                            . EEH_HTML::span(
78
-                                EEH_Template::get_help_tab_link('help_tour_activation_info'),
79
-                                'help_tour_activation'
80
-                            ),
81
-                            '',
82
-                            'ee-admin-settings-hdr'
83
-                        )
84
-                    ),
85
-                    'help_tour_activation' => new EE_Yes_No_Input(
86
-                        array(
87
-                            'html_label_text' => esc_html__('Activate Global Help Tours?', 'event_espresso'),
88
-                            'html_help_text'  => esc_html__(
89
-                                'This toggles whether the Event Espresso help tours are active globally or not.',
90
-                                'event_espresso'
91
-                            ),
92
-                            'default'         => isset($this->registry->CFG->admin->help_tour_activation)
93
-                                ? filter_var($this->registry->CFG->admin->help_tour_activation, FILTER_VALIDATE_BOOLEAN)
94
-                                : true,
95
-                            'required'        => false
96
-                        )
97
-                    ),
98
-                    'compatibility_hdr'   => new EE_Form_Section_HTML(
99
-                        EEH_HTML::h2(
100
-                            esc_html__('Compatibility Settings', 'event_espresso'),
101
-                            '',
102
-                            'ee-admin-settings-hdr'
103
-                        )
104
-                    ),
105
-                    'encode_session_data' => new EE_Yes_No_Input(
106
-                        array(
107
-                            'html_label_text' => esc_html__('Encode Session Data?', 'event_espresso'),
108
-                            'html_help_text'  => sprintf(
109
-                                esc_html__(
110
-                                    'Some servers and database configurations can cause problems when saving the Event Espresso session data. Setting this option to "Yes" adds an extra layer of encoding to session data to prevent serialization errors, but can be incompatible with some server configurations.%1$sIf you receive "500 internal server" type errors during registration, try turning this option on.%1$sIf you get fatal PHP errors regarding missing base64 functions, then turn this option off.',
111
-                                    'event_espresso'
112
-                                ),
113
-                                '<br>'
114
-                            ),
115
-                            'default'         => $this->registry->CFG->admin->encode_session_data(),
116
-                            'required'        => false
117
-                        )
118
-                    ),
119
-                )
120
-            )
121
-        );
122
-        if ($this->registry->CAP->current_user_can(
123
-            'manage_options',
124
-            'display_admin_settings_options_promote_and_affiliate'
125
-        ) ) {
126
-            $form->add_subsections(
127
-                array(
128
-                    'promote_ee_hdr'  => new EE_Form_Section_HTML(
129
-                        EEH_HTML::h2(
130
-                            esc_html__('Promote Event Espresso', 'event_espresso')
131
-                            . ' '
132
-                            . EEH_HTML::span(
133
-                                EEH_Template::get_help_tab_link('affiliate_info'),
134
-                                'affiliate_info'
135
-                            ),
136
-                            '',
137
-                            'ee-admin-settings-hdr'
138
-                        )
139
-                    ),
140
-                    'show_reg_footer' => new EE_Yes_No_Input(
141
-                        array(
142
-                            'html_label_text' => esc_html__(
143
-                                'Link to Event Espresso in your Registration Page?',
144
-                                'event_espresso'
145
-                            )
146
-                                                 . EEH_Template::get_help_tab_link('email_validation_info'),
147
-                            'html_help_text'  => esc_html__(
148
-                                'adds an unobtrusive link to Event Espresso\'s website in the footer of your registration form. Get an affiliate link (see below) and make money if people click the link and purchase Event Espresso.',
149
-                                'event_espresso'
150
-                            ),
151
-                            'default'         => isset($this->registry->CFG->admin->show_reg_footer)
152
-                                ? filter_var($this->registry->CFG->admin->show_reg_footer, FILTER_VALIDATE_BOOLEAN)
153
-                                : true,
154
-                            'required'        => false
155
-                        )
156
-                    ),
157
-                    'affiliate_id'    => new EE_Text_Input(
158
-                        array(
159
-                            'html_label_text' => sprintf(
160
-                                esc_html__('Event Espresso %1$sAffiliate%2$s ID', 'event_espresso'),
161
-                                '<a href="http://eventespresso.com/affiliates/" target="_blank">',
162
-                                '</a>'
163
-                            ),
164
-                            'html_help_text'  => esc_html__(
165
-                                'Earn cash for promoting Event Espresso.',
166
-                                'event_espresso'
167
-                            ),
168
-                            'html_class'      => 'regular-text',
169
-                            'default'         => isset($this->registry->CFG->admin->affiliate_id)
170
-                                ? $this->registry->CFG->admin->get_pretty('affiliate_id')
171
-                                : '',
172
-                            'required'        => false
173
-                        )
174
-                    ),
175
-                ),
176
-                'help_tour_activation_hdr'
177
-            );
178
-        }
179
-        return $form;
180
-    }
181
-
182
-
183
-
184
-    /**
185
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
186
-     * returns a string of HTML that can be directly echoed in a template
187
-     *
188
-     * @return string
189
-     * @throws LogicException
190
-     * @throws \EE_Error
191
-     */
192
-    public function display()
193
-    {
194
-        add_filter(
195
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
196
-            array($this, 'handleOldAdminOptionsSettingsAction')
197
-        );
198
-        return parent::display();
199
-    }
200
-
201
-
202
-
203
-    /**
204
-     * @return string
205
-     */
206
-    public function handleOldAdminOptionsSettingsAction()
207
-    {
208
-        ob_start();
209
-        do_action('AHEE__admin_option_settings__template__before', $this->template_args);
210
-        return ob_get_clean();
211
-    }
212
-
213
-
214
-
215
-    /**
216
-     * handles processing the form submission
217
-     * returns true or false depending on whether the form was processed successfully or not
218
-     *
219
-     * @param array $form_data
220
-     * @return bool
221
-     * @throws InvalidFormSubmissionException
222
-     * @throws EE_Error
223
-     * @throws LogicException
224
-     * @throws InvalidArgumentException
225
-     * @throws InvalidDataTypeException
226
-     */
227
-    public function process($form_data = array())
228
-    {
229
-        // process form
230
-        $valid_data = (array)parent::process($form_data);
231
-        if (empty($valid_data)) {
232
-            return false;
233
-        }
234
-        $this->registry->CFG->admin->show_reg_footer = isset($form_data['show_reg_footer'])
235
-            ? absint($form_data['show_reg_footer'])
236
-            : $this->registry->CFG->admin->show_reg_footer;
237
-        $this->registry->CFG->admin->affiliate_id = isset($form_data['affiliate_id'])
238
-            ? sanitize_text_field($form_data['affiliate_id'])
239
-            : $this->registry->CFG->admin->affiliate_id;
240
-        $this->registry->CFG->admin->help_tour_activation = isset($form_data['help_tour_activation'])
241
-            ? absint($form_data['help_tour_activation'])
242
-            : $this->registry->CFG->admin->help_tour_activation;
243
-        if (isset($form_data['encode_session_data'])) {
244
-            $this->registry->CFG->admin->set_encode_session_data($form_data['encode_session_data']);
245
-        }
246
-        return false;
247
-    }
28
+	protected $template_args = array();
29
+
30
+	/**
31
+	 * Form constructor.
32
+	 *
33
+	 * @param \EE_Registry $registry
34
+	 */
35
+	public function __construct(\EE_Registry $registry)
36
+	{
37
+		parent::__construct(
38
+			esc_html__('Admin Options', 'event_espresso'),
39
+			esc_html__('Admin Options', 'event_espresso'),
40
+			'admin_option_settings',
41
+			'',
42
+			FormHandler::DO_NOT_SETUP_FORM,
43
+			$registry
44
+		);
45
+	}
46
+
47
+
48
+
49
+	/**
50
+	 * @param array $template_args
51
+	 */
52
+	public function setTemplateArgs(array $template_args)
53
+	{
54
+		$this->template_args = $template_args;
55
+	}
56
+
57
+
58
+
59
+	/**
60
+	 * creates and returns the actual form
61
+	 *
62
+	 * @return EE_Form_Section_Proper
63
+	 * @throws \EE_Error
64
+	 */
65
+	public function generate()
66
+	{
67
+		$form = new \EE_Form_Section_Proper(
68
+			array(
69
+				'name'            => 'admin_option_settings',
70
+				'html_id'         => 'admin_option_settings',
71
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
72
+				'subsections'     => array(
73
+					'help_tour_activation_hdr' => new EE_Form_Section_HTML(
74
+						EEH_HTML::h2(
75
+							esc_html__('Help Tour Global Activation', 'event_espresso')
76
+							. ' '
77
+							. EEH_HTML::span(
78
+								EEH_Template::get_help_tab_link('help_tour_activation_info'),
79
+								'help_tour_activation'
80
+							),
81
+							'',
82
+							'ee-admin-settings-hdr'
83
+						)
84
+					),
85
+					'help_tour_activation' => new EE_Yes_No_Input(
86
+						array(
87
+							'html_label_text' => esc_html__('Activate Global Help Tours?', 'event_espresso'),
88
+							'html_help_text'  => esc_html__(
89
+								'This toggles whether the Event Espresso help tours are active globally or not.',
90
+								'event_espresso'
91
+							),
92
+							'default'         => isset($this->registry->CFG->admin->help_tour_activation)
93
+								? filter_var($this->registry->CFG->admin->help_tour_activation, FILTER_VALIDATE_BOOLEAN)
94
+								: true,
95
+							'required'        => false
96
+						)
97
+					),
98
+					'compatibility_hdr'   => new EE_Form_Section_HTML(
99
+						EEH_HTML::h2(
100
+							esc_html__('Compatibility Settings', 'event_espresso'),
101
+							'',
102
+							'ee-admin-settings-hdr'
103
+						)
104
+					),
105
+					'encode_session_data' => new EE_Yes_No_Input(
106
+						array(
107
+							'html_label_text' => esc_html__('Encode Session Data?', 'event_espresso'),
108
+							'html_help_text'  => sprintf(
109
+								esc_html__(
110
+									'Some servers and database configurations can cause problems when saving the Event Espresso session data. Setting this option to "Yes" adds an extra layer of encoding to session data to prevent serialization errors, but can be incompatible with some server configurations.%1$sIf you receive "500 internal server" type errors during registration, try turning this option on.%1$sIf you get fatal PHP errors regarding missing base64 functions, then turn this option off.',
111
+									'event_espresso'
112
+								),
113
+								'<br>'
114
+							),
115
+							'default'         => $this->registry->CFG->admin->encode_session_data(),
116
+							'required'        => false
117
+						)
118
+					),
119
+				)
120
+			)
121
+		);
122
+		if ($this->registry->CAP->current_user_can(
123
+			'manage_options',
124
+			'display_admin_settings_options_promote_and_affiliate'
125
+		) ) {
126
+			$form->add_subsections(
127
+				array(
128
+					'promote_ee_hdr'  => new EE_Form_Section_HTML(
129
+						EEH_HTML::h2(
130
+							esc_html__('Promote Event Espresso', 'event_espresso')
131
+							. ' '
132
+							. EEH_HTML::span(
133
+								EEH_Template::get_help_tab_link('affiliate_info'),
134
+								'affiliate_info'
135
+							),
136
+							'',
137
+							'ee-admin-settings-hdr'
138
+						)
139
+					),
140
+					'show_reg_footer' => new EE_Yes_No_Input(
141
+						array(
142
+							'html_label_text' => esc_html__(
143
+								'Link to Event Espresso in your Registration Page?',
144
+								'event_espresso'
145
+							)
146
+												 . EEH_Template::get_help_tab_link('email_validation_info'),
147
+							'html_help_text'  => esc_html__(
148
+								'adds an unobtrusive link to Event Espresso\'s website in the footer of your registration form. Get an affiliate link (see below) and make money if people click the link and purchase Event Espresso.',
149
+								'event_espresso'
150
+							),
151
+							'default'         => isset($this->registry->CFG->admin->show_reg_footer)
152
+								? filter_var($this->registry->CFG->admin->show_reg_footer, FILTER_VALIDATE_BOOLEAN)
153
+								: true,
154
+							'required'        => false
155
+						)
156
+					),
157
+					'affiliate_id'    => new EE_Text_Input(
158
+						array(
159
+							'html_label_text' => sprintf(
160
+								esc_html__('Event Espresso %1$sAffiliate%2$s ID', 'event_espresso'),
161
+								'<a href="http://eventespresso.com/affiliates/" target="_blank">',
162
+								'</a>'
163
+							),
164
+							'html_help_text'  => esc_html__(
165
+								'Earn cash for promoting Event Espresso.',
166
+								'event_espresso'
167
+							),
168
+							'html_class'      => 'regular-text',
169
+							'default'         => isset($this->registry->CFG->admin->affiliate_id)
170
+								? $this->registry->CFG->admin->get_pretty('affiliate_id')
171
+								: '',
172
+							'required'        => false
173
+						)
174
+					),
175
+				),
176
+				'help_tour_activation_hdr'
177
+			);
178
+		}
179
+		return $form;
180
+	}
181
+
182
+
183
+
184
+	/**
185
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
186
+	 * returns a string of HTML that can be directly echoed in a template
187
+	 *
188
+	 * @return string
189
+	 * @throws LogicException
190
+	 * @throws \EE_Error
191
+	 */
192
+	public function display()
193
+	{
194
+		add_filter(
195
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
196
+			array($this, 'handleOldAdminOptionsSettingsAction')
197
+		);
198
+		return parent::display();
199
+	}
200
+
201
+
202
+
203
+	/**
204
+	 * @return string
205
+	 */
206
+	public function handleOldAdminOptionsSettingsAction()
207
+	{
208
+		ob_start();
209
+		do_action('AHEE__admin_option_settings__template__before', $this->template_args);
210
+		return ob_get_clean();
211
+	}
212
+
213
+
214
+
215
+	/**
216
+	 * handles processing the form submission
217
+	 * returns true or false depending on whether the form was processed successfully or not
218
+	 *
219
+	 * @param array $form_data
220
+	 * @return bool
221
+	 * @throws InvalidFormSubmissionException
222
+	 * @throws EE_Error
223
+	 * @throws LogicException
224
+	 * @throws InvalidArgumentException
225
+	 * @throws InvalidDataTypeException
226
+	 */
227
+	public function process($form_data = array())
228
+	{
229
+		// process form
230
+		$valid_data = (array)parent::process($form_data);
231
+		if (empty($valid_data)) {
232
+			return false;
233
+		}
234
+		$this->registry->CFG->admin->show_reg_footer = isset($form_data['show_reg_footer'])
235
+			? absint($form_data['show_reg_footer'])
236
+			: $this->registry->CFG->admin->show_reg_footer;
237
+		$this->registry->CFG->admin->affiliate_id = isset($form_data['affiliate_id'])
238
+			? sanitize_text_field($form_data['affiliate_id'])
239
+			: $this->registry->CFG->admin->affiliate_id;
240
+		$this->registry->CFG->admin->help_tour_activation = isset($form_data['help_tour_activation'])
241
+			? absint($form_data['help_tour_activation'])
242
+			: $this->registry->CFG->admin->help_tour_activation;
243
+		if (isset($form_data['encode_session_data'])) {
244
+			$this->registry->CFG->admin->set_encode_session_data($form_data['encode_session_data']);
245
+		}
246
+		return false;
247
+	}
248 248
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         if ($this->registry->CAP->current_user_can(
123 123
             'manage_options',
124 124
             'display_admin_settings_options_promote_and_affiliate'
125
-        ) ) {
125
+        )) {
126 126
             $form->add_subsections(
127 127
                 array(
128 128
                     'promote_ee_hdr'  => new EE_Form_Section_HTML(
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     public function process($form_data = array())
228 228
     {
229 229
         // process form
230
-        $valid_data = (array)parent::process($form_data);
230
+        $valid_data = (array) parent::process($form_data);
231 231
         if (empty($valid_data)) {
232 232
             return false;
233 233
         }
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorRowStandard.php 2 patches
Indentation   +355 added lines, -355 removed lines patch added patch discarded remove patch
@@ -17,359 +17,359 @@
 block discarded – undo
17 17
 class TicketSelectorRowStandard extends TicketSelectorRow
18 18
 {
19 19
 
20
-    /**
21
-     * @var TicketDetails $ticket_details
22
-     */
23
-    protected $ticket_details;
24
-
25
-    /**
26
-     * @var \EE_Ticket_Selector_Config $template_settings
27
-     */
28
-    protected $template_settings;
29
-
30
-    /**
31
-     * @var EE_Tax_Config $tax_settings
32
-     */
33
-    protected $tax_settings;
34
-
35
-    /**
36
-     * @var boolean $prices_displayed_including_taxes
37
-     */
38
-    protected $prices_displayed_including_taxes;
39
-
40
-    /**
41
-     * @var int $row
42
-     */
43
-    protected $row;
44
-
45
-    /**
46
-     * @var int $cols
47
-     */
48
-    protected $cols;
49
-
50
-    /**
51
-     * @var boolean $hidden_input_qty
52
-     */
53
-    protected $hidden_input_qty;
54
-
55
-    /**
56
-     * @var string $ticket_datetime_classes
57
-     */
58
-    protected $ticket_datetime_classes;
59
-
60
-
61
-    /**
62
-     * TicketDetails constructor.
63
-     *
64
-     * @param TicketDetails $ticket_details
65
-     * @param EE_Tax_Config $tax_settings
66
-     * @param int           $total_tickets
67
-     * @param int           $max_attendees
68
-     * @param int           $row
69
-     * @param int           $cols
70
-     * @param boolean       $required_ticket_sold_out
71
-     * @param string        $event_status
72
-     * @param string        $ticket_datetime_classes
73
-     * @throws EE_Error
74
-     * @throws UnexpectedEntityException
75
-     */
76
-    public function __construct(
77
-        TicketDetails $ticket_details,
78
-        EE_Tax_Config $tax_settings,
79
-        $total_tickets,
80
-        $max_attendees,
81
-        $row,
82
-        $cols,
83
-        $required_ticket_sold_out,
84
-        $event_status,
85
-        $ticket_datetime_classes
86
-    ) {
87
-        $this->ticket_details = $ticket_details;
88
-        $this->template_settings = $ticket_details->getTemplateSettings();
89
-        $this->tax_settings = $tax_settings;
90
-        $this->row = $row;
91
-        $this->cols = $cols;
92
-        $this->ticket_datetime_classes = $ticket_datetime_classes;
93
-        parent::__construct(
94
-            $ticket_details->getTicket(),
95
-            $max_attendees,
96
-            $ticket_details->getDateFormat(),
97
-            $event_status,
98
-            $required_ticket_sold_out,
99
-            $total_tickets
100
-        );
101
-    }
102
-
103
-
104
-    /**
105
-     * other ticket rows will need to know if a required ticket is sold out,
106
-     * so that they are not offered for sale
107
-     *
108
-     * @return boolean
109
-     */
110
-    public function getRequiredTicketSoldOut()
111
-    {
112
-        return $this->required_ticket_sold_out;
113
-    }
114
-
115
-
116
-    /**
117
-     * @return int
118
-     */
119
-    public function getCols()
120
-    {
121
-        return $this->cols;
122
-    }
123
-
124
-
125
-    /**
126
-     * getHtml
127
-     *
128
-     * @return string
129
-     * @throws EE_Error
130
-     */
131
-    public function getHtml()
132
-    {
133
-        $this->min = 0;
134
-        $this->max = $this->ticket->max();
135
-        $remaining = $this->ticket->remaining();
136
-        if ($this->ticket->is_on_sale() && $this->ticket->is_remaining()) {
137
-            $this->setTicketMinAndMax($remaining);
138
-        } else {
139
-            // set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
140
-            $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining
141
-                ? $this->ticket->start_date()
142
-                : $this->required_ticket_sold_out;
143
-        }
144
-        $this->setTicketPriceDetails();
145
-        $this->setTicketStatusClasses($remaining);
146
-        $filtered_row_html = $this->getFilteredRowHtml();
147
-        if ($filtered_row_html !== false) {
148
-            return $filtered_row_html;
149
-        }
150
-        $ticket_selector_row_html = EEH_HTML::tr(
151
-            '',
152
-            '',
153
-            "tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} "
154
-            . espresso_get_object_css_class($this->ticket)
155
-        );
156
-        $filtered_row_content = $this->getFilteredRowContents();
157
-        if ($filtered_row_content !== false && $this->max_attendees === 1) {
158
-            return $ticket_selector_row_html
159
-                   . $filtered_row_content
160
-                   . $this->ticketQtyAndIdHiddenInputs()
161
-                   . EEH_HTML::trx();
162
-        }
163
-        if ($filtered_row_content !== false) {
164
-            return $ticket_selector_row_html
165
-                   . $filtered_row_content
166
-                   . EEH_HTML::trx();
167
-        }
168
-        $this->hidden_input_qty = $this->max_attendees > 1;
169
-
170
-        $ticket_selector_row_html .= $this->ticketNameTableCell();
171
-        $ticket_selector_row_html .= $this->ticketPriceTableCell();
172
-        $ticket_selector_row_html .= EEH_HTML::td(
173
-            '',
174
-            '',
175
-            'tckt-slctr-tbl-td-qty cntr',
176
-            '',
177
-            'headers="quantity-' . $this->EVT_ID . '"'
178
-        );
179
-        $this->setTicketStatusDisplay($remaining);
180
-        if (empty($this->ticket_status_display)) {
181
-            if ($this->max_attendees === 1) {
182
-                // only ONE attendee is allowed to register at a time
183
-                $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister();
184
-            } elseif ($this->max > 0) {
185
-                $ticket_selector_row_html .= $this->ticketQuantitySelector();
186
-            }
187
-        }
188
-        $ticket_selector_row_html .= $this->ticket_status_display;
189
-        $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs();
190
-        $ticket_selector_row_html .= $this->ticket_details->display(
191
-            $this->ticket_price,
192
-            $remaining,
193
-            $this->cols
194
-        );
195
-        $ticket_selector_row_html .= EEH_HTML::tdx();
196
-        $ticket_selector_row_html .= EEH_HTML::trx();
197
-
198
-
199
-        $this->row++;
200
-        return $ticket_selector_row_html;
201
-    }
202
-
203
-
204
-    /**
205
-     * getTicketPriceDetails
206
-     *
207
-     * @return void
208
-     * @throws EE_Error
209
-     */
210
-    protected function setTicketPriceDetails()
211
-    {
212
-        $this->ticket_price = $this->tax_settings->prices_displayed_including_taxes
213
-            ? $this->ticket->get_ticket_total_with_taxes()
214
-            : $this->ticket->get_ticket_subtotal();
215
-        $this->ticket_bundle = false;
216
-        $ticket_min = $this->ticket->min();
217
-        // for ticket bundles, set min and max qty the same
218
-        if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) {
219
-            $this->ticket_price *= $ticket_min;
220
-            $this->ticket_bundle = true;
221
-        }
222
-        $this->ticket_price = apply_filters(
223
-            'FHEE__ticket_selector_chart_template__ticket_price',
224
-            $this->ticket_price,
225
-            $this->ticket
226
-        );
227
-    }
228
-
229
-
230
-    /**
231
-     * ticketNameTableCell
232
-     *
233
-     * @return string
234
-     * @throws EE_Error
235
-     */
236
-    protected function ticketNameTableCell()
237
-    {
238
-        $html = EEH_HTML::td(
239
-            '',
240
-            '',
241
-            'tckt-slctr-tbl-td-name',
242
-            '',
243
-            'headers="details-' . $this->EVT_ID . '"'
244
-        );
245
-        $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
246
-        $html .= $this->ticket_details->getShowHideLinks();
247
-        if ($this->ticket->required()) {
248
-            $html .= EEH_HTML::p(
249
-                apply_filters(
250
-                    'FHEE__ticket_selector_chart_template__ticket_required_message',
251
-                    esc_html__('This ticket is required and must be purchased.', 'event_espresso')
252
-                ),
253
-                '',
254
-                'ticket-required-pg'
255
-            );
256
-        }
257
-        $html .= EEH_HTML::tdx();
258
-        return $html;
259
-    }
260
-
261
-
262
-    /**
263
-     * ticketPriceTableCell
264
-     *
265
-     * @return string
266
-     * @throws EE_Error
267
-     */
268
-    protected function ticketPriceTableCell()
269
-    {
270
-        $html = '';
271
-        if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) {
272
-            $html .= EEH_HTML::td(
273
-                '',
274
-                '',
275
-                'tckt-slctr-tbl-td-price jst-rght',
276
-                '',
277
-                'headers="price-' . $this->EVT_ID . '"'
278
-            );
279
-            $html .= \EEH_Template::format_currency($this->ticket_price);
280
-            $html .= $this->ticket->taxable()
281
-                ? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text')
282
-                : '';
283
-            $html .= '&nbsp;';
284
-            // phpcs:disable WordPress.WP.I18n.NoEmptyStrings
285
-            $html .= EEH_HTML::span(
286
-                $this->ticket_bundle
287
-                    ? apply_filters(
288
-                        'FHEE__ticket_selector_chart_template__per_ticket_bundle_text',
289
-                        __(' / bundle', 'event_espresso')
290
-                    )
291
-                    : apply_filters(
292
-                        'FHEE__ticket_selector_chart_template__per_ticket_text',
293
-                        __('', 'event_espresso')
294
-                    ),
295
-                '',
296
-                'smaller-text no-bold'
297
-            );
298
-            $html .= '&nbsp;';
299
-            $html .= EEH_HTML::tdx();
300
-            $this->cols++;
301
-        }
302
-        return $html;
303
-    }
304
-
305
-
306
-    /**
307
-     * onlyOneAttendeeCanRegister
308
-     *
309
-     * @return string
310
-     */
311
-    protected function onlyOneAttendeeCanRegister()
312
-    {
313
-        // display submit button since we have tickets available
314
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
315
-        $this->hidden_input_qty = false;
316
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
317
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
318
-        $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
319
-        $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
320
-        $html .= ' id="' . $id . '"';
321
-        $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
322
-        $html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
323
-        $html .= ' title=""/>';
324
-        return $html;
325
-    }
326
-
327
-
328
-    /**
329
-     * ticketQuantitySelector
330
-     *
331
-     * @return string
332
-     * @throws EE_Error
333
-     */
334
-    protected function ticketQuantitySelector()
335
-    {
336
-        // display submit button since we have tickets available
337
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
338
-        $this->hidden_input_qty = false;
339
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
340
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
341
-        $html .= esc_html__('Quantity', 'event_espresso') . '</label>';
342
-        $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
343
-        $html .= ' id="' . $id . '"';
344
-        $html .= ' class="ticket-selector-tbl-qty-slct">';
345
-        // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
346
-        if ($this->min !== 0 && ! $this->ticket->required()) {
347
-            $html .= '<option value="0">&nbsp;0&nbsp;</option>';
348
-        }
349
-        // offer ticket quantities from the min to the max
350
-        for ($i = $this->min; $i <= $this->max; $i++) {
351
-            $html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
352
-        }
353
-        $html .= '</select>';
354
-        return $html;
355
-    }
356
-
357
-
358
-    /**
359
-     * getHiddenInputs
360
-     *
361
-     * @return string
362
-     * @throws EE_Error
363
-     */
364
-    protected function ticketQtyAndIdHiddenInputs()
365
-    {
366
-        $html = '';
367
-        // depending on group reg we need to change the format for qty
368
-        if ($this->hidden_input_qty) {
369
-            $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
370
-        }
371
-        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
372
-        $html .= ' value="' . $this->ticket->ID() . '"/>';
373
-        return $html;
374
-    }
20
+	/**
21
+	 * @var TicketDetails $ticket_details
22
+	 */
23
+	protected $ticket_details;
24
+
25
+	/**
26
+	 * @var \EE_Ticket_Selector_Config $template_settings
27
+	 */
28
+	protected $template_settings;
29
+
30
+	/**
31
+	 * @var EE_Tax_Config $tax_settings
32
+	 */
33
+	protected $tax_settings;
34
+
35
+	/**
36
+	 * @var boolean $prices_displayed_including_taxes
37
+	 */
38
+	protected $prices_displayed_including_taxes;
39
+
40
+	/**
41
+	 * @var int $row
42
+	 */
43
+	protected $row;
44
+
45
+	/**
46
+	 * @var int $cols
47
+	 */
48
+	protected $cols;
49
+
50
+	/**
51
+	 * @var boolean $hidden_input_qty
52
+	 */
53
+	protected $hidden_input_qty;
54
+
55
+	/**
56
+	 * @var string $ticket_datetime_classes
57
+	 */
58
+	protected $ticket_datetime_classes;
59
+
60
+
61
+	/**
62
+	 * TicketDetails constructor.
63
+	 *
64
+	 * @param TicketDetails $ticket_details
65
+	 * @param EE_Tax_Config $tax_settings
66
+	 * @param int           $total_tickets
67
+	 * @param int           $max_attendees
68
+	 * @param int           $row
69
+	 * @param int           $cols
70
+	 * @param boolean       $required_ticket_sold_out
71
+	 * @param string        $event_status
72
+	 * @param string        $ticket_datetime_classes
73
+	 * @throws EE_Error
74
+	 * @throws UnexpectedEntityException
75
+	 */
76
+	public function __construct(
77
+		TicketDetails $ticket_details,
78
+		EE_Tax_Config $tax_settings,
79
+		$total_tickets,
80
+		$max_attendees,
81
+		$row,
82
+		$cols,
83
+		$required_ticket_sold_out,
84
+		$event_status,
85
+		$ticket_datetime_classes
86
+	) {
87
+		$this->ticket_details = $ticket_details;
88
+		$this->template_settings = $ticket_details->getTemplateSettings();
89
+		$this->tax_settings = $tax_settings;
90
+		$this->row = $row;
91
+		$this->cols = $cols;
92
+		$this->ticket_datetime_classes = $ticket_datetime_classes;
93
+		parent::__construct(
94
+			$ticket_details->getTicket(),
95
+			$max_attendees,
96
+			$ticket_details->getDateFormat(),
97
+			$event_status,
98
+			$required_ticket_sold_out,
99
+			$total_tickets
100
+		);
101
+	}
102
+
103
+
104
+	/**
105
+	 * other ticket rows will need to know if a required ticket is sold out,
106
+	 * so that they are not offered for sale
107
+	 *
108
+	 * @return boolean
109
+	 */
110
+	public function getRequiredTicketSoldOut()
111
+	{
112
+		return $this->required_ticket_sold_out;
113
+	}
114
+
115
+
116
+	/**
117
+	 * @return int
118
+	 */
119
+	public function getCols()
120
+	{
121
+		return $this->cols;
122
+	}
123
+
124
+
125
+	/**
126
+	 * getHtml
127
+	 *
128
+	 * @return string
129
+	 * @throws EE_Error
130
+	 */
131
+	public function getHtml()
132
+	{
133
+		$this->min = 0;
134
+		$this->max = $this->ticket->max();
135
+		$remaining = $this->ticket->remaining();
136
+		if ($this->ticket->is_on_sale() && $this->ticket->is_remaining()) {
137
+			$this->setTicketMinAndMax($remaining);
138
+		} else {
139
+			// set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
140
+			$this->required_ticket_sold_out = $this->ticket->required() && ! $remaining
141
+				? $this->ticket->start_date()
142
+				: $this->required_ticket_sold_out;
143
+		}
144
+		$this->setTicketPriceDetails();
145
+		$this->setTicketStatusClasses($remaining);
146
+		$filtered_row_html = $this->getFilteredRowHtml();
147
+		if ($filtered_row_html !== false) {
148
+			return $filtered_row_html;
149
+		}
150
+		$ticket_selector_row_html = EEH_HTML::tr(
151
+			'',
152
+			'',
153
+			"tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} "
154
+			. espresso_get_object_css_class($this->ticket)
155
+		);
156
+		$filtered_row_content = $this->getFilteredRowContents();
157
+		if ($filtered_row_content !== false && $this->max_attendees === 1) {
158
+			return $ticket_selector_row_html
159
+				   . $filtered_row_content
160
+				   . $this->ticketQtyAndIdHiddenInputs()
161
+				   . EEH_HTML::trx();
162
+		}
163
+		if ($filtered_row_content !== false) {
164
+			return $ticket_selector_row_html
165
+				   . $filtered_row_content
166
+				   . EEH_HTML::trx();
167
+		}
168
+		$this->hidden_input_qty = $this->max_attendees > 1;
169
+
170
+		$ticket_selector_row_html .= $this->ticketNameTableCell();
171
+		$ticket_selector_row_html .= $this->ticketPriceTableCell();
172
+		$ticket_selector_row_html .= EEH_HTML::td(
173
+			'',
174
+			'',
175
+			'tckt-slctr-tbl-td-qty cntr',
176
+			'',
177
+			'headers="quantity-' . $this->EVT_ID . '"'
178
+		);
179
+		$this->setTicketStatusDisplay($remaining);
180
+		if (empty($this->ticket_status_display)) {
181
+			if ($this->max_attendees === 1) {
182
+				// only ONE attendee is allowed to register at a time
183
+				$ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister();
184
+			} elseif ($this->max > 0) {
185
+				$ticket_selector_row_html .= $this->ticketQuantitySelector();
186
+			}
187
+		}
188
+		$ticket_selector_row_html .= $this->ticket_status_display;
189
+		$ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs();
190
+		$ticket_selector_row_html .= $this->ticket_details->display(
191
+			$this->ticket_price,
192
+			$remaining,
193
+			$this->cols
194
+		);
195
+		$ticket_selector_row_html .= EEH_HTML::tdx();
196
+		$ticket_selector_row_html .= EEH_HTML::trx();
197
+
198
+
199
+		$this->row++;
200
+		return $ticket_selector_row_html;
201
+	}
202
+
203
+
204
+	/**
205
+	 * getTicketPriceDetails
206
+	 *
207
+	 * @return void
208
+	 * @throws EE_Error
209
+	 */
210
+	protected function setTicketPriceDetails()
211
+	{
212
+		$this->ticket_price = $this->tax_settings->prices_displayed_including_taxes
213
+			? $this->ticket->get_ticket_total_with_taxes()
214
+			: $this->ticket->get_ticket_subtotal();
215
+		$this->ticket_bundle = false;
216
+		$ticket_min = $this->ticket->min();
217
+		// for ticket bundles, set min and max qty the same
218
+		if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) {
219
+			$this->ticket_price *= $ticket_min;
220
+			$this->ticket_bundle = true;
221
+		}
222
+		$this->ticket_price = apply_filters(
223
+			'FHEE__ticket_selector_chart_template__ticket_price',
224
+			$this->ticket_price,
225
+			$this->ticket
226
+		);
227
+	}
228
+
229
+
230
+	/**
231
+	 * ticketNameTableCell
232
+	 *
233
+	 * @return string
234
+	 * @throws EE_Error
235
+	 */
236
+	protected function ticketNameTableCell()
237
+	{
238
+		$html = EEH_HTML::td(
239
+			'',
240
+			'',
241
+			'tckt-slctr-tbl-td-name',
242
+			'',
243
+			'headers="details-' . $this->EVT_ID . '"'
244
+		);
245
+		$html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
246
+		$html .= $this->ticket_details->getShowHideLinks();
247
+		if ($this->ticket->required()) {
248
+			$html .= EEH_HTML::p(
249
+				apply_filters(
250
+					'FHEE__ticket_selector_chart_template__ticket_required_message',
251
+					esc_html__('This ticket is required and must be purchased.', 'event_espresso')
252
+				),
253
+				'',
254
+				'ticket-required-pg'
255
+			);
256
+		}
257
+		$html .= EEH_HTML::tdx();
258
+		return $html;
259
+	}
260
+
261
+
262
+	/**
263
+	 * ticketPriceTableCell
264
+	 *
265
+	 * @return string
266
+	 * @throws EE_Error
267
+	 */
268
+	protected function ticketPriceTableCell()
269
+	{
270
+		$html = '';
271
+		if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) {
272
+			$html .= EEH_HTML::td(
273
+				'',
274
+				'',
275
+				'tckt-slctr-tbl-td-price jst-rght',
276
+				'',
277
+				'headers="price-' . $this->EVT_ID . '"'
278
+			);
279
+			$html .= \EEH_Template::format_currency($this->ticket_price);
280
+			$html .= $this->ticket->taxable()
281
+				? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text')
282
+				: '';
283
+			$html .= '&nbsp;';
284
+			// phpcs:disable WordPress.WP.I18n.NoEmptyStrings
285
+			$html .= EEH_HTML::span(
286
+				$this->ticket_bundle
287
+					? apply_filters(
288
+						'FHEE__ticket_selector_chart_template__per_ticket_bundle_text',
289
+						__(' / bundle', 'event_espresso')
290
+					)
291
+					: apply_filters(
292
+						'FHEE__ticket_selector_chart_template__per_ticket_text',
293
+						__('', 'event_espresso')
294
+					),
295
+				'',
296
+				'smaller-text no-bold'
297
+			);
298
+			$html .= '&nbsp;';
299
+			$html .= EEH_HTML::tdx();
300
+			$this->cols++;
301
+		}
302
+		return $html;
303
+	}
304
+
305
+
306
+	/**
307
+	 * onlyOneAttendeeCanRegister
308
+	 *
309
+	 * @return string
310
+	 */
311
+	protected function onlyOneAttendeeCanRegister()
312
+	{
313
+		// display submit button since we have tickets available
314
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
315
+		$this->hidden_input_qty = false;
316
+		$id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
317
+		$html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
318
+		$html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
319
+		$html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
320
+		$html .= ' id="' . $id . '"';
321
+		$html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
322
+		$html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
323
+		$html .= ' title=""/>';
324
+		return $html;
325
+	}
326
+
327
+
328
+	/**
329
+	 * ticketQuantitySelector
330
+	 *
331
+	 * @return string
332
+	 * @throws EE_Error
333
+	 */
334
+	protected function ticketQuantitySelector()
335
+	{
336
+		// display submit button since we have tickets available
337
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
338
+		$this->hidden_input_qty = false;
339
+		$id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
340
+		$html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
341
+		$html .= esc_html__('Quantity', 'event_espresso') . '</label>';
342
+		$html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
343
+		$html .= ' id="' . $id . '"';
344
+		$html .= ' class="ticket-selector-tbl-qty-slct">';
345
+		// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
346
+		if ($this->min !== 0 && ! $this->ticket->required()) {
347
+			$html .= '<option value="0">&nbsp;0&nbsp;</option>';
348
+		}
349
+		// offer ticket quantities from the min to the max
350
+		for ($i = $this->min; $i <= $this->max; $i++) {
351
+			$html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
352
+		}
353
+		$html .= '</select>';
354
+		return $html;
355
+	}
356
+
357
+
358
+	/**
359
+	 * getHiddenInputs
360
+	 *
361
+	 * @return string
362
+	 * @throws EE_Error
363
+	 */
364
+	protected function ticketQtyAndIdHiddenInputs()
365
+	{
366
+		$html = '';
367
+		// depending on group reg we need to change the format for qty
368
+		if ($this->hidden_input_qty) {
369
+			$html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
370
+		}
371
+		$html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
372
+		$html .= ' value="' . $this->ticket->ID() . '"/>';
373
+		return $html;
374
+	}
375 375
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             '',
175 175
             'tckt-slctr-tbl-td-qty cntr',
176 176
             '',
177
-            'headers="quantity-' . $this->EVT_ID . '"'
177
+            'headers="quantity-'.$this->EVT_ID.'"'
178 178
         );
179 179
         $this->setTicketStatusDisplay($remaining);
180 180
         if (empty($this->ticket_status_display)) {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
             '',
241 241
             'tckt-slctr-tbl-td-name',
242 242
             '',
243
-            'headers="details-' . $this->EVT_ID . '"'
243
+            'headers="details-'.$this->EVT_ID.'"'
244 244
         );
245 245
         $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
246 246
         $html .= $this->ticket_details->getShowHideLinks();
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
                 '',
275 275
                 'tckt-slctr-tbl-td-price jst-rght',
276 276
                 '',
277
-                'headers="price-' . $this->EVT_ID . '"'
277
+                'headers="price-'.$this->EVT_ID.'"'
278 278
             );
279 279
             $html .= \EEH_Template::format_currency($this->ticket_price);
280 280
             $html .= $this->ticket->taxable()
@@ -313,12 +313,12 @@  discard block
 block discarded – undo
313 313
         // display submit button since we have tickets available
314 314
         add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
315 315
         $this->hidden_input_qty = false;
316
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
317
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
318
-        $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
319
-        $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
320
-        $html .= ' id="' . $id . '"';
321
-        $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
316
+        $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row;
317
+        $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">';
318
+        $html .= esc_html__('Select this ticket', 'event_espresso').'</label>';
319
+        $html .= '<input type="radio" name="tkt-slctr-qty-'.$this->EVT_ID.'"';
320
+        $html .= ' id="'.$id.'"';
321
+        $html .= ' class="ticket-selector-tbl-qty-slct" value="'.$this->row.'-1"';
322 322
         $html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
323 323
         $html .= ' title=""/>';
324 324
         return $html;
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
         // display submit button since we have tickets available
337 337
         add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
338 338
         $this->hidden_input_qty = false;
339
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
340
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
341
-        $html .= esc_html__('Quantity', 'event_espresso') . '</label>';
342
-        $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
343
-        $html .= ' id="' . $id . '"';
339
+        $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row;
340
+        $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">';
341
+        $html .= esc_html__('Quantity', 'event_espresso').'</label>';
342
+        $html .= '<select name="tkt-slctr-qty-'.$this->EVT_ID.'[]"';
343
+        $html .= ' id="'.$id.'"';
344 344
         $html .= ' class="ticket-selector-tbl-qty-slct">';
345 345
         // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
346 346
         if ($this->min !== 0 && ! $this->ticket->required()) {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         }
349 349
         // offer ticket quantities from the min to the max
350 350
         for ($i = $this->min; $i <= $this->max; $i++) {
351
-            $html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
351
+            $html .= '<option value="'.$i.'">&nbsp;'.$i.'&nbsp;</option>';
352 352
         }
353 353
         $html .= '</select>';
354 354
         return $html;
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
         $html = '';
367 367
         // depending on group reg we need to change the format for qty
368 368
         if ($this->hidden_input_qty) {
369
-            $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
369
+            $html .= '<input type="hidden" name="tkt-slctr-qty-'.$this->EVT_ID.'[]" value="0"/>';
370 370
         }
371
-        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
372
-        $html .= ' value="' . $this->ticket->ID() . '"/>';
371
+        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-'.$this->EVT_ID.'[]"';
372
+        $html .= ' value="'.$this->ticket->ID().'"/>';
373 373
         return $html;
374 374
     }
375 375
 }
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorIframeEmbedButton.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,24 +14,24 @@
 block discarded – undo
14 14
 class TicketSelectorIframeEmbedButton extends IframeEmbedButton
15 15
 {
16 16
 
17
-    /**
18
-     * TicketSelectorIframeEmbedButton constructor.
19
-     */
20
-    public function __construct()
21
-    {
22
-        parent::__construct(
23
-            esc_html__('Ticket Selector', 'event_espresso'),
24
-            'ticket_selector'
25
-        );
26
-    }
17
+	/**
18
+	 * TicketSelectorIframeEmbedButton constructor.
19
+	 */
20
+	public function __construct()
21
+	{
22
+		parent::__construct(
23
+			esc_html__('Ticket Selector', 'event_espresso'),
24
+			'ticket_selector'
25
+		);
26
+	}
27 27
 
28 28
 
29
-    /**
30
-     * Adds an iframe embed code button to the Event editor.
31
-     */
32
-    public function addEventEditorIframeEmbedButton()
33
-    {
34
-        // add button for iframe code to event editor.
35
-        $this->addEventEditorIframeEmbedButtonFilter();
36
-    }
29
+	/**
30
+	 * Adds an iframe embed code button to the Event editor.
31
+	 */
32
+	public function addEventEditorIframeEmbedButton()
33
+	{
34
+		// add button for iframe code to event editor.
35
+		$this->addEventEditorIframeEmbedButtonFilter();
36
+	}
37 37
 }
Please login to merge, or discard this patch.