Completed
Branch FET/improve-reports (6a2391)
by
unknown
02:20 queued 17s
created
core/domain/DomainBase.php 2 patches
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -19,150 +19,150 @@
 block discarded – undo
19 19
 abstract class DomainBase implements DomainInterface
20 20
 {
21 21
 
22
-    /**
23
-     * Equivalent to `__FILE__` for main plugin file.
24
-     *
25
-     * @var FilePath
26
-     */
27
-    private $plugin_file;
28
-
29
-    /**
30
-     * String indicating version for plugin
31
-     *
32
-     * @var string
33
-     */
34
-    private $version;
35
-
36
-    /**
37
-     * @var string $plugin_basename
38
-     */
39
-    private $plugin_basename;
40
-
41
-    /**
42
-     * @var string $plugin_path
43
-     */
44
-    private $plugin_path;
45
-
46
-    /**
47
-     * @var string $plugin_url
48
-     */
49
-    private $plugin_url;
50
-
51
-    /**
52
-     * @var string $asset_namespace
53
-     */
54
-    private $asset_namespace;
55
-
56
-
57
-
58
-    /**
59
-     * Initializes internal properties.
60
-     *
61
-     * @param FilePath $plugin_file
62
-     * @param Version  $version
63
-     */
64
-    public function __construct(FilePath $plugin_file, Version $version)
65
-    {
66
-        $this->plugin_file = $plugin_file;
67
-        $this->version = $version;
68
-        $this->plugin_basename = plugin_basename($this->pluginFile());
69
-        $this->plugin_path = plugin_dir_path($this->pluginFile());
70
-        $this->plugin_url = plugin_dir_url($this->pluginFile());
71
-        $this->setAssetNamespace();
72
-    }
73
-
74
-
75
-    /**
76
-     * @return string
77
-     */
78
-    public function pluginFile()
79
-    {
80
-        return (string) $this->plugin_file;
81
-    }
82
-
83
-
84
-
85
-    /**
86
-     * @return string
87
-     */
88
-    public function pluginBasename()
89
-    {
90
-        return $this->plugin_basename;
91
-    }
92
-
93
-
94
-
95
-    /**
96
-     * @return string
97
-     */
98
-    public function pluginPath()
99
-    {
100
-        return $this->plugin_path;
101
-    }
102
-
103
-
104
-
105
-    /**
106
-     * @return string
107
-     */
108
-    public function pluginUrl()
109
-    {
110
-        return $this->plugin_url;
111
-    }
112
-
113
-
114
-
115
-    /**
116
-     * @return string
117
-     */
118
-    public function version()
119
-    {
120
-        return (string) $this->version;
121
-    }
122
-
123
-
124
-
125
-    /**
126
-     * @return Version
127
-     */
128
-    public function versionValueObject()
129
-    {
130
-        return $this->version;
131
-    }
132
-
133
-
134
-    /**
135
-     * @return string
136
-     */
137
-    public function distributionAssetsPath()
138
-    {
139
-        return $this->pluginPath() . 'assets/dist/';
140
-    }
141
-
142
-
143
-    /**
144
-     * @return string
145
-     */
146
-    public function distributionAssetsUrl()
147
-    {
148
-        return $this->pluginUrl() . 'assets/dist/';
149
-    }
22
+	/**
23
+	 * Equivalent to `__FILE__` for main plugin file.
24
+	 *
25
+	 * @var FilePath
26
+	 */
27
+	private $plugin_file;
28
+
29
+	/**
30
+	 * String indicating version for plugin
31
+	 *
32
+	 * @var string
33
+	 */
34
+	private $version;
35
+
36
+	/**
37
+	 * @var string $plugin_basename
38
+	 */
39
+	private $plugin_basename;
40
+
41
+	/**
42
+	 * @var string $plugin_path
43
+	 */
44
+	private $plugin_path;
45
+
46
+	/**
47
+	 * @var string $plugin_url
48
+	 */
49
+	private $plugin_url;
50
+
51
+	/**
52
+	 * @var string $asset_namespace
53
+	 */
54
+	private $asset_namespace;
55
+
56
+
57
+
58
+	/**
59
+	 * Initializes internal properties.
60
+	 *
61
+	 * @param FilePath $plugin_file
62
+	 * @param Version  $version
63
+	 */
64
+	public function __construct(FilePath $plugin_file, Version $version)
65
+	{
66
+		$this->plugin_file = $plugin_file;
67
+		$this->version = $version;
68
+		$this->plugin_basename = plugin_basename($this->pluginFile());
69
+		$this->plugin_path = plugin_dir_path($this->pluginFile());
70
+		$this->plugin_url = plugin_dir_url($this->pluginFile());
71
+		$this->setAssetNamespace();
72
+	}
73
+
74
+
75
+	/**
76
+	 * @return string
77
+	 */
78
+	public function pluginFile()
79
+	{
80
+		return (string) $this->plugin_file;
81
+	}
82
+
83
+
84
+
85
+	/**
86
+	 * @return string
87
+	 */
88
+	public function pluginBasename()
89
+	{
90
+		return $this->plugin_basename;
91
+	}
92
+
93
+
94
+
95
+	/**
96
+	 * @return string
97
+	 */
98
+	public function pluginPath()
99
+	{
100
+		return $this->plugin_path;
101
+	}
102
+
103
+
104
+
105
+	/**
106
+	 * @return string
107
+	 */
108
+	public function pluginUrl()
109
+	{
110
+		return $this->plugin_url;
111
+	}
112
+
113
+
114
+
115
+	/**
116
+	 * @return string
117
+	 */
118
+	public function version()
119
+	{
120
+		return (string) $this->version;
121
+	}
122
+
123
+
124
+
125
+	/**
126
+	 * @return Version
127
+	 */
128
+	public function versionValueObject()
129
+	{
130
+		return $this->version;
131
+	}
132
+
133
+
134
+	/**
135
+	 * @return string
136
+	 */
137
+	public function distributionAssetsPath()
138
+	{
139
+		return $this->pluginPath() . 'assets/dist/';
140
+	}
141
+
142
+
143
+	/**
144
+	 * @return string
145
+	 */
146
+	public function distributionAssetsUrl()
147
+	{
148
+		return $this->pluginUrl() . 'assets/dist/';
149
+	}
150 150
 
151
-
152
-    /**
153
-     * @return string
154
-     */
155
-    public function assetNamespace()
156
-    {
157
-        return $this->asset_namespace;
158
-    }
159
-
160
-
161
-    /**
162
-     * @return void
163
-     */
164
-    private function setAssetNamespace()
165
-    {
166
-        $this->asset_namespace = sanitize_key($this->plugin_basename);
167
-    }
151
+
152
+	/**
153
+	 * @return string
154
+	 */
155
+	public function assetNamespace()
156
+	{
157
+		return $this->asset_namespace;
158
+	}
159
+
160
+
161
+	/**
162
+	 * @return void
163
+	 */
164
+	private function setAssetNamespace()
165
+	{
166
+		$this->asset_namespace = sanitize_key($this->plugin_basename);
167
+	}
168 168
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function distributionAssetsPath()
138 138
     {
139
-        return $this->pluginPath() . 'assets/dist/';
139
+        return $this->pluginPath().'assets/dist/';
140 140
     }
141 141
 
142 142
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function distributionAssetsUrl()
147 147
     {
148
-        return $this->pluginUrl() . 'assets/dist/';
148
+        return $this->pluginUrl().'assets/dist/';
149 149
     }
150 150
 
151 151
 
Please login to merge, or discard this patch.
core/domain/values/assets/ManifestFile.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,26 +16,26 @@
 block discarded – undo
16 16
 class ManifestFile extends Asset
17 17
 {
18 18
 
19
-    /**
20
-     * Asset constructor.
21
-     *
22
-     * @param DomainInterface $domain
23
-     * @throws InvalidDataTypeException
24
-     */
25
-    public function __construct(DomainInterface $domain)
26
-    {
27
-        parent::__construct(Asset::TYPE_MANIFEST, $domain->assetNamespace(), $domain);
28
-    }
29
-
30
-
31
-    public function urlBase()
32
-    {
33
-        return $this->domain->distributionAssetsUrl();
34
-    }
35
-
36
-
37
-    public function filepath()
38
-    {
39
-        return $this->domain->distributionAssetsPath();
40
-    }
19
+	/**
20
+	 * Asset constructor.
21
+	 *
22
+	 * @param DomainInterface $domain
23
+	 * @throws InvalidDataTypeException
24
+	 */
25
+	public function __construct(DomainInterface $domain)
26
+	{
27
+		parent::__construct(Asset::TYPE_MANIFEST, $domain->assetNamespace(), $domain);
28
+	}
29
+
30
+
31
+	public function urlBase()
32
+	{
33
+		return $this->domain->distributionAssetsUrl();
34
+	}
35
+
36
+
37
+	public function filepath()
38
+	{
39
+		return $this->domain->distributionAssetsPath();
40
+	}
41 41
 }
Please login to merge, or discard this patch.
core/domain/values/assets/Asset.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     private function setType($type)
84 84
     {
85
-        if (! in_array($type, $this->validAssetTypes(), true)) {
85
+        if ( ! in_array($type, $this->validAssetTypes(), true)) {
86 86
             throw new InvalidDataTypeException(
87 87
                 'Asset::$type',
88 88
                 $type,
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     private function setHandle($handle)
101 101
     {
102
-        if (! is_string($handle)) {
102
+        if ( ! is_string($handle)) {
103 103
             throw new InvalidDataTypeException(
104 104
                 '$handle',
105 105
                 $handle,
Please login to merge, or discard this patch.
Indentation   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -16,154 +16,154 @@
 block discarded – undo
16 16
 abstract class Asset
17 17
 {
18 18
 
19
-    /**
20
-     * indicates the file extension for a build distribution CSS file
21
-     */
22
-    const FILE_EXTENSION_DISTRIBUTION_CSS = '.dist.css';
23
-
24
-    /**
25
-     * indicates the file extension for a build distribution JS file
26
-     */
27
-    const FILE_EXTENSION_DISTRIBUTION_JS = '.dist.js';
28
-
29
-    /**
30
-     * indicates a Cascading Style Sheet asset
31
-     */
32
-    const TYPE_CSS = 'css';
33
-
34
-    /**
35
-     * indicates a Javascript asset
36
-     */
37
-    const TYPE_JS = 'js';
38
-
39
-    /**
40
-     * indicates a Javascript manifest file
41
-     */
42
-    const TYPE_MANIFEST = 'manifest';
43
-
44
-    /**
45
-     * @var DomainInterface $domain
46
-     */
47
-    protected $domain;
48
-
49
-    /**
50
-     * @var string $type
51
-     */
52
-    private $type;
53
-
54
-    /**
55
-     * @var string $handle
56
-     */
57
-    private $handle;
58
-
59
-    /**
60
-     * @var bool $registered
61
-     */
62
-    private $registered = false;
63
-
64
-
65
-    /**
66
-     * Asset constructor.
67
-     *
68
-     * @param                 $type
69
-     * @param string          $handle
70
-     * @param DomainInterface $domain
71
-     * @throws InvalidDataTypeException
72
-     */
73
-    public function __construct($type, $handle, DomainInterface $domain)
74
-    {
75
-        $this->domain = $domain;
76
-        $this->setType($type);
77
-        $this->setHandle($handle);
78
-    }
79
-
80
-
81
-    /**
82
-     * @return array
83
-     */
84
-    public function validAssetTypes()
85
-    {
86
-        return array(
87
-            Asset::TYPE_CSS,
88
-            Asset::TYPE_JS,
89
-            Asset::TYPE_MANIFEST,
90
-        );
91
-    }
92
-
93
-
94
-    /**
95
-     * @param string $type
96
-     * @throws InvalidDataTypeException
97
-     */
98
-    private function setType($type)
99
-    {
100
-        if (! in_array($type, $this->validAssetTypes(), true)) {
101
-            throw new InvalidDataTypeException(
102
-                'Asset::$type',
103
-                $type,
104
-                'one of the TYPE_* class constants on \EventEspresso\core\domain\values\Asset is required'
105
-            );
106
-        }
107
-        $this->type = $type;
108
-    }
109
-
110
-
111
-    /**
112
-     * @param string $handle
113
-     * @throws InvalidDataTypeException
114
-     */
115
-    private function setHandle($handle)
116
-    {
117
-        if (! is_string($handle)) {
118
-            throw new InvalidDataTypeException(
119
-                '$handle',
120
-                $handle,
121
-                'string'
122
-            );
123
-        }
124
-        $this->handle = $handle;
125
-    }
126
-
127
-
128
-    /**
129
-     * @return string
130
-     */
131
-    public function assetNamespace()
132
-    {
133
-        return $this->domain->assetNamespace();
134
-    }
135
-
136
-
137
-    /**
138
-     * @return string
139
-     */
140
-    public function type()
141
-    {
142
-        return $this->type;
143
-    }
144
-
145
-
146
-    /**
147
-     * @return string
148
-     */
149
-    public function handle()
150
-    {
151
-        return $this->handle;
152
-    }
153
-
154
-    /**
155
-     * @return bool
156
-     */
157
-    public function isRegistered()
158
-    {
159
-        return $this->registered;
160
-    }
161
-
162
-    /**
163
-     * @param bool $registered
164
-     */
165
-    public function setRegistered($registered = true)
166
-    {
167
-        $this->registered = filter_var($registered, FILTER_VALIDATE_BOOLEAN);
168
-    }
19
+	/**
20
+	 * indicates the file extension for a build distribution CSS file
21
+	 */
22
+	const FILE_EXTENSION_DISTRIBUTION_CSS = '.dist.css';
23
+
24
+	/**
25
+	 * indicates the file extension for a build distribution JS file
26
+	 */
27
+	const FILE_EXTENSION_DISTRIBUTION_JS = '.dist.js';
28
+
29
+	/**
30
+	 * indicates a Cascading Style Sheet asset
31
+	 */
32
+	const TYPE_CSS = 'css';
33
+
34
+	/**
35
+	 * indicates a Javascript asset
36
+	 */
37
+	const TYPE_JS = 'js';
38
+
39
+	/**
40
+	 * indicates a Javascript manifest file
41
+	 */
42
+	const TYPE_MANIFEST = 'manifest';
43
+
44
+	/**
45
+	 * @var DomainInterface $domain
46
+	 */
47
+	protected $domain;
48
+
49
+	/**
50
+	 * @var string $type
51
+	 */
52
+	private $type;
53
+
54
+	/**
55
+	 * @var string $handle
56
+	 */
57
+	private $handle;
58
+
59
+	/**
60
+	 * @var bool $registered
61
+	 */
62
+	private $registered = false;
63
+
64
+
65
+	/**
66
+	 * Asset constructor.
67
+	 *
68
+	 * @param                 $type
69
+	 * @param string          $handle
70
+	 * @param DomainInterface $domain
71
+	 * @throws InvalidDataTypeException
72
+	 */
73
+	public function __construct($type, $handle, DomainInterface $domain)
74
+	{
75
+		$this->domain = $domain;
76
+		$this->setType($type);
77
+		$this->setHandle($handle);
78
+	}
79
+
80
+
81
+	/**
82
+	 * @return array
83
+	 */
84
+	public function validAssetTypes()
85
+	{
86
+		return array(
87
+			Asset::TYPE_CSS,
88
+			Asset::TYPE_JS,
89
+			Asset::TYPE_MANIFEST,
90
+		);
91
+	}
92
+
93
+
94
+	/**
95
+	 * @param string $type
96
+	 * @throws InvalidDataTypeException
97
+	 */
98
+	private function setType($type)
99
+	{
100
+		if (! in_array($type, $this->validAssetTypes(), true)) {
101
+			throw new InvalidDataTypeException(
102
+				'Asset::$type',
103
+				$type,
104
+				'one of the TYPE_* class constants on \EventEspresso\core\domain\values\Asset is required'
105
+			);
106
+		}
107
+		$this->type = $type;
108
+	}
109
+
110
+
111
+	/**
112
+	 * @param string $handle
113
+	 * @throws InvalidDataTypeException
114
+	 */
115
+	private function setHandle($handle)
116
+	{
117
+		if (! is_string($handle)) {
118
+			throw new InvalidDataTypeException(
119
+				'$handle',
120
+				$handle,
121
+				'string'
122
+			);
123
+		}
124
+		$this->handle = $handle;
125
+	}
126
+
127
+
128
+	/**
129
+	 * @return string
130
+	 */
131
+	public function assetNamespace()
132
+	{
133
+		return $this->domain->assetNamespace();
134
+	}
135
+
136
+
137
+	/**
138
+	 * @return string
139
+	 */
140
+	public function type()
141
+	{
142
+		return $this->type;
143
+	}
144
+
145
+
146
+	/**
147
+	 * @return string
148
+	 */
149
+	public function handle()
150
+	{
151
+		return $this->handle;
152
+	}
153
+
154
+	/**
155
+	 * @return bool
156
+	 */
157
+	public function isRegistered()
158
+	{
159
+		return $this->registered;
160
+	}
161
+
162
+	/**
163
+	 * @param bool $registered
164
+	 */
165
+	public function setRegistered($registered = true)
166
+	{
167
+		$this->registered = filter_var($registered, FILTER_VALIDATE_BOOLEAN);
168
+	}
169 169
 }
Please login to merge, or discard this patch.
core/domain/values/assets/BrowserAsset.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     private function setSource($source)
95 95
     {
96
-        if (! is_string($source)) {
96
+        if ( ! is_string($source)) {
97 97
             throw new InvalidDataTypeException(
98 98
                 '$source',
99 99
                 $source,
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function setVersion($version = EVENT_ESPRESSO_VERSION)
128 128
     {
129
-        if (! is_string($version)) {
129
+        if ( ! is_string($version)) {
130 130
             throw new InvalidDataTypeException(
131 131
                 '$version',
132 132
                 $version,
Please login to merge, or discard this patch.
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -16,136 +16,136 @@
 block discarded – undo
16 16
 abstract class BrowserAsset extends Asset
17 17
 {
18 18
 
19
-    /**
20
-     * @var string $source
21
-     */
22
-    private $source;
23
-
24
-    /**
25
-     * @var array $dependencies
26
-     */
27
-    private $dependencies;
28
-
29
-    /**
30
-     * @var string $version
31
-     */
32
-    private $version;
33
-
34
-
35
-    /**
36
-     * Asset constructor.
37
-     *
38
-     * @param string          $type
39
-     * @param string          $handle
40
-     * @param string          $source
41
-     * @param array           $dependencies
42
-     * @param DomainInterface $domain
43
-     * @throws InvalidDataTypeException
44
-     */
45
-    public function __construct($type, $handle, $source, array $dependencies, DomainInterface $domain)
46
-    {
47
-        parent::__construct($type, $handle, $domain);
48
-        $this->setSource($source);
49
-        $this->setDependencies($dependencies);
50
-    }
51
-
52
-
53
-    /**
54
-     * @since $VID:$
55
-     */
56
-    abstract public function enqueueAsset();
57
-
58
-
59
-    /**
60
-     * @return array
61
-     */
62
-    public function dependencies()
63
-    {
64
-        return $this->dependencies;
65
-    }
66
-
67
-
68
-    /**
69
-     * @param array $dependencies
70
-     */
71
-    private function setDependencies(array $dependencies)
72
-    {
73
-        $this->dependencies = $dependencies;
74
-    }
75
-
76
-
77
-    /**
78
-     * @since $VID:$
79
-     * @return bool
80
-     */
81
-    public function hasDependencies()
82
-    {
83
-        return count($this->dependencies) > 0;
84
-    }
85
-
86
-
87
-    /**
88
-     * @return string
89
-     */
90
-    public function source()
91
-    {
92
-        return $this->source;
93
-    }
94
-
95
-
96
-    /**
97
-     * @param string $source
98
-     * @throws InvalidDataTypeException
99
-     */
100
-    private function setSource($source)
101
-    {
102
-        if (! is_string($source)) {
103
-            throw new InvalidDataTypeException(
104
-                '$source',
105
-                $source,
106
-                'string'
107
-            );
108
-        }
109
-        $this->source = $source;
110
-    }
111
-
112
-
113
-    /**
114
-     * @return string
115
-     * @throws InvalidDataTypeException
116
-     */
117
-    public function version()
118
-    {
119
-        // if version is NOT set and this asset was NOT built for distribution,
120
-        // then set the version equal to the EE core plugin version
121
-        if (
122
-            $this->version === null
123
-            && (
124
-                substr($this->source, -8) !== Asset::FILE_EXTENSION_DISTRIBUTION_JS
125
-                || substr($this->source, -9) !== Asset::FILE_EXTENSION_DISTRIBUTION_CSS
126
-            )
127
-        ) {
128
-            $this->setVersion();
129
-        }
130
-        return $this->version;
131
-    }
132
-
133
-
134
-    /**
135
-     * @param string $version
136
-     * @return BrowserAsset
137
-     * @throws InvalidDataTypeException
138
-     */
139
-    public function setVersion($version = EVENT_ESPRESSO_VERSION)
140
-    {
141
-        if (! is_string($version)) {
142
-            throw new InvalidDataTypeException(
143
-                '$version',
144
-                $version,
145
-                'string'
146
-            );
147
-        }
148
-        $this->version = $version;
149
-        return $this;
150
-    }
19
+	/**
20
+	 * @var string $source
21
+	 */
22
+	private $source;
23
+
24
+	/**
25
+	 * @var array $dependencies
26
+	 */
27
+	private $dependencies;
28
+
29
+	/**
30
+	 * @var string $version
31
+	 */
32
+	private $version;
33
+
34
+
35
+	/**
36
+	 * Asset constructor.
37
+	 *
38
+	 * @param string          $type
39
+	 * @param string          $handle
40
+	 * @param string          $source
41
+	 * @param array           $dependencies
42
+	 * @param DomainInterface $domain
43
+	 * @throws InvalidDataTypeException
44
+	 */
45
+	public function __construct($type, $handle, $source, array $dependencies, DomainInterface $domain)
46
+	{
47
+		parent::__construct($type, $handle, $domain);
48
+		$this->setSource($source);
49
+		$this->setDependencies($dependencies);
50
+	}
51
+
52
+
53
+	/**
54
+	 * @since $VID:$
55
+	 */
56
+	abstract public function enqueueAsset();
57
+
58
+
59
+	/**
60
+	 * @return array
61
+	 */
62
+	public function dependencies()
63
+	{
64
+		return $this->dependencies;
65
+	}
66
+
67
+
68
+	/**
69
+	 * @param array $dependencies
70
+	 */
71
+	private function setDependencies(array $dependencies)
72
+	{
73
+		$this->dependencies = $dependencies;
74
+	}
75
+
76
+
77
+	/**
78
+	 * @since $VID:$
79
+	 * @return bool
80
+	 */
81
+	public function hasDependencies()
82
+	{
83
+		return count($this->dependencies) > 0;
84
+	}
85
+
86
+
87
+	/**
88
+	 * @return string
89
+	 */
90
+	public function source()
91
+	{
92
+		return $this->source;
93
+	}
94
+
95
+
96
+	/**
97
+	 * @param string $source
98
+	 * @throws InvalidDataTypeException
99
+	 */
100
+	private function setSource($source)
101
+	{
102
+		if (! is_string($source)) {
103
+			throw new InvalidDataTypeException(
104
+				'$source',
105
+				$source,
106
+				'string'
107
+			);
108
+		}
109
+		$this->source = $source;
110
+	}
111
+
112
+
113
+	/**
114
+	 * @return string
115
+	 * @throws InvalidDataTypeException
116
+	 */
117
+	public function version()
118
+	{
119
+		// if version is NOT set and this asset was NOT built for distribution,
120
+		// then set the version equal to the EE core plugin version
121
+		if (
122
+			$this->version === null
123
+			&& (
124
+				substr($this->source, -8) !== Asset::FILE_EXTENSION_DISTRIBUTION_JS
125
+				|| substr($this->source, -9) !== Asset::FILE_EXTENSION_DISTRIBUTION_CSS
126
+			)
127
+		) {
128
+			$this->setVersion();
129
+		}
130
+		return $this->version;
131
+	}
132
+
133
+
134
+	/**
135
+	 * @param string $version
136
+	 * @return BrowserAsset
137
+	 * @throws InvalidDataTypeException
138
+	 */
139
+	public function setVersion($version = EVENT_ESPRESSO_VERSION)
140
+	{
141
+		if (! is_string($version)) {
142
+			throw new InvalidDataTypeException(
143
+				'$version',
144
+				$version,
145
+				'string'
146
+			);
147
+		}
148
+		$this->version = $version;
149
+		return $this;
150
+	}
151 151
 }
Please login to merge, or discard this patch.
core/domain/values/assets/StylesheetAsset.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
      */
55 55
     private function setMedia($media)
56 56
     {
57
-        if (! is_string($media)) {
57
+        if ( ! is_string($media)) {
58 58
             throw new InvalidDataTypeException(
59 59
                 '$media',
60 60
                 $media,
Please login to merge, or discard this patch.
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -16,60 +16,60 @@
 block discarded – undo
16 16
 class StylesheetAsset extends BrowserAsset
17 17
 {
18 18
 
19
-    /**
20
-     * @var string $media
21
-     */
22
-    private $media;
19
+	/**
20
+	 * @var string $media
21
+	 */
22
+	private $media;
23 23
 
24 24
 
25
-    /**
26
-     * CssFile constructor.
27
-     *
28
-     * @param                 $handle
29
-     * @param string          $source
30
-     * @param array           $dependencies
31
-     * @param DomainInterface $domain
32
-     * @param                 $media
33
-     * @throws InvalidDataTypeException
34
-     */
35
-    public function __construct($handle, $source, array $dependencies, DomainInterface $domain, $media = 'all')
36
-    {
37
-        parent::__construct(Asset::TYPE_CSS, $handle, $source, $dependencies, $domain);
38
-        $this->setMedia($media);
39
-    }
25
+	/**
26
+	 * CssFile constructor.
27
+	 *
28
+	 * @param                 $handle
29
+	 * @param string          $source
30
+	 * @param array           $dependencies
31
+	 * @param DomainInterface $domain
32
+	 * @param                 $media
33
+	 * @throws InvalidDataTypeException
34
+	 */
35
+	public function __construct($handle, $source, array $dependencies, DomainInterface $domain, $media = 'all')
36
+	{
37
+		parent::__construct(Asset::TYPE_CSS, $handle, $source, $dependencies, $domain);
38
+		$this->setMedia($media);
39
+	}
40 40
 
41 41
 
42
-    /**
43
-     * @return string
44
-     */
45
-    public function media()
46
-    {
47
-        return $this->media;
48
-    }
42
+	/**
43
+	 * @return string
44
+	 */
45
+	public function media()
46
+	{
47
+		return $this->media;
48
+	}
49 49
 
50 50
 
51
-    /**
52
-     * @param string $media
53
-     * @throws InvalidDataTypeException
54
-     */
55
-    private function setMedia($media)
56
-    {
57
-        if (! is_string($media)) {
58
-            throw new InvalidDataTypeException(
59
-                '$media',
60
-                $media,
61
-                'string'
62
-            );
63
-        }
64
-        $this->media = $media;
65
-    }
51
+	/**
52
+	 * @param string $media
53
+	 * @throws InvalidDataTypeException
54
+	 */
55
+	private function setMedia($media)
56
+	{
57
+		if (! is_string($media)) {
58
+			throw new InvalidDataTypeException(
59
+				'$media',
60
+				$media,
61
+				'string'
62
+			);
63
+		}
64
+		$this->media = $media;
65
+	}
66 66
 
67 67
 
68
-    /**
69
-     * @since $VID:$
70
-     */
71
-    public function enqueueAsset()
72
-    {
73
-        wp_enqueue_style($this->handle());
74
-    }
68
+	/**
69
+	 * @since $VID:$
70
+	 */
71
+	public function enqueueAsset()
72
+	{
73
+		wp_enqueue_style($this->handle());
74
+	}
75 75
 }
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.
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 .= ' ';
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 .= ' ';
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.
modules/ticket_selector/TicketSelectorStandard.php 2 patches
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -14,121 +14,121 @@
 block discarded – undo
14 14
 class TicketSelectorStandard extends TicketSelector
15 15
 {
16 16
 
17
-    /**
18
-     * @var string $date_format
19
-     */
20
-    protected $date_format;
17
+	/**
18
+	 * @var string $date_format
19
+	 */
20
+	protected $date_format;
21 21
 
22
-    /**
23
-     * @var string $time_format
24
-     */
25
-    protected $time_format;
22
+	/**
23
+	 * @var string $time_format
24
+	 */
25
+	protected $time_format;
26 26
 
27
-    /**
28
-     * @var \EE_Ticket_Selector_Config $ticket_selector_config
29
-     */
30
-    protected $ticket_selector_config;
27
+	/**
28
+	 * @var \EE_Ticket_Selector_Config $ticket_selector_config
29
+	 */
30
+	protected $ticket_selector_config;
31 31
 
32
-    /**
33
-     * @var \EE_Tax_Config $tax_config
34
-     */
35
-    protected $tax_config;
32
+	/**
33
+	 * @var \EE_Tax_Config $tax_config
34
+	 */
35
+	protected $tax_config;
36 36
 
37 37
 
38
-    /**
39
-     * TicketSelectorSimple constructor.
40
-     *
41
-     * @param \EE_Event                  $event
42
-     * @param \EE_Ticket[]               $tickets
43
-     * @param int                        $max_attendees
44
-     * @param array                      $template_args
45
-     * @param string                     $date_format
46
-     * @param string                     $time_format
47
-     * @param \EE_Ticket_Selector_Config $ticket_selector_config
48
-     * @param \EE_Tax_Config             $tax_config
49
-     */
50
-    public function __construct(
51
-        \EE_Event $event,
52
-        array $tickets,
53
-        $max_attendees,
54
-        array $template_args,
55
-        $date_format = 'Y-m-d',
56
-        $time_format = 'g:i a',
57
-        \EE_Ticket_Selector_Config $ticket_selector_config = null,
58
-        \EE_Tax_Config $tax_config = null
59
-    ) {
60
-        $this->date_format = $date_format;
61
-        $this->time_format = $time_format;
62
-        // get EE_Ticket_Selector_Config and TicketDetails
63
-        $this->ticket_selector_config = isset(\EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)
64
-            ? \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector
65
-            : new \EE_Ticket_Selector_Config();
66
-        // $template_settings->setDatetimeSelectorThreshold(2);
67
-        // \EEH_Debug_Tools::printr($template_settings->getShowDatetimeSelector(), 'getShowDatetimeSelector', __FILE__, __LINE__);
68
-        // \EEH_Debug_Tools::printr($template_settings->getDatetimeSelectorThreshold(), 'getDatetimeSelectorThreshold', __FILE__, __LINE__);
69
-        $this->tax_config = isset(\EE_Registry::instance()->CFG->tax_settings)
70
-            ? \EE_Registry::instance()->CFG->tax_settings
71
-            : new \EE_Tax_Config();
72
-        parent::__construct($event, $tickets, $max_attendees, $template_args);
73
-    }
38
+	/**
39
+	 * TicketSelectorSimple constructor.
40
+	 *
41
+	 * @param \EE_Event                  $event
42
+	 * @param \EE_Ticket[]               $tickets
43
+	 * @param int                        $max_attendees
44
+	 * @param array                      $template_args
45
+	 * @param string                     $date_format
46
+	 * @param string                     $time_format
47
+	 * @param \EE_Ticket_Selector_Config $ticket_selector_config
48
+	 * @param \EE_Tax_Config             $tax_config
49
+	 */
50
+	public function __construct(
51
+		\EE_Event $event,
52
+		array $tickets,
53
+		$max_attendees,
54
+		array $template_args,
55
+		$date_format = 'Y-m-d',
56
+		$time_format = 'g:i a',
57
+		\EE_Ticket_Selector_Config $ticket_selector_config = null,
58
+		\EE_Tax_Config $tax_config = null
59
+	) {
60
+		$this->date_format = $date_format;
61
+		$this->time_format = $time_format;
62
+		// get EE_Ticket_Selector_Config and TicketDetails
63
+		$this->ticket_selector_config = isset(\EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)
64
+			? \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector
65
+			: new \EE_Ticket_Selector_Config();
66
+		// $template_settings->setDatetimeSelectorThreshold(2);
67
+		// \EEH_Debug_Tools::printr($template_settings->getShowDatetimeSelector(), 'getShowDatetimeSelector', __FILE__, __LINE__);
68
+		// \EEH_Debug_Tools::printr($template_settings->getDatetimeSelectorThreshold(), 'getDatetimeSelectorThreshold', __FILE__, __LINE__);
69
+		$this->tax_config = isset(\EE_Registry::instance()->CFG->tax_settings)
70
+			? \EE_Registry::instance()->CFG->tax_settings
71
+			: new \EE_Tax_Config();
72
+		parent::__construct($event, $tickets, $max_attendees, $template_args);
73
+	}
74 74
 
75 75
 
76
-    /**
77
-     * sets any and all template args that are required for this Ticket Selector
78
-     *
79
-     * @return void
80
-     * @throws \EE_Error
81
-     */
82
-    protected function addTemplateArgs()
83
-    {
84
-        $row = 1;
85
-        $ticket_row_html = '';
86
-        $required_ticket_sold_out = false;
87
-        // flag to indicate that at least one taxable ticket has been encountered
88
-        $taxable_tickets = false;
89
-        $datetime_selector = null;
90
-        $this->template_args['datetime_selector'] = '';
91
-        if ($this->ticket_selector_config->getShowDatetimeSelector()
92
-            !== \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
93
-        ) {
94
-            $datetime_selector = new DatetimeSelector(
95
-                $this->event,
96
-                $this->tickets,
97
-                $this->ticket_selector_config,
98
-                $this->date_format,
99
-                $this->time_format
100
-            );
101
-            $this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector();
102
-        }
103
-        $total_tickets = count($this->tickets);
104
-        // loop through tickets
105
-        foreach ($this->tickets as $TKT_ID => $ticket) {
106
-            if ($ticket instanceof \EE_Ticket) {
107
-                $cols = 2;
108
-                $taxable_tickets = $ticket->taxable() ? true : $taxable_tickets;
109
-                $ticket_selector_row = new TicketSelectorRowStandard(
110
-                    new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args),
111
-                    $this->tax_config,
112
-                    $total_tickets,
113
-                    $this->max_attendees,
114
-                    $row,
115
-                    $cols,
116
-                    $required_ticket_sold_out,
117
-                    $this->template_args['event_status'],
118
-                    $datetime_selector instanceof DatetimeSelector
119
-                        ? $datetime_selector->getTicketDatetimeClasses($ticket)
120
-                        : ''
121
-                );
122
-                $ticket_row_html .= $ticket_selector_row->getHtml();
123
-                $required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut();
124
-                $row++;
125
-            }
126
-        }
127
-        $this->template_args['row'] = $row;
128
-        $this->template_args['ticket_row_html'] = $ticket_row_html;
129
-        $this->template_args['taxable_tickets'] = $taxable_tickets;
130
-        $this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes;
131
-        $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'standard_ticket_selector.template.php';
132
-        remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector');
133
-    }
76
+	/**
77
+	 * sets any and all template args that are required for this Ticket Selector
78
+	 *
79
+	 * @return void
80
+	 * @throws \EE_Error
81
+	 */
82
+	protected function addTemplateArgs()
83
+	{
84
+		$row = 1;
85
+		$ticket_row_html = '';
86
+		$required_ticket_sold_out = false;
87
+		// flag to indicate that at least one taxable ticket has been encountered
88
+		$taxable_tickets = false;
89
+		$datetime_selector = null;
90
+		$this->template_args['datetime_selector'] = '';
91
+		if ($this->ticket_selector_config->getShowDatetimeSelector()
92
+			!== \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
93
+		) {
94
+			$datetime_selector = new DatetimeSelector(
95
+				$this->event,
96
+				$this->tickets,
97
+				$this->ticket_selector_config,
98
+				$this->date_format,
99
+				$this->time_format
100
+			);
101
+			$this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector();
102
+		}
103
+		$total_tickets = count($this->tickets);
104
+		// loop through tickets
105
+		foreach ($this->tickets as $TKT_ID => $ticket) {
106
+			if ($ticket instanceof \EE_Ticket) {
107
+				$cols = 2;
108
+				$taxable_tickets = $ticket->taxable() ? true : $taxable_tickets;
109
+				$ticket_selector_row = new TicketSelectorRowStandard(
110
+					new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args),
111
+					$this->tax_config,
112
+					$total_tickets,
113
+					$this->max_attendees,
114
+					$row,
115
+					$cols,
116
+					$required_ticket_sold_out,
117
+					$this->template_args['event_status'],
118
+					$datetime_selector instanceof DatetimeSelector
119
+						? $datetime_selector->getTicketDatetimeClasses($ticket)
120
+						: ''
121
+				);
122
+				$ticket_row_html .= $ticket_selector_row->getHtml();
123
+				$required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut();
124
+				$row++;
125
+			}
126
+		}
127
+		$this->template_args['row'] = $row;
128
+		$this->template_args['ticket_row_html'] = $ticket_row_html;
129
+		$this->template_args['taxable_tickets'] = $taxable_tickets;
130
+		$this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes;
131
+		$this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'standard_ticket_selector.template.php';
132
+		remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector');
133
+	}
134 134
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
         $this->template_args['ticket_row_html'] = $ticket_row_html;
129 129
         $this->template_args['taxable_tickets'] = $taxable_tickets;
130 130
         $this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes;
131
-        $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'standard_ticket_selector.template.php';
131
+        $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH.'standard_ticket_selector.template.php';
132 132
         remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector');
133 133
     }
134 134
 }
Please login to merge, or discard this patch.