Completed
Branch EDTR/master (7a3fe8)
by
unknown
10:11 queued 01:18
created
core/domain/services/assets/EspressoAdminAssetManager.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace EventEspresso\core\domain\services\assets;
4 4
 
5 5
 use EEH_Qtip_Loader;
6
-use EventEspresso\core\domain\values\assets\JavascriptAsset;
7 6
 use EventEspresso\core\services\assets\AssetManager;
8 7
 
9 8
 /**
Please login to merge, or discard this patch.
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -17,121 +17,121 @@
 block discarded – undo
17 17
 class EspressoAdminAssetManager extends AssetManager
18 18
 {
19 19
 
20
-    const JS_HANDLE_INJECT_WP = 'ee-inject-wp';
21
-
22
-    const JS_HANDLE_JQUERY_COOKIE = 'jquery-cookie';
23
-
24
-    const JS_HANDLE_JOYRIDE_MODERNIZR = 'joyride-modernizr';
25
-
26
-    const JS_HANDLE_JQUERY_JOYRIDE = 'jquery-joyride';
27
-
28
-    const CSS_HANDLE_EE_JOYRIDE = 'ee-joyride-css';
29
-
30
-    const CSS_HANDLE_JOYRIDE = 'joyride-css';
31
-
32
-
33
-    /**
34
-     * @inheritDoc
35
-     */
36
-    public function addAssets()
37
-    {
38
-        $joyride = filter_var(apply_filters('FHEE_load_joyride', false), FILTER_VALIDATE_BOOLEAN);
39
-        $this->registerJavascript($joyride);
40
-        $this->registerStyleSheets($joyride);
41
-    }
42
-
43
-
44
-    /**
45
-     * Register javascript assets
46
-     *
47
-     * @param bool $joyride
48
-     */
49
-    private function registerJavascript($joyride = false)
50
-    {
51
-        // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
52
-        // Note: the intention of this script is to only do TARGETED injections.
53
-        //ie: only injecting on certain script calls.
54
-        $this->addJavascript(
55
-            EspressoAdminAssetManager::JS_HANDLE_INJECT_WP,
56
-            EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js',
57
-            ['jquery'],
58
-            true,
59
-            EVENT_ESPRESSO_VERSION
60
-        );
61
-        // joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook,
62
-        // can be turned back on again via: add_filter('FHEE_load_joyride', '__return_true' );
63
-        if (! $joyride) {
64
-            return;
65
-        }
66
-        // register cookie script for future dependencies
67
-        $this->addJavascript(
68
-            EspressoAdminAssetManager::JS_HANDLE_JQUERY_COOKIE,
69
-            EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js',
70
-            ['jquery'],
71
-            true,
72
-            '2.1'
73
-        );
74
-        $this->addJavascript(
75
-            EspressoAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
76
-            EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js',
77
-            [],
78
-            true,
79
-            '2.1'
80
-        );
81
-        // wanna go for a joyride?
82
-        $this->addJavascript(
83
-            EspressoAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
84
-            EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js',
85
-            [
86
-                EspressoAdminAssetManager::JS_HANDLE_JQUERY_COOKIE,
87
-                EspressoAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR
88
-            ],
89
-            '2.1',
90
-            true
91
-        )->enqueueAsset();
92
-        $this->loadQtipJs();
93
-    }
94
-
95
-
96
-    /**
97
-     * Register CSS assets.
98
-     *
99
-     * @param bool $joyride
100
-     */
101
-    private function registerStyleSheets($joyride = false)
102
-    {
103
-        if (! $joyride) {
104
-            return;
105
-        }       // joyride style
106
-        $this->addStylesheet(
107
-            EspressoAdminAssetManager::CSS_HANDLE_JOYRIDE,
108
-            EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css',
109
-            [],
110
-            'all',
111
-            '2.1'
112
-        );
113
-        $this->addStylesheet(
114
-            EspressoAdminAssetManager::CSS_HANDLE_EE_JOYRIDE,
115
-            EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css',
116
-            ['joyride-css'],
117
-            'all',
118
-            EVENT_ESPRESSO_VERSION
119
-        )->enqueueAsset();
120
-    }
121
-
122
-
123
-    /**
124
-     * registers assets for cleaning your ears
125
-     */
126
-    public function loadQtipJs()
127
-    {
128
-        // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
129
-        // can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
130
-        if (apply_filters('FHEE_load_qtip', false)) {
131
-            $qtip_loader = EEH_Qtip_Loader::instance();
132
-            if ($qtip_loader instanceof EEH_Qtip_Loader) {
133
-                $qtip_loader->register_and_enqueue();
134
-            }
135
-        }
136
-    }
20
+	const JS_HANDLE_INJECT_WP = 'ee-inject-wp';
21
+
22
+	const JS_HANDLE_JQUERY_COOKIE = 'jquery-cookie';
23
+
24
+	const JS_HANDLE_JOYRIDE_MODERNIZR = 'joyride-modernizr';
25
+
26
+	const JS_HANDLE_JQUERY_JOYRIDE = 'jquery-joyride';
27
+
28
+	const CSS_HANDLE_EE_JOYRIDE = 'ee-joyride-css';
29
+
30
+	const CSS_HANDLE_JOYRIDE = 'joyride-css';
31
+
32
+
33
+	/**
34
+	 * @inheritDoc
35
+	 */
36
+	public function addAssets()
37
+	{
38
+		$joyride = filter_var(apply_filters('FHEE_load_joyride', false), FILTER_VALIDATE_BOOLEAN);
39
+		$this->registerJavascript($joyride);
40
+		$this->registerStyleSheets($joyride);
41
+	}
42
+
43
+
44
+	/**
45
+	 * Register javascript assets
46
+	 *
47
+	 * @param bool $joyride
48
+	 */
49
+	private function registerJavascript($joyride = false)
50
+	{
51
+		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
52
+		// Note: the intention of this script is to only do TARGETED injections.
53
+		//ie: only injecting on certain script calls.
54
+		$this->addJavascript(
55
+			EspressoAdminAssetManager::JS_HANDLE_INJECT_WP,
56
+			EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js',
57
+			['jquery'],
58
+			true,
59
+			EVENT_ESPRESSO_VERSION
60
+		);
61
+		// joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook,
62
+		// can be turned back on again via: add_filter('FHEE_load_joyride', '__return_true' );
63
+		if (! $joyride) {
64
+			return;
65
+		}
66
+		// register cookie script for future dependencies
67
+		$this->addJavascript(
68
+			EspressoAdminAssetManager::JS_HANDLE_JQUERY_COOKIE,
69
+			EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js',
70
+			['jquery'],
71
+			true,
72
+			'2.1'
73
+		);
74
+		$this->addJavascript(
75
+			EspressoAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
76
+			EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js',
77
+			[],
78
+			true,
79
+			'2.1'
80
+		);
81
+		// wanna go for a joyride?
82
+		$this->addJavascript(
83
+			EspressoAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
84
+			EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js',
85
+			[
86
+				EspressoAdminAssetManager::JS_HANDLE_JQUERY_COOKIE,
87
+				EspressoAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR
88
+			],
89
+			'2.1',
90
+			true
91
+		)->enqueueAsset();
92
+		$this->loadQtipJs();
93
+	}
94
+
95
+
96
+	/**
97
+	 * Register CSS assets.
98
+	 *
99
+	 * @param bool $joyride
100
+	 */
101
+	private function registerStyleSheets($joyride = false)
102
+	{
103
+		if (! $joyride) {
104
+			return;
105
+		}       // joyride style
106
+		$this->addStylesheet(
107
+			EspressoAdminAssetManager::CSS_HANDLE_JOYRIDE,
108
+			EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css',
109
+			[],
110
+			'all',
111
+			'2.1'
112
+		);
113
+		$this->addStylesheet(
114
+			EspressoAdminAssetManager::CSS_HANDLE_EE_JOYRIDE,
115
+			EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css',
116
+			['joyride-css'],
117
+			'all',
118
+			EVENT_ESPRESSO_VERSION
119
+		)->enqueueAsset();
120
+	}
121
+
122
+
123
+	/**
124
+	 * registers assets for cleaning your ears
125
+	 */
126
+	public function loadQtipJs()
127
+	{
128
+		// qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
129
+		// can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
130
+		if (apply_filters('FHEE_load_qtip', false)) {
131
+			$qtip_loader = EEH_Qtip_Loader::instance();
132
+			if ($qtip_loader instanceof EEH_Qtip_Loader) {
133
+				$qtip_loader->register_and_enqueue();
134
+			}
135
+		}
136
+	}
137 137
 }
Please login to merge, or discard this patch.
core/services/blocks/BlockRenderer.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -15,57 +15,57 @@
 block discarded – undo
15 15
 abstract class BlockRenderer implements BlockRendererInterface
