Completed
Pull Request — FET/Gutenberg/11400/block-mana... (#317)
by
unknown
88:22 queued 75:25
created
core/services/assets/AssetRegisterCollection.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -20,55 +20,55 @@
 block discarded – undo
20 20
 class AssetRegisterCollection extends Collection implements AssetRegisterInterface
21 21
 {
22 22
 
23
-    /**
24
-     * Collection constructor
25
-     *
26
-     * @throws InvalidInterfaceException
27
-     */
28
-    public function __construct()
29
-    {
30
-        parent::__construct('EventEspresso\core\services\assets\AssetRegisterInterface');
31
-    }
23
+	/**
24
+	 * Collection constructor
25
+	 *
26
+	 * @throws InvalidInterfaceException
27
+	 */
28
+	public function __construct()
29
+	{
30
+		parent::__construct('EventEspresso\core\services\assets\AssetRegisterInterface');
31
+	}
32 32
 
33 33
 
34
-    /**
35
-     * @return  void
36
-     */
37
-    public function registerManifestFile()
38
-    {
39
-        $this->rewind();
40
-        while ($this->valid()) {
41
-            $this->current()->registerManifestFile();
42
-            $this->next();
43
-        }
44
-        $this->rewind();
45
-    }
34
+	/**
35
+	 * @return  void
36
+	 */
37
+	public function registerManifestFile()
38
+	{
39
+		$this->rewind();
40
+		while ($this->valid()) {
41
+			$this->current()->registerManifestFile();
42
+			$this->next();
43
+		}
44
+		$this->rewind();
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     * @return  void
50
-     */
51
-    public function registerScripts()
52
-    {
53
-        $this->rewind();
54
-        while ($this->valid()) {
55
-            $this->current()->registerScripts();
56
-            $this->next();
57
-        }
58
-        $this->rewind();
59
-    }
48
+	/**
49
+	 * @return  void
50
+	 */
51
+	public function registerScripts()
52
+	{
53
+		$this->rewind();
54
+		while ($this->valid()) {
55
+			$this->current()->registerScripts();
56
+			$this->next();
57
+		}
58
+		$this->rewind();
59
+	}
60 60
 
61 61
 
62
-    /**
63
-     * @return void
64
-     */
65
-    public function registerStyles()
66
-    {
67
-        $this->rewind();
68
-        while ($this->valid()) {
69
-            $this->current()->registerStyles();
70
-            $this->next();
71
-        }
72
-        $this->rewind();
73
-    }
62
+	/**
63
+	 * @return void
64
+	 */
65
+	public function registerStyles()
66
+	{
67
+		$this->rewind();
68
+		while ($this->valid()) {
69
+			$this->current()->registerStyles();
70
+			$this->next();
71
+		}
72
+		$this->rewind();
73
+	}
74 74
 }
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
core/services/assets/AssetRegisterInterface.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,20 +17,20 @@
 block discarded – undo
17 17
 interface AssetRegisterInterface
18 18
 {
19 19
 
20
-    /**
21
-     * @return  void
22
-     */
23
-    public function registerManifestFile();
20
+	/**
21
+	 * @return  void
22
+	 */
23
+	public function registerManifestFile();
24 24
 
25 25
 
26
-    /**
27
-     * @return  void
28
-     */
29
-    public function registerScripts();
26
+	/**
27
+	 * @return  void
28
+	 */
29
+	public function registerScripts();
30 30
 
31 31
 
32
-    /**
33
-     * @return void
34
-     */
35
-    public function registerStyles();
32
+	/**
33
+	 * @return void
34
+	 */
35
+	public function registerStyles();
36 36
 }
37 37
\ No newline at end of file
Please login to merge, or discard this patch.
core/services/assets/Registry.php 2 patches
Indentation   +693 added lines, -693 removed lines patch added patch discarded remove patch
@@ -26,704 +26,704 @@
 block discarded – undo
26 26
 class Registry
27 27
 {
28 28
 
29
-    const ASSET_TYPE_CSS           = 'css';
30
-    const ASSET_TYPE_JS            = 'js';
31
-    const ASSET_NAMESPACE_CORE     = 'core';
32
-    const FILE_NAME_BUILD_MANIFEST = 'build-manifest.json';
33
-
34
-    /**
35
-     * @var EE_Template_Config $template_config
36
-     */
37
-    protected $template_config;
38
-
39
-    /**
40
-     * @var EE_Currency_Config $currency_config
41
-     */
42
-    protected $currency_config;
43
-
44
-    /**
45
-     * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.
46
-     *
47
-     * @var array
48
-     */
49
-    protected $jsdata = array();
50
-
51
-
52
-    /**
53
-     * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
54
-     * page source.
55
-     * @var array
56
-     */
57
-    protected $script_handles_with_data = array();
58
-
59
-
60
-    /**
61
-     * @var DomainInterface
62
-     */
63
-    protected $domain;
64
-
65
-
66
-    /**
67
-     * @var I18nRegistry
68
-     */
69
-    private $i18n_registry;
70
-
71
-
72
-
73
-    /**
74
-     * Holds the manifest data obtained from registered manifest files.
75
-     * Manifests are maps of asset chunk name to actual built asset file names.
76
-     * Shape of this array is:
77
-     *
78
-     * array(
79
-     *  'some_namespace_slug' => array(
80
-     *      'some_chunk_name' => array(
81
-     *          'js' => 'filename.js'
82
-     *          'css' => 'filename.js'
83
-     *      ),
84
-     *      'url_base' => 'https://baseurl.com/to/assets
85
-     *  )
86
-     * )
87
-     *
88
-     * @var array
89
-     */
90
-    private $manifest_data = array();
91
-
92
-
93
-    /**
94
-     * Registry constructor.
95
-     * Hooking into WP actions for script registry.
96
-     *
97
-     * @param EE_Template_Config $template_config
98
-     * @param EE_Currency_Config $currency_config
99
-     * @param I18nRegistry       $i18n_registry
100
-     * @param DomainInterface    $domain
101
-     * @throws InvalidArgumentException
102
-     * @throws InvalidFilePathException
103
-     */
104
-    public function __construct(
105
-        EE_Template_Config $template_config,
106
-        EE_Currency_Config $currency_config,
107
-        I18nRegistry $i18n_registry,
108
-        DomainInterface $domain
109
-    ) {
110
-        $this->template_config = $template_config;
111
-        $this->currency_config = $currency_config;
112
-        $this->domain = $domain;
113
-        $this->i18n_registry = $i18n_registry;
114
-        $this->registerManifestFile(
115
-            self::ASSET_NAMESPACE_CORE,
116
-            $this->domain->distributionAssetsUrl(),
117
-            $this->domain->distributionAssetsPath() . self::FILE_NAME_BUILD_MANIFEST
118
-        );
119
-        add_action('wp_enqueue_scripts', array($this, 'scripts'), 1);
120
-        add_action('admin_enqueue_scripts', array($this, 'scripts'), 1);
121
-        add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 2);
122
-        add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 2);
123
-        add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1);
124
-        add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1);
125
-    }
126
-
127
-
128
-    /**
129
-     * For classes that have Registry as a dependency, this provides a handy way to register script handles for i18n
130
-     * translation handling.
131
-     *
132
-     * @return I18nRegistry
133
-     */
134
-    public function getI18nRegistry()
135
-    {
136
-        return $this->i18n_registry;
137
-    }
138
-
139
-    /**
140
-     * Callback for the WP script actions.
141
-     * Used to register globally accessible core scripts.
142
-     * Also used to add the eejs.data object to the source for any js having eejs-core as a dependency.
143
-     *
144
-     */
145
-    public function scripts()
146
-    {
147
-        global $wp_version;
148
-        wp_register_script(
149
-            'ee-manifest',
150
-            $this->getJsUrl(self::ASSET_NAMESPACE_CORE, 'manifest'),
151
-            array(),
152
-            null,
153
-            true
154
-        );
155
-        wp_register_script(
156
-            'eejs-core',
157
-            $this->getJsUrl(self::ASSET_NAMESPACE_CORE, 'eejs'),
158
-            array('ee-manifest'),
159
-            null,
160
-            true
161
-        );
162
-        wp_register_script(
163
-            'ee-vendor-react',
164
-            $this->getJsUrl(self::ASSET_NAMESPACE_CORE, 'reactVendor'),
165
-            array('eejs-core'),
166
-            null,
167
-            true
168
-        );
169
-        //only run this if WordPress 4.4.0 > is in use.
170
-        if (version_compare($wp_version, '4.4.0', '>')) {
171
-            //js.api
172
-            wp_register_script(
173
-                'eejs-api',
174
-                EE_LIBRARIES_URL . 'rest_api/assets/js/eejs-api.min.js',
175
-                array('underscore', 'eejs-core'),
176
-                EVENT_ESPRESSO_VERSION,
177
-                true
178
-            );
179
-            $this->jsdata['eejs_api_nonce'] = wp_create_nonce('wp_rest');
180
-            $this->jsdata['paths'] = array('rest_route' => rest_url('ee/v4.8.36/'));
181
-        }
182
-        if (! is_admin()) {
183
-            $this->loadCoreCss();
184
-        }
185
-        $this->registerTranslationsForHandles(array('eejs-core'));
186
-        $this->loadCoreJs();
187
-        $this->loadJqueryValidate();
188
-        $this->loadAccountingJs();
189
-        $this->loadQtipJs();
190
-        $this->registerAdminAssets();
191
-    }
192
-
193
-
194
-
195
-    /**
196
-     * Call back for the script print in frontend and backend.
197
-     * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
198
-     *
199
-     * @since 4.9.31.rc.015
200
-     */
201
-    public function enqueueData()
202
-    {
203
-        $this->removeAlreadyRegisteredDataForScriptHandles();
204
-        wp_add_inline_script(
205
-            'eejs-core',
206
-            'var eejsdata=' . wp_json_encode(array('data' => $this->jsdata)),
207
-            'before'
208
-        );
209
-        wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
210
-        $this->localizeAccountingJs();
211
-        $this->addRegisteredScriptHandlesWithData('eejs-core');
212
-        $this->addRegisteredScriptHandlesWithData('espresso_core');
213
-    }
214
-
215
-
216
-
217
-    /**
218
-     * Used to add data to eejs.data object.
219
-     * Note:  Overriding existing data is not allowed.
220
-     * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
221
-     * If the data you add is something like this:
222
-     *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
223
-     * It will be exposed in the page source as:
224
-     *  eejs.data.my_plugin_data.foo == gar
225
-     *
226
-     * @param string       $key   Key used to access your data
227
-     * @param string|array $value Value to attach to key
228
-     * @throws InvalidArgumentException
229
-     */
230
-    public function addData($key, $value)
231
-    {
232
-        if ($this->verifyDataNotExisting($key)) {
233
-            $this->jsdata[$key] = $value;
234
-        }
235
-    }
236
-
237
-
238
-
239
-    /**
240
-     * Similar to addData except this allows for users to push values to an existing key where the values on key are
241
-     * elements in an array.
242
-     * When you use this method, the value you include will be appended to the end of an array on $key.
243
-     * So if the $key was 'test' and you added a value of 'my_data' then it would be represented in the javascript
244
-     * object like this, eejs.data.test = [ my_data,
245
-     * ]
246
-     * If there has already been a scalar value attached to the data object given key, then
247
-     * this will throw an exception.
248
-     *
249
-     * @param string       $key   Key to attach data to.
250
-     * @param string|array $value Value being registered.
251
-     * @throws InvalidArgumentException
252
-     */
253
-    public function pushData($key, $value)
254
-    {
255
-        if (isset($this->jsdata[$key])
256
-            && ! is_array($this->jsdata[$key])
257
-        ) {
258
-            throw new invalidArgumentException(
259
-                sprintf(
260
-                    __(
261
-                        'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
29
+	const ASSET_TYPE_CSS           = 'css';
30
+	const ASSET_TYPE_JS            = 'js';
31
+	const ASSET_NAMESPACE_CORE     = 'core';
32
+	const FILE_NAME_BUILD_MANIFEST = 'build-manifest.json';
33
+
34
+	/**
35
+	 * @var EE_Template_Config $template_config
36
+	 */
37
+	protected $template_config;
38
+
39
+	/**
40
+	 * @var EE_Currency_Config $currency_config
41
+	 */
42
+	protected $currency_config;
43
+
44
+	/**
45
+	 * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.
46
+	 *
47
+	 * @var array
48
+	 */
49
+	protected $jsdata = array();
50
+
51
+
52
+	/**
53
+	 * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
54
+	 * page source.
55
+	 * @var array
56
+	 */
57
+	protected $script_handles_with_data = array();
58
+
59
+
60
+	/**
61
+	 * @var DomainInterface
62
+	 */
63
+	protected $domain;
64
+
65
+
66
+	/**
67
+	 * @var I18nRegistry
68
+	 */
69
+	private $i18n_registry;
70
+
71
+
72
+
73
+	/**
74
+	 * Holds the manifest data obtained from registered manifest files.
75
+	 * Manifests are maps of asset chunk name to actual built asset file names.
76
+	 * Shape of this array is:
77
+	 *
78
+	 * array(
79
+	 *  'some_namespace_slug' => array(
80
+	 *      'some_chunk_name' => array(
81
+	 *          'js' => 'filename.js'
82
+	 *          'css' => 'filename.js'
83
+	 *      ),
84
+	 *      'url_base' => 'https://baseurl.com/to/assets
85
+	 *  )
86
+	 * )
87
+	 *
88
+	 * @var array
89
+	 */
90
+	private $manifest_data = array();
91
+
92
+
93
+	/**
94
+	 * Registry constructor.
95
+	 * Hooking into WP actions for script registry.
96
+	 *
97
+	 * @param EE_Template_Config $template_config
98
+	 * @param EE_Currency_Config $currency_config
99
+	 * @param I18nRegistry       $i18n_registry
100
+	 * @param DomainInterface    $domain
101
+	 * @throws InvalidArgumentException
102
+	 * @throws InvalidFilePathException
103
+	 */
104
+	public function __construct(
105
+		EE_Template_Config $template_config,
106
+		EE_Currency_Config $currency_config,
107
+		I18nRegistry $i18n_registry,
108
+		DomainInterface $domain
109
+	) {
110
+		$this->template_config = $template_config;
111
+		$this->currency_config = $currency_config;
112
+		$this->domain = $domain;
113
+		$this->i18n_registry = $i18n_registry;
114
+		$this->registerManifestFile(
115
+			self::ASSET_NAMESPACE_CORE,
116
+			$this->domain->distributionAssetsUrl(),
117
+			$this->domain->distributionAssetsPath() . self::FILE_NAME_BUILD_MANIFEST
118
+		);
119
+		add_action('wp_enqueue_scripts', array($this, 'scripts'), 1);
120
+		add_action('admin_enqueue_scripts', array($this, 'scripts'), 1);
121
+		add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 2);
122
+		add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 2);
123
+		add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1);
124
+		add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1);
125
+	}
126
+
127
+
128
+	/**
129
+	 * For classes that have Registry as a dependency, this provides a handy way to register script handles for i18n
130
+	 * translation handling.
131
+	 *
132
+	 * @return I18nRegistry
133
+	 */
134
+	public function getI18nRegistry()
135
+	{
136
+		return $this->i18n_registry;
137
+	}
138
+
139
+	/**
140
+	 * Callback for the WP script actions.
141
+	 * Used to register globally accessible core scripts.
142
+	 * Also used to add the eejs.data object to the source for any js having eejs-core as a dependency.
143
+	 *
144
+	 */
145
+	public function scripts()
146
+	{
147
+		global $wp_version;
148
+		wp_register_script(
149
+			'ee-manifest',
150
+			$this->getJsUrl(self::ASSET_NAMESPACE_CORE, 'manifest'),
151
+			array(),
152
+			null,
153
+			true
154
+		);
155
+		wp_register_script(
156
+			'eejs-core',
157
+			$this->getJsUrl(self::ASSET_NAMESPACE_CORE, 'eejs'),
158
+			array('ee-manifest'),
159
+			null,
160
+			true
161
+		);
162
+		wp_register_script(
163
+			'ee-vendor-react',
164
+			$this->getJsUrl(self::ASSET_NAMESPACE_CORE, 'reactVendor'),
165
+			array('eejs-core'),
166
+			null,
167
+			true
168
+		);
169
+		//only run this if WordPress 4.4.0 > is in use.
170
+		if (version_compare($wp_version, '4.4.0', '>')) {
171
+			//js.api
172
+			wp_register_script(
173
+				'eejs-api',
174
+				EE_LIBRARIES_URL . 'rest_api/assets/js/eejs-api.min.js',
175
+				array('underscore', 'eejs-core'),
176
+				EVENT_ESPRESSO_VERSION,
177
+				true
178
+			);
179
+			$this->jsdata['eejs_api_nonce'] = wp_create_nonce('wp_rest');
180
+			$this->jsdata['paths'] = array('rest_route' => rest_url('ee/v4.8.36/'));
181
+		}
182
+		if (! is_admin()) {
183
+			$this->loadCoreCss();
184
+		}
185
+		$this->registerTranslationsForHandles(array('eejs-core'));
186
+		$this->loadCoreJs();
187
+		$this->loadJqueryValidate();
188
+		$this->loadAccountingJs();
189
+		$this->loadQtipJs();
190
+		$this->registerAdminAssets();
191
+	}
192
+
193
+
194
+
195
+	/**
196
+	 * Call back for the script print in frontend and backend.
197
+	 * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
198
+	 *
199
+	 * @since 4.9.31.rc.015
200
+	 */
201
+	public function enqueueData()
202
+	{
203
+		$this->removeAlreadyRegisteredDataForScriptHandles();
204
+		wp_add_inline_script(
205
+			'eejs-core',
206
+			'var eejsdata=' . wp_json_encode(array('data' => $this->jsdata)),
207
+			'before'
208
+		);
209
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
210
+		$this->localizeAccountingJs();
211
+		$this->addRegisteredScriptHandlesWithData('eejs-core');
212
+		$this->addRegisteredScriptHandlesWithData('espresso_core');
213
+	}
214
+
215
+
216
+
217
+	/**
218
+	 * Used to add data to eejs.data object.
219
+	 * Note:  Overriding existing data is not allowed.
220
+	 * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
221
+	 * If the data you add is something like this:
222
+	 *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
223
+	 * It will be exposed in the page source as:
224
+	 *  eejs.data.my_plugin_data.foo == gar
225
+	 *
226
+	 * @param string       $key   Key used to access your data
227
+	 * @param string|array $value Value to attach to key
228
+	 * @throws InvalidArgumentException
229
+	 */
230
+	public function addData($key, $value)
231
+	{
232
+		if ($this->verifyDataNotExisting($key)) {
233
+			$this->jsdata[$key] = $value;
234
+		}
235
+	}
236
+
237
+
238
+
239
+	/**
240
+	 * Similar to addData except this allows for users to push values to an existing key where the values on key are
241
+	 * elements in an array.
242
+	 * When you use this method, the value you include will be appended to the end of an array on $key.
243
+	 * So if the $key was 'test' and you added a value of 'my_data' then it would be represented in the javascript
244
+	 * object like this, eejs.data.test = [ my_data,
245
+	 * ]
246
+	 * If there has already been a scalar value attached to the data object given key, then
247
+	 * this will throw an exception.
248
+	 *
249
+	 * @param string       $key   Key to attach data to.
250
+	 * @param string|array $value Value being registered.
251
+	 * @throws InvalidArgumentException
252
+	 */
253
+	public function pushData($key, $value)
254
+	{
255
+		if (isset($this->jsdata[$key])
256
+			&& ! is_array($this->jsdata[$key])
257
+		) {
258
+			throw new invalidArgumentException(
259
+				sprintf(
260
+					__(
261
+						'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
262 262
                          push values to this data element when it is an array.',
263
-                        'event_espresso'
264
-                    ),
265
-                    $key,
266
-                    __METHOD__
267
-                )
268
-            );
269
-        }
270
-        $this->jsdata[$key][] = $value;
271
-    }
272
-
273
-
274
-
275
-    /**
276
-     * Used to set content used by javascript for a template.
277
-     * Note: Overrides of existing registered templates are not allowed.
278
-     *
279
-     * @param string $template_reference
280
-     * @param string $template_content
281
-     * @throws InvalidArgumentException
282
-     */
283
-    public function addTemplate($template_reference, $template_content)
284
-    {
285
-        if (! isset($this->jsdata['templates'])) {
286
-            $this->jsdata['templates'] = array();
287
-        }
288
-        //no overrides allowed.
289
-        if (isset($this->jsdata['templates'][$template_reference])) {
290
-            throw new invalidArgumentException(
291
-                sprintf(
292
-                    __(
293
-                        'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
294
-                        'event_espresso'
295
-                    ),
296
-                    $template_reference
297
-                )
298
-            );
299
-        }
300
-        $this->jsdata['templates'][$template_reference] = $template_content;
301
-    }
302
-
303
-
304
-
305
-    /**
306
-     * Retrieve the template content already registered for the given reference.
307
-     *
308
-     * @param string $template_reference
309
-     * @return string
310
-     */
311
-    public function getTemplate($template_reference)
312
-    {
313
-        return isset($this->jsdata['templates'][$template_reference])
314
-            ? $this->jsdata['templates'][$template_reference]
315
-            : '';
316
-    }
317
-
318
-
319
-
320
-    /**
321
-     * Retrieve registered data.
322
-     *
323
-     * @param string $key Name of key to attach data to.
324
-     * @return mixed                If there is no for the given key, then false is returned.
325
-     */
326
-    public function getData($key)
327
-    {
328
-        return isset($this->jsdata[$key])
329
-            ? $this->jsdata[$key]
330
-            : false;
331
-    }
332
-
333
-
334
-    /**
335
-     * Get the actual asset path for asset manifests.
336
-     * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.
337
-     * @param string $namespace  The namespace associated with the manifest file hosting the map of chunk_name to actual
338
-     *                           asset file location.
339
-     * @param string $chunk_name
340
-     * @param string $asset_type
341
-     * @return string
342
-     * @since 4.9.59.p
343
-     */
344
-    public function getAssetUrl($namespace, $chunk_name, $asset_type)
345
-    {
346
-        $url = isset(
347
-            $this->manifest_data[$namespace][$chunk_name][$asset_type],
348
-            $this->manifest_data[$namespace]['url_base']
349
-        )
350
-            ? $this->manifest_data[$namespace]['url_base']
351
-              . $this->manifest_data[$namespace][$chunk_name][$asset_type]
352
-            : $chunk_name;
353
-        return apply_filters(
354
-            'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',
355
-            $url,
356
-            $namespace,
357
-            $chunk_name,
358
-            $asset_type
359
-        );
360
-    }
361
-
362
-
363
-
364
-    /**
365
-     * Return the url to a js file for the given namespace and chunk name.
366
-     *
367
-     * @param string $namespace
368
-     * @param string $chunk_name
369
-     * @return string
370
-     */
371
-    public function getJsUrl($namespace, $chunk_name)
372
-    {
373
-        return $this->getAssetUrl($namespace, $chunk_name, self::ASSET_TYPE_JS);
374
-    }
375
-
376
-
377
-    /**
378
-     * Return the url to a css file for the given namespace and chunk name.
379
-     *
380
-     * @param string $namespace
381
-     * @param string $chunk_name
382
-     * @return string
383
-     */
384
-    public function getCssUrl($namespace, $chunk_name)
385
-    {
386
-        return $this->getAssetUrl($namespace, $chunk_name, self::ASSET_TYPE_CSS);
387
-    }
388
-
389
-
390
-    /**
391
-     * Used to register a js/css manifest file with the registered_manifest_files property.
392
-     *
393
-     * @param string $namespace     Provided to associate the manifest file with a specific namespace.
394
-     * @param string $url_base      The url base for the manifest file location.
395
-     * @param string $manifest_file The absolute path to the manifest file.
396
-     * @throws InvalidArgumentException
397
-     * @throws InvalidFilePathException
398
-     * @since 4.9.59.p
399
-     */
400
-    public function registerManifestFile($namespace, $url_base, $manifest_file)
401
-    {
402
-        if (isset($this->manifest_data[$namespace])) {
403
-            throw new InvalidArgumentException(
404
-                sprintf(
405
-                    esc_html__(
406
-                        'The namespace for this manifest file has already been registered, choose a namespace other than %s',
407
-                        'event_espresso'
408
-                    ),
409
-                    $namespace
410
-                )
411
-            );
412
-        }
413
-        if (filter_var($url_base, FILTER_VALIDATE_URL) === false) {
414
-            if (is_admin()) {
415
-                EE_Error::add_error(
416
-                    sprintf(
417
-                        esc_html__(
418
-                            'The url given for %1$s assets is invalid.  The url provided was: "%2$s". This usually happens when another plugin or theme on a site is using the "%3$s" filter or has an invalid url set for the "%4$s" constant',
419
-                            'event_espresso'
420
-                        ),
421
-                        'Event Espresso',
422
-                        $url_base,
423
-                        'plugins_url',
424
-                        'WP_PLUGIN_URL'
425
-                    ),
426
-                    __FILE__,
427
-                    __FUNCTION__,
428
-                    __LINE__
429
-                );
430
-            }
431
-            return;
432
-        }
433
-        $this->manifest_data[$namespace] = $this->decodeManifestFile($manifest_file);
434
-        if (! isset($this->manifest_data[$namespace]['url_base'])) {
435
-            $this->manifest_data[$namespace]['url_base'] = trailingslashit($url_base);
436
-        }
437
-    }
438
-
439
-
440
-
441
-    /**
442
-     * Decodes json from the provided manifest file.
443
-     *
444
-     * @since 4.9.59.p
445
-     * @param string $manifest_file Path to manifest file.
446
-     * @return array
447
-     * @throws InvalidFilePathException
448
-     */
449
-    private function decodeManifestFile($manifest_file)
450
-    {
451
-        if (! file_exists($manifest_file)) {
452
-            throw new InvalidFilePathException($manifest_file);
453
-        }
454
-        return json_decode(file_get_contents($manifest_file), true);
455
-    }
456
-
457
-
458
-
459
-    /**
460
-     * Verifies whether the given data exists already on the jsdata array.
461
-     * Overriding data is not allowed.
462
-     *
463
-     * @param string $key Index for data.
464
-     * @return bool        If valid then return true.
465
-     * @throws InvalidArgumentException if data already exists.
466
-     */
467
-    protected function verifyDataNotExisting($key)
468
-    {
469
-        if (isset($this->jsdata[$key])) {
470
-            if (is_array($this->jsdata[$key])) {
471
-                throw new InvalidArgumentException(
472
-                    sprintf(
473
-                        __(
474
-                            'The value for %1$s already exists in the Registry::eejs object.
263
+						'event_espresso'
264
+					),
265
+					$key,
266
+					__METHOD__
267
+				)
268
+			);
269
+		}
270
+		$this->jsdata[$key][] = $value;
271
+	}
272
+
273
+
274
+
275
+	/**
276
+	 * Used to set content used by javascript for a template.
277
+	 * Note: Overrides of existing registered templates are not allowed.
278
+	 *
279
+	 * @param string $template_reference
280
+	 * @param string $template_content
281
+	 * @throws InvalidArgumentException
282
+	 */
283
+	public function addTemplate($template_reference, $template_content)
284
+	{
285
+		if (! isset($this->jsdata['templates'])) {
286
+			$this->jsdata['templates'] = array();
287
+		}
288
+		//no overrides allowed.
289
+		if (isset($this->jsdata['templates'][$template_reference])) {
290
+			throw new invalidArgumentException(
291
+				sprintf(
292
+					__(
293
+						'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
294
+						'event_espresso'
295
+					),
296
+					$template_reference
297
+				)
298
+			);
299
+		}
300
+		$this->jsdata['templates'][$template_reference] = $template_content;
301
+	}
302
+
303
+
304
+
305
+	/**
306
+	 * Retrieve the template content already registered for the given reference.
307
+	 *
308
+	 * @param string $template_reference
309
+	 * @return string
310
+	 */
311
+	public function getTemplate($template_reference)
312
+	{
313
+		return isset($this->jsdata['templates'][$template_reference])
314
+			? $this->jsdata['templates'][$template_reference]
315
+			: '';
316
+	}
317
+
318
+
319
+
320
+	/**
321
+	 * Retrieve registered data.
322
+	 *
323
+	 * @param string $key Name of key to attach data to.
324
+	 * @return mixed                If there is no for the given key, then false is returned.
325
+	 */
326
+	public function getData($key)
327
+	{
328
+		return isset($this->jsdata[$key])
329
+			? $this->jsdata[$key]
330
+			: false;
331
+	}
332
+
333
+
334
+	/**
335
+	 * Get the actual asset path for asset manifests.
336
+	 * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.
337
+	 * @param string $namespace  The namespace associated with the manifest file hosting the map of chunk_name to actual
338
+	 *                           asset file location.
339
+	 * @param string $chunk_name
340
+	 * @param string $asset_type
341
+	 * @return string
342
+	 * @since 4.9.59.p
343
+	 */
344
+	public function getAssetUrl($namespace, $chunk_name, $asset_type)
345
+	{
346
+		$url = isset(
347
+			$this->manifest_data[$namespace][$chunk_name][$asset_type],
348
+			$this->manifest_data[$namespace]['url_base']
349
+		)
350
+			? $this->manifest_data[$namespace]['url_base']
351
+			  . $this->manifest_data[$namespace][$chunk_name][$asset_type]
352
+			: $chunk_name;
353
+		return apply_filters(
354
+			'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',
355
+			$url,
356
+			$namespace,
357
+			$chunk_name,
358
+			$asset_type
359
+		);
360
+	}
361
+
362
+
363
+
364
+	/**
365
+	 * Return the url to a js file for the given namespace and chunk name.
366
+	 *
367
+	 * @param string $namespace
368
+	 * @param string $chunk_name
369
+	 * @return string
370
+	 */
371
+	public function getJsUrl($namespace, $chunk_name)
372
+	{
373
+		return $this->getAssetUrl($namespace, $chunk_name, self::ASSET_TYPE_JS);
374
+	}
375
+
376
+
377
+	/**
378
+	 * Return the url to a css file for the given namespace and chunk name.
379
+	 *
380
+	 * @param string $namespace
381
+	 * @param string $chunk_name
382
+	 * @return string
383
+	 */
384
+	public function getCssUrl($namespace, $chunk_name)
385
+	{
386
+		return $this->getAssetUrl($namespace, $chunk_name, self::ASSET_TYPE_CSS);
387
+	}
388
+
389
+
390
+	/**
391
+	 * Used to register a js/css manifest file with the registered_manifest_files property.
392
+	 *
393
+	 * @param string $namespace     Provided to associate the manifest file with a specific namespace.
394
+	 * @param string $url_base      The url base for the manifest file location.
395
+	 * @param string $manifest_file The absolute path to the manifest file.
396
+	 * @throws InvalidArgumentException
397
+	 * @throws InvalidFilePathException
398
+	 * @since 4.9.59.p
399
+	 */
400
+	public function registerManifestFile($namespace, $url_base, $manifest_file)
401
+	{
402
+		if (isset($this->manifest_data[$namespace])) {
403
+			throw new InvalidArgumentException(
404
+				sprintf(
405
+					esc_html__(
406
+						'The namespace for this manifest file has already been registered, choose a namespace other than %s',
407
+						'event_espresso'
408
+					),
409
+					$namespace
410
+				)
411
+			);
412
+		}
413
+		if (filter_var($url_base, FILTER_VALIDATE_URL) === false) {
414
+			if (is_admin()) {
415
+				EE_Error::add_error(
416
+					sprintf(
417
+						esc_html__(
418
+							'The url given for %1$s assets is invalid.  The url provided was: "%2$s". This usually happens when another plugin or theme on a site is using the "%3$s" filter or has an invalid url set for the "%4$s" constant',
419
+							'event_espresso'
420
+						),
421
+						'Event Espresso',
422
+						$url_base,
423
+						'plugins_url',
424
+						'WP_PLUGIN_URL'
425
+					),
426
+					__FILE__,
427
+					__FUNCTION__,
428
+					__LINE__
429
+				);
430
+			}
431
+			return;
432
+		}
433
+		$this->manifest_data[$namespace] = $this->decodeManifestFile($manifest_file);
434
+		if (! isset($this->manifest_data[$namespace]['url_base'])) {
435
+			$this->manifest_data[$namespace]['url_base'] = trailingslashit($url_base);
436
+		}
437
+	}
438
+
439
+
440
+
441
+	/**
442
+	 * Decodes json from the provided manifest file.
443
+	 *
444
+	 * @since 4.9.59.p
445
+	 * @param string $manifest_file Path to manifest file.
446
+	 * @return array
447
+	 * @throws InvalidFilePathException
448
+	 */
449
+	private function decodeManifestFile($manifest_file)
450
+	{
451
+		if (! file_exists($manifest_file)) {
452
+			throw new InvalidFilePathException($manifest_file);
453
+		}
454
+		return json_decode(file_get_contents($manifest_file), true);
455
+	}
456
+
457
+
458
+
459
+	/**
460
+	 * Verifies whether the given data exists already on the jsdata array.
461
+	 * Overriding data is not allowed.
462
+	 *
463
+	 * @param string $key Index for data.
464
+	 * @return bool        If valid then return true.
465
+	 * @throws InvalidArgumentException if data already exists.
466
+	 */
467
+	protected function verifyDataNotExisting($key)
468
+	{
469
+		if (isset($this->jsdata[$key])) {
470
+			if (is_array($this->jsdata[$key])) {
471
+				throw new InvalidArgumentException(
472
+					sprintf(
473
+						__(
474
+							'The value for %1$s already exists in the Registry::eejs object.
475 475
                             Overrides are not allowed. Since the value of this data is an array, you may want to use the
476 476
                             %2$s method to push your value to the array.',
477
-                            'event_espresso'
478
-                        ),
479
-                        $key,
480
-                        'pushData()'
481
-                    )
482
-                );
483
-            }
484
-            throw new InvalidArgumentException(
485
-                sprintf(
486
-                    __(
487
-                        'The value for %1$s already exists in the Registry::eejs object. Overrides are not
477
+							'event_espresso'
478
+						),
479
+						$key,
480
+						'pushData()'
481
+					)
482
+				);
483
+			}
484
+			throw new InvalidArgumentException(
485
+				sprintf(
486
+					__(
487
+						'The value for %1$s already exists in the Registry::eejs object. Overrides are not
488 488
                         allowed.  Consider attaching your value to a different key',
489
-                        'event_espresso'
490
-                    ),
491
-                    $key
492
-                )
493
-            );
494
-        }
495
-        return true;
496
-    }
497
-
498
-
499
-
500
-    /**
501
-     * registers core default stylesheets
502
-     */
503
-    private function loadCoreCss()
504
-    {
505
-        if ($this->template_config->enable_default_style) {
506
-            $default_stylesheet_path = is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
507
-                ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
508
-                : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css';
509
-            wp_register_style(
510
-                'espresso_default',
511
-                $default_stylesheet_path,
512
-                array('dashicons'),
513
-                EVENT_ESPRESSO_VERSION
514
-            );
515
-            //Load custom style sheet if available
516
-            if ($this->template_config->custom_style_sheet !== null) {
517
-                wp_register_style(
518
-                    'espresso_custom_css',
519
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
520
-                    array('espresso_default'),
521
-                    EVENT_ESPRESSO_VERSION
522
-                );
523
-            }
524
-        }
525
-    }
526
-
527
-
528
-
529
-    /**
530
-     * registers core default javascript
531
-     */
532
-    private function loadCoreJs()
533
-    {
534
-        // load core js
535
-        wp_register_script(
536
-            'espresso_core',
537
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
538
-            array('jquery'),
539
-            EVENT_ESPRESSO_VERSION,
540
-            true
541
-        );
542
-    }
543
-
544
-
545
-
546
-    /**
547
-     * registers jQuery Validate for form validation
548
-     */
549
-    private function loadJqueryValidate()
550
-    {
551
-        // register jQuery Validate and additional methods
552
-        wp_register_script(
553
-            'jquery-validate',
554
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
555
-            array('jquery'),
556
-            '1.15.0',
557
-            true
558
-        );
559
-        wp_register_script(
560
-            'jquery-validate-extra-methods',
561
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
562
-            array('jquery', 'jquery-validate'),
563
-            '1.15.0',
564
-            true
565
-        );
566
-    }
567
-
568
-
569
-
570
-    /**
571
-     * registers accounting.js for performing client-side calculations
572
-     */
573
-    private function loadAccountingJs()
574
-    {
575
-        //accounting.js library
576
-        // @link http://josscrowcroft.github.io/accounting.js/
577
-        wp_register_script(
578
-            'ee-accounting-core',
579
-            EE_THIRD_PARTY_URL . 'accounting/accounting.js',
580
-            array('underscore'),
581
-            '0.3.2',
582
-            true
583
-        );
584
-        wp_register_script(
585
-            'ee-accounting',
586
-            EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
587
-            array('ee-accounting-core'),
588
-            EVENT_ESPRESSO_VERSION,
589
-            true
590
-        );
591
-    }
592
-
593
-
594
-
595
-    /**
596
-     * registers accounting.js for performing client-side calculations
597
-     */
598
-    private function localizeAccountingJs()
599
-    {
600
-        wp_localize_script(
601
-            'ee-accounting',
602
-            'EE_ACCOUNTING_CFG',
603
-            array(
604
-                'currency' => array(
605
-                    'symbol'    => $this->currency_config->sign,
606
-                    'format'    => array(
607
-                        'pos'  => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',
608
-                        'neg'  => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',
609
-                        'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',
610
-                    ),
611
-                    'decimal'   => $this->currency_config->dec_mrk,
612
-                    'thousand'  => $this->currency_config->thsnds,
613
-                    'precision' => $this->currency_config->dec_plc,
614
-                ),
615
-                'number'   => array(
616
-                    'precision' => $this->currency_config->dec_plc,
617
-                    'thousand'  => $this->currency_config->thsnds,
618
-                    'decimal'   => $this->currency_config->dec_mrk,
619
-                ),
620
-            )
621
-        );
622
-        $this->addRegisteredScriptHandlesWithData('ee-accounting');
623
-    }
624
-
625
-
626
-
627
-    /**
628
-     * registers assets for cleaning your ears
629
-     */
630
-    private function loadQtipJs()
631
-    {
632
-        // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
633
-        // can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
634
-        if (apply_filters('FHEE_load_qtip', false)) {
635
-            EEH_Qtip_Loader::instance()->register_and_enqueue();
636
-        }
637
-    }
638
-
639
-
640
-    /**
641
-     * This is used to set registered script handles that have data.
642
-     * @param string $script_handle
643
-     */
644
-    private function addRegisteredScriptHandlesWithData($script_handle)
645
-    {
646
-        $this->script_handles_with_data[$script_handle] = $script_handle;
647
-    }
648
-
649
-
650
-    /**i
489
+						'event_espresso'
490
+					),
491
+					$key
492
+				)
493
+			);
494
+		}
495
+		return true;
496
+	}
497
+
498
+
499
+
500
+	/**
501
+	 * registers core default stylesheets
502
+	 */
503
+	private function loadCoreCss()
504
+	{
505
+		if ($this->template_config->enable_default_style) {
506
+			$default_stylesheet_path = is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
507
+				? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
508
+				: EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css';
509
+			wp_register_style(
510
+				'espresso_default',
511
+				$default_stylesheet_path,
512
+				array('dashicons'),
513
+				EVENT_ESPRESSO_VERSION
514
+			);
515
+			//Load custom style sheet if available
516
+			if ($this->template_config->custom_style_sheet !== null) {
517
+				wp_register_style(
518
+					'espresso_custom_css',
519
+					EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
520
+					array('espresso_default'),
521
+					EVENT_ESPRESSO_VERSION
522
+				);
523
+			}
524
+		}
525
+	}
526
+
527
+
528
+
529
+	/**
530
+	 * registers core default javascript
531
+	 */
532
+	private function loadCoreJs()
533
+	{
534
+		// load core js
535
+		wp_register_script(
536
+			'espresso_core',
537
+			EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
538
+			array('jquery'),
539
+			EVENT_ESPRESSO_VERSION,
540
+			true
541
+		);
542
+	}
543
+
544
+
545
+
546
+	/**
547
+	 * registers jQuery Validate for form validation
548
+	 */
549
+	private function loadJqueryValidate()
550
+	{
551
+		// register jQuery Validate and additional methods
552
+		wp_register_script(
553
+			'jquery-validate',
554
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
555
+			array('jquery'),
556
+			'1.15.0',
557
+			true
558
+		);
559
+		wp_register_script(
560
+			'jquery-validate-extra-methods',
561
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
562
+			array('jquery', 'jquery-validate'),
563
+			'1.15.0',
564
+			true
565
+		);
566
+	}
567
+
568
+
569
+
570
+	/**
571
+	 * registers accounting.js for performing client-side calculations
572
+	 */
573
+	private function loadAccountingJs()
574
+	{
575
+		//accounting.js library
576
+		// @link http://josscrowcroft.github.io/accounting.js/
577
+		wp_register_script(
578
+			'ee-accounting-core',
579
+			EE_THIRD_PARTY_URL . 'accounting/accounting.js',
580
+			array('underscore'),
581
+			'0.3.2',
582
+			true
583
+		);
584
+		wp_register_script(
585
+			'ee-accounting',
586
+			EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
587
+			array('ee-accounting-core'),
588
+			EVENT_ESPRESSO_VERSION,
589
+			true
590
+		);
591
+	}
592
+
593
+
594
+
595
+	/**
596
+	 * registers accounting.js for performing client-side calculations
597
+	 */
598
+	private function localizeAccountingJs()
599
+	{
600
+		wp_localize_script(
601
+			'ee-accounting',
602
+			'EE_ACCOUNTING_CFG',
603
+			array(
604
+				'currency' => array(
605
+					'symbol'    => $this->currency_config->sign,
606
+					'format'    => array(
607
+						'pos'  => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',
608
+						'neg'  => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',
609
+						'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',
610
+					),
611
+					'decimal'   => $this->currency_config->dec_mrk,
612
+					'thousand'  => $this->currency_config->thsnds,
613
+					'precision' => $this->currency_config->dec_plc,
614
+				),
615
+				'number'   => array(
616
+					'precision' => $this->currency_config->dec_plc,
617
+					'thousand'  => $this->currency_config->thsnds,
618
+					'decimal'   => $this->currency_config->dec_mrk,
619
+				),
620
+			)
621
+		);
622
+		$this->addRegisteredScriptHandlesWithData('ee-accounting');
623
+	}
624
+
625
+
626
+
627
+	/**
628
+	 * registers assets for cleaning your ears
629
+	 */
630
+	private function loadQtipJs()
631
+	{
632
+		// qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
633
+		// can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
634
+		if (apply_filters('FHEE_load_qtip', false)) {
635
+			EEH_Qtip_Loader::instance()->register_and_enqueue();
636
+		}
637
+	}
638
+
639
+
640
+	/**
641
+	 * This is used to set registered script handles that have data.
642
+	 * @param string $script_handle
643
+	 */
644
+	private function addRegisteredScriptHandlesWithData($script_handle)
645
+	{
646
+		$this->script_handles_with_data[$script_handle] = $script_handle;
647
+	}
648
+
649
+
650
+	/**i
651 651
      * Checks WP_Scripts for all of each script handle registered internally as having data and unsets from the
652 652
      * Dependency stored in WP_Scripts if its set.
653 653
      */
654
-    private function removeAlreadyRegisteredDataForScriptHandles()
655
-    {
656
-        if (empty($this->script_handles_with_data)) {
657
-            return;
658
-        }
659
-        foreach ($this->script_handles_with_data as $script_handle) {
660
-            $this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
661
-        }
662
-    }
663
-
664
-
665
-    /**
666
-     * Removes any data dependency registered in WP_Scripts if its set.
667
-     * @param string $script_handle
668
-     */
669
-    private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
670
-    {
671
-        if (isset($this->script_handles_with_data[$script_handle])) {
672
-            global $wp_scripts;
673
-            $unset_handle = false;
674
-            if ($wp_scripts->get_data($script_handle, 'data')) {
675
-                unset($wp_scripts->registered[$script_handle]->extra['data']);
676
-                $unset_handle = true;
677
-            }
678
-            //deal with inline_scripts
679
-            if ($wp_scripts->get_data($script_handle, 'before')) {
680
-                unset($wp_scripts->registered[$script_handle]->extra['before']);
681
-                $unset_handle = true;
682
-            }
683
-            if ($wp_scripts->get_data($script_handle, 'after')) {
684
-                unset($wp_scripts->registered[$script_handle]->extra['after']);
685
-            }
686
-            if ($unset_handle) {
687
-                unset($this->script_handles_with_data[$script_handle]);
688
-            }
689
-        }
690
-    }
691
-
692
-
693
-    /**
694
-     * Registers assets that are used in the WordPress admin.
695
-     */
696
-    private function registerAdminAssets()
697
-    {
698
-        wp_register_script(
699
-            'ee-wp-plugins-page',
700
-            $this->getJsUrl(self::ASSET_NAMESPACE_CORE, 'wp-plugins-page'),
701
-            array(
702
-                'jquery',
703
-                'ee-vendor-react'
704
-            ),
705
-            null,
706
-            true
707
-        );
708
-        wp_register_style(
709
-            'ee-wp-plugins-page',
710
-            $this->getCssUrl(self::ASSET_NAMESPACE_CORE, 'wp-plugins-page'),
711
-            array(),
712
-            null
713
-        );
714
-        $this->registerTranslationsForHandles(array('ee-wp-plugins-page'));
715
-    }
716
-
717
-
718
-    /**
719
-     * All handles that are registered via the registry that might have translations have their translations registered
720
-     *
721
-     * @param array $handles_to_register
722
-     */
723
-    private function registerTranslationsForHandles(array $handles_to_register)
724
-    {
725
-        foreach($handles_to_register as $handle) {
726
-            $this->i18n_registry->registerScriptI18n($handle);
727
-        }
728
-    }
654
+	private function removeAlreadyRegisteredDataForScriptHandles()
655
+	{
656
+		if (empty($this->script_handles_with_data)) {
657
+			return;
658
+		}
659
+		foreach ($this->script_handles_with_data as $script_handle) {
660
+			$this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
661
+		}
662
+	}
663
+
664
+
665
+	/**
666
+	 * Removes any data dependency registered in WP_Scripts if its set.
667
+	 * @param string $script_handle
668
+	 */
669
+	private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
670
+	{
671
+		if (isset($this->script_handles_with_data[$script_handle])) {
672
+			global $wp_scripts;
673
+			$unset_handle = false;
674
+			if ($wp_scripts->get_data($script_handle, 'data')) {
675
+				unset($wp_scripts->registered[$script_handle]->extra['data']);
676
+				$unset_handle = true;
677
+			}
678
+			//deal with inline_scripts
679
+			if ($wp_scripts->get_data($script_handle, 'before')) {
680
+				unset($wp_scripts->registered[$script_handle]->extra['before']);
681
+				$unset_handle = true;
682
+			}
683
+			if ($wp_scripts->get_data($script_handle, 'after')) {
684
+				unset($wp_scripts->registered[$script_handle]->extra['after']);
685
+			}
686
+			if ($unset_handle) {
687
+				unset($this->script_handles_with_data[$script_handle]);
688
+			}
689
+		}
690
+	}
691
+
692
+
693
+	/**
694
+	 * Registers assets that are used in the WordPress admin.
695
+	 */
696
+	private function registerAdminAssets()
697
+	{
698
+		wp_register_script(
699
+			'ee-wp-plugins-page',
700
+			$this->getJsUrl(self::ASSET_NAMESPACE_CORE, 'wp-plugins-page'),
701
+			array(
702
+				'jquery',
703
+				'ee-vendor-react'
704
+			),
705
+			null,
706
+			true
707
+		);
708
+		wp_register_style(
709
+			'ee-wp-plugins-page',
710
+			$this->getCssUrl(self::ASSET_NAMESPACE_CORE, 'wp-plugins-page'),
711
+			array(),
712
+			null
713
+		);
714
+		$this->registerTranslationsForHandles(array('ee-wp-plugins-page'));
715
+	}
716
+
717
+
718
+	/**
719
+	 * All handles that are registered via the registry that might have translations have their translations registered
720
+	 *
721
+	 * @param array $handles_to_register
722
+	 */
723
+	private function registerTranslationsForHandles(array $handles_to_register)
724
+	{
725
+		foreach($handles_to_register as $handle) {
726
+			$this->i18n_registry->registerScriptI18n($handle);
727
+		}
728
+	}
729 729
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $this->registerManifestFile(
115 115
             self::ASSET_NAMESPACE_CORE,
116 116
             $this->domain->distributionAssetsUrl(),
117
-            $this->domain->distributionAssetsPath() . self::FILE_NAME_BUILD_MANIFEST
117
+            $this->domain->distributionAssetsPath().self::FILE_NAME_BUILD_MANIFEST
118 118
         );
119 119
         add_action('wp_enqueue_scripts', array($this, 'scripts'), 1);
120 120
         add_action('admin_enqueue_scripts', array($this, 'scripts'), 1);
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             //js.api
172 172
             wp_register_script(
173 173
                 'eejs-api',
174
-                EE_LIBRARIES_URL . 'rest_api/assets/js/eejs-api.min.js',
174
+                EE_LIBRARIES_URL.'rest_api/assets/js/eejs-api.min.js',
175 175
                 array('underscore', 'eejs-core'),
176 176
                 EVENT_ESPRESSO_VERSION,
177 177
                 true
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             $this->jsdata['eejs_api_nonce'] = wp_create_nonce('wp_rest');
180 180
             $this->jsdata['paths'] = array('rest_route' => rest_url('ee/v4.8.36/'));
181 181
         }
182
-        if (! is_admin()) {
182
+        if ( ! is_admin()) {
183 183
             $this->loadCoreCss();
184 184
         }
185 185
         $this->registerTranslationsForHandles(array('eejs-core'));
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         $this->removeAlreadyRegisteredDataForScriptHandles();
204 204
         wp_add_inline_script(
205 205
             'eejs-core',
206
-            'var eejsdata=' . wp_json_encode(array('data' => $this->jsdata)),
206
+            'var eejsdata='.wp_json_encode(array('data' => $this->jsdata)),
207 207
             'before'
208 208
         );
209 209
         wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      */
283 283
     public function addTemplate($template_reference, $template_content)
284 284
     {
285
-        if (! isset($this->jsdata['templates'])) {
285
+        if ( ! isset($this->jsdata['templates'])) {
286 286
             $this->jsdata['templates'] = array();
287 287
         }
288 288
         //no overrides allowed.
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
             return;
432 432
         }
433 433
         $this->manifest_data[$namespace] = $this->decodeManifestFile($manifest_file);
434
-        if (! isset($this->manifest_data[$namespace]['url_base'])) {
434
+        if ( ! isset($this->manifest_data[$namespace]['url_base'])) {
435 435
             $this->manifest_data[$namespace]['url_base'] = trailingslashit($url_base);
436 436
         }
437 437
     }
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
      */
449 449
     private function decodeManifestFile($manifest_file)
450 450
     {
451
-        if (! file_exists($manifest_file)) {
451
+        if ( ! file_exists($manifest_file)) {
452 452
             throw new InvalidFilePathException($manifest_file);
453 453
         }
454 454
         return json_decode(file_get_contents($manifest_file), true);
@@ -503,9 +503,9 @@  discard block
 block discarded – undo
503 503
     private function loadCoreCss()
504 504
     {
505 505
         if ($this->template_config->enable_default_style) {
506
-            $default_stylesheet_path = is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
506
+            $default_stylesheet_path = is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')
507 507
                 ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
508
-                : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css';
508
+                : EE_GLOBAL_ASSETS_URL.'css/espresso_default.css';
509 509
             wp_register_style(
510 510
                 'espresso_default',
511 511
                 $default_stylesheet_path,
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
             if ($this->template_config->custom_style_sheet !== null) {
517 517
                 wp_register_style(
518 518
                     'espresso_custom_css',
519
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
519
+                    EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->template_config->custom_style_sheet,
520 520
                     array('espresso_default'),
521 521
                     EVENT_ESPRESSO_VERSION
522 522
                 );
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
         // load core js
535 535
         wp_register_script(
536 536
             'espresso_core',
537
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
537
+            EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js',
538 538
             array('jquery'),
539 539
             EVENT_ESPRESSO_VERSION,
540 540
             true
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
         // register jQuery Validate and additional methods
552 552
         wp_register_script(
553 553
             'jquery-validate',
554
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
554
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js',
555 555
             array('jquery'),
556 556
             '1.15.0',
557 557
             true
558 558
         );
559 559
         wp_register_script(
560 560
             'jquery-validate-extra-methods',
561
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
561
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js',
562 562
             array('jquery', 'jquery-validate'),
563 563
             '1.15.0',
564 564
             true
@@ -576,14 +576,14 @@  discard block
 block discarded – undo
576 576
         // @link http://josscrowcroft.github.io/accounting.js/
577 577
         wp_register_script(
578 578
             'ee-accounting-core',
579
-            EE_THIRD_PARTY_URL . 'accounting/accounting.js',
579
+            EE_THIRD_PARTY_URL.'accounting/accounting.js',
580 580
             array('underscore'),
581 581
             '0.3.2',
582 582
             true
583 583
         );
584 584
         wp_register_script(
585 585
             'ee-accounting',
586
-            EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
586
+            EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js',
587 587
             array('ee-accounting-core'),
588 588
             EVENT_ESPRESSO_VERSION,
589 589
             true
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
      */
723 723
     private function registerTranslationsForHandles(array $handles_to_register)
724 724
     {
725
-        foreach($handles_to_register as $handle) {
725
+        foreach ($handles_to_register as $handle) {
726 726
             $this->i18n_registry->registerScriptI18n($handle);
727 727
         }
728 728
     }
Please login to merge, or discard this patch.
core/domain/DomainInterface.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -16,55 +16,55 @@
 block discarded – undo
16 16
 interface DomainInterface extends InterminableInterface
17 17
 {
18 18
 
19
-    /**
20
-     * @return string
21
-     * @throws DomainException
22
-     */
23
-    public function pluginFile();
19
+	/**
20
+	 * @return string
21
+	 * @throws DomainException
22
+	 */
23
+	public function pluginFile();
24 24
 
25 25
 
26
-    /**
27
-     * @return string
28
-     * @throws DomainException
29
-     */
30
-    public function pluginBasename();
26
+	/**
27
+	 * @return string
28
+	 * @throws DomainException
29
+	 */
30
+	public function pluginBasename();
31 31
 
32 32
 
33
-    /**
34
-     * @return string
35
-     */
36
-    public function pluginPath();
33
+	/**
34
+	 * @return string
35
+	 */
36
+	public function pluginPath();
37 37
 
38 38
 
39
-    /**
40
-     * @return string
41
-     * @throws DomainException
42
-     */
43
-    public function pluginUrl();
39
+	/**
40
+	 * @return string
41
+	 * @throws DomainException
42
+	 */
43
+	public function pluginUrl();
44 44
 
45 45
 
46
-    /**
47
-     * @return string
48
-     * @throws DomainException
49
-     */
50
-    public function version();
46
+	/**
47
+	 * @return string
48
+	 * @throws DomainException
49
+	 */
50
+	public function version();
51 51
 
52 52
 
53
-    /**
54
-     * @return string
55
-     */
56
-    public function distributionAssetsPath();
53
+	/**
54
+	 * @return string
55
+	 */
56
+	public function distributionAssetsPath();
57 57
 
58 58
 
59
-    /**
60
-     * @return string
61
-     */
62
-    public function distributionAssetsUrl();
59
+	/**
60
+	 * @return string
61
+	 */
62
+	public function distributionAssetsUrl();
63 63
 
64 64
 
65
-    /**
66
-     * @return string
67
-     */
68
-    public function assetNamespace();
65
+	/**
66
+	 * @return string
67
+	 */
68
+	public function assetNamespace();
69 69
 
70 70
 }
Please login to merge, or discard this patch.
core/domain/DomainBase.php 2 patches
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -20,157 +20,157 @@
 block discarded – undo
20 20
 abstract class DomainBase implements DomainInterface
21 21
 {
22 22
 
23
-    /**
24
-     * Equivalent to `__FILE__` for main plugin file.
25
-     *
26
-     * @var FilePath
27
-     */
28
-    private $plugin_file;
29
-
30
-    /**
31
-     * String indicating version for plugin
32
-     *
33
-     * @var string
34
-     */
35
-    private $version;
36
-
37
-    /**
38
-     * @var string $plugin_basename
39
-     */
40
-    private $plugin_basename;
41
-
42
-    /**
43
-     * @var string $plugin_path
44
-     */
45
-    private $plugin_path;
46
-
47
-    /**
48
-     * @var string $plugin_url
49
-     */
50
-    private $plugin_url;
51
-
52
-    /**
53
-     * @var string $asset_namespace
54
-     */
55
-    private $asset_namespace;
56
-
57
-
58
-
59
-    /**
60
-     * Initializes internal properties.
61
-     *
62
-     * @param FilePath $plugin_file
63
-     * @param Version  $version
64
-     */
65
-    public function __construct(FilePath $plugin_file, Version $version)
66
-    {
67
-        $this->plugin_file = $plugin_file;
68
-        $this->version = $version;
69
-        $this->plugin_basename = plugin_basename($this->pluginFile());
70
-        $this->plugin_path = plugin_dir_path($this->pluginFile());
71
-        $this->plugin_url = plugin_dir_url($this->pluginFile());
72
-        $this->setAssetNamespace();
73
-    }
74
-
75
-
76
-    /**
77
-     * @return string
78
-     */
79
-    public function pluginFile()
80
-    {
81
-        return (string) $this->plugin_file;
82
-    }
83
-
84
-
85
-
86
-    /**
87
-     * @return string
88
-     */
89
-    public function pluginBasename()
90
-    {
91
-        return $this->plugin_basename;
92
-    }
93
-
94
-
95
-
96
-    /**
97
-     * @return string
98
-     */
99
-    public function pluginPath()
100
-    {
101
-        return $this->plugin_path;
102
-    }
103
-
104
-
105
-
106
-    /**
107
-     * @return string
108
-     */
109
-    public function pluginUrl()
110
-    {
111
-        return $this->plugin_url;
112
-    }
113
-
114
-
115
-
116
-    /**
117
-     * @return string
118
-     */
119
-    public function version()
120
-    {
121
-        return (string) $this->version;
122
-    }
123
-
124
-
125
-
126
-    /**
127
-     * @return Version
128
-     */
129
-    public function versionValueObject()
130
-    {
131
-        return $this->version;
132
-    }
133
-
134
-
135
-    /**
136
-     * @return string
137
-     */
138
-    public function distributionAssetsPath()
139
-    {
140
-        return $this->pluginPath() . 'assets/dist/';
141
-    }
142
-
143
-
144
-    /**
145
-     * @return string
146
-     */
147
-    public function distributionAssetsUrl()
148
-    {
149
-        return $this->pluginUrl() . 'assets/dist/';
150
-    }
151
-
152
-
153
-    /**
154
-     * @return string
155
-     */
156
-    public function assetNamespace()
157
-    {
158
-        return $this->asset_namespace;
159
-    }
160
-
161
-
162
-    /**
163
-     * @return void
164
-     */
165
-    private function setAssetNamespace()
166
-    {
167
-        $asset_namespace  = explode('/', $this->plugin_basename);
168
-        $asset_namespace = reset($asset_namespace);
169
-        $asset_namespace = $asset_namespace === 'event-espresso-core'
170
-            ? Registry::ASSET_NAMESPACE_CORE
171
-            : $asset_namespace;
172
-        $this->asset_namespace = $asset_namespace;
173
-    }
23
+	/**
24
+	 * Equivalent to `__FILE__` for main plugin file.
25
+	 *
26
+	 * @var FilePath
27
+	 */
28
+	private $plugin_file;
29
+
30
+	/**
31
+	 * String indicating version for plugin
32
+	 *
33
+	 * @var string
34
+	 */
35
+	private $version;
36
+
37
+	/**
38
+	 * @var string $plugin_basename
39
+	 */
40
+	private $plugin_basename;
41
+
42
+	/**
43
+	 * @var string $plugin_path
44
+	 */
45
+	private $plugin_path;
46
+
47
+	/**
48
+	 * @var string $plugin_url
49
+	 */
50
+	private $plugin_url;
51
+
52
+	/**
53
+	 * @var string $asset_namespace
54
+	 */
55
+	private $asset_namespace;
56
+
57
+
58
+
59
+	/**
60
+	 * Initializes internal properties.
61
+	 *
62
+	 * @param FilePath $plugin_file
63
+	 * @param Version  $version
64
+	 */
65
+	public function __construct(FilePath $plugin_file, Version $version)
66
+	{
67
+		$this->plugin_file = $plugin_file;
68
+		$this->version = $version;
69
+		$this->plugin_basename = plugin_basename($this->pluginFile());
70
+		$this->plugin_path = plugin_dir_path($this->pluginFile());
71
+		$this->plugin_url = plugin_dir_url($this->pluginFile());
72
+		$this->setAssetNamespace();
73
+	}
74
+
75
+
76
+	/**
77
+	 * @return string
78
+	 */
79
+	public function pluginFile()
80
+	{
81
+		return (string) $this->plugin_file;
82
+	}
83
+
84
+
85
+
86
+	/**
87
+	 * @return string
88
+	 */
89
+	public function pluginBasename()
90
+	{
91
+		return $this->plugin_basename;
92
+	}
93
+
94
+
95
+
96
+	/**
97
+	 * @return string
98
+	 */
99
+	public function pluginPath()
100
+	{
101
+		return $this->plugin_path;
102
+	}
103
+
104
+
105
+
106
+	/**
107
+	 * @return string
108
+	 */
109
+	public function pluginUrl()
110
+	{
111
+		return $this->plugin_url;
112
+	}
113
+
114
+
115
+
116
+	/**
117
+	 * @return string
118
+	 */
119
+	public function version()
120
+	{
121
+		return (string) $this->version;
122
+	}
123
+
124
+
125
+
126
+	/**
127
+	 * @return Version
128
+	 */
129
+	public function versionValueObject()
130
+	{
131
+		return $this->version;
132
+	}
133
+
134
+
135
+	/**
136
+	 * @return string
137
+	 */
138
+	public function distributionAssetsPath()
139
+	{
140
+		return $this->pluginPath() . 'assets/dist/';
141
+	}
142
+
143
+
144
+	/**
145
+	 * @return string
146
+	 */
147
+	public function distributionAssetsUrl()
148
+	{
149
+		return $this->pluginUrl() . 'assets/dist/';
150
+	}
151
+
152
+
153
+	/**
154
+	 * @return string
155
+	 */
156
+	public function assetNamespace()
157
+	{
158
+		return $this->asset_namespace;
159
+	}
160
+
161
+
162
+	/**
163
+	 * @return void
164
+	 */
165
+	private function setAssetNamespace()
166
+	{
167
+		$asset_namespace  = explode('/', $this->plugin_basename);
168
+		$asset_namespace = reset($asset_namespace);
169
+		$asset_namespace = $asset_namespace === 'event-espresso-core'
170
+			? Registry::ASSET_NAMESPACE_CORE
171
+			: $asset_namespace;
172
+		$this->asset_namespace = $asset_namespace;
173
+	}
174 174
 
175 175
 
176 176
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function distributionAssetsPath()
139 139
     {
140
-        return $this->pluginPath() . 'assets/dist/';
140
+        return $this->pluginPath().'assets/dist/';
141 141
     }
142 142
 
143 143
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function distributionAssetsUrl()
148 148
     {
149
-        return $this->pluginUrl() . 'assets/dist/';
149
+        return $this->pluginUrl().'assets/dist/';
150 150
     }
151 151
 
152 152
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      */
165 165
     private function setAssetNamespace()
166 166
     {
167
-        $asset_namespace  = explode('/', $this->plugin_basename);
167
+        $asset_namespace = explode('/', $this->plugin_basename);
168 168
         $asset_namespace = reset($asset_namespace);
169 169
         $asset_namespace = $asset_namespace === 'event-espresso-core'
170 170
             ? Registry::ASSET_NAMESPACE_CORE
Please login to merge, or discard this patch.
core/domain/entities/editor/BlockInterface.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -26,68 +26,68 @@
 block discarded – undo
26 26
 interface BlockInterface
27 27
 {
28 28
 
29
-    /**
30
-     * Perform any early setup required by the block
31
-     * including setting the block type and supported post types
32
-     *
33
-     * @return void
34
-     */
35
-    public function initialize();
36
-
37
-
38
-    /**
39
-     * @return string
40
-     */
41
-    public function blockType();
42
-
43
-
44
-    /**
45
-     * AssetRegister that this editor block uses for asset registration
46
-     *
47
-     * @return AssetRegisterInterface
48
-     */
49
-    public function assetRegister();
50
-
51
-
52
-    /**
53
-     * Registers the Editor Block with WP core;
54
-     * Returns the registered block type on success, or false on failure.
55
-     *
56
-     * @return WP_Block_Type|false
57
-     */
58
-    public function registerBlock();
59
-
60
-
61
-    /**
62
-     * Un-registers the Editor Block with WP core;
63
-     * Returns the registered block type on success, or false on failure.
64
-     *
65
-     * @return WP_Block_Type|false
66
-     */
67
-    public function unRegisterBlock();
68
-
69
-
70
-    /**
71
-     * returns true if the block type applies for the supplied post type
72
-     * and should be added to that post type's editor
73
-     *
74
-     * @param string $post_type
75
-     * @return boolean
76
-     */
77
-    public function appliesToPostType($post_type);
78
-
79
-
80
-    /**
81
-     * @return array
82
-     */
83
-    public function getEditorContainer();
84
-
85
-
86
-    /**
87
-     * returns the rendered HTML for the block
88
-     *
89
-     * @param array $attributes
90
-     * @return string
91
-     */
92
-    public function renderBlock(array $attributes = array());
29
+	/**
30
+	 * Perform any early setup required by the block
31
+	 * including setting the block type and supported post types
32
+	 *
33
+	 * @return void
34
+	 */
35
+	public function initialize();
36
+
37
+
38
+	/**
39
+	 * @return string
40
+	 */
41
+	public function blockType();
42
+
43
+
44
+	/**
45
+	 * AssetRegister that this editor block uses for asset registration
46
+	 *
47
+	 * @return AssetRegisterInterface
48
+	 */
49
+	public function assetRegister();
50
+
51
+
52
+	/**
53
+	 * Registers the Editor Block with WP core;
54
+	 * Returns the registered block type on success, or false on failure.
55
+	 *
56
+	 * @return WP_Block_Type|false
57
+	 */
58
+	public function registerBlock();
59
+
60
+
61
+	/**
62
+	 * Un-registers the Editor Block with WP core;
63
+	 * Returns the registered block type on success, or false on failure.
64
+	 *
65
+	 * @return WP_Block_Type|false
66
+	 */
67
+	public function unRegisterBlock();
68
+
69
+
70
+	/**
71
+	 * returns true if the block type applies for the supplied post type
72
+	 * and should be added to that post type's editor
73
+	 *
74
+	 * @param string $post_type
75
+	 * @return boolean
76
+	 */
77
+	public function appliesToPostType($post_type);
78
+
79
+
80
+	/**
81
+	 * @return array
82
+	 */
83
+	public function getEditorContainer();
84
+
85
+
86
+	/**
87
+	 * returns the rendered HTML for the block
88
+	 *
89
+	 * @param array $attributes
90
+	 * @return string
91
+	 */
92
+	public function renderBlock(array $attributes = array());
93 93
 }
Please login to merge, or discard this patch.
core/domain/entities/editor/blocks/CoreBlocksAssetRegister.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -20,20 +20,20 @@
 block discarded – undo
20 20
  */
21 21
 class CoreBlocksAssetRegister extends BlockAssetRegister
22 22
 {
23
-    /**
24
-     * CoreBlocksAssetRegister constructor.
25
-     *
26
-     * @param DomainInterface $domain
27
-     * @param Registry        $registry
28
-     */
29
-    public function __construct(DomainInterface $domain, Registry $registry) {
30
-        parent::__construct(
31
-            'core-blocks',
32
-            array(),
33
-            'core-blocks',
34
-            array(),
35
-            $domain,
36
-            $registry
37
-        );
38
-    }
23
+	/**
24
+	 * CoreBlocksAssetRegister constructor.
25
+	 *
26
+	 * @param DomainInterface $domain
27
+	 * @param Registry        $registry
28
+	 */
29
+	public function __construct(DomainInterface $domain, Registry $registry) {
30
+		parent::__construct(
31
+			'core-blocks',
32
+			array(),
33
+			'core-blocks',
34
+			array(),
35
+			$domain,
36
+			$registry
37
+		);
38
+	}
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
core/domain/entities/editor/blocks/widgets/EventAttendees.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -25,29 +25,29 @@
 block discarded – undo
25 25
 class EventAttendees extends Block
26 26
 {
27 27
 
28
-    const BLOCK_TYPE = 'widgets-event-attendees';
29
-
30
-
31
-    /**
32
-     * EventAttendees constructor.
33
-     *
34
-     * @param CoreBlocksAssetRegister $asset_register
35
-     */
36
-    public function __construct(CoreBlocksAssetRegister $asset_register) {
37
-        parent::__construct($asset_register);
38
-    }
39
-
40
-
41
-    /**
42
-     * Perform any early setup required by the block
43
-     * including setting the block type and supported post types
44
-     *
45
-     * @return void
46
-     */
47
-    public function initialize()
48
-    {
49
-        $this->setBlockType(EventAttendees::BLOCK_TYPE);
50
-        $this->setSupportedPostTypes(array('espresso_events', 'post', 'page'));
51
-        $this->setAttributes(array());
52
-    }
28
+	const BLOCK_TYPE = 'widgets-event-attendees';
29
+
30
+
31
+	/**
32
+	 * EventAttendees constructor.
33
+	 *
34
+	 * @param CoreBlocksAssetRegister $asset_register
35
+	 */
36
+	public function __construct(CoreBlocksAssetRegister $asset_register) {
37
+		parent::__construct($asset_register);
38
+	}
39
+
40
+
41
+	/**
42
+	 * Perform any early setup required by the block
43
+	 * including setting the block type and supported post types
44
+	 *
45
+	 * @return void
46
+	 */
47
+	public function initialize()
48
+	{
49
+		$this->setBlockType(EventAttendees::BLOCK_TYPE);
50
+		$this->setSupportedPostTypes(array('espresso_events', 'post', 'page'));
51
+		$this->setAttributes(array());
52
+	}
53 53
 }
Please login to merge, or discard this patch.
core/domain/entities/editor/BlockCollection.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -20,55 +20,55 @@
 block discarded – undo
20 20
 class BlockCollection extends Collection
21 21
 {
22 22
 
23
-    /**
24
-     * Collection constructor
25
-     *
26
-     * @throws InvalidInterfaceException
27
-     */
28
-    public function __construct()
29
-    {
30
-        parent::__construct('EventEspresso\core\domain\entities\editor\BlockInterface');
31
-    }
23
+	/**
24
+	 * Collection constructor
25
+	 *
26
+	 * @throws InvalidInterfaceException
27
+	 */
28
+	public function __construct()
29
+	{
30
+		parent::__construct('EventEspresso\core\domain\entities\editor\BlockInterface');
31
+	}
32 32
 
33 33
 
34
-    /**
35
-     * unRegisterBlock
36
-     * finds block in the Collection based on the identifier that was set using addObject()
37
-     * and calls unRegisterBlock() on it. Returns block if successful and false if block was not found.
38
-     * PLZ NOTE: the pointer is reset to the beginning of the collection afterwards
39
-     *
40
-     * @param mixed $identifier
41
-     * @return boolean
42
-     */
43
-    public function unRegisterBlock($identifier)
44
-    {
45
-        $this->rewind();
46
-        while ($this->valid()) {
47
-            if ($identifier === $this->getInfo()) {
48
-                $object = $this->current();
49
-                $this->rewind();
50
-                return $object->unRegisterBlock();
51
-            }
52
-            $this->next();
53
-        }
54
-        return false;
55
-    }
34
+	/**
35
+	 * unRegisterBlock
36
+	 * finds block in the Collection based on the identifier that was set using addObject()
37
+	 * and calls unRegisterBlock() on it. Returns block if successful and false if block was not found.
38
+	 * PLZ NOTE: the pointer is reset to the beginning of the collection afterwards
39
+	 *
40
+	 * @param mixed $identifier
41
+	 * @return boolean
42
+	 */
43
+	public function unRegisterBlock($identifier)
44
+	{
45
+		$this->rewind();
46
+		while ($this->valid()) {
47
+			if ($identifier === $this->getInfo()) {
48
+				$object = $this->current();
49
+				$this->rewind();
50
+				return $object->unRegisterBlock();
51
+			}
52
+			$this->next();
53
+		}
54
+		return false;
55
+	}
56 56
 
57 57
 
58
-    /**
59
-     * unRegisterAllBlocks
60
-     * calls unRegisterBlock() on all blocks in Collection.
61
-     * PLZ NOTE: the pointer is reset to the beginning of the collection afterwards
62
-     *
63
-     * @return void
64
-     */
65
-    public function unRegisterAllBlocks()
66
-    {
67
-        $this->rewind();
68
-        while ($this->valid()) {
69
-            $this->current()->unRegisterBlock();
70
-            $this->next();
71
-        }
72
-        $this->rewind();
73
-    }
58
+	/**
59
+	 * unRegisterAllBlocks
60
+	 * calls unRegisterBlock() on all blocks in Collection.
61
+	 * PLZ NOTE: the pointer is reset to the beginning of the collection afterwards
62
+	 *
63
+	 * @return void
64
+	 */
65
+	public function unRegisterAllBlocks()
66
+	{
67
+		$this->rewind();
68
+		while ($this->valid()) {
69
+			$this->current()->unRegisterBlock();
70
+			$this->next();
71
+		}
72
+		$this->rewind();
73
+	}
74 74
 }
Please login to merge, or discard this patch.