16 16
 {
17 17
 
18
-    /**
19
-     * @var DomainInterface
20
-     */
21
-    protected $domain;
18
+	/**
19
+	 * @var DomainInterface
20
+	 */
21
+	protected $domain;
22 22
 
23
-    /**
24
-     * @var string
25
-     */
26
-    private $template_root_path;
23
+	/**
24
+	 * @var string
25
+	 */
26
+	private $template_root_path;
27 27
 
28 28
 
29
-    /**
30
-     * BlockRenderer constructor.
31
-     *
32
-     * @param DomainInterface $domain
33
-     */
34
-    public function __construct(DomainInterface $domain)
35
-    {
36
-        $this->domain = $domain;
37
-        $this->setTemplateRootPath();
38
-    }
29
+	/**
30
+	 * BlockRenderer constructor.
31
+	 *
32
+	 * @param DomainInterface $domain
33
+	 */
34
+	public function __construct(DomainInterface $domain)
35
+	{
36
+		$this->domain = $domain;
37
+		$this->setTemplateRootPath();
38
+	}
39 39
 
40 40
 
41
-    /**
42
-     * Sets the root path to the main block template.
43
-     */
44
-    private function setTemplateRootPath()
45
-    {
46
-        $this->template_root_path = $this->domain->pluginPath() . 'ui/blocks/';
47
-    }
41
+	/**
42
+	 * Sets the root path to the main block template.
43
+	 */
44
+	private function setTemplateRootPath()
45
+	{
46
+		$this->template_root_path = $this->domain->pluginPath() . 'ui/blocks/';
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * Exposes the root path for the main block template.
52
-     * @return string
53
-     */
54
-    public function templateRootPath()
55
-    {
56
-        return $this->template_root_path;
57
-    }
50
+	/**
51
+	 * Exposes the root path for the main block template.
52
+	 * @return string
53
+	 */
54
+	public function templateRootPath()
55
+	{
56
+		return $this->template_root_path;
57
+	}
58 58
 
59 59
 
60
-    /**
61
-     * converts GraphQL GUID into EE DB ID
62
-     *
63
-     * @param string $GUID
64
-     * @return int
65
-     */
66
-    protected function parseGUID($GUID)
67
-    {
68
-        $parts = Relay::fromGlobalId($GUID);
69
-        return ! empty($parts['id']) ? $parts['id'] : 0;
70
-    }
60
+	/**
61
+	 * converts GraphQL GUID into EE DB ID
62
+	 *
63
+	 * @param string $GUID
64
+	 * @return int
65
+	 */
66
+	protected function parseGUID($GUID)
67
+	{
68
+		$parts = Relay::fromGlobalId($GUID);
69
+		return ! empty($parts['id']) ? $parts['id'] : 0;
70
+	}
71 71
 }
Please login to merge, or discard this patch.
core/services/assets/BlockAssetManager.php 2 patches
Indentation   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -21,263 +21,263 @@
 block discarded – undo
21 21
 abstract class BlockAssetManager extends AssetManager implements BlockAssetManagerInterface
22 22
 {
23 23
 
24
-    /**
25
-     * @var string $editor_script_handle
26
-     */
27
-    private $editor_script_handle;
28
-
29
-    /**
30
-     * @var string $editor_style_handle
31
-     */
32
-    private $editor_style_handle;
33
-
34
-    /**
35
-     * @var string $script_handle
36
-     */
37
-    private $script_handle;
38
-
39
-    /**
40
-     * @var string $style_handle
41
-     */
42
-    private $style_handle;
43
-
44
-
45
-    /**
46
-     * @return string
47
-     */
48
-    public function getEditorScriptHandle()
49
-    {
50
-        return $this->editor_script_handle;
51
-    }
52
-
53
-
54
-    /**
55
-     * @param string $editor_script_handle
56
-     */
57
-    public function setEditorScriptHandle($editor_script_handle)
58
-    {
59
-        if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
60
-            $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
61
-        }
62
-        $this->editor_script_handle = $editor_script_handle;
63
-    }
64
-
65
-
66
-    /**
67
-     * @return string
68
-     */
69
-    public function getEditorStyleHandle()
70
-    {
71
-        return $this->editor_style_handle;
72
-    }
73
-
74
-
75
-    /**
76
-     * @param string $editor_style_handle
77
-     */
78
-    public function setEditorStyleHandle($editor_style_handle)
79
-    {
80
-        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
81
-            $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
82
-        }
83
-        $this->editor_style_handle = $editor_style_handle;
84
-    }
85
-
86
-
87
-    /**
88
-     * @return string
89
-     */
90
-    public function getScriptHandle()
91
-    {
92
-        return $this->script_handle;
93
-    }
94
-
95
-
96
-    /**
97
-     * @param string $script_handle
98
-     */
99
-    public function setScriptHandle($script_handle)
100
-    {
101
-        if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
102
-            $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
103
-        }
104
-        $this->script_handle = $script_handle;
105
-    }
106
-
107
-
108
-    /**
109
-     * @return string
110
-     */
111
-    public function getStyleHandle()
112
-    {
113
-        return $this->style_handle;
114
-    }
115
-
116
-
117
-    /**
118
-     * @param string $style_handle
119
-     */
120
-    public function setStyleHandle($style_handle)
121
-    {
122
-        if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
123
-            $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
124
-        }
125
-        $this->style_handle = $style_handle;
126
-    }
127
-
128
-    /**
129
-     * @since 4.9.71.p
130
-     * @throws InvalidDataTypeException
131
-     * @throws InvalidEntityException
132
-     * @throws DuplicateCollectionIdentifierException
133
-     */
134
-    public function addAssets()
135
-    {
136
-        $this->addEditorScript($this->getEditorScriptHandle());
137
-        // $this->addEditorStyle($this->getEditorStyleHandle());
138
-        $this->addScript($this->getScriptHandle());
139
-        // $this->addStyle($this->getStyleHandle());
140
-    }
141
-
142
-
143
-    /**
144
-     * @param       $handle
145
-     * @param array $dependencies
146
-     * @since 4.9.71.p
147
-     * @return JavascriptAsset
148
-     * @throws InvalidDataTypeException
149
-     * @throws InvalidEntityException
150
-     * @throws DuplicateCollectionIdentifierException
151
-     */
152
-    public function addEditorScript($handle, array $dependencies = array())
153
-    {
154
-        if ($this->assets->hasJavascriptAsset($handle)){
155
-            return $this->assets->getJavascriptAsset($handle);
156
-        }
157
-        $dependencies = array_merge(
158
-            $dependencies,
159
-            ['wp-blocks']
160
-        );
161
-        return $this
162
-            ->addJs($handle, $dependencies)->setRequiresTranslation()
163
-            ->setInlineDataCallback(
164
-                static function () {
165
-                    wp_add_inline_script(
166
-                        'eventespresso-core-app',
167
-                        "var eeDomain='blocks';",
168
-                        'before'
169
-                    );
170
-                }
171
-            );
172
-    }
173
-
174
-
175
-    /**
176
-     * @param        $handle
177
-     * @param array  $dependencies
178
-     * @since 4.9.71.p
179
-     * @return StylesheetAsset
180
-     * @throws InvalidDataTypeException
181
-     * @throws InvalidEntityException
182
-     * @throws DuplicateCollectionIdentifierException
183
-     */
184
-    public function addEditorStyle($handle, array $dependencies = array())
185
-    {
186
-        if ($this->assets->hasStylesheetAsset($handle)) {
187
-            return $this->assets->getStylesheetAsset($handle);
188
-        }
189
-        return $this->addCss($handle, $dependencies);
190
-    }
191
-
192
-
193
-    /**
194
-     * @param       $handle
195
-     * @param array $dependencies
196
-     * @since 4.9.71.p
197
-     * @return JavascriptAsset
198
-     * @throws InvalidDataTypeException
199
-     * @throws InvalidEntityException
200
-     * @throws DuplicateCollectionIdentifierException
201
-     */
202
-    public function addScript($handle, array $dependencies = array())
203
-    {
204
-        if ($this->assets->hasJavascriptAsset($handle)) {
205
-            return $this->assets->getJavascriptAsset($handle);
206
-        }
207
-        return $this->addJs($handle, $dependencies)->setRequiresTranslation();
208
-    }
209
-
210
-
211
-    /**
212
-     * @param        $handle
213
-     * @param array  $dependencies
214
-     * @since 4.9.71.p
215
-     * @return StylesheetAsset
216
-     * @throws InvalidDataTypeException
217
-     * @throws InvalidEntityException
218
-     * @throws DuplicateCollectionIdentifierException
219
-     */
220
-    public function addStyle($handle, array $dependencies = array())
221
-    {
222
-        if ($this->assets->hasStylesheetAsset($handle)) {
223
-            return $this->assets->getStylesheetAsset($handle);
224
-        }
225
-        return $this->addCss($handle, $dependencies);
226
-    }
227
-
228
-
229
-    /**
230
-     * @return JavascriptAsset|null
231
-     */
232
-    public function getEditorScript()
233
-    {
234
-        return $this->assets->getJavascriptAsset($this->editor_script_handle);
235
-    }
236
-
237
-
238
-    /**
239
-     * @return StylesheetAsset|null
240
-     */
241
-    public function getEditorStyle()
242
-    {
243
-        return $this->assets->getStylesheetAsset($this->editor_style_handle);
244
-    }
245
-
246
-
247
-    /**
248
-     * @return JavascriptAsset|null
249
-     */
250
-    public function getScript()
251
-    {
252
-        return $this->assets->getJavascriptAsset($this->script_handle);
253
-    }
254
-
255
-
256
-    /**
257
-     * @return StylesheetAsset|null
258
-     */
259
-    public function getStyle()
260
-    {
261
-        return $this->assets->getStylesheetAsset($this->style_handle);
262
-    }
263
-
264
-
265
-    /**
266
-     * @return  void
267
-     */
268
-    public function enqueueAssets()
269
-    {
270
-        $assets = array(
271
-            $this->getEditorScript(),
272
-            $this->getEditorStyle(),
273
-            $this->getScript(),
274
-            $this->getStyle(),
275
-        );
276
-        foreach ($assets as $asset) {
277
-            if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
278
-                $asset->enqueueAsset();
279
-            }
280
-        }
281
-    }
24
+	/**
25
+	 * @var string $editor_script_handle
26
+	 */
27
+	private $editor_script_handle;
28
+
29
+	/**
30
+	 * @var string $editor_style_handle
31
+	 */
32
+	private $editor_style_handle;
33
+
34
+	/**
35
+	 * @var string $script_handle
36
+	 */
37
+	private $script_handle;
38
+
39
+	/**
40
+	 * @var string $style_handle
41
+	 */
42
+	private $style_handle;
43
+
44
+
45
+	/**
46
+	 * @return string
47
+	 */
48
+	public function getEditorScriptHandle()
49
+	{
50
+		return $this->editor_script_handle;
51
+	}
52
+
53
+
54
+	/**
55
+	 * @param string $editor_script_handle
56
+	 */
57
+	public function setEditorScriptHandle($editor_script_handle)
58
+	{
59
+		if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
60
+			$editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
61
+		}
62
+		$this->editor_script_handle = $editor_script_handle;
63
+	}
64
+
65
+
66
+	/**
67
+	 * @return string
68
+	 */
69
+	public function getEditorStyleHandle()
70
+	{
71
+		return $this->editor_style_handle;
72
+	}
73
+
74
+
75
+	/**
76
+	 * @param string $editor_style_handle
77
+	 */
78
+	public function setEditorStyleHandle($editor_style_handle)
79
+	{
80
+		if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
81
+			$editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
82
+		}
83
+		$this->editor_style_handle = $editor_style_handle;
84
+	}
85
+
86
+
87
+	/**
88
+	 * @return string
89
+	 */
90
+	public function getScriptHandle()
91
+	{
92
+		return $this->script_handle;
93
+	}
94
+
95
+
96
+	/**
97
+	 * @param string $script_handle
98
+	 */
99
+	public function setScriptHandle($script_handle)
100
+	{
101
+		if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
102
+			$script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
103
+		}
104
+		$this->script_handle = $script_handle;
105
+	}
106
+
107
+
108
+	/**
109
+	 * @return string
110
+	 */
111
+	public function getStyleHandle()
112
+	{
113
+		return $this->style_handle;
114
+	}
115
+
116
+
117
+	/**
118
+	 * @param string $style_handle
119
+	 */
120
+	public function setStyleHandle($style_handle)
121
+	{
122
+		if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
123
+			$style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
124
+		}
125
+		$this->style_handle = $style_handle;
126
+	}
127
+
128
+	/**
129
+	 * @since 4.9.71.p
130
+	 * @throws InvalidDataTypeException
131
+	 * @throws InvalidEntityException
132
+	 * @throws DuplicateCollectionIdentifierException
133
+	 */
134
+	public function addAssets()
135
+	{
136
+		$this->addEditorScript($this->getEditorScriptHandle());
137
+		// $this->addEditorStyle($this->getEditorStyleHandle());
138
+		$this->addScript($this->getScriptHandle());
139
+		// $this->addStyle($this->getStyleHandle());
140
+	}
141
+
142
+
143
+	/**
144
+	 * @param       $handle
145
+	 * @param array $dependencies
146
+	 * @since 4.9.71.p
147
+	 * @return JavascriptAsset
148
+	 * @throws InvalidDataTypeException
149
+	 * @throws InvalidEntityException
150
+	 * @throws DuplicateCollectionIdentifierException
151
+	 */
152
+	public function addEditorScript($handle, array $dependencies = array())
153
+	{
154
+		if ($this->assets->hasJavascriptAsset($handle)){
155
+			return $this->assets->getJavascriptAsset($handle);
156
+		}
157
+		$dependencies = array_merge(
158
+			$dependencies,
159
+			['wp-blocks']
160
+		);
161
+		return $this
162
+			->addJs($handle, $dependencies)->setRequiresTranslation()
163
+			->setInlineDataCallback(
164
+				static function () {
165
+					wp_add_inline_script(
166
+						'eventespresso-core-app',
167
+						"var eeDomain='blocks';",
168
+						'before'
169
+					);
170
+				}
171
+			);
172
+	}
173
+
174
+
175
+	/**
176
+	 * @param        $handle
177
+	 * @param array  $dependencies
178
+	 * @since 4.9.71.p
179
+	 * @return StylesheetAsset
180
+	 * @throws InvalidDataTypeException
181
+	 * @throws InvalidEntityException
182
+	 * @throws DuplicateCollectionIdentifierException
183
+	 */
184
+	public function addEditorStyle($handle, array $dependencies = array())
185
+	{
186
+		if ($this->assets->hasStylesheetAsset($handle)) {
187
+			return $this->assets->getStylesheetAsset($handle);
188
+		}
189
+		return $this->addCss($handle, $dependencies);
190
+	}
191
+
192
+
193
+	/**
194
+	 * @param       $handle
195
+	 * @param array $dependencies
196
+	 * @since 4.9.71.p
197
+	 * @return JavascriptAsset
198
+	 * @throws InvalidDataTypeException
199
+	 * @throws InvalidEntityException
200
+	 * @throws DuplicateCollectionIdentifierException
201
+	 */
202
+	public function addScript($handle, array $dependencies = array())
203
+	{
204
+		if ($this->assets->hasJavascriptAsset($handle)) {
205
+			return $this->assets->getJavascriptAsset($handle);
206
+		}
207
+		return $this->addJs($handle, $dependencies)->setRequiresTranslation();
208
+	}
209
+
210
+
211
+	/**
212
+	 * @param        $handle
213
+	 * @param array  $dependencies
214
+	 * @since 4.9.71.p
215
+	 * @return StylesheetAsset
216
+	 * @throws InvalidDataTypeException
217
+	 * @throws InvalidEntityException
218
+	 * @throws DuplicateCollectionIdentifierException
219
+	 */
220
+	public function addStyle($handle, array $dependencies = array())
221
+	{
222
+		if ($this->assets->hasStylesheetAsset($handle)) {
223
+			return $this->assets->getStylesheetAsset($handle);
224
+		}
225
+		return $this->addCss($handle, $dependencies);
226
+	}
227
+
228
+
229
+	/**
230
+	 * @return JavascriptAsset|null
231
+	 */
232
+	public function getEditorScript()
233
+	{
234
+		return $this->assets->getJavascriptAsset($this->editor_script_handle);
235
+	}
236
+
237
+
238
+	/**
239
+	 * @return StylesheetAsset|null
240
+	 */
241
+	public function getEditorStyle()
242
+	{
243
+		return $this->assets->getStylesheetAsset($this->editor_style_handle);
244
+	}
245
+
246
+
247
+	/**
248
+	 * @return JavascriptAsset|null
249
+	 */
250
+	public function getScript()
251
+	{
252
+		return $this->assets->getJavascriptAsset($this->script_handle);
253
+	}
254
+
255
+
256
+	/**
257
+	 * @return StylesheetAsset|null
258
+	 */
259
+	public function getStyle()
260
+	{
261
+		return $this->assets->getStylesheetAsset($this->style_handle);
262
+	}
263
+
264
+
265
+	/**
266
+	 * @return  void
267
+	 */
268
+	public function enqueueAssets()
269
+	{
270
+		$assets = array(
271
+			$this->getEditorScript(),
272
+			$this->getEditorStyle(),
273
+			$this->getScript(),
274
+			$this->getStyle(),
275
+		);
276
+		foreach ($assets as $asset) {
277
+			if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
278
+				$asset->enqueueAsset();
279
+			}
280
+		}
281
+	}
282 282
 
283 283
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function setEditorScriptHandle($editor_script_handle)
58 58
     {
59
-        if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
60
-            $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
59
+        if (strpos($editor_script_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
60
+            $editor_script_handle = BlockInterface::NAME_SPACE.'-'.$editor_script_handle;
61 61
         }
62 62
         $this->editor_script_handle = $editor_script_handle;
63 63
     }
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function setEditorStyleHandle($editor_style_handle)
79 79
     {
80
-        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
81
-            $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
80
+        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
81
+            $editor_style_handle = BlockInterface::NAME_SPACE.'-'.$editor_style_handle;
82 82
         }
83 83
         $this->editor_style_handle = $editor_style_handle;
84 84
     }
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function setScriptHandle($script_handle)
100 100
     {
101
-        if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
102
-            $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
101
+        if (strpos($script_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
102
+            $script_handle = BlockInterface::NAME_SPACE.'-'.$script_handle;
103 103
         }
104 104
         $this->script_handle = $script_handle;
105 105
     }
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function setStyleHandle($style_handle)
121 121
     {
122
-        if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
123
-            $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
122
+        if (strpos($style_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
123
+            $style_handle = BlockInterface::NAME_SPACE.'-'.$style_handle;
124 124
         }
125 125
         $this->style_handle = $style_handle;
126 126
     }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function addEditorScript($handle, array $dependencies = array())
153 153
     {
154
-        if ($this->assets->hasJavascriptAsset($handle)){
154
+        if ($this->assets->hasJavascriptAsset($handle)) {
155 155
             return $this->assets->getJavascriptAsset($handle);
156 156
         }
157 157
         $dependencies = array_merge(
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         return $this
162 162
             ->addJs($handle, $dependencies)->setRequiresTranslation()
163 163
             ->setInlineDataCallback(
164
-                static function () {
164
+                static function() {
165 165
                     wp_add_inline_script(
166 166
                         'eventespresso-core-app',
167 167
                         "var eeDomain='blocks';",
Please login to merge, or discard this patch.
core/domain/entities/editor/Block.php 2 patches
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -21,209 +21,209 @@
 block discarded – undo
21 21
 abstract class Block implements BlockInterface
22 22
 {
23 23
 
24
-    /**
25
-     * BlockAssetManager that this editor block uses for asset registration
26
-     *
27
-     * @var BlockAssetManagerInterface $block_asset_manager
28
-     */
29
-    protected $block_asset_manager;
30
-
31
-    /**
32
-     * @var RequestInterface $request
33
-     */
34
-    protected $request;
35
-
36
-    /**
37
-     * @var array $attributes
38
-     */
39
-    private $attributes;
40
-
41
-    /**
42
-     * If set to true, then the block will render its content client side
43
-     * If false, then the block will render its content server side using the renderBlock() method
44
-     *
45
-     * @var bool $dynamic
46
-     */
47
-    private $dynamic = false;
48
-
49
-    /**
50
-     * @var string $block_type
51
-     */
52
-    private $block_type;
53
-
54
-    /**
55
-     * @var array $supported_routes
56
-     */
57
-    private $supported_routes;
58
-
59
-
60
-    /**
61
-     * Block constructor.
62
-     *
63
-     * @param BlockAssetManagerInterface $block_asset_manager
64
-     * @param RequestInterface           $request
65
-     */
66
-    public function __construct(BlockAssetManagerInterface $block_asset_manager, RequestInterface $request)
67
-    {
68
-        $this->block_asset_manager = $block_asset_manager;
69
-        $this->request = $request;
70
-    }
71
-
72
-
73
-    /**
74
-     * @return string
75
-     */
76
-    public function blockType()
77
-    {
78
-        return $this->block_type;
79
-    }
80
-
81
-
82
-    /**
83
-     * @return string
84
-     */
85
-    public function namespacedBlockType()
86
-    {
87
-        return Block::NAME_SPACE . '/' . $this->block_type;
88
-    }
89
-
90
-
91
-    /**
92
-     * @param string $block_type
93
-     */
94
-    protected function setBlockType($block_type)
95
-    {
96
-        $this->block_type = $block_type;
97
-    }
98
-
99
-
100
-    /**
101
-     * BlockAssetManager that this editor block uses for asset registration
102
-     *
103
-     * @return BlockAssetManagerInterface
104
-     */
105
-    public function assetManager()
106
-    {
107
-        return $this->block_asset_manager;
108
-    }
109
-
110
-
111
-    /**
112
-     * returns an array of fully qualified class names
113
-     * for RouteMatchSpecificationInterface objects
114
-     * that specify routes that the block should be loaded for.
115
-     *
116
-     * @return array
117
-     */
118
-    public function supportedRoutes()
119
-    {
120
-        return $this->supported_routes;
121
-    }
122
-
123
-
124
-    /**
125
-     * @param array $supported_routes
126
-     */
127
-    protected function setSupportedRoutes(array $supported_routes)
128
-    {
129
-        $this->supported_routes = $supported_routes;
130
-    }
131
-
132
-
133
-    /**
134
-     * @return array
135
-     */
136
-    public function attributes()
137
-    {
138
-        return $this->attributes;
139
-    }
140
-
141
-
142
-    /**
143
-     * @param array $attributes
144
-     */
145
-    public function setAttributes(array $attributes)
146
-    {
147
-        $this->attributes = $attributes;
148
-    }
149
-
150
-
151
-    /**
152
-     * @return bool
153
-     */
154
-    public function isDynamic()
155
-    {
156
-        return $this->dynamic;
157
-    }
158
-
159
-
160
-    /**
161
-     * @param bool $dynamic
162
-     */
163
-    public function setDynamic($dynamic = true)
164
-    {
165
-        $this->dynamic = filter_var($dynamic, FILTER_VALIDATE_BOOLEAN);
166
-    }
167
-
168
-
169
-    /**
170
-     * Registers the Editor Block with WP core;
171
-     * Returns the registered block type on success, or false on failure.
172
-     *
173
-     * @return WP_Block_Type|false
174
-     */
175
-    public function registerBlock()
176
-    {
177
-        $args = array(
178
-            'attributes'    => $this->attributes(),
179
-            'editor_script' => $this->block_asset_manager->getEditorScriptHandle(),
180
-            'script'        => $this->block_asset_manager->getScriptHandle(),
181
-        );
182
-        if ($this->isDynamic()) {
183
-            $args['render_callback'] = array($this, 'renderBlock');
184
-        }
185
-        return register_block_type(
186
-            new WP_Block_Type(
187
-                $this->namespacedBlockType(),
188
-                $args
189
-            )
190
-        );
191
-    }
192
-
193
-
194
-    /**
195
-     * @return WP_Block_Type|false The registered block type on success, or false on failure.
196
-     */
197
-    public function unRegisterBlock()
198
-    {
199
-        return unregister_block_type($this->namespacedBlockType());
200
-    }
201
-
202
-
203
-
204
-    /**
205
-     * @return array
206
-     */
207
-    public function getEditorContainer()
208
-    {
209
-        return array(
210
-            $this->namespacedBlockType(),
211
-            array(),
212
-        );
213
-    }
214
-
215
-
216
-    /**
217
-     * @since $VID:$
218
-     */
219
-    protected function loadGraphQLRelayAutoloader()
220
-    {
221
-        if (! class_exists('GraphQLRelay')) {
222
-            $autoloader = EE_THIRD_PARTY . 'wp-graphql/vendor/autoload.php';
223
-            if (! file_exists($autoloader)) {
224
-                return;
225
-            }
226
-            require_once $autoloader;
227
-        }
228
-    }
24
+	/**
25
+	 * BlockAssetManager that this editor block uses for asset registration
26
+	 *
27
+	 * @var BlockAssetManagerInterface $block_asset_manager
28
+	 */
29
+	protected $block_asset_manager;
30
+
31
+	/**
32
+	 * @var RequestInterface $request
33
+	 */
34
+	protected $request;
35
+
36
+	/**
37
+	 * @var array $attributes
38
+	 */
39
+	private $attributes;
40
+
41
+	/**
42
+	 * If set to true, then the block will render its content client side
43
+	 * If false, then the block will render its content server side using the renderBlock() method
44
+	 *
45
+	 * @var bool $dynamic
46
+	 */
47
+	private $dynamic = false;
48
+
49
+	/**
50
+	 * @var string $block_type
51
+	 */
52
+	private $block_type;
53
+
54
+	/**
55
+	 * @var array $supported_routes
56
+	 */
57
+	private $supported_routes;
58
+
59
+
60
+	/**
61
+	 * Block constructor.
62
+	 *
63
+	 * @param BlockAssetManagerInterface $block_asset_manager
64
+	 * @param RequestInterface           $request
65
+	 */
66
+	public function __construct(BlockAssetManagerInterface $block_asset_manager, RequestInterface $request)
67
+	{
68
+		$this->block_asset_manager = $block_asset_manager;
69
+		$this->request = $request;
70
+	}
71
+
72
+
73
+	/**
74
+	 * @return string
75
+	 */
76
+	public function blockType()
77
+	{
78
+		return $this->block_type;
79
+	}
80
+
81
+
82
+	/**
83
+	 * @return string
84
+	 */
85
+	public function namespacedBlockType()
86
+	{
87
+		return Block::NAME_SPACE . '/' . $this->block_type;
88
+	}
89
+
90
+
91
+	/**
92
+	 * @param string $block_type
93
+	 */
94
+	protected function setBlockType($block_type)
95
+	{
96
+		$this->block_type = $block_type;
97
+	}
98
+
99
+
100
+	/**
101
+	 * BlockAssetManager that this editor block uses for asset registration
102
+	 *
103
+	 * @return BlockAssetManagerInterface
104
+	 */
105
+	public function assetManager()
106
+	{
107
+		return $this->block_asset_manager;
108
+	}
109
+
110
+
111
+	/**
112
+	 * returns an array of fully qualified class names
113
+	 * for RouteMatchSpecificationInterface objects
114
+	 * that specify routes that the block should be loaded for.
115
+	 *
116
+	 * @return array
117
+	 */
118
+	public function supportedRoutes()
119
+	{
120
+		return $this->supported_routes;
121
+	}
122
+
123
+
124
+	/**
125
+	 * @param array $supported_routes
126
+	 */
127
+	protected function setSupportedRoutes(array $supported_routes)
128
+	{
129
+		$this->supported_routes = $supported_routes;
130
+	}
131
+
132
+
133
+	/**
134
+	 * @return array
135
+	 */
136
+	public function attributes()
137
+	{
138
+		return $this->attributes;
139
+	}
140
+
141
+
142
+	/**
143
+	 * @param array $attributes
144
+	 */
145
+	public function setAttributes(array $attributes)
146
+	{
147
+		$this->attributes = $attributes;
148
+	}
149
+
150
+
151
+	/**
152
+	 * @return bool
153
+	 */
154
+	public function isDynamic()
155
+	{
156
+		return $this->dynamic;
157
+	}
158
+
159
+
160
+	/**
161
+	 * @param bool $dynamic
162
+	 */
163
+	public function setDynamic($dynamic = true)
164
+	{
165
+		$this->dynamic = filter_var($dynamic, FILTER_VALIDATE_BOOLEAN);
166
+	}
167
+
168
+
169
+	/**
170
+	 * Registers the Editor Block with WP core;
171
+	 * Returns the registered block type on success, or false on failure.
172
+	 *
173
+	 * @return WP_Block_Type|false
174
+	 */
175
+	public function registerBlock()
176
+	{
177
+		$args = array(
178
+			'attributes'    => $this->attributes(),
179
+			'editor_script' => $this->block_asset_manager->getEditorScriptHandle(),
180
+			'script'        => $this->block_asset_manager->getScriptHandle(),
181
+		);
182
+		if ($this->isDynamic()) {
183
+			$args['render_callback'] = array($this, 'renderBlock');
184
+		}
185
+		return register_block_type(
186
+			new WP_Block_Type(
187
+				$this->namespacedBlockType(),
188
+				$args
189
+			)
190
+		);
191
+	}
192
+
193
+
194
+	/**
195
+	 * @return WP_Block_Type|false The registered block type on success, or false on failure.
196
+	 */
197
+	public function unRegisterBlock()
198
+	{
199
+		return unregister_block_type($this->namespacedBlockType());
200
+	}
201
+
202
+
203
+
204
+	/**
205
+	 * @return array
206
+	 */
207
+	public function getEditorContainer()
208
+	{
209
+		return array(
210
+			$this->namespacedBlockType(),
211
+			array(),
212
+		);
213
+	}
214
+
215
+
216
+	/**
217
+	 * @since $VID:$
218
+	 */
219
+	protected function loadGraphQLRelayAutoloader()
220
+	{
221
+		if (! class_exists('GraphQLRelay')) {
222
+			$autoloader = EE_THIRD_PARTY . 'wp-graphql/vendor/autoload.php';
223
+			if (! file_exists($autoloader)) {
224
+				return;
225
+			}
226
+			require_once $autoloader;
227
+		}
228
+	}
229 229
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function namespacedBlockType()
86 86
     {
87
-        return Block::NAME_SPACE . '/' . $this->block_type;
87
+        return Block::NAME_SPACE.'/'.$this->block_type;
88 88
     }
89 89
 
90 90
 
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
      */
219 219
     protected function loadGraphQLRelayAutoloader()
220 220
     {
221
-        if (! class_exists('GraphQLRelay')) {
222
-            $autoloader = EE_THIRD_PARTY . 'wp-graphql/vendor/autoload.php';
223
-            if (! file_exists($autoloader)) {
221
+        if ( ! class_exists('GraphQLRelay')) {
222
+            $autoloader = EE_THIRD_PARTY.'wp-graphql/vendor/autoload.php';
223
+            if ( ! file_exists($autoloader)) {
224 224
                 return;
225 225
             }
226 226
             require_once $autoloader;
Please login to merge, or discard this patch.
core/domain/entities/editor/blocks/EventAttendees.php 2 patches
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -21,176 +21,176 @@
 block discarded – undo
21 21
 class EventAttendees extends Block
22 22
 {
23 23
 
24
-    const BLOCK_TYPE = 'event-attendees';
24
+	const BLOCK_TYPE = 'event-attendees';
25 25
 
26
-    /**
27
-     * @var EventAttendeesBlockRenderer $renderer
28
-     */
29
-    protected $renderer;
26
+	/**
27
+	 * @var EventAttendeesBlockRenderer $renderer
28
+	 */
29
+	protected $renderer;
30 30
 
31 31
 
32
-    /**
33
-     * EventAttendees constructor.
34
-     *
35
-     * @param CoreBlocksAssetManager      $block_asset_manager
36
-     * @param RequestInterface            $request
37
-     * @param EventAttendeesBlockRenderer $renderer
38
-     */
39
-    public function __construct(
40
-        CoreBlocksAssetManager $block_asset_manager,
41
-        RequestInterface $request,
42
-        EventAttendeesBlockRenderer $renderer
43
-    ) {
44
-        parent::__construct($block_asset_manager, $request);
45
-        $this->renderer= $renderer;
46
-    }
32
+	/**
33
+	 * EventAttendees constructor.
34
+	 *
35
+	 * @param CoreBlocksAssetManager      $block_asset_manager
36
+	 * @param RequestInterface            $request
37
+	 * @param EventAttendeesBlockRenderer $renderer
38
+	 */
39
+	public function __construct(
40
+		CoreBlocksAssetManager $block_asset_manager,
41
+		RequestInterface $request,
42
+		EventAttendeesBlockRenderer $renderer
43
+	) {
44
+		parent::__construct($block_asset_manager, $request);
45
+		$this->renderer= $renderer;
46
+	}
47 47
 
48 48
 
49
-    /**
50
-     * Perform any early setup required by the block
51
-     * including setting the block type and supported post types
52
-     *
53
-     * @return void
54
-     */
55
-    public function initialize()
56
-    {
57
-        $this->setBlockType(EventAttendees::BLOCK_TYPE);
58
-        $this->setSupportedRoutes(
59
-            array(
60
-                'EventEspresso\core\domain\entities\route_match\specifications\admin\WordPressPostTypeEditor',
61
-                'EventEspresso\core\domain\entities\route_match\specifications\frontend\EspressoBlockRenderer',
62
-                'EventEspresso\core\domain\entities\route_match\specifications\frontend\AnyFrontendRequest'
63
-            )
64
-        );
65
-        $EVT_ID = $this->request->getRequestParam('page') === 'espresso_events'
66
-            ? $this->request->getRequestParam('post', 0)
67
-            : 0;
68
-        $this->setAttributes(
69
-            array(
70
-                'eventId'           => array(
71
-                    'type'    => 'number',
72
-                    'default' => $EVT_ID,
73
-                ),
74
-                'datetimeId'        => array(
75
-                    'type'    => 'number',
76
-                    'default' => 0,
77
-                ),
78
-                'ticketId'          => array(
79
-                    'type'    => 'number',
80
-                    'default' => 0,
81
-                ),
82
-                'status'            => array(
83
-                    'type'    => 'string',
84
-                    'default' => EEM_Registration::status_id_approved,
85
-                ),
86
-                'limit'             => array(
87
-                    'type'    => 'number',
88
-                    'default' => 100,
89
-                ),
90
-                'order' => array(
91
-                    'type' => 'string',
92
-                    'default' => 'ASC'
93
-                ),
94
-                'orderBy' => array(
95
-                    'type' => 'string',
96
-                    'default' => 'lastThenFirstName',
97
-                ),
98
-                'showGravatar'      => array(
99
-                    'type'    => 'boolean',
100
-                    'default' => false,
101
-                ),
102
-                'avatarClass' => array(
103
-                    'type' => 'string',
104
-                    'default' => 'contact',
105
-                ),
106
-                'avatarSize' => array(
107
-                    'type' => 'number',
108
-                    'default' => 24,
109
-                ),
110
-                'displayOnArchives' => array(
111
-                    'type'    => 'boolean',
112
-                    'default' => false,
113
-                ),
114
-            )
115
-        );
116
-        $this->setDynamic();
117
-    }
49
+	/**
50
+	 * Perform any early setup required by the block
51
+	 * including setting the block type and supported post types
52
+	 *
53
+	 * @return void
54
+	 */
55
+	public function initialize()
56
+	{
57
+		$this->setBlockType(EventAttendees::BLOCK_TYPE);
58
+		$this->setSupportedRoutes(
59
+			array(
60
+				'EventEspresso\core\domain\entities\route_match\specifications\admin\WordPressPostTypeEditor',
61
+				'EventEspresso\core\domain\entities\route_match\specifications\frontend\EspressoBlockRenderer',
62
+				'EventEspresso\core\domain\entities\route_match\specifications\frontend\AnyFrontendRequest'
63
+			)
64
+		);
65
+		$EVT_ID = $this->request->getRequestParam('page') === 'espresso_events'
66
+			? $this->request->getRequestParam('post', 0)
67
+			: 0;
68
+		$this->setAttributes(
69
+			array(
70
+				'eventId'           => array(
71
+					'type'    => 'number',
72
+					'default' => $EVT_ID,
73
+				),
74
+				'datetimeId'        => array(
75
+					'type'    => 'number',
76
+					'default' => 0,
77
+				),
78
+				'ticketId'          => array(
79
+					'type'    => 'number',
80
+					'default' => 0,
81
+				),
82
+				'status'            => array(
83
+					'type'    => 'string',
84
+					'default' => EEM_Registration::status_id_approved,
85
+				),
86
+				'limit'             => array(
87
+					'type'    => 'number',
88
+					'default' => 100,
89
+				),
90
+				'order' => array(
91
+					'type' => 'string',
92
+					'default' => 'ASC'
93
+				),
94
+				'orderBy' => array(
95
+					'type' => 'string',
96
+					'default' => 'lastThenFirstName',
97
+				),
98
+				'showGravatar'      => array(
99
+					'type'    => 'boolean',
100
+					'default' => false,
101
+				),
102
+				'avatarClass' => array(
103
+					'type' => 'string',
104
+					'default' => 'contact',
105
+				),
106
+				'avatarSize' => array(
107
+					'type' => 'number',
108
+					'default' => 24,
109
+				),
110
+				'displayOnArchives' => array(
111
+					'type'    => 'boolean',
112
+					'default' => false,
113
+				),
114
+			)
115
+		);
116
+		$this->setDynamic();
117
+	}
118 118
 
119 119
 
120
-    /**
121
-     * Returns an array where the key corresponds to the incoming attribute name from the WP block
122
-     * and the value corresponds to the attribute name for the existing EspressoEventAttendees shortcode
123
-     *
124
-     * @since 4.9.71.p
125
-     * @return array
126
-     */
127
-    private function getAttributesMap()
128
-    {
129
-        return array(
130
-            'event'             => 'sanitize_text_field',
131
-            'datetime'          => 'sanitize_text_field',
132
-            'ticket'            => 'sanitize_text_field',
133
-            'eventId'           => 'absint',
134
-            'datetimeId'        => 'absint',
135
-            'ticketId'          => 'absint',
136
-            'status'            => 'sanitize_text_field',
137
-            'limit'             => 'intval',
138
-            'showGravatar'      => 'bool',
139
-            'avatarClass'       => 'sanitize_text_field',
140
-            'avatarSize'        => 'absint',
141
-            'displayOnArchives' => 'bool',
142
-            'order' => 'sanitize_text_field',
143
-            'orderBy' => 'sanitize_text_field',
144
-        );
145
-    }
120
+	/**
121
+	 * Returns an array where the key corresponds to the incoming attribute name from the WP block
122
+	 * and the value corresponds to the attribute name for the existing EspressoEventAttendees shortcode
123
+	 *
124
+	 * @since 4.9.71.p
125
+	 * @return array
126
+	 */
127
+	private function getAttributesMap()
128
+	{
129
+		return array(
130
+			'event'             => 'sanitize_text_field',
131
+			'datetime'          => 'sanitize_text_field',
132
+			'ticket'            => 'sanitize_text_field',
133
+			'eventId'           => 'absint',
134
+			'datetimeId'        => 'absint',
135
+			'ticketId'          => 'absint',
136
+			'status'            => 'sanitize_text_field',
137
+			'limit'             => 'intval',
138
+			'showGravatar'      => 'bool',
139
+			'avatarClass'       => 'sanitize_text_field',
140
+			'avatarSize'        => 'absint',
141
+			'displayOnArchives' => 'bool',
142
+			'order' => 'sanitize_text_field',
143
+			'orderBy' => 'sanitize_text_field',
144
+		);
145
+	}
146 146
 
147 147
 
148
-    /**
149
-     * Sanitizes attributes.
150
-     *
151
-     * @param array $attributes
152
-     * @return array
153
-     */
154
-    private function sanitizeAttributes(array $attributes)
155
-    {
156
-        $sanitized_attributes = array();
157
-        foreach ($attributes as $attribute => $value) {
158
-            $convert = $this->getAttributesMap();
159
-            if (isset($convert[ $attribute ])) {
160
-                $sanitize = $convert[ $attribute ];
161
-                if ($sanitize === 'bool') {
162
-                    $sanitized_attributes[ $attribute ] = filter_var(
163
-                        $value,
164
-                        FILTER_VALIDATE_BOOLEAN
165
-                    );
166
-                } else {
167
-                    $sanitized_attributes[ $attribute ] = $sanitize($value);
168
-                }
169
-                // don't pass along attributes with a 0 value
170
-                if ($sanitized_attributes[ $attribute ] === 0) {
171
-                    unset($sanitized_attributes[ $attribute ]);
172
-                }
173
-            }
174
-        }
175
-        return $attributes;
176
-    }
148
+	/**
149
+	 * Sanitizes attributes.
150
+	 *
151
+	 * @param array $attributes
152
+	 * @return array
153
+	 */
154
+	private function sanitizeAttributes(array $attributes)
155
+	{
156
+		$sanitized_attributes = array();
157
+		foreach ($attributes as $attribute => $value) {
158
+			$convert = $this->getAttributesMap();
159
+			if (isset($convert[ $attribute ])) {
160
+				$sanitize = $convert[ $attribute ];
161
+				if ($sanitize === 'bool') {
162
+					$sanitized_attributes[ $attribute ] = filter_var(
163
+						$value,
164
+						FILTER_VALIDATE_BOOLEAN
165
+					);
166
+				} else {
167
+					$sanitized_attributes[ $attribute ] = $sanitize($value);
168
+				}
169
+				// don't pass along attributes with a 0 value
170
+				if ($sanitized_attributes[ $attribute ] === 0) {
171
+					unset($sanitized_attributes[ $attribute ]);
172
+				}
173
+			}
174
+		}
175
+		return $attributes;
176
+	}
177 177
 
178 178
 
179
-    /**
180
-     * Returns the rendered HTML for the block
181
-     *
182
-     * @param array $attributes
183
-     * @return string
184
-     * @throws DomainException
185
-     * @throws EE_Error
186
-     */
187
-    public function renderBlock(array $attributes = array())
188
-    {
189
-        $attributes = $this->sanitizeAttributes($attributes);
190
-        if (! (bool) $attributes['displayOnArchives'] && (is_archive() || is_front_page() || is_home())) {
191
-            return '';
192
-        }
193
-        $this->loadGraphQLRelayAutoloader();
194
-        return $this->renderer->render($attributes);
195
-    }
179
+	/**
180
+	 * Returns the rendered HTML for the block
181
+	 *
182
+	 * @param array $attributes
183
+	 * @return string
184
+	 * @throws DomainException
185
+	 * @throws EE_Error
186
+	 */
187
+	public function renderBlock(array $attributes = array())
188
+	{
189
+		$attributes = $this->sanitizeAttributes($attributes);
190
+		if (! (bool) $attributes['displayOnArchives'] && (is_archive() || is_front_page() || is_home())) {
191
+			return '';
192
+		}
193
+		$this->loadGraphQLRelayAutoloader();
194
+		return $this->renderer->render($attributes);
195
+	}
196 196
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         EventAttendeesBlockRenderer $renderer
43 43
     ) {
44 44
         parent::__construct($block_asset_manager, $request);
45
-        $this->renderer= $renderer;
45
+        $this->renderer = $renderer;
46 46
     }
47 47
 
48 48
 
@@ -156,19 +156,19 @@  discard block
 block discarded – undo
156 156
         $sanitized_attributes = array();
157 157
         foreach ($attributes as $attribute => $value) {
158 158
             $convert = $this->getAttributesMap();
159
-            if (isset($convert[ $attribute ])) {
160
-                $sanitize = $convert[ $attribute ];
159
+            if (isset($convert[$attribute])) {
160
+                $sanitize = $convert[$attribute];
161 161
                 if ($sanitize === 'bool') {
162
-                    $sanitized_attributes[ $attribute ] = filter_var(
162
+                    $sanitized_attributes[$attribute] = filter_var(
163 163
                         $value,
164 164
                         FILTER_VALIDATE_BOOLEAN
165 165
                     );
166 166
                 } else {
167
-                    $sanitized_attributes[ $attribute ] = $sanitize($value);
167
+                    $sanitized_attributes[$attribute] = $sanitize($value);
168 168
                 }
169 169
                 // don't pass along attributes with a 0 value
170
-                if ($sanitized_attributes[ $attribute ] === 0) {
171
-                    unset($sanitized_attributes[ $attribute ]);
170
+                if ($sanitized_attributes[$attribute] === 0) {
171
+                    unset($sanitized_attributes[$attribute]);
172 172
                 }
173 173
             }
174 174
         }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     public function renderBlock(array $attributes = array())
188 188
     {
189 189
         $attributes = $this->sanitizeAttributes($attributes);
190
-        if (! (bool) $attributes['displayOnArchives'] && (is_archive() || is_front_page() || is_home())) {
190
+        if ( ! (bool) $attributes['displayOnArchives'] && (is_archive() || is_front_page() || is_home())) {
191 191
             return '';
192 192
         }
193 193
         $this->loadGraphQLRelayAutoloader();
Please login to merge, or discard this patch.
core/domain/entities/editor/CoreBlocksAssetManager.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@
 block discarded – undo
14 14
  */
15 15
 class CoreBlocksAssetManager extends BlockAssetManager
16 16
 {
17
-    const JS_HANDLE_CORE_BLOCKS_EDITOR = 'eventespresso-blocks';
18
-    const JS_HANDLE_CORE_BLOCKS = 'eventespresso-blocks';
17
+	const JS_HANDLE_CORE_BLOCKS_EDITOR = 'eventespresso-blocks';
18
+	const JS_HANDLE_CORE_BLOCKS = 'eventespresso-blocks';
19 19
 
20 20
 
21
-    /**
22
-     * @since 4.9.71.p
23
-     */
24
-    public function setAssetHandles()
25
-    {
26
-        $this->setEditorScriptHandle(CoreBlocksAssetManager::JS_HANDLE_CORE_BLOCKS_EDITOR);
27
-        $this->setScriptHandle(CoreBlocksAssetManager::JS_HANDLE_CORE_BLOCKS);
28
-    }
21
+	/**
22
+	 * @since 4.9.71.p
23
+	 */
24
+	public function setAssetHandles()
25
+	{
26
+		$this->setEditorScriptHandle(CoreBlocksAssetManager::JS_HANDLE_CORE_BLOCKS_EDITOR);
27
+		$this->setScriptHandle(CoreBlocksAssetManager::JS_HANDLE_CORE_BLOCKS);
28
+	}
29 29
 }
Please login to merge, or discard this patch.
core/domain/services/blocks/EventAttendeesBlockRenderer.php 1 patch
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -20,133 +20,133 @@
 block discarded – undo
20 20
 class EventAttendeesBlockRenderer extends BlockRenderer
21 21
 {
22 22
 
23
-    /**
24
-     * @var EEM_Attendee
25
-     */
26
-    private $attendee_model;
23
+	/**
24
+	 * @var EEM_Attendee
25
+	 */
26
+	private $attendee_model;
27 27
 
28
-    public function __construct(DomainInterface $domain, EEM_Attendee $attendee_model)
29
-    {
30
-        $this->attendee_model = $attendee_model;
31
-        parent::__construct($domain);
32
-    }
28
+	public function __construct(DomainInterface $domain, EEM_Attendee $attendee_model)
29
+	{
30
+		$this->attendee_model = $attendee_model;
31
+		parent::__construct($domain);
32
+	}
33 33
 
34 34
 
35
-    /**
36
-     * Renders the block.
37
-     *
38
-     * @param array $attributes  Expect already validated and sanitized array of attributes for use in generating the
39
-     *                           query and the template output.
40
-     * @return string
41
-     * @throws DomainException
42
-     * @throws EE_Error
43
-     */
44
-    public function render(array $attributes)
45
-    {
46
-        $attributes = $this->parseGlobalIDs($attributes);
47
-        $template_args['attributes'] = $attributes;
48
-        $template_args['attendees'] = $this->attendee_model->get_all($this->getQueryParams($attributes));
49
-        return EEH_Template::display_template(
50
-            $this->templateRootPath() . 'event-attendees.php',
51
-            $template_args,
52
-            true
53
-        );
54
-    }
35
+	/**
36
+	 * Renders the block.
37
+	 *
38
+	 * @param array $attributes  Expect already validated and sanitized array of attributes for use in generating the
39
+	 *                           query and the template output.
40
+	 * @return string
41
+	 * @throws DomainException
42
+	 * @throws EE_Error
43
+	 */
44
+	public function render(array $attributes)
45
+	{
46
+		$attributes = $this->parseGlobalIDs($attributes);
47
+		$template_args['attributes'] = $attributes;
48
+		$template_args['attendees'] = $this->attendee_model->get_all($this->getQueryParams($attributes));
49
+		return EEH_Template::display_template(
50
+			$this->templateRootPath() . 'event-attendees.php',
51
+			$template_args,
52
+			true
53
+		);
54
+	}
55 55
 
56 56
 
57
-    /**
58
-     * Get query parameters for model query.
59
-     *
60
-     * @param array $attributes
61
-     * @return array
62
-     */
63
-    private function parseGlobalIDs(array $attributes)
64
-    {
65
-        // if ticket ID is set, then that's all we need to run the query
66
-        $ticket = isset($attributes['ticket']) ? $attributes['ticket'] : '';
67
-        $datetime = isset($attributes['datetime']) ? $attributes['datetime'] : '';
68
-        $event = isset($attributes['event']) ? $attributes['event'] : '';
69
-        if ($ticket !== '') {
70
-            $ticketId = $this->parseGUID($ticket);
71
-            $attributes['ticketId'] = $ticketId;
72
-        } elseif ($datetime !== '') {
73
-            $datetimeId = $this->parseGUID($datetime);
74
-            $attributes['datetimeId'] = $datetimeId;
75
-        } elseif ($event !== '') {
76
-            $eventId = $this->parseGUID($event);
77
-            $attributes['eventId'] = $eventId;
78
-        }
79
-        // remove unnecessary data so it doesn't get added to the query vars
80
-        unset($attributes['ticket'], $attributes['datetime'], $attributes['event']);
81
-        return $attributes;
82
-    }
57
+	/**
58
+	 * Get query parameters for model query.
59
+	 *
60
+	 * @param array $attributes
61
+	 * @return array
62
+	 */
63
+	private function parseGlobalIDs(array $attributes)
64
+	{
65
+		// if ticket ID is set, then that's all we need to run the query
66
+		$ticket = isset($attributes['ticket']) ? $attributes['ticket'] : '';
67
+		$datetime = isset($attributes['datetime']) ? $attributes['datetime'] : '';
68
+		$event = isset($attributes['event']) ? $attributes['event'] : '';
69
+		if ($ticket !== '') {
70
+			$ticketId = $this->parseGUID($ticket);
71
+			$attributes['ticketId'] = $ticketId;
72
+		} elseif ($datetime !== '') {
73
+			$datetimeId = $this->parseGUID($datetime);
74
+			$attributes['datetimeId'] = $datetimeId;
75
+		} elseif ($event !== '') {
76
+			$eventId = $this->parseGUID($event);
77
+			$attributes['eventId'] = $eventId;
78
+		}
79
+		// remove unnecessary data so it doesn't get added to the query vars
80
+		unset($attributes['ticket'], $attributes['datetime'], $attributes['event']);
81
+		return $attributes;
82
+	}
83 83
 
84 84
 
85
-    /**
86
-     * Get query parameters for model query.
87
-     *
88
-     * @param array $attributes
89
-     * @return array
90
-     */
91
-    private function getQueryParams(array $attributes)
92
-    {
93
-        return array(
94
-            0 => $this->getWhereQueryPart($attributes),
95
-            'default_where_conditions' => 'this_model_only',
96
-            'limit' => $attributes['limit'],
97
-            'group_by' => array('ATT_ID'),
98
-            'order_by' => $this->getOrderByQueryPart($attributes)
99
-        );
100
-    }
85
+	/**
86
+	 * Get query parameters for model query.
87
+	 *
88
+	 * @param array $attributes
89
+	 * @return array
90
+	 */
91
+	private function getQueryParams(array $attributes)
92
+	{
93
+		return array(
94
+			0 => $this->getWhereQueryPart($attributes),
95
+			'default_where_conditions' => 'this_model_only',
96
+			'limit' => $attributes['limit'],
97
+			'group_by' => array('ATT_ID'),
98
+			'order_by' => $this->getOrderByQueryPart($attributes)
99
+		);
100
+	}
101 101
 
102 102
 
103
-    /**
104
-     * Get where query part for query parameters for model query.
105
-     *
106
-     * @param array $attributes
107
-     * @return array
108
-     */
109
-    private function getWhereQueryPart(array $attributes)
110
-    {
111
-        $where = array();
112
-        if ($attributes['ticketId'] > 0) {
113
-            $where['Registration.TKT_ID'] = $attributes['ticketId'];
114
-        } elseif ($attributes['datetimeId'] > 0) {
115
-            $where['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetimeId'];
116
-        } else {
117
-            $where['Registration.EVT_ID'] = $attributes['eventId'];
118
-        }
119
-        $where['Registration.STS_ID'] = $attributes['status'];
120
-        return $where;
121
-    }
103
+	/**
104
+	 * Get where query part for query parameters for model query.
105
+	 *
106
+	 * @param array $attributes
107
+	 * @return array
108
+	 */
109
+	private function getWhereQueryPart(array $attributes)
110
+	{
111
+		$where = array();
112
+		if ($attributes['ticketId'] > 0) {
113
+			$where['Registration.TKT_ID'] = $attributes['ticketId'];
114
+		} elseif ($attributes['datetimeId'] > 0) {
115
+			$where['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetimeId'];
116
+		} else {
117
+			$where['Registration.EVT_ID'] = $attributes['eventId'];
118
+		}
119
+		$where['Registration.STS_ID'] = $attributes['status'];
120
+		return $where;
121
+	}
122 122
 
123 123
 
124
-    /**
125
-     * Get order by query part for query parameters for model query.
126
-     *
127
-     * @param array $attributes
128
-     * @return array
129
-     */
130
-    private function getOrderByQueryPart(array $attributes)
131
-    {
132
-        $order = $attributes['order'];
133
-        switch ($attributes['orderBy']) {
134
-            case 'id':
135
-                $order_by = array('ATT_ID' => $order);
136
-                break;
137
-            case 'lastNameOnly':
138
-                $order_by = array('ATT_lname' => $order);
139
-                break;
140
-            case 'firstNameOnly':
141
-                $order_by = array('ATT_fname' => $order);
142
-                break;
143
-            case 'firstThenLastName':
144
-                $order_by = array('ATT_fname' => $order, 'ATT_lname' => $order);
145
-                break;
146
-            default:
147
-                $order_by = array('ATT_lname' => $order, 'ATT_fname' => $order);
148
-                break;
149
-        }
150
-        return $order_by;
151
-    }
124
+	/**
125
+	 * Get order by query part for query parameters for model query.
126
+	 *
127
+	 * @param array $attributes
128
+	 * @return array
129
+	 */
130
+	private function getOrderByQueryPart(array $attributes)
131
+	{
132
+		$order = $attributes['order'];
133
+		switch ($attributes['orderBy']) {
134
+			case 'id':
135
+				$order_by = array('ATT_ID' => $order);
136
+				break;
137
+			case 'lastNameOnly':
138
+				$order_by = array('ATT_lname' => $order);
139
+				break;
140
+			case 'firstNameOnly':
141
+				$order_by = array('ATT_fname' => $order);
142
+				break;
143
+			case 'firstThenLastName':
144
+				$order_by = array('ATT_fname' => $order, 'ATT_lname' => $order);
145
+				break;
146
+			default:
147
+				$order_by = array('ATT_lname' => $order, 'ATT_fname' => $order);
148
+				break;
149
+		}
150
+		return $order_by;
151
+	}
152 152
 }
Please login to merge, or discard this patch.
core/domain/services/assets/EspressoEditorAssetManager.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -17,39 +17,39 @@
 block discarded – undo
17 17
  */
18 18
 class EspressoEditorAssetManager extends ReactAssetManager
19 19
 {
20
-    const JS_HANDLE_EDITOR = 'eventespresso-core-app';
20
+	const JS_HANDLE_EDITOR = 'eventespresso-core-app';
21 21
 
22
-    /**
23
-     * @throws InvalidDataTypeException
24
-     * @throws InvalidEntityException
25
-     * @throws DuplicateCollectionIdentifierException
26
-     * @throws DomainException
27
-     */
28
-    public function addAssets()
29
-    {
30
-        parent::addAssets();
31
-        $this->registerJavascript();
32
-    }
22
+	/**
23
+	 * @throws InvalidDataTypeException
24
+	 * @throws InvalidEntityException
25
+	 * @throws DuplicateCollectionIdentifierException
26
+	 * @throws DomainException
27
+	 */
28
+	public function addAssets()
29
+	{
30
+		parent::addAssets();
31
+		$this->registerJavascript();
32
+	}
33 33
 
34 34
 
35
-    /**
36
-     * Register javascript assets
37
-     *
38
-     * @throws InvalidDataTypeException
39
-     * @throws InvalidEntityException
40
-     * @throws DuplicateCollectionIdentifierException
41
-     * @throws DomainException
42
-     */
43
-    private function registerJavascript()
44
-    {
45
-        $this->addJs(
46
-            EspressoEditorAssetManager::JS_HANDLE_EDITOR,
47
-            [
48
-                ReactAssetManager::JS_HANDLE_REACT,
49
-                ReactAssetManager::JS_HANDLE_REACT_DOM,
50
-                CoreAssetManager::JS_HANDLE_JS_CORE,
51
-                'wp-i18n',
52
-            ]
53
-        )->setRequiresTranslation();
54
-    }
35
+	/**
36
+	 * Register javascript assets
37
+	 *
38
+	 * @throws InvalidDataTypeException
39
+	 * @throws InvalidEntityException
40
+	 * @throws DuplicateCollectionIdentifierException
41
+	 * @throws DomainException
42
+	 */
43
+	private function registerJavascript()
44
+	{
45
+		$this->addJs(
46
+			EspressoEditorAssetManager::JS_HANDLE_EDITOR,
47
+			[
48
+				ReactAssetManager::JS_HANDLE_REACT,
49
+				ReactAssetManager::JS_HANDLE_REACT_DOM,
50
+				CoreAssetManager::JS_HANDLE_JS_CORE,
51
+				'wp-i18n',
52
+			]
53
+		)->setRequiresTranslation();
54
+	}
55 55
 }
Please login to merge, or discard this patch.
core/domain/services/assets/WordpressPluginsPageAssetManager.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -21,96 +21,96 @@
 block discarded – undo
21 21
  */
22 22
 class WordpressPluginsPageAssetManager extends ReactAssetManager
23 23
 {
24
-    const JS_HANDLE_WP_PLUGINS_PAGE = 'eventespresso-core-app';
24
+	const JS_HANDLE_WP_PLUGINS_PAGE = 'eventespresso-core-app';
25 25
 
26
-    /**
27
-     * @var ExitModal $exit_modal
28
-     */
29
-    private $exit_modal;
26
+	/**
27
+	 * @var ExitModal $exit_modal
28
+	 */
29
+	private $exit_modal;
30 30
 
31 31
 
32
-    /**
33
-     * WordpressPluginsPageAssetManager constructor.
34
-     *
35
-     * @param AssetCollection $assets
36
-     * @param DomainInterface $domain
37
-     * @param Registry        $registry
38
-     * @param ExitModal       $exit_modal
39
-     */
40
-    public function __construct(
41
-        AssetCollection $assets,
42
-        DomainInterface $domain,
43
-        Registry $registry,
44
-        ExitModal $exit_modal
45
-    ) {
46
-        $this->exit_modal = $exit_modal;
47
-        parent::__construct($domain, $assets, $registry);
48
-    }
32
+	/**
33
+	 * WordpressPluginsPageAssetManager constructor.
34
+	 *
35
+	 * @param AssetCollection $assets
36
+	 * @param DomainInterface $domain
37
+	 * @param Registry        $registry
38
+	 * @param ExitModal       $exit_modal
39
+	 */
40
+	public function __construct(
41
+		AssetCollection $assets,
42
+		DomainInterface $domain,
43
+		Registry $registry,
44
+		ExitModal $exit_modal
45
+	) {
46
+		$this->exit_modal = $exit_modal;
47
+		parent::__construct($domain, $assets, $registry);
48
+	}
49 49
 
50 50
 
51
-    /**
52
-     * @inheritDoc
53
-     */
54
-    public function addAssets()
55
-    {
56
-        parent::addAssets();
57
-        $this->registerJavascript();
58
-        $this->registerStyleSheets();
59
-        add_action('admin_enqueue_scripts', [$this, 'enqueueBrowserAssets'], 10);
60
-    }
51
+	/**
52
+	 * @inheritDoc
53
+	 */
54
+	public function addAssets()
55
+	{
56
+		parent::addAssets();
57
+		$this->registerJavascript();
58
+		$this->registerStyleSheets();
59
+		add_action('admin_enqueue_scripts', [$this, 'enqueueBrowserAssets'], 10);
60
+	}
61 61
 
62 62
 
63
-    /**
64
-     * Register javascript assets
65
-     *
66
-     * @throws InvalidDataTypeException
67
-     * @throws InvalidEntityException
68
-     * @throws DuplicateCollectionIdentifierException
69
-     * @throws DomainException
70
-     */
71
-    private function registerJavascript()
72
-    {
73
-        $this->addJs(
74
-            WordpressPluginsPageAssetManager::JS_HANDLE_WP_PLUGINS_PAGE,
75
-            [
76
-                CoreAssetManager::JS_HANDLE_JS_CORE,
77
-                ReactAssetManager::JS_HANDLE_REACT,
78
-                ReactAssetManager::JS_HANDLE_REACT_DOM,
79
-                'wp-components',
80
-                'wp-i18n',
81
-                'wp-url'
82
-            ]
83
-        )
84
-        ->setRequiresTranslation()
85
-        ->setInlineDataCallback(
86
-            function () {
87
-                wp_localize_script(
88
-                    WordpressPluginsPageAssetManager::JS_HANDLE_WP_PLUGINS_PAGE,
89
-                    'eeExitSurveyInfo',
90
-                    $this->exit_modal->getExitSurveyInfo()
91
-                );
92
-                wp_add_inline_script(
93
-                    WordpressPluginsPageAssetManager::JS_HANDLE_WP_PLUGINS_PAGE,
94
-                    "
63
+	/**
64
+	 * Register javascript assets
65
+	 *
66
+	 * @throws InvalidDataTypeException
67
+	 * @throws InvalidEntityException
68
+	 * @throws DuplicateCollectionIdentifierException
69
+	 * @throws DomainException
70
+	 */
71
+	private function registerJavascript()
72
+	{
73
+		$this->addJs(
74
+			WordpressPluginsPageAssetManager::JS_HANDLE_WP_PLUGINS_PAGE,
75
+			[
76
+				CoreAssetManager::JS_HANDLE_JS_CORE,
77
+				ReactAssetManager::JS_HANDLE_REACT,
78
+				ReactAssetManager::JS_HANDLE_REACT_DOM,
79
+				'wp-components',
80
+				'wp-i18n',
81
+				'wp-url'
82
+			]
83
+		)
84
+		->setRequiresTranslation()
85
+		->setInlineDataCallback(
86
+			function () {
87
+				wp_localize_script(
88
+					WordpressPluginsPageAssetManager::JS_HANDLE_WP_PLUGINS_PAGE,
89
+					'eeExitSurveyInfo',
90
+					$this->exit_modal->getExitSurveyInfo()
91
+				);
92
+				wp_add_inline_script(
93
+					WordpressPluginsPageAssetManager::JS_HANDLE_WP_PLUGINS_PAGE,
94
+					"
95 95
 var eeDomain='wpPluginsPage';
96 96
         ",
97
-                    'before'
98
-                );
99
-            }
100
-        );
101
-    }
97
+					'before'
98
+				);
99
+			}
100
+		);
101
+	}
102 102
 
103 103
 
104
-    /**
105
-     * Register CSS assets.
106
-     *
107
-     * @throws DuplicateCollectionIdentifierException
108
-     * @throws InvalidDataTypeException
109
-     * @throws InvalidEntityException
110
-     * @throws DomainException
111
-     */
112
-    private function registerStyleSheets()
113
-    {
114
-        wp_enqueue_style('wp-components');
115
-    }
104
+	/**
105
+	 * Register CSS assets.
106
+	 *
107
+	 * @throws DuplicateCollectionIdentifierException
108
+	 * @throws InvalidDataTypeException
109
+	 * @throws InvalidEntityException
110
+	 * @throws DomainException
111
+	 */
112
+	private function registerStyleSheets()
113
+	{
114
+		wp_enqueue_style('wp-components');
115
+	}
116 116
 }
Please login to merge, or discard this patch.