Completed
Branch ENHANCE/255/add-wp-version-to-... (1ae4e3)
by
unknown
37:42 queued 28:14
created
core/bootstrap_espresso.php 2 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -6,22 +6,22 @@  discard block
 block discarded – undo
6 6
  */
7 7
 function espresso_load_error_handling()
8 8
 {
9
-    static $error_handling_loaded = false;
10
-    if ($error_handling_loaded) {
11
-        return;
12
-    }
13
-    // load debugging tools
14
-    if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
15
-        require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php';
16
-        \EEH_Debug_Tools::instance();
17
-    }
18
-    // load error handling
19
-    if (is_readable(EE_CORE . 'EE_Error.core.php')) {
20
-        require_once EE_CORE . 'EE_Error.core.php';
21
-    } else {
22
-        wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
23
-    }
24
-    $error_handling_loaded = true;
9
+	static $error_handling_loaded = false;
10
+	if ($error_handling_loaded) {
11
+		return;
12
+	}
13
+	// load debugging tools
14
+	if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
15
+		require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php';
16
+		\EEH_Debug_Tools::instance();
17
+	}
18
+	// load error handling
19
+	if (is_readable(EE_CORE . 'EE_Error.core.php')) {
20
+		require_once EE_CORE . 'EE_Error.core.php';
21
+	} else {
22
+		wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
23
+	}
24
+	$error_handling_loaded = true;
25 25
 }
26 26
 
27 27
 
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function espresso_load_required($classname, $full_path_to_file)
37 37
 {
38
-    if (is_readable($full_path_to_file)) {
39
-        require_once $full_path_to_file;
40
-    } else {
41
-        throw new \EE_Error(
42
-            sprintf(
43
-                esc_html__(
44
-                    'The %s class file could not be located or is not readable due to file permissions.',
45
-                    'event_espresso'
46
-                ),
47
-                $classname
48
-            )
49
-        );
50
-    }
38
+	if (is_readable($full_path_to_file)) {
39
+		require_once $full_path_to_file;
40
+	} else {
41
+		throw new \EE_Error(
42
+			sprintf(
43
+				esc_html__(
44
+					'The %s class file could not be located or is not readable due to file permissions.',
45
+					'event_espresso'
46
+				),
47
+				$classname
48
+			)
49
+		);
50
+	}
51 51
 }
52 52
 
53 53
 
@@ -66,52 +66,52 @@  discard block
 block discarded – undo
66 66
  */
67 67
 function bootstrap_espresso()
68 68
 {
69
-    require_once __DIR__ . '/espresso_definitions.php';
70
-    try {
71
-        espresso_load_error_handling();
72
-        // include WordPress shims for functions introduced in later versions of WordPress
73
-        espresso_load_required(
74
-            '',
75
-            EE_CORE . 'wordpress-shims.php'
76
-        );
77
-        espresso_load_required(
78
-            '',
79
-            EE_CORE . 'third-party-compatibility.php'
80
-        );
81
-        espresso_load_required(
82
-            'EEH_Base',
83
-            EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'
84
-        );
85
-        espresso_load_required(
86
-            'EEH_File',
87
-            EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php'
88
-        );
89
-        espresso_load_required(
90
-            'EEH_File',
91
-            EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'
92
-        );
93
-        espresso_load_required(
94
-            'EEH_Array',
95
-            EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php'
96
-        );
97
-        espresso_load_required(
98
-            'EE_Base',
99
-            EE_CORE . 'EE_Base.core.php'
100
-        );
101
-        // instantiate and configure PSR4 autoloader
102
-        espresso_load_required(
103
-            'Psr4Autoloader',
104
-            EE_CORE . 'Psr4Autoloader.php'
105
-        );
106
-        espresso_load_required(
107
-            'EE_Psr4AutoloaderInit',
108
-            EE_CORE . 'EE_Psr4AutoloaderInit.core.php'
109
-        );
110
-        $AutoloaderInit = new EE_Psr4AutoloaderInit();
111
-        $AutoloaderInit->initializeAutoloader();
112
-        new EventEspresso\core\services\bootstrap\BootstrapCore();
113
-    } catch (Exception $e) {
114
-        require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php';
115
-        new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e);
116
-    }
69
+	require_once __DIR__ . '/espresso_definitions.php';
70
+	try {
71
+		espresso_load_error_handling();
72
+		// include WordPress shims for functions introduced in later versions of WordPress
73
+		espresso_load_required(
74
+			'',
75
+			EE_CORE . 'wordpress-shims.php'
76
+		);
77
+		espresso_load_required(
78
+			'',
79
+			EE_CORE . 'third-party-compatibility.php'
80
+		);
81
+		espresso_load_required(
82
+			'EEH_Base',
83
+			EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'
84
+		);
85
+		espresso_load_required(
86
+			'EEH_File',
87
+			EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php'
88
+		);
89
+		espresso_load_required(
90
+			'EEH_File',
91
+			EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'
92
+		);
93
+		espresso_load_required(
94
+			'EEH_Array',
95
+			EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php'
96
+		);
97
+		espresso_load_required(
98
+			'EE_Base',
99
+			EE_CORE . 'EE_Base.core.php'
100
+		);
101
+		// instantiate and configure PSR4 autoloader
102
+		espresso_load_required(
103
+			'Psr4Autoloader',
104
+			EE_CORE . 'Psr4Autoloader.php'
105
+		);
106
+		espresso_load_required(
107
+			'EE_Psr4AutoloaderInit',
108
+			EE_CORE . 'EE_Psr4AutoloaderInit.core.php'
109
+		);
110
+		$AutoloaderInit = new EE_Psr4AutoloaderInit();
111
+		$AutoloaderInit->initializeAutoloader();
112
+		new EventEspresso\core\services\bootstrap\BootstrapCore();
113
+	} catch (Exception $e) {
114
+		require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php';
115
+		new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e);
116
+	}
117 117
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
         return;
12 12
     }
13 13
     // load debugging tools
14
-    if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
15
-        require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php';
14
+    if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
15
+        require_once EE_HELPERS.'EEH_Debug_Tools.helper.php';
16 16
         \EEH_Debug_Tools::instance();
17 17
     }
18 18
     // load error handling
19
-    if (is_readable(EE_CORE . 'EE_Error.core.php')) {
20
-        require_once EE_CORE . 'EE_Error.core.php';
19
+    if (is_readable(EE_CORE.'EE_Error.core.php')) {
20
+        require_once EE_CORE.'EE_Error.core.php';
21 21
     } else {
22 22
         wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
23 23
     }
@@ -66,52 +66,52 @@  discard block
 block discarded – undo
66 66
  */
67 67
 function bootstrap_espresso()
68 68
 {
69
-    require_once __DIR__ . '/espresso_definitions.php';
69
+    require_once __DIR__.'/espresso_definitions.php';
70 70
     try {
71 71
         espresso_load_error_handling();
72 72
         // include WordPress shims for functions introduced in later versions of WordPress
73 73
         espresso_load_required(
74 74
             '',
75
-            EE_CORE . 'wordpress-shims.php'
75
+            EE_CORE.'wordpress-shims.php'
76 76
         );
77 77
         espresso_load_required(
78 78
             '',
79
-            EE_CORE . 'third-party-compatibility.php'
79
+            EE_CORE.'third-party-compatibility.php'
80 80
         );
81 81
         espresso_load_required(
82 82
             'EEH_Base',
83
-            EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'
83
+            EE_CORE.'helpers'.DS.'EEH_Base.helper.php'
84 84
         );
85 85
         espresso_load_required(
86 86
             'EEH_File',
87
-            EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php'
87
+            EE_CORE.'interfaces'.DS.'EEHI_File.interface.php'
88 88
         );
89 89
         espresso_load_required(
90 90
             'EEH_File',
91
-            EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'
91
+            EE_CORE.'helpers'.DS.'EEH_File.helper.php'
92 92
         );
93 93
         espresso_load_required(
94 94
             'EEH_Array',
95
-            EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php'
95
+            EE_CORE.'helpers'.DS.'EEH_Array.helper.php'
96 96
         );
97 97
         espresso_load_required(
98 98
             'EE_Base',
99
-            EE_CORE . 'EE_Base.core.php'
99
+            EE_CORE.'EE_Base.core.php'
100 100
         );
101 101
         // instantiate and configure PSR4 autoloader
102 102
         espresso_load_required(
103 103
             'Psr4Autoloader',
104
-            EE_CORE . 'Psr4Autoloader.php'
104
+            EE_CORE.'Psr4Autoloader.php'
105 105
         );
106 106
         espresso_load_required(
107 107
             'EE_Psr4AutoloaderInit',
108
-            EE_CORE . 'EE_Psr4AutoloaderInit.core.php'
108
+            EE_CORE.'EE_Psr4AutoloaderInit.core.php'
109 109
         );
110 110
         $AutoloaderInit = new EE_Psr4AutoloaderInit();
111 111
         $AutoloaderInit->initializeAutoloader();
112 112
         new EventEspresso\core\services\bootstrap\BootstrapCore();
113 113
     } catch (Exception $e) {
114
-        require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php';
114
+        require_once EE_CORE.'exceptions'.DS.'ExceptionStackTraceDisplay.php';
115 115
         new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e);
116 116
     }
117 117
 }
Please login to merge, or discard this patch.
core/third-party-compatibility.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
  * ACF compatibility
8 8
  */
9 9
 add_action(
10
-    'plugins_loaded',
11
-    function () {
12
-        if (function_exists('acf_include')) {
13
-            add_filter(
14
-                'acf/get_post_types',
15
-                function ($post_types, $args) {
16
-                    if (! empty($args['show_ui'])) {
17
-                        $ee_post_types = get_post_types(array('show_ee_ui' => 1));
18
-                        $ee_post_types = array_keys($ee_post_types);
19
-                        $post_types = array_merge($post_types, $ee_post_types);
20
-                        $post_types = array_unique($post_types);
21
-                    }
22
-                    return $post_types;
23
-                },
24
-                10,
25
-                2
26
-            );
27
-        }
28
-    },
29
-    100
10
+	'plugins_loaded',
11
+	function () {
12
+		if (function_exists('acf_include')) {
13
+			add_filter(
14
+				'acf/get_post_types',
15
+				function ($post_types, $args) {
16
+					if (! empty($args['show_ui'])) {
17
+						$ee_post_types = get_post_types(array('show_ee_ui' => 1));
18
+						$ee_post_types = array_keys($ee_post_types);
19
+						$post_types = array_merge($post_types, $ee_post_types);
20
+						$post_types = array_unique($post_types);
21
+					}
22
+					return $post_types;
23
+				},
24
+				10,
25
+				2
26
+			);
27
+		}
28
+	},
29
+	100
30 30
 );
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
  */
9 9
 add_action(
10 10
     'plugins_loaded',
11
-    function () {
11
+    function() {
12 12
         if (function_exists('acf_include')) {
13 13
             add_filter(
14 14
                 'acf/get_post_types',
15
-                function ($post_types, $args) {
16
-                    if (! empty($args['show_ui'])) {
15
+                function($post_types, $args) {
16
+                    if ( ! empty($args['show_ui'])) {
17 17
                         $ee_post_types = get_post_types(array('show_ee_ui' => 1));
18 18
                         $ee_post_types = array_keys($ee_post_types);
19 19
                         $post_types = array_merge($post_types, $ee_post_types);
Please login to merge, or discard this patch.
core/domain/entities/editor/CoreBlocksAssetManager.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,20 +14,20 @@
 block discarded – undo
14 14
  */
15 15
 class CoreBlocksAssetManager extends BlockAssetManager
16 16
 {
17
-    const JS_HANDLE_CORE_BLOCKS_EDITOR = 'eventespresso-core-blocks';
18
-    const CSS_HANDLE_CORE_BLOCKS_EDITOR = 'eventespresso-core-blocks';
19
-    const JS_HANDLE_CORE_BLOCKS = 'eventespresso-core-blocks-frontend';
20
-    const CSS_HANDLE_CORE_BLOCKS = 'eventespresso-core-blocks-frontend';
17
+	const JS_HANDLE_CORE_BLOCKS_EDITOR = 'eventespresso-core-blocks';
18
+	const CSS_HANDLE_CORE_BLOCKS_EDITOR = 'eventespresso-core-blocks';
19
+	const JS_HANDLE_CORE_BLOCKS = 'eventespresso-core-blocks-frontend';
20
+	const CSS_HANDLE_CORE_BLOCKS = 'eventespresso-core-blocks-frontend';
21 21
 
22 22
 
23
-    /**
24
-     * @since 4.9.71.p
25
-     */
26
-    public function setAssetHandles()
27
-    {
28
-        $this->setEditorScriptHandle(self::JS_HANDLE_CORE_BLOCKS_EDITOR);
29
-        $this->setEditorStyleHandle(self::CSS_HANDLE_CORE_BLOCKS_EDITOR);
30
-        $this->setScriptHandle(self::JS_HANDLE_CORE_BLOCKS);
31
-        $this->setStyleHandle(self::CSS_HANDLE_CORE_BLOCKS);
32
-    }
23
+	/**
24
+	 * @since 4.9.71.p
25
+	 */
26
+	public function setAssetHandles()
27
+	{
28
+		$this->setEditorScriptHandle(self::JS_HANDLE_CORE_BLOCKS_EDITOR);
29
+		$this->setEditorStyleHandle(self::CSS_HANDLE_CORE_BLOCKS_EDITOR);
30
+		$this->setScriptHandle(self::JS_HANDLE_CORE_BLOCKS);
31
+		$this->setStyleHandle(self::CSS_HANDLE_CORE_BLOCKS);
32
+	}
33 33
 }
Please login to merge, or discard this patch.
core/domain/values/assets/Asset.php 1 patch
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -16,164 +16,164 @@
 block discarded – undo
16 16
 abstract class Asset
17 17
 {
18 18
 
19
-    /**
20
-     * indicates the file extension for a build distribution CSS file
21
-     */
22
-    const FILE_EXTENSION_DISTRIBUTION_CSS = '.dist.css';
23
-
24
-    /**
25
-     * indicates the file extension for a build distribution JS file
26
-     */
27
-    const FILE_EXTENSION_DISTRIBUTION_JS = '.dist.js';
28
-
29
-    /**
30
-     * Indicates the file extension for a build distribution dependencies json file.
31
-     */
32
-    const FILE_EXTENSION_DISTRIBUTION_DEPS = '.dist.deps.json';
33
-
34
-    /**
35
-     * indicates a Cascading Style Sheet asset
36
-     */
37
-    const TYPE_CSS = 'css';
38
-
39
-    /**
40
-     * indicates a Javascript asset
41
-     */
42
-    const TYPE_JS = 'js';
43
-
44
-    /**
45
-     * indicates a JSON asset
46
-     */
47
-    CONST TYPE_JSON = 'json';
48
-
49
-    /**
50
-     * indicates a Javascript manifest file
51
-     */
52
-    const TYPE_MANIFEST = 'manifest';
53
-
54
-    /**
55
-     * @var DomainInterface $domain
56
-     */
57
-    protected $domain;
58
-
59
-    /**
60
-     * @var string $type
61
-     */
62
-    private $type;
63
-
64
-    /**
65
-     * @var string $handle
66
-     */
67
-    private $handle;
68
-
69
-    /**
70
-     * @var bool $registered
71
-     */
72
-    private $registered = false;
73
-
74
-
75
-    /**
76
-     * Asset constructor.
77
-     *
78
-     * @param                 $type
79
-     * @param string          $handle
80
-     * @param DomainInterface $domain
81
-     * @throws InvalidDataTypeException
82
-     */
83
-    public function __construct($type, $handle, DomainInterface $domain)
84
-    {
85
-        $this->domain = $domain;
86
-        $this->setType($type);
87
-        $this->setHandle($handle);
88
-    }
89
-
90
-
91
-    /**
92
-     * @return array
93
-     */
94
-    public function validAssetTypes()
95
-    {
96
-        return array(
97
-            Asset::TYPE_CSS,
98
-            Asset::TYPE_JS,
99
-            Asset::TYPE_MANIFEST,
100
-        );
101
-    }
102
-
103
-
104
-    /**
105
-     * @param string $type
106
-     * @throws InvalidDataTypeException
107
-     */
108
-    private function setType($type)
109
-    {
110
-        if (! in_array($type, $this->validAssetTypes(), true)) {
111
-            throw new InvalidDataTypeException(
112
-                'Asset::$type',
113
-                $type,
114
-                'one of the TYPE_* class constants on \EventEspresso\core\domain\values\Asset is required'
115
-            );
116
-        }
117
-        $this->type = $type;
118
-    }
119
-
120
-
121
-    /**
122
-     * @param string $handle
123
-     * @throws InvalidDataTypeException
124
-     */
125
-    private function setHandle($handle)
126
-    {
127
-        if (! is_string($handle)) {
128
-            throw new InvalidDataTypeException(
129
-                '$handle',
130
-                $handle,
131
-                'string'
132
-            );
133
-        }
134
-        $this->handle = $handle;
135
-    }
136
-
137
-
138
-    /**
139
-     * @return string
140
-     */
141
-    public function assetNamespace()
142
-    {
143
-        return $this->domain->assetNamespace();
144
-    }
145
-
146
-
147
-    /**
148
-     * @return string
149
-     */
150
-    public function type()
151
-    {
152
-        return $this->type;
153
-    }
154
-
155
-
156
-    /**
157
-     * @return string
158
-     */
159
-    public function handle()
160
-    {
161
-        return $this->handle;
162
-    }
163
-
164
-    /**
165
-     * @return bool
166
-     */
167
-    public function isRegistered()
168
-    {
169
-        return $this->registered;
170
-    }
171
-
172
-    /**
173
-     * @param bool $registered
174
-     */
175
-    public function setRegistered($registered = true)
176
-    {
177
-        $this->registered = filter_var($registered, FILTER_VALIDATE_BOOLEAN);
178
-    }
19
+	/**
20
+	 * indicates the file extension for a build distribution CSS file
21
+	 */
22
+	const FILE_EXTENSION_DISTRIBUTION_CSS = '.dist.css';
23
+
24
+	/**
25
+	 * indicates the file extension for a build distribution JS file
26
+	 */
27
+	const FILE_EXTENSION_DISTRIBUTION_JS = '.dist.js';
28
+
29
+	/**
30
+	 * Indicates the file extension for a build distribution dependencies json file.
31
+	 */
32
+	const FILE_EXTENSION_DISTRIBUTION_DEPS = '.dist.deps.json';
33
+
34
+	/**
35
+	 * indicates a Cascading Style Sheet asset
36
+	 */
37
+	const TYPE_CSS = 'css';
38
+
39
+	/**
40
+	 * indicates a Javascript asset
41
+	 */
42
+	const TYPE_JS = 'js';
43
+
44
+	/**
45
+	 * indicates a JSON asset
46
+	 */
47
+	CONST TYPE_JSON = 'json';
48
+
49
+	/**
50
+	 * indicates a Javascript manifest file
51
+	 */
52
+	const TYPE_MANIFEST = 'manifest';
53
+
54
+	/**
55
+	 * @var DomainInterface $domain
56
+	 */
57
+	protected $domain;
58
+
59
+	/**
60
+	 * @var string $type
61
+	 */
62
+	private $type;
63
+
64
+	/**
65
+	 * @var string $handle
66
+	 */
67
+	private $handle;
68
+
69
+	/**
70
+	 * @var bool $registered
71
+	 */
72
+	private $registered = false;
73
+
74
+
75
+	/**
76
+	 * Asset constructor.
77
+	 *
78
+	 * @param                 $type
79
+	 * @param string          $handle
80
+	 * @param DomainInterface $domain
81
+	 * @throws InvalidDataTypeException
82
+	 */
83
+	public function __construct($type, $handle, DomainInterface $domain)
84
+	{
85
+		$this->domain = $domain;
86
+		$this->setType($type);
87
+		$this->setHandle($handle);
88
+	}
89
+
90
+
91
+	/**
92
+	 * @return array
93
+	 */
94
+	public function validAssetTypes()
95
+	{
96
+		return array(
97
+			Asset::TYPE_CSS,
98
+			Asset::TYPE_JS,
99
+			Asset::TYPE_MANIFEST,
100
+		);
101
+	}
102
+
103
+
104
+	/**
105
+	 * @param string $type
106
+	 * @throws InvalidDataTypeException
107
+	 */
108
+	private function setType($type)
109
+	{
110
+		if (! in_array($type, $this->validAssetTypes(), true)) {
111
+			throw new InvalidDataTypeException(
112
+				'Asset::$type',
113
+				$type,
114
+				'one of the TYPE_* class constants on \EventEspresso\core\domain\values\Asset is required'
115
+			);
116
+		}
117
+		$this->type = $type;
118
+	}
119
+
120
+
121
+	/**
122
+	 * @param string $handle
123
+	 * @throws InvalidDataTypeException
124
+	 */
125
+	private function setHandle($handle)
126
+	{
127
+		if (! is_string($handle)) {
128
+			throw new InvalidDataTypeException(
129
+				'$handle',
130
+				$handle,
131
+				'string'
132
+			);
133
+		}
134
+		$this->handle = $handle;
135
+	}
136
+
137
+
138
+	/**
139
+	 * @return string
140
+	 */
141
+	public function assetNamespace()
142
+	{
143
+		return $this->domain->assetNamespace();
144
+	}
145
+
146
+
147
+	/**
148
+	 * @return string
149
+	 */
150
+	public function type()
151
+	{
152
+		return $this->type;
153
+	}
154
+
155
+
156
+	/**
157
+	 * @return string
158
+	 */
159
+	public function handle()
160
+	{
161
+		return $this->handle;
162
+	}
163
+
164
+	/**
165
+	 * @return bool
166
+	 */
167
+	public function isRegistered()
168
+	{
169
+		return $this->registered;
170
+	}
171
+
172
+	/**
173
+	 * @param bool $registered
174
+	 */
175
+	public function setRegistered($registered = true)
176
+	{
177
+		$this->registered = filter_var($registered, FILTER_VALIDATE_BOOLEAN);
178
+	}
179 179
 }
Please login to merge, or discard this patch.
core/domain/services/assets/CoreAssetManager.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         $this->addJs(self::JS_HANDLE_MODEL)->setRequiresTranslation();
202 202
         $this->addJs(self::JS_HANDLE_VALUE_OBJECTS)->setRequiresTranslation();
203 203
         $this->addJs(self::JS_HANDLE_DATA_STORES)->setRequiresTranslation()->setInlineDataCallback(
204
-            function () {
204
+            function() {
205 205
                 wp_add_inline_script(
206 206
                     CoreAssetManager::JS_HANDLE_DATA_STORES,
207 207
                     is_admin()
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 
261 261
         $this->addJavascript(
262 262
             CoreAssetManager::JS_HANDLE_CORE,
263
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
263
+            EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js',
264 264
             array(CoreAssetManager::JS_HANDLE_JQUERY)
265 265
         )
266 266
         ->setInlineDataCallback(
267
-            function () {
267
+            function() {
268 268
                 wp_localize_script(
269 269
                     CoreAssetManager::JS_HANDLE_CORE,
270 270
                     CoreAssetManager::JS_HANDLE_I18N,
@@ -368,16 +368,16 @@  discard block
 block discarded – undo
368 368
         if ($this->template_config->enable_default_style && ! is_admin()) {
369 369
             $this->addStylesheet(
370 370
                 CoreAssetManager::CSS_HANDLE_DEFAULT,
371
-                is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
371
+                is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')
372 372
                     ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
373
-                    : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
373
+                    : EE_GLOBAL_ASSETS_URL.'css/espresso_default.css',
374 374
                 array('dashicons')
375 375
             );
376 376
             //Load custom style sheet if available
377 377
             if ($this->template_config->custom_style_sheet !== null) {
378 378
                 $this->addStylesheet(
379 379
                     CoreAssetManager::CSS_HANDLE_CUSTOM,
380
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
380
+                    EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->template_config->custom_style_sheet,
381 381
                     array(CoreAssetManager::CSS_HANDLE_DEFAULT)
382 382
                 );
383 383
             }
@@ -420,14 +420,14 @@  discard block
 block discarded – undo
420 420
     {
421 421
         $this->addJavascript(
422 422
             CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE,
423
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
423
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js',
424 424
             array(CoreAssetManager::JS_HANDLE_JQUERY)
425 425
         )
426 426
         ->setVersion('1.15.0');
427 427
 
428 428
         $this->addJavascript(
429 429
             CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
430
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
430
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js',
431 431
             array(CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE)
432 432
         )
433 433
         ->setVersion('1.15.0');
@@ -449,18 +449,18 @@  discard block
 block discarded – undo
449 449
         // @link http://josscrowcroft.github.io/accounting.js/
450 450
         $this->addJavascript(
451 451
             CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE,
452
-            EE_THIRD_PARTY_URL . 'accounting/accounting.js',
452
+            EE_THIRD_PARTY_URL.'accounting/accounting.js',
453 453
             array(CoreAssetManager::JS_HANDLE_UNDERSCORE)
454 454
         )
455 455
         ->setVersion('0.3.2');
456 456
 
457 457
         $this->addJavascript(
458 458
             CoreAssetManager::JS_HANDLE_ACCOUNTING,
459
-            EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
459
+            EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js',
460 460
             array(CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE)
461 461
         )
462 462
         ->setInlineDataCallback(
463
-            function () {
463
+            function() {
464 464
                  wp_localize_script(
465 465
                      CoreAssetManager::JS_HANDLE_ACCOUNTING,
466 466
                      'EE_ACCOUNTING_CFG',
Please login to merge, or discard this patch.
Indentation   +433 added lines, -433 removed lines patch added patch discarded remove patch
@@ -32,456 +32,456 @@
 block discarded – undo
32 32
 class CoreAssetManager extends AssetManager
33 33
 {
34 34
 
35
-    // WordPress core / Third party JS asset handles
36
-    const JS_HANDLE_JQUERY = 'jquery';
35
+	// WordPress core / Third party JS asset handles
36
+	const JS_HANDLE_JQUERY = 'jquery';
37 37
 
38
-    const JS_HANDLE_JQUERY_VALIDATE = 'jquery-validate';
38
+	const JS_HANDLE_JQUERY_VALIDATE = 'jquery-validate';
39 39
 
40
-    const JS_HANDLE_JQUERY_VALIDATE_EXTRA = 'jquery-validate-extra-methods';
40
+	const JS_HANDLE_JQUERY_VALIDATE_EXTRA = 'jquery-validate-extra-methods';
41 41
 
42
-    const JS_HANDLE_UNDERSCORE = 'underscore';
42
+	const JS_HANDLE_UNDERSCORE = 'underscore';
43 43
 
44
-    const JS_HANDLE_ACCOUNTING_CORE = 'ee-accounting-core';
44
+	const JS_HANDLE_ACCOUNTING_CORE = 'ee-accounting-core';
45 45
 
46
-    /**
47
-     * @since 4.9.71.p
48
-     */
49
-    const JS_HANDLE_REACT = 'react';
46
+	/**
47
+	 * @since 4.9.71.p
48
+	 */
49
+	const JS_HANDLE_REACT = 'react';
50 50
 
51
-    /**
52
-     * @since 4.9.71.p
53
-     */
54
-    const JS_HANDLE_REACT_DOM = 'react-dom';
51
+	/**
52
+	 * @since 4.9.71.p
53
+	 */
54
+	const JS_HANDLE_REACT_DOM = 'react-dom';
55 55
 
56
-    /**
57
-     * @since 4.9.71.p
58
-     */
59
-    const JS_HANDLE_LODASH = 'lodash';
56
+	/**
57
+	 * @since 4.9.71.p
58
+	 */
59
+	const JS_HANDLE_LODASH = 'lodash';
60 60
 
61
-    const JS_HANDLE_JS_CORE = 'eejs-core';
61
+	const JS_HANDLE_JS_CORE = 'eejs-core';
62 62
 
63
-    const JS_HANDLE_VENDOR = 'eventespresso-vendor';
63
+	const JS_HANDLE_VENDOR = 'eventespresso-vendor';
64 64
 
65
-    const JS_HANDLE_DATA_STORES = 'eventespresso-data-stores';
65
+	const JS_HANDLE_DATA_STORES = 'eventespresso-data-stores';
66 66
 
67
-    const JS_HANDLE_HELPERS = 'eventespresso-helpers';
67
+	const JS_HANDLE_HELPERS = 'eventespresso-helpers';
68 68
 
69
-    const JS_HANDLE_MODEL = 'eventespresso-model';
69
+	const JS_HANDLE_MODEL = 'eventespresso-model';
70 70
 
71
-    const JS_HANDLE_VALUE_OBJECTS = 'eventespresso-value-objects';
71
+	const JS_HANDLE_VALUE_OBJECTS = 'eventespresso-value-objects';
72 72
 
73
-    const JS_HANDLE_HOCS = 'eventespresso-hocs';
73
+	const JS_HANDLE_HOCS = 'eventespresso-hocs';
74 74
 
75
-    const JS_HANDLE_COMPONENTS = 'eventespresso-components';
75
+	const JS_HANDLE_COMPONENTS = 'eventespresso-components';
76 76
 
77
-    const JS_HANDLE_EDITOR_HOCS = 'eventespresso-editor-hocs';
78
-
79
-    const JS_HANDLE_VALIDATORS = 'eventespresso-validators';
77
+	const JS_HANDLE_EDITOR_HOCS = 'eventespresso-editor-hocs';
78
+
79
+	const JS_HANDLE_VALIDATORS = 'eventespresso-validators';
80 80
 
81
-    const JS_HANDLE_CORE = 'espresso_core';
81
+	const JS_HANDLE_CORE = 'espresso_core';
82 82
 
83
-    const JS_HANDLE_I18N = 'eei18n';
83
+	const JS_HANDLE_I18N = 'eei18n';
84 84
 
85
-    const JS_HANDLE_ACCOUNTING = 'ee-accounting';
86
-
87
-    const JS_HANDLE_WP_PLUGINS_PAGE = 'ee-wp-plugins-page';
88
-
89
-    // EE CSS assets handles
90
-    const CSS_HANDLE_DEFAULT = 'espresso_default';
91
-
92
-    const CSS_HANDLE_CUSTOM = 'espresso_custom_css';
93
-
94
-    const CSS_HANDLE_COMPONENTS = 'eventespresso-components';
95
-
96
-    const CSS_HANDLE_CORE_CSS_DEFAULT = 'eventespresso-core-css-default';
97
-
98
-    /**
99
-     * @var EE_Currency_Config $currency_config
100
-     */
101
-    protected $currency_config;
102
-
103
-    /**
104
-     * @var EE_Template_Config $template_config
105
-     */
106
-    protected $template_config;
107
-
108
-
109
-    /**
110
-     * CoreAssetRegister constructor.
111
-     *
112
-     * @param AssetCollection    $assets
113
-     * @param EE_Currency_Config $currency_config
114
-     * @param EE_Template_Config $template_config
115
-     * @param DomainInterface    $domain
116
-     * @param Registry           $registry
117
-     */
118
-    public function __construct(
119
-        AssetCollection $assets,
120
-        EE_Currency_Config $currency_config,
121
-        EE_Template_Config $template_config,
122
-        DomainInterface $domain,
123
-        Registry $registry
124
-    ) {
125
-        $this->currency_config = $currency_config;
126
-        $this->template_config = $template_config;
127
-        parent::__construct($domain, $assets, $registry);
128
-    }
129
-
130
-
131
-    /**
132
-     * @since 4.9.62.p
133
-     * @throws DomainException
134
-     * @throws DuplicateCollectionIdentifierException
135
-     * @throws InvalidArgumentException
136
-     * @throws InvalidDataTypeException
137
-     * @throws InvalidEntityException
138
-     * @throws InvalidInterfaceException
139
-     */
140
-    public function addAssets()
141
-    {
142
-        $this->addJavascriptFiles();
143
-        $this->addStylesheetFiles();
144
-    }
145
-
146
-
147
-    /**
148
-     * @since 4.9.62.p
149
-     * @throws DomainException
150
-     * @throws DuplicateCollectionIdentifierException
151
-     * @throws InvalidArgumentException
152
-     * @throws InvalidDataTypeException
153
-     * @throws InvalidEntityException
154
-     * @throws InvalidInterfaceException
155
-     */
156
-    public function addJavascriptFiles()
157
-    {
158
-        $this->loadCoreJs();
159
-        $this->loadJqueryValidate();
160
-        $this->loadAccountingJs();
161
-        add_action(
162
-            'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
163
-            array($this, 'loadQtipJs')
164
-        );
165
-        $this->registerAdminAssets();
166
-    }
167
-
168
-
169
-    /**
170
-     * @since 4.9.62.p
171
-     * @throws DuplicateCollectionIdentifierException
172
-     * @throws InvalidDataTypeException
173
-     * @throws InvalidEntityException
174
-     */
175
-    public function addStylesheetFiles()
176
-    {
177
-        $this->loadCoreCss();
178
-    }
179
-
180
-
181
-    /**
182
-     * core default javascript
183
-     *
184
-     * @since 4.9.62.p
185
-     * @throws DomainException
186
-     * @throws DuplicateCollectionIdentifierException
187
-     * @throws InvalidArgumentException
188
-     * @throws InvalidDataTypeException
189
-     * @throws InvalidEntityException
190
-     * @throws InvalidInterfaceException
191
-     */
192
-    private function loadCoreJs()
193
-    {
194
-        // conditionally load third-party libraries that WP core MIGHT have.
195
-        $this->registerWpAssets();
196
-
197
-        $this->addJs(self::JS_HANDLE_JS_CORE)->setHasInlineData();
198
-        $this->addJs(self::JS_HANDLE_VENDOR);
199
-        $this->addJs(self::JS_HANDLE_VALIDATORS)->setRequiresTranslation();
200
-        $this->addJs(self::JS_HANDLE_HELPERS)->setRequiresTranslation();
201
-        $this->addJs(self::JS_HANDLE_MODEL)->setRequiresTranslation();
202
-        $this->addJs(self::JS_HANDLE_VALUE_OBJECTS)->setRequiresTranslation();
203
-        $this->addJs(self::JS_HANDLE_DATA_STORES)->setRequiresTranslation()->setInlineDataCallback(
204
-            function () {
205
-                wp_add_inline_script(
206
-                    CoreAssetManager::JS_HANDLE_DATA_STORES,
207
-                    is_admin()
208
-                        ? 'wp.apiFetch.use( eejs.middleWares.apiFetch.capsMiddleware( eejs.middleWares.apiFetch.CONTEXT_CAPS_EDIT ) )'
209
-                        : 'wp.apiFetch.use( eejs.middleWares.apiFetch.capsMiddleware )'
210
-                );
211
-            }
212
-        );
213
-        $this->addJs(self::JS_HANDLE_HOCS, self::JS_HANDLE_DATA_STORES)->setRequiresTranslation();
214
-        $this->addJs(self::JS_HANDLE_COMPONENTS, self::JS_HANDLE_DATA_STORES)->setRequiresTranslation();
215
-        $this->addJs(self::JS_HANDLE_EDITOR_HOCS)->setRequiresTranslation();
216
-
217
-        $this->registry->addData('eejs_api_nonce', wp_create_nonce('wp_rest'));
218
-        $this->registry->addData(
219
-            'paths',
220
-            array(
221
-                'base_rest_route' => rest_url(),
222
-                'rest_route' => rest_url('ee/v4.8.36/'),
223
-                'collection_endpoints' => EED_Core_Rest_Api::getCollectionRoutesIndexedByModelName(),
224
-                'primary_keys' => EED_Core_Rest_Api::getPrimaryKeyNamesIndexedByModelName(),
225
-                'site_url' => site_url('/'),
226
-                'admin_url' => admin_url('/'),
227
-            )
228
-        );
229
-        // Event Espresso brand name
230
-        $this->registry->addData('brandName', Domain::brandName());
231
-        /** site formatting values **/
232
-        $this->registry->addData(
233
-            'site_formats',
234
-            array(
235
-                'date_formats' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats()
236
-            )
237
-        );
238
-        /** currency data **/
239
-        $this->registry->addData(
240
-            'currency_config',
241
-            $this->getCurrencySettings()
242
-        );
243
-        /** site timezone */
244
-        $this->registry->addData(
245
-            'default_timezone',
246
-            array(
247
-                'pretty' => EEH_DTT_Helper::get_timezone_string_for_display(),
248
-                'string' => get_option('timezone_string'),
249
-                'offset' => EEH_DTT_Helper::get_site_timezone_gmt_offset(),
250
-            )
251
-        );
252
-        /** site locale (user locale if user logged in) */
253
-        $this->registry->addData(
254
-            'locale',
255
-            array(
256
-                'user' => get_user_locale(),
257
-                'site' => get_locale()
258
-            )
259
-        );
260
-
261
-        $this->addJavascript(
262
-            CoreAssetManager::JS_HANDLE_CORE,
263
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
264
-            array(CoreAssetManager::JS_HANDLE_JQUERY)
265
-        )
266
-        ->setInlineDataCallback(
267
-            function () {
268
-                wp_localize_script(
269
-                    CoreAssetManager::JS_HANDLE_CORE,
270
-                    CoreAssetManager::JS_HANDLE_I18N,
271
-                    EE_Registry::$i18n_js_strings
272
-                );
273
-            }
274
-        );
275
-    }
276
-
277
-
278
-    /**
279
-     * Registers vendor files that are bundled with a later version WP but might not be for the current version of
280
-     * WordPress in the running environment.
281
-     *
282
-     * @throws DuplicateCollectionIdentifierException
283
-     * @throws InvalidDataTypeException
284
-     * @throws InvalidEntityException
285
-     * @throws DomainException
286
-     * @since 4.9.71.p
287
-     */
288
-    private function registerWpAssets()
289
-    {
290
-        global $wp_version;
291
-        if (version_compare($wp_version, '5.0.beta', '>=')) {
292
-            return;
293
-        }
294
-        $this->addVendorJavascript(CoreAssetManager::JS_HANDLE_REACT)
295
-            ->setVersion('16.6.0');
296
-        $this->addVendorJavascript(
297
-            CoreAssetManager::JS_HANDLE_REACT_DOM,
298
-            array(CoreAssetManager::JS_HANDLE_REACT)
299
-        )->setVersion('16.6.0');
300
-        $this->addVendorJavascript(CoreAssetManager::JS_HANDLE_LODASH)
301
-            ->setInlineDataCallback(
302
-                function() {
303
-                    wp_add_inline_script(
304
-                        CoreAssetManager::JS_HANDLE_LODASH,
305
-                        'window.lodash = _.noConflict();'
306
-                    );
307
-                }
308
-            )
309
-            ->setVersion('4.17.11');
310
-    }
311
-
312
-
313
-    /**
314
-     * Returns configuration data for the accounting-js library.
315
-     * @since 4.9.71.p
316
-     * @return array
317
-     */
318
-    private function getAccountingSettings() {
319
-        return array(
320
-            'currency' => array(
321
-                'symbol'    => $this->currency_config->sign,
322
-                'format'    => array(
323
-                    'pos'  => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',
324
-                    'neg'  => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',
325
-                    'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',
326
-                ),
327
-                'decimal'   => $this->currency_config->dec_mrk,
328
-                'thousand'  => $this->currency_config->thsnds,
329
-                'precision' => $this->currency_config->dec_plc,
330
-            ),
331
-            'number'   => array(
332
-                'precision' => $this->currency_config->dec_plc,
333
-                'thousand'  => $this->currency_config->thsnds,
334
-                'decimal'   => $this->currency_config->dec_mrk,
335
-            ),
336
-        );
337
-    }
338
-
339
-
340
-    /**
341
-     * Returns configuration data for the js Currency VO.
342
-     * @since 4.9.71.p
343
-     * @return array
344
-     */
345
-    private function getCurrencySettings()
346
-    {
347
-        return array(
348
-            'code' => $this->currency_config->code,
349
-            'singularLabel' => $this->currency_config->name,
350
-            'pluralLabel' => $this->currency_config->plural,
351
-            'sign' => $this->currency_config->sign,
352
-            'signB4' => $this->currency_config->sign_b4,
353
-            'decimalPlaces' => $this->currency_config->dec_plc,
354
-            'decimalMark' => $this->currency_config->dec_mrk,
355
-            'thousandsSeparator' => $this->currency_config->thsnds,
356
-        );
357
-    }
358
-
359
-
360
-    /**
361
-     * @since 4.9.62.p
362
-     * @throws DuplicateCollectionIdentifierException
363
-     * @throws InvalidDataTypeException
364
-     * @throws InvalidEntityException
365
-     */
366
-    private function loadCoreCss()
367
-    {
368
-        if ($this->template_config->enable_default_style && ! is_admin()) {
369
-            $this->addStylesheet(
370
-                CoreAssetManager::CSS_HANDLE_DEFAULT,
371
-                is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
372
-                    ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
373
-                    : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
374
-                array('dashicons')
375
-            );
376
-            //Load custom style sheet if available
377
-            if ($this->template_config->custom_style_sheet !== null) {
378
-                $this->addStylesheet(
379
-                    CoreAssetManager::CSS_HANDLE_CUSTOM,
380
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
381
-                    array(CoreAssetManager::CSS_HANDLE_DEFAULT)
382
-                );
383
-            }
384
-        }
385
-        $this->addCss(self::CSS_HANDLE_CORE_CSS_DEFAULT, 'dashicons');
386
-        $this->addCss(self::CSS_HANDLE_COMPONENTS, self::CSS_HANDLE_CORE_CSS_DEFAULT);
387
-    }
388
-
389
-
390
-    /**
391
-     * jQuery Validate for form validation
392
-     *
393
-     * @since 4.9.62.p
394
-     * @throws DomainException
395
-     * @throws DuplicateCollectionIdentifierException
396
-     * @throws InvalidDataTypeException
397
-     * @throws InvalidEntityException
398
-     */
399
-    private function loadJqueryValidate()
400
-    {
401
-        $this->addJavascript(
402
-            CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE,
403
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
404
-            array(CoreAssetManager::JS_HANDLE_JQUERY)
405
-        )
406
-        ->setVersion('1.15.0');
407
-
408
-        $this->addJavascript(
409
-            CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
410
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
411
-            array(CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE)
412
-        )
413
-        ->setVersion('1.15.0');
414
-    }
415
-
416
-
417
-    /**
418
-     * accounting.js for performing client-side calculations
419
-     *
420
-     * @since 4.9.62.p
421
-     * @throws DomainException
422
-     * @throws DuplicateCollectionIdentifierException
423
-     * @throws InvalidDataTypeException
424
-     * @throws InvalidEntityException
425
-     */
426
-    private function loadAccountingJs()
427
-    {
428
-        //accounting.js library
429
-        // @link http://josscrowcroft.github.io/accounting.js/
430
-        $this->addJavascript(
431
-            CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE,
432
-            EE_THIRD_PARTY_URL . 'accounting/accounting.js',
433
-            array(CoreAssetManager::JS_HANDLE_UNDERSCORE)
434
-        )
435
-        ->setVersion('0.3.2');
436
-
437
-        $this->addJavascript(
438
-            CoreAssetManager::JS_HANDLE_ACCOUNTING,
439
-            EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
440
-            array(CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE)
441
-        )
442
-        ->setInlineDataCallback(
443
-            function () {
444
-                 wp_localize_script(
445
-                     CoreAssetManager::JS_HANDLE_ACCOUNTING,
446
-                     'EE_ACCOUNTING_CFG',
447
-                     $this->getAccountingSettings()
448
-                 );
449
-            }
450
-        )
451
-        ->setVersion();
452
-    }
453
-
454
-
455
-    /**
456
-     * registers assets for cleaning your ears
457
-     *
458
-     * @param JavascriptAsset $script
459
-     */
460
-    public function loadQtipJs(JavascriptAsset $script)
461
-    {
462
-        // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
463
-        // can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
464
-        if (
465
-            $script->handle() === CoreAssetManager::JS_HANDLE_WP_PLUGINS_PAGE
466
-            && apply_filters('FHEE_load_qtip', false)
467
-        ) {
468
-            EEH_Qtip_Loader::instance()->register_and_enqueue();
469
-        }
470
-    }
471
-
472
-
473
-    /**
474
-     * assets that are used in the WordPress admin
475
-     *
476
-     * @since 4.9.62.p
477
-     * @throws DuplicateCollectionIdentifierException
478
-     * @throws InvalidDataTypeException
479
-     * @throws InvalidEntityException
480
-     */
481
-    private function registerAdminAssets()
482
-    {
483
-        $this->addJs(self::JS_HANDLE_WP_PLUGINS_PAGE)->setRequiresTranslation();
484
-        // note usage of the "JS_HANDLE.." constant is intentional here because css uses the same handle.
485
-        $this->addCss(self::JS_HANDLE_WP_PLUGINS_PAGE);
486
-    }
85
+	const JS_HANDLE_ACCOUNTING = 'ee-accounting';
86
+
87
+	const JS_HANDLE_WP_PLUGINS_PAGE = 'ee-wp-plugins-page';
88
+
89
+	// EE CSS assets handles
90
+	const CSS_HANDLE_DEFAULT = 'espresso_default';
91
+
92
+	const CSS_HANDLE_CUSTOM = 'espresso_custom_css';
93
+
94
+	const CSS_HANDLE_COMPONENTS = 'eventespresso-components';
95
+
96
+	const CSS_HANDLE_CORE_CSS_DEFAULT = 'eventespresso-core-css-default';
97
+
98
+	/**
99
+	 * @var EE_Currency_Config $currency_config
100
+	 */
101
+	protected $currency_config;
102
+
103
+	/**
104
+	 * @var EE_Template_Config $template_config
105
+	 */
106
+	protected $template_config;
107
+
108
+
109
+	/**
110
+	 * CoreAssetRegister constructor.
111
+	 *
112
+	 * @param AssetCollection    $assets
113
+	 * @param EE_Currency_Config $currency_config
114
+	 * @param EE_Template_Config $template_config
115
+	 * @param DomainInterface    $domain
116
+	 * @param Registry           $registry
117
+	 */
118
+	public function __construct(
119
+		AssetCollection $assets,
120
+		EE_Currency_Config $currency_config,
121
+		EE_Template_Config $template_config,
122
+		DomainInterface $domain,
123
+		Registry $registry
124
+	) {
125
+		$this->currency_config = $currency_config;
126
+		$this->template_config = $template_config;
127
+		parent::__construct($domain, $assets, $registry);
128
+	}
129
+
130
+
131
+	/**
132
+	 * @since 4.9.62.p
133
+	 * @throws DomainException
134
+	 * @throws DuplicateCollectionIdentifierException
135
+	 * @throws InvalidArgumentException
136
+	 * @throws InvalidDataTypeException
137
+	 * @throws InvalidEntityException
138
+	 * @throws InvalidInterfaceException
139
+	 */
140
+	public function addAssets()
141
+	{
142
+		$this->addJavascriptFiles();
143
+		$this->addStylesheetFiles();
144
+	}
145
+
146
+
147
+	/**
148
+	 * @since 4.9.62.p
149
+	 * @throws DomainException
150
+	 * @throws DuplicateCollectionIdentifierException
151
+	 * @throws InvalidArgumentException
152
+	 * @throws InvalidDataTypeException
153
+	 * @throws InvalidEntityException
154
+	 * @throws InvalidInterfaceException
155
+	 */
156
+	public function addJavascriptFiles()
157
+	{
158
+		$this->loadCoreJs();
159
+		$this->loadJqueryValidate();
160
+		$this->loadAccountingJs();
161
+		add_action(
162
+			'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
163
+			array($this, 'loadQtipJs')
164
+		);
165
+		$this->registerAdminAssets();
166
+	}
167
+
168
+
169
+	/**
170
+	 * @since 4.9.62.p
171
+	 * @throws DuplicateCollectionIdentifierException
172
+	 * @throws InvalidDataTypeException
173
+	 * @throws InvalidEntityException
174
+	 */
175
+	public function addStylesheetFiles()
176
+	{
177
+		$this->loadCoreCss();
178
+	}
179
+
180
+
181
+	/**
182
+	 * core default javascript
183
+	 *
184
+	 * @since 4.9.62.p
185
+	 * @throws DomainException
186
+	 * @throws DuplicateCollectionIdentifierException
187
+	 * @throws InvalidArgumentException
188
+	 * @throws InvalidDataTypeException
189
+	 * @throws InvalidEntityException
190
+	 * @throws InvalidInterfaceException
191
+	 */
192
+	private function loadCoreJs()
193
+	{
194
+		// conditionally load third-party libraries that WP core MIGHT have.
195
+		$this->registerWpAssets();
196
+
197
+		$this->addJs(self::JS_HANDLE_JS_CORE)->setHasInlineData();
198
+		$this->addJs(self::JS_HANDLE_VENDOR);
199
+		$this->addJs(self::JS_HANDLE_VALIDATORS)->setRequiresTranslation();
200
+		$this->addJs(self::JS_HANDLE_HELPERS)->setRequiresTranslation();
201
+		$this->addJs(self::JS_HANDLE_MODEL)->setRequiresTranslation();
202
+		$this->addJs(self::JS_HANDLE_VALUE_OBJECTS)->setRequiresTranslation();
203
+		$this->addJs(self::JS_HANDLE_DATA_STORES)->setRequiresTranslation()->setInlineDataCallback(
204
+			function () {
205
+				wp_add_inline_script(
206
+					CoreAssetManager::JS_HANDLE_DATA_STORES,
207
+					is_admin()
208
+						? 'wp.apiFetch.use( eejs.middleWares.apiFetch.capsMiddleware( eejs.middleWares.apiFetch.CONTEXT_CAPS_EDIT ) )'
209
+						: 'wp.apiFetch.use( eejs.middleWares.apiFetch.capsMiddleware )'
210
+				);
211
+			}
212
+		);
213
+		$this->addJs(self::JS_HANDLE_HOCS, self::JS_HANDLE_DATA_STORES)->setRequiresTranslation();
214
+		$this->addJs(self::JS_HANDLE_COMPONENTS, self::JS_HANDLE_DATA_STORES)->setRequiresTranslation();
215
+		$this->addJs(self::JS_HANDLE_EDITOR_HOCS)->setRequiresTranslation();
216
+
217
+		$this->registry->addData('eejs_api_nonce', wp_create_nonce('wp_rest'));
218
+		$this->registry->addData(
219
+			'paths',
220
+			array(
221
+				'base_rest_route' => rest_url(),
222
+				'rest_route' => rest_url('ee/v4.8.36/'),
223
+				'collection_endpoints' => EED_Core_Rest_Api::getCollectionRoutesIndexedByModelName(),
224
+				'primary_keys' => EED_Core_Rest_Api::getPrimaryKeyNamesIndexedByModelName(),
225
+				'site_url' => site_url('/'),
226
+				'admin_url' => admin_url('/'),
227
+			)
228
+		);
229
+		// Event Espresso brand name
230
+		$this->registry->addData('brandName', Domain::brandName());
231
+		/** site formatting values **/
232
+		$this->registry->addData(
233
+			'site_formats',
234
+			array(
235
+				'date_formats' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats()
236
+			)
237
+		);
238
+		/** currency data **/
239
+		$this->registry->addData(
240
+			'currency_config',
241
+			$this->getCurrencySettings()
242
+		);
243
+		/** site timezone */
244
+		$this->registry->addData(
245
+			'default_timezone',
246
+			array(
247
+				'pretty' => EEH_DTT_Helper::get_timezone_string_for_display(),
248
+				'string' => get_option('timezone_string'),
249
+				'offset' => EEH_DTT_Helper::get_site_timezone_gmt_offset(),
250
+			)
251
+		);
252
+		/** site locale (user locale if user logged in) */
253
+		$this->registry->addData(
254
+			'locale',
255
+			array(
256
+				'user' => get_user_locale(),
257
+				'site' => get_locale()
258
+			)
259
+		);
260
+
261
+		$this->addJavascript(
262
+			CoreAssetManager::JS_HANDLE_CORE,
263
+			EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
264
+			array(CoreAssetManager::JS_HANDLE_JQUERY)
265
+		)
266
+		->setInlineDataCallback(
267
+			function () {
268
+				wp_localize_script(
269
+					CoreAssetManager::JS_HANDLE_CORE,
270
+					CoreAssetManager::JS_HANDLE_I18N,
271
+					EE_Registry::$i18n_js_strings
272
+				);
273
+			}
274
+		);
275
+	}
276
+
277
+
278
+	/**
279
+	 * Registers vendor files that are bundled with a later version WP but might not be for the current version of
280
+	 * WordPress in the running environment.
281
+	 *
282
+	 * @throws DuplicateCollectionIdentifierException
283
+	 * @throws InvalidDataTypeException
284
+	 * @throws InvalidEntityException
285
+	 * @throws DomainException
286
+	 * @since 4.9.71.p
287
+	 */
288
+	private function registerWpAssets()
289
+	{
290
+		global $wp_version;
291
+		if (version_compare($wp_version, '5.0.beta', '>=')) {
292
+			return;
293
+		}
294
+		$this->addVendorJavascript(CoreAssetManager::JS_HANDLE_REACT)
295
+			->setVersion('16.6.0');
296
+		$this->addVendorJavascript(
297
+			CoreAssetManager::JS_HANDLE_REACT_DOM,
298
+			array(CoreAssetManager::JS_HANDLE_REACT)
299
+		)->setVersion('16.6.0');
300
+		$this->addVendorJavascript(CoreAssetManager::JS_HANDLE_LODASH)
301
+			->setInlineDataCallback(
302
+				function() {
303
+					wp_add_inline_script(
304
+						CoreAssetManager::JS_HANDLE_LODASH,
305
+						'window.lodash = _.noConflict();'
306
+					);
307
+				}
308
+			)
309
+			->setVersion('4.17.11');
310
+	}
311
+
312
+
313
+	/**
314
+	 * Returns configuration data for the accounting-js library.
315
+	 * @since 4.9.71.p
316
+	 * @return array
317
+	 */
318
+	private function getAccountingSettings() {
319
+		return array(
320
+			'currency' => array(
321
+				'symbol'    => $this->currency_config->sign,
322
+				'format'    => array(
323
+					'pos'  => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',
324
+					'neg'  => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',
325
+					'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',
326
+				),
327
+				'decimal'   => $this->currency_config->dec_mrk,
328
+				'thousand'  => $this->currency_config->thsnds,
329
+				'precision' => $this->currency_config->dec_plc,
330
+			),
331
+			'number'   => array(
332
+				'precision' => $this->currency_config->dec_plc,
333
+				'thousand'  => $this->currency_config->thsnds,
334
+				'decimal'   => $this->currency_config->dec_mrk,
335
+			),
336
+		);
337
+	}
338
+
339
+
340
+	/**
341
+	 * Returns configuration data for the js Currency VO.
342
+	 * @since 4.9.71.p
343
+	 * @return array
344
+	 */
345
+	private function getCurrencySettings()
346
+	{
347
+		return array(
348
+			'code' => $this->currency_config->code,
349
+			'singularLabel' => $this->currency_config->name,
350
+			'pluralLabel' => $this->currency_config->plural,
351
+			'sign' => $this->currency_config->sign,
352
+			'signB4' => $this->currency_config->sign_b4,
353
+			'decimalPlaces' => $this->currency_config->dec_plc,
354
+			'decimalMark' => $this->currency_config->dec_mrk,
355
+			'thousandsSeparator' => $this->currency_config->thsnds,
356
+		);
357
+	}
358
+
359
+
360
+	/**
361
+	 * @since 4.9.62.p
362
+	 * @throws DuplicateCollectionIdentifierException
363
+	 * @throws InvalidDataTypeException
364
+	 * @throws InvalidEntityException
365
+	 */
366
+	private function loadCoreCss()
367
+	{
368
+		if ($this->template_config->enable_default_style && ! is_admin()) {
369
+			$this->addStylesheet(
370
+				CoreAssetManager::CSS_HANDLE_DEFAULT,
371
+				is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
372
+					? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
373
+					: EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
374
+				array('dashicons')
375
+			);
376
+			//Load custom style sheet if available
377
+			if ($this->template_config->custom_style_sheet !== null) {
378
+				$this->addStylesheet(
379
+					CoreAssetManager::CSS_HANDLE_CUSTOM,
380
+					EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
381
+					array(CoreAssetManager::CSS_HANDLE_DEFAULT)
382
+				);
383
+			}
384
+		}
385
+		$this->addCss(self::CSS_HANDLE_CORE_CSS_DEFAULT, 'dashicons');
386
+		$this->addCss(self::CSS_HANDLE_COMPONENTS, self::CSS_HANDLE_CORE_CSS_DEFAULT);
387
+	}
388
+
389
+
390
+	/**
391
+	 * jQuery Validate for form validation
392
+	 *
393
+	 * @since 4.9.62.p
394
+	 * @throws DomainException
395
+	 * @throws DuplicateCollectionIdentifierException
396
+	 * @throws InvalidDataTypeException
397
+	 * @throws InvalidEntityException
398
+	 */
399
+	private function loadJqueryValidate()
400
+	{
401
+		$this->addJavascript(
402
+			CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE,
403
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
404
+			array(CoreAssetManager::JS_HANDLE_JQUERY)
405
+		)
406
+		->setVersion('1.15.0');
407
+
408
+		$this->addJavascript(
409
+			CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
410
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
411
+			array(CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE)
412
+		)
413
+		->setVersion('1.15.0');
414
+	}
415
+
416
+
417
+	/**
418
+	 * accounting.js for performing client-side calculations
419
+	 *
420
+	 * @since 4.9.62.p
421
+	 * @throws DomainException
422
+	 * @throws DuplicateCollectionIdentifierException
423
+	 * @throws InvalidDataTypeException
424
+	 * @throws InvalidEntityException
425
+	 */
426
+	private function loadAccountingJs()
427
+	{
428
+		//accounting.js library
429
+		// @link http://josscrowcroft.github.io/accounting.js/
430
+		$this->addJavascript(
431
+			CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE,
432
+			EE_THIRD_PARTY_URL . 'accounting/accounting.js',
433
+			array(CoreAssetManager::JS_HANDLE_UNDERSCORE)
434
+		)
435
+		->setVersion('0.3.2');
436
+
437
+		$this->addJavascript(
438
+			CoreAssetManager::JS_HANDLE_ACCOUNTING,
439
+			EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
440
+			array(CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE)
441
+		)
442
+		->setInlineDataCallback(
443
+			function () {
444
+				 wp_localize_script(
445
+					 CoreAssetManager::JS_HANDLE_ACCOUNTING,
446
+					 'EE_ACCOUNTING_CFG',
447
+					 $this->getAccountingSettings()
448
+				 );
449
+			}
450
+		)
451
+		->setVersion();
452
+	}
453
+
454
+
455
+	/**
456
+	 * registers assets for cleaning your ears
457
+	 *
458
+	 * @param JavascriptAsset $script
459
+	 */
460
+	public function loadQtipJs(JavascriptAsset $script)
461
+	{
462
+		// qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
463
+		// can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
464
+		if (
465
+			$script->handle() === CoreAssetManager::JS_HANDLE_WP_PLUGINS_PAGE
466
+			&& apply_filters('FHEE_load_qtip', false)
467
+		) {
468
+			EEH_Qtip_Loader::instance()->register_and_enqueue();
469
+		}
470
+	}
471
+
472
+
473
+	/**
474
+	 * assets that are used in the WordPress admin
475
+	 *
476
+	 * @since 4.9.62.p
477
+	 * @throws DuplicateCollectionIdentifierException
478
+	 * @throws InvalidDataTypeException
479
+	 * @throws InvalidEntityException
480
+	 */
481
+	private function registerAdminAssets()
482
+	{
483
+		$this->addJs(self::JS_HANDLE_WP_PLUGINS_PAGE)->setRequiresTranslation();
484
+		// note usage of the "JS_HANDLE.." constant is intentional here because css uses the same handle.
485
+		$this->addCss(self::JS_HANDLE_WP_PLUGINS_PAGE);
486
+	}
487 487
 }
Please login to merge, or discard this patch.
core/services/assets/AssetManager.php 2 patches
Indentation   +229 added lines, -229 removed lines patch added patch discarded remove patch
@@ -23,233 +23,233 @@
 block discarded – undo
23 23
 abstract class AssetManager implements AssetManagerInterface
24 24
 {
25 25
 
26
-    /**
27
-     * @var AssetCollection $assets
28
-     */
29
-    protected $assets;
30
-
31
-    /**
32
-     * @var DomainInterface
33
-     */
34
-    protected $domain;
35
-
36
-    /**
37
-     * @var Registry $registry
38
-     */
39
-    protected $registry;
40
-
41
-
42
-    /**
43
-     * AssetRegister constructor.
44
-     *
45
-     * @param DomainInterface $domain
46
-     * @param AssetCollection $assets
47
-     * @param Registry        $registry
48
-     */
49
-    public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry)
50
-    {
51
-        $this->domain = $domain;
52
-        $this->assets = $assets;
53
-        $this->registry = $registry;
54
-        add_action('wp_enqueue_scripts', array($this, 'addManifestFile'), 0);
55
-        add_action('admin_enqueue_scripts', array($this, 'addManifestFile'), 0);
56
-        add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2);
57
-        add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2);
58
-    }
59
-
60
-
61
-    /**
62
-     * @since 4.9.71.p
63
-     * @return string
64
-     */
65
-    public function assetNamespace()
66
-    {
67
-        return $this->domain->assetNamespace();
68
-    }
69
-
70
-
71
-    /**
72
-     * @return void
73
-     * @throws DuplicateCollectionIdentifierException
74
-     * @throws InvalidDataTypeException
75
-     * @throws InvalidEntityException
76
-     * @since 4.9.62.p
77
-     */
78
-    public function addManifestFile()
79
-    {
80
-        // if a manifest file has already been added for this domain, then just return
81
-        if ($this->assets->has($this->domain->assetNamespace())) {
82
-            return;
83
-        }
84
-        $asset = new ManifestFile($this->domain);
85
-        $this->assets->add($asset, $this->domain->assetNamespace());
86
-    }
87
-
88
-
89
-    /**
90
-     * @return ManifestFile[]
91
-     * @since 4.9.62.p
92
-     */
93
-    public function getManifestFile()
94
-    {
95
-        return $this->assets->getManifestFiles();
96
-    }
97
-
98
-
99
-    /**
100
-     * @param string $handle
101
-     * @param string $source
102
-     * @param array  $dependencies
103
-     * @param bool   $load_in_footer
104
-     * @return JavascriptAsset
105
-     * @throws DuplicateCollectionIdentifierException
106
-     * @throws InvalidDataTypeException
107
-     * @throws InvalidEntityException
108
-     * @since 4.9.62.p
109
-     */
110
-    public function addJavascript(
111
-        $handle,
112
-        $source,
113
-        array $dependencies = array(),
114
-        $load_in_footer = true
115
-    ) {
116
-        $asset = new JavascriptAsset(
117
-            $handle,
118
-            $source,
119
-            array_unique($dependencies),
120
-            $load_in_footer,
121
-            $this->domain
122
-        );
123
-        $this->assets->add($asset, $handle);
124
-        return $asset;
125
-    }
126
-
127
-
128
-    /**
129
-     * Used to register a javascript asset where everything is dynamically derived from the given handle.
130
-     *
131
-     * @param string $handle
132
-     * @param string|array  $extra_dependencies
133
-     * @return JavascriptAsset
134
-     * @throws DuplicateCollectionIdentifierException
135
-     * @throws InvalidDataTypeException
136
-     * @throws InvalidEntityException
137
-     */
138
-    public function addJs($handle, $extra_dependencies = [])
139
-    {
140
-        $dependencies = $this->registry->getJsDependencies(
141
-            $this->domain->assetNamespace(),
142
-            $handle
143
-        );
144
-        $dependencies = ! empty( $extra_dependencies )
145
-            ? array_merge(( array ) $extra_dependencies, $dependencies)
146
-            : $dependencies;
147
-        return $this->addJavascript(
148
-            $handle,
149
-            $this->registry->getJsUrl($this->domain->assetNamespace(), $handle),
150
-            $dependencies
151
-        );
152
-    }
153
-
154
-
155
-    /**
156
-     * @param string $handle
157
-     * @param array  $dependencies
158
-     * @param bool   $load_in_footer
159
-     * @return JavascriptAsset
160
-     * @throws DuplicateCollectionIdentifierException
161
-     * @throws InvalidDataTypeException
162
-     * @throws InvalidEntityException
163
-     * @throws DomainException
164
-     * @since 4.9.71.p
165
-     */
166
-    public function addVendorJavascript(
167
-        $handle,
168
-        array $dependencies = array(),
169
-        $load_in_footer = true
170
-    ) {
171
-        $dev_suffix = wp_scripts_get_suffix('dev');
172
-        $vendor_path = $this->domain->pluginUrl() . 'assets/vendor/';
173
-        return $this->addJavascript(
174
-            $handle,
175
-            "{$vendor_path}{$handle}{$dev_suffix}.js",
176
-            $dependencies,
177
-            $load_in_footer
178
-        );
179
-    }
180
-
181
-
182
-
183
-    /**
184
-     * @param string $handle
185
-     * @param string $source
186
-     * @param array  $dependencies
187
-     * @param string $media
188
-     * @return StylesheetAsset
189
-     * @throws DuplicateCollectionIdentifierException
190
-     * @throws InvalidDataTypeException
191
-     * @throws InvalidEntityException
192
-     * @since 4.9.62.p
193
-     */
194
-    public function addStylesheet(
195
-        $handle,
196
-        $source,
197
-        array $dependencies = array(),
198
-        $media = 'all'
199
-    ) {
200
-        $asset = new StylesheetAsset(
201
-            $handle,
202
-            $source,
203
-            array_unique($dependencies),
204
-            $this->domain,
205
-            $media
206
-        );
207
-        $this->assets->add($asset, $handle);
208
-        return $asset;
209
-    }
210
-
211
-
212
-    /**
213
-     * Used to register a css asset where everything is dynamically derived from the given handle.
214
-     *
215
-     * @param string $handle
216
-     * @param string|array  $extra_dependencies
217
-     * @return StylesheetAsset
218
-     * @throws DuplicateCollectionIdentifierException
219
-     * @throws InvalidDataTypeException
220
-     * @throws InvalidEntityException
221
-     */
222
-    public function addCss($handle, $extra_dependencies = [])
223
-    {
224
-        $dependencies = $this->registry->getCssDependencies(
225
-            $this->domain->assetNamespace(),
226
-            $handle
227
-        );
228
-        $dependencies = ! empty( $extra_dependencies )
229
-            ? array_merge(( array ) $extra_dependencies, $dependencies)
230
-            : $dependencies;
231
-        return $this->addStylesheet(
232
-            $handle,
233
-            $this->registry->getCssUrl($this->domain->assetNamespace(), $handle),
234
-            $dependencies
235
-        );
236
-    }
237
-
238
-
239
-    /**
240
-     * @param string $handle
241
-     * @return bool
242
-     * @since 4.9.62.p
243
-     */
244
-    public function enqueueAsset($handle)
245
-    {
246
-        if ($this->assets->has($handle)) {
247
-            $asset = $this->assets->get($handle);
248
-            if ($asset->isRegistered()) {
249
-                $asset->enqueueAsset();
250
-                return true;
251
-            }
252
-        }
253
-        return false;
254
-    }
26
+	/**
27
+	 * @var AssetCollection $assets
28
+	 */
29
+	protected $assets;
30
+
31
+	/**
32
+	 * @var DomainInterface
33
+	 */
34
+	protected $domain;
35
+
36
+	/**
37
+	 * @var Registry $registry
38
+	 */
39
+	protected $registry;
40
+
41
+
42
+	/**
43
+	 * AssetRegister constructor.
44
+	 *
45
+	 * @param DomainInterface $domain
46
+	 * @param AssetCollection $assets
47
+	 * @param Registry        $registry
48
+	 */
49
+	public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry)
50
+	{
51
+		$this->domain = $domain;
52
+		$this->assets = $assets;
53
+		$this->registry = $registry;
54
+		add_action('wp_enqueue_scripts', array($this, 'addManifestFile'), 0);
55
+		add_action('admin_enqueue_scripts', array($this, 'addManifestFile'), 0);
56
+		add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2);
57
+		add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2);
58
+	}
59
+
60
+
61
+	/**
62
+	 * @since 4.9.71.p
63
+	 * @return string
64
+	 */
65
+	public function assetNamespace()
66
+	{
67
+		return $this->domain->assetNamespace();
68
+	}
69
+
70
+
71
+	/**
72
+	 * @return void
73
+	 * @throws DuplicateCollectionIdentifierException
74
+	 * @throws InvalidDataTypeException
75
+	 * @throws InvalidEntityException
76
+	 * @since 4.9.62.p
77
+	 */
78
+	public function addManifestFile()
79
+	{
80
+		// if a manifest file has already been added for this domain, then just return
81
+		if ($this->assets->has($this->domain->assetNamespace())) {
82
+			return;
83
+		}
84
+		$asset = new ManifestFile($this->domain);
85
+		$this->assets->add($asset, $this->domain->assetNamespace());
86
+	}
87
+
88
+
89
+	/**
90
+	 * @return ManifestFile[]
91
+	 * @since 4.9.62.p
92
+	 */
93
+	public function getManifestFile()
94
+	{
95
+		return $this->assets->getManifestFiles();
96
+	}
97
+
98
+
99
+	/**
100
+	 * @param string $handle
101
+	 * @param string $source
102
+	 * @param array  $dependencies
103
+	 * @param bool   $load_in_footer
104
+	 * @return JavascriptAsset
105
+	 * @throws DuplicateCollectionIdentifierException
106
+	 * @throws InvalidDataTypeException
107
+	 * @throws InvalidEntityException
108
+	 * @since 4.9.62.p
109
+	 */
110
+	public function addJavascript(
111
+		$handle,
112
+		$source,
113
+		array $dependencies = array(),
114
+		$load_in_footer = true
115
+	) {
116
+		$asset = new JavascriptAsset(
117
+			$handle,
118
+			$source,
119
+			array_unique($dependencies),
120
+			$load_in_footer,
121
+			$this->domain
122
+		);
123
+		$this->assets->add($asset, $handle);
124
+		return $asset;
125
+	}
126
+
127
+
128
+	/**
129
+	 * Used to register a javascript asset where everything is dynamically derived from the given handle.
130
+	 *
131
+	 * @param string $handle
132
+	 * @param string|array  $extra_dependencies
133
+	 * @return JavascriptAsset
134
+	 * @throws DuplicateCollectionIdentifierException
135
+	 * @throws InvalidDataTypeException
136
+	 * @throws InvalidEntityException
137
+	 */
138
+	public function addJs($handle, $extra_dependencies = [])
139
+	{
140
+		$dependencies = $this->registry->getJsDependencies(
141
+			$this->domain->assetNamespace(),
142
+			$handle
143
+		);
144
+		$dependencies = ! empty( $extra_dependencies )
145
+			? array_merge(( array ) $extra_dependencies, $dependencies)
146
+			: $dependencies;
147
+		return $this->addJavascript(
148
+			$handle,
149
+			$this->registry->getJsUrl($this->domain->assetNamespace(), $handle),
150
+			$dependencies
151
+		);
152
+	}
153
+
154
+
155
+	/**
156
+	 * @param string $handle
157
+	 * @param array  $dependencies
158
+	 * @param bool   $load_in_footer
159
+	 * @return JavascriptAsset
160
+	 * @throws DuplicateCollectionIdentifierException
161
+	 * @throws InvalidDataTypeException
162
+	 * @throws InvalidEntityException
163
+	 * @throws DomainException
164
+	 * @since 4.9.71.p
165
+	 */
166
+	public function addVendorJavascript(
167
+		$handle,
168
+		array $dependencies = array(),
169
+		$load_in_footer = true
170
+	) {
171
+		$dev_suffix = wp_scripts_get_suffix('dev');
172
+		$vendor_path = $this->domain->pluginUrl() . 'assets/vendor/';
173
+		return $this->addJavascript(
174
+			$handle,
175
+			"{$vendor_path}{$handle}{$dev_suffix}.js",
176
+			$dependencies,
177
+			$load_in_footer
178
+		);
179
+	}
180
+
181
+
182
+
183
+	/**
184
+	 * @param string $handle
185
+	 * @param string $source
186
+	 * @param array  $dependencies
187
+	 * @param string $media
188
+	 * @return StylesheetAsset
189
+	 * @throws DuplicateCollectionIdentifierException
190
+	 * @throws InvalidDataTypeException
191
+	 * @throws InvalidEntityException
192
+	 * @since 4.9.62.p
193
+	 */
194
+	public function addStylesheet(
195
+		$handle,
196
+		$source,
197
+		array $dependencies = array(),
198
+		$media = 'all'
199
+	) {
200
+		$asset = new StylesheetAsset(
201
+			$handle,
202
+			$source,
203
+			array_unique($dependencies),
204
+			$this->domain,
205
+			$media
206
+		);
207
+		$this->assets->add($asset, $handle);
208
+		return $asset;
209
+	}
210
+
211
+
212
+	/**
213
+	 * Used to register a css asset where everything is dynamically derived from the given handle.
214
+	 *
215
+	 * @param string $handle
216
+	 * @param string|array  $extra_dependencies
217
+	 * @return StylesheetAsset
218
+	 * @throws DuplicateCollectionIdentifierException
219
+	 * @throws InvalidDataTypeException
220
+	 * @throws InvalidEntityException
221
+	 */
222
+	public function addCss($handle, $extra_dependencies = [])
223
+	{
224
+		$dependencies = $this->registry->getCssDependencies(
225
+			$this->domain->assetNamespace(),
226
+			$handle
227
+		);
228
+		$dependencies = ! empty( $extra_dependencies )
229
+			? array_merge(( array ) $extra_dependencies, $dependencies)
230
+			: $dependencies;
231
+		return $this->addStylesheet(
232
+			$handle,
233
+			$this->registry->getCssUrl($this->domain->assetNamespace(), $handle),
234
+			$dependencies
235
+		);
236
+	}
237
+
238
+
239
+	/**
240
+	 * @param string $handle
241
+	 * @return bool
242
+	 * @since 4.9.62.p
243
+	 */
244
+	public function enqueueAsset($handle)
245
+	{
246
+		if ($this->assets->has($handle)) {
247
+			$asset = $this->assets->get($handle);
248
+			if ($asset->isRegistered()) {
249
+				$asset->enqueueAsset();
250
+				return true;
251
+			}
252
+		}
253
+		return false;
254
+	}
255 255
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
             $this->domain->assetNamespace(),
142 142
             $handle
143 143
         );
144
-        $dependencies = ! empty( $extra_dependencies )
145
-            ? array_merge(( array ) $extra_dependencies, $dependencies)
144
+        $dependencies = ! empty($extra_dependencies)
145
+            ? array_merge((array) $extra_dependencies, $dependencies)
146 146
             : $dependencies;
147 147
         return $this->addJavascript(
148 148
             $handle,
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         $load_in_footer = true
170 170
     ) {
171 171
         $dev_suffix = wp_scripts_get_suffix('dev');
172
-        $vendor_path = $this->domain->pluginUrl() . 'assets/vendor/';
172
+        $vendor_path = $this->domain->pluginUrl().'assets/vendor/';
173 173
         return $this->addJavascript(
174 174
             $handle,
175 175
             "{$vendor_path}{$handle}{$dev_suffix}.js",
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
             $this->domain->assetNamespace(),
226 226
             $handle
227 227
         );
228
-        $dependencies = ! empty( $extra_dependencies )
229
-            ? array_merge(( array ) $extra_dependencies, $dependencies)
228
+        $dependencies = ! empty($extra_dependencies)
229
+            ? array_merge((array) $extra_dependencies, $dependencies)
230 230
             : $dependencies;
231 231
         return $this->addStylesheet(
232 232
             $handle,
Please login to merge, or discard this patch.
core/services/assets/BlockAssetManager.php 2 patches
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -22,249 +22,249 @@
 block discarded – undo
22 22
 abstract class BlockAssetManager extends AssetManager implements BlockAssetManagerInterface
23 23
 {
24 24
 
25
-    /**
26
-     * @var string $editor_script_handle
27
-     */
28
-    private $editor_script_handle;
29
-
30
-    /**
31
-     * @var string $editor_style_handle
32
-     */
33
-    private $editor_style_handle;
34
-
35
-    /**
36
-     * @var string $script_handle
37
-     */
38
-    private $script_handle;
39
-
40
-    /**
41
-     * @var string $style_handle
42
-     */
43
-    private $style_handle;
44
-
45
-
46
-    /**
47
-     * @return string
48
-     */
49
-    public function getEditorScriptHandle()
50
-    {
51
-        return $this->editor_script_handle;
52
-    }
53
-
54
-
55
-    /**
56
-     * @param string $editor_script_handle
57
-     */
58
-    public function setEditorScriptHandle($editor_script_handle)
59
-    {
60
-        if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
61
-            $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
62
-        }
63
-        $this->editor_script_handle = $editor_script_handle;
64
-    }
65
-
66
-
67
-    /**
68
-     * @return string
69
-     */
70
-    public function getEditorStyleHandle()
71
-    {
72
-        return $this->editor_style_handle;
73
-    }
74
-
75
-
76
-    /**
77
-     * @param string $editor_style_handle
78
-     */
79
-    public function setEditorStyleHandle($editor_style_handle)
80
-    {
81
-        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
82
-            $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
83
-        }
84
-        $this->editor_style_handle = $editor_style_handle;
85
-    }
86
-
87
-
88
-    /**
89
-     * @return string
90
-     */
91
-    public function getScriptHandle()
92
-    {
93
-        return $this->script_handle;
94
-    }
95
-
96
-
97
-    /**
98
-     * @param string $script_handle
99
-     */
100
-    public function setScriptHandle($script_handle)
101
-    {
102
-        if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
103
-            $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
104
-        }
105
-        $this->script_handle = $script_handle;
106
-    }
107
-
108
-
109
-    /**
110
-     * @return string
111
-     */
112
-    public function getStyleHandle()
113
-    {
114
-        return $this->style_handle;
115
-    }
116
-
117
-
118
-    /**
119
-     * @param string $style_handle
120
-     */
121
-    public function setStyleHandle($style_handle)
122
-    {
123
-        if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
124
-            $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
125
-        }
126
-        $this->style_handle = $style_handle;
127
-    }
128
-
129
-    /**
130
-     * @since 4.9.71.p
131
-     * @throws InvalidDataTypeException
132
-     * @throws InvalidEntityException
133
-     * @throws DuplicateCollectionIdentifierException
134
-     */
135
-    public function addAssets()
136
-    {
137
-        $this->addEditorScript($this->getEditorScriptHandle());
138
-        $this->addEditorStyle($this->getEditorStyleHandle());
139
-        $this->addScript($this->getScriptHandle());
140
-        $this->addStyle($this->getStyleHandle());
141
-    }
142
-
143
-
144
-    /**
145
-     * @param       $handle
146
-     * @param array $dependencies
147
-     * @since 4.9.71.p
148
-     * @return JavascriptAsset
149
-     * @throws InvalidDataTypeException
150
-     * @throws InvalidEntityException
151
-     * @throws DuplicateCollectionIdentifierException
152
-     */
153
-    public function addEditorScript($handle, array $dependencies = array())
154
-    {
155
-        if ($this->assets->hasJavascriptAsset($handle)){
156
-            return $this->assets->getJavascriptAsset($handle);
157
-        }
158
-        return $this->addJs($handle, $dependencies)->setRequiresTranslation();
159
-    }
160
-
161
-
162
-    /**
163
-     * @param        $handle
164
-     * @param array  $dependencies
165
-     * @since 4.9.71.p
166
-     * @return StylesheetAsset
167
-     * @throws InvalidDataTypeException
168
-     * @throws InvalidEntityException
169
-     * @throws DuplicateCollectionIdentifierException
170
-     */
171
-    public function addEditorStyle($handle, array $dependencies = array())
172
-    {
173
-        if ($this->assets->hasStylesheetAsset($handle)) {
174
-            return $this->assets->getStylesheetAsset($handle);
175
-        }
176
-        return $this->addCss($handle, $dependencies);
177
-    }
178
-
179
-
180
-    /**
181
-     * @param       $handle
182
-     * @param array $dependencies
183
-     * @since 4.9.71.p
184
-     * @return JavascriptAsset
185
-     * @throws InvalidDataTypeException
186
-     * @throws InvalidEntityException
187
-     * @throws DuplicateCollectionIdentifierException
188
-     */
189
-    public function addScript($handle, array $dependencies = array())
190
-    {
191
-        if ($this->assets->hasJavascriptAsset($handle)) {
192
-            return $this->assets->getJavascriptAsset($handle);
193
-        }
194
-        return $this->addJs($handle, $dependencies)->setRequiresTranslation();
195
-    }
196
-
197
-
198
-    /**
199
-     * @param        $handle
200
-     * @param array  $dependencies
201
-     * @since 4.9.71.p
202
-     * @return StylesheetAsset
203
-     * @throws InvalidDataTypeException
204
-     * @throws InvalidEntityException
205
-     * @throws DuplicateCollectionIdentifierException
206
-     */
207
-    public function addStyle($handle, array $dependencies = array())
208
-    {
209
-        if ($this->assets->hasStylesheetAsset($handle)) {
210
-            return $this->assets->getStylesheetAsset($handle);
211
-        }
212
-        return $this->addCss($handle, $dependencies);
213
-    }
214
-
215
-
216
-    /**
217
-     * @return JavascriptAsset|null
218
-     */
219
-    public function getEditorScript()
220
-    {
221
-        return $this->assets->getJavascriptAsset($this->editor_script_handle);
222
-    }
223
-
224
-
225
-    /**
226
-     * @return StylesheetAsset|null
227
-     */
228
-    public function getEditorStyle()
229
-    {
230
-        return $this->assets->getStylesheetAsset($this->editor_style_handle);
231
-    }
232
-
233
-
234
-    /**
235
-     * @return JavascriptAsset|null
236
-     */
237
-    public function getScript()
238
-    {
239
-        return $this->assets->getJavascriptAsset($this->script_handle);
240
-    }
241
-
242
-
243
-    /**
244
-     * @return StylesheetAsset|null
245
-     */
246
-    public function getStyle()
247
-    {
248
-        return $this->assets->getStylesheetAsset($this->style_handle);
249
-    }
250
-
251
-
252
-    /**
253
-     * @return  void
254
-     */
255
-    public function enqueueAssets()
256
-    {
257
-        $assets = array(
258
-            $this->getEditorScript(),
259
-            $this->getEditorStyle(),
260
-            $this->getScript(),
261
-            $this->getStyle(),
262
-        );
263
-        foreach ($assets as $asset) {
264
-            if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
265
-                $asset->enqueueAsset();
266
-            }
267
-        }
268
-    }
25
+	/**
26
+	 * @var string $editor_script_handle
27
+	 */
28
+	private $editor_script_handle;
29
+
30
+	/**
31
+	 * @var string $editor_style_handle
32
+	 */
33
+	private $editor_style_handle;
34
+
35
+	/**
36
+	 * @var string $script_handle
37
+	 */
38
+	private $script_handle;
39
+
40
+	/**
41
+	 * @var string $style_handle
42
+	 */
43
+	private $style_handle;
44
+
45
+
46
+	/**
47
+	 * @return string
48
+	 */
49
+	public function getEditorScriptHandle()
50
+	{
51
+		return $this->editor_script_handle;
52
+	}
53
+
54
+
55
+	/**
56
+	 * @param string $editor_script_handle
57
+	 */
58
+	public function setEditorScriptHandle($editor_script_handle)
59
+	{
60
+		if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
61
+			$editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
62
+		}
63
+		$this->editor_script_handle = $editor_script_handle;
64
+	}
65
+
66
+
67
+	/**
68
+	 * @return string
69
+	 */
70
+	public function getEditorStyleHandle()
71
+	{
72
+		return $this->editor_style_handle;
73
+	}
74
+
75
+
76
+	/**
77
+	 * @param string $editor_style_handle
78
+	 */
79
+	public function setEditorStyleHandle($editor_style_handle)
80
+	{
81
+		if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
82
+			$editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
83
+		}
84
+		$this->editor_style_handle = $editor_style_handle;
85
+	}
86
+
87
+
88
+	/**
89
+	 * @return string
90
+	 */
91
+	public function getScriptHandle()
92
+	{
93
+		return $this->script_handle;
94
+	}
95
+
96
+
97
+	/**
98
+	 * @param string $script_handle
99
+	 */
100
+	public function setScriptHandle($script_handle)
101
+	{
102
+		if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
103
+			$script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
104
+		}
105
+		$this->script_handle = $script_handle;
106
+	}
107
+
108
+
109
+	/**
110
+	 * @return string
111
+	 */
112
+	public function getStyleHandle()
113
+	{
114
+		return $this->style_handle;
115
+	}
116
+
117
+
118
+	/**
119
+	 * @param string $style_handle
120
+	 */
121
+	public function setStyleHandle($style_handle)
122
+	{
123
+		if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
124
+			$style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
125
+		}
126
+		$this->style_handle = $style_handle;
127
+	}
128
+
129
+	/**
130
+	 * @since 4.9.71.p
131
+	 * @throws InvalidDataTypeException
132
+	 * @throws InvalidEntityException
133
+	 * @throws DuplicateCollectionIdentifierException
134
+	 */
135
+	public function addAssets()
136
+	{
137
+		$this->addEditorScript($this->getEditorScriptHandle());
138
+		$this->addEditorStyle($this->getEditorStyleHandle());
139
+		$this->addScript($this->getScriptHandle());
140
+		$this->addStyle($this->getStyleHandle());
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param       $handle
146
+	 * @param array $dependencies
147
+	 * @since 4.9.71.p
148
+	 * @return JavascriptAsset
149
+	 * @throws InvalidDataTypeException
150
+	 * @throws InvalidEntityException
151
+	 * @throws DuplicateCollectionIdentifierException
152
+	 */
153
+	public function addEditorScript($handle, array $dependencies = array())
154
+	{
155
+		if ($this->assets->hasJavascriptAsset($handle)){
156
+			return $this->assets->getJavascriptAsset($handle);
157
+		}
158
+		return $this->addJs($handle, $dependencies)->setRequiresTranslation();
159
+	}
160
+
161
+
162
+	/**
163
+	 * @param        $handle
164
+	 * @param array  $dependencies
165
+	 * @since 4.9.71.p
166
+	 * @return StylesheetAsset
167
+	 * @throws InvalidDataTypeException
168
+	 * @throws InvalidEntityException
169
+	 * @throws DuplicateCollectionIdentifierException
170
+	 */
171
+	public function addEditorStyle($handle, array $dependencies = array())
172
+	{
173
+		if ($this->assets->hasStylesheetAsset($handle)) {
174
+			return $this->assets->getStylesheetAsset($handle);
175
+		}
176
+		return $this->addCss($handle, $dependencies);
177
+	}
178
+
179
+
180
+	/**
181
+	 * @param       $handle
182
+	 * @param array $dependencies
183
+	 * @since 4.9.71.p
184
+	 * @return JavascriptAsset
185
+	 * @throws InvalidDataTypeException
186
+	 * @throws InvalidEntityException
187
+	 * @throws DuplicateCollectionIdentifierException
188
+	 */
189
+	public function addScript($handle, array $dependencies = array())
190
+	{
191
+		if ($this->assets->hasJavascriptAsset($handle)) {
192
+			return $this->assets->getJavascriptAsset($handle);
193
+		}
194
+		return $this->addJs($handle, $dependencies)->setRequiresTranslation();
195
+	}
196
+
197
+
198
+	/**
199
+	 * @param        $handle
200
+	 * @param array  $dependencies
201
+	 * @since 4.9.71.p
202
+	 * @return StylesheetAsset
203
+	 * @throws InvalidDataTypeException
204
+	 * @throws InvalidEntityException
205
+	 * @throws DuplicateCollectionIdentifierException
206
+	 */
207
+	public function addStyle($handle, array $dependencies = array())
208
+	{
209
+		if ($this->assets->hasStylesheetAsset($handle)) {
210
+			return $this->assets->getStylesheetAsset($handle);
211
+		}
212
+		return $this->addCss($handle, $dependencies);
213
+	}
214
+
215
+
216
+	/**
217
+	 * @return JavascriptAsset|null
218
+	 */
219
+	public function getEditorScript()
220
+	{
221
+		return $this->assets->getJavascriptAsset($this->editor_script_handle);
222
+	}
223
+
224
+
225
+	/**
226
+	 * @return StylesheetAsset|null
227
+	 */
228
+	public function getEditorStyle()
229
+	{
230
+		return $this->assets->getStylesheetAsset($this->editor_style_handle);
231
+	}
232
+
233
+
234
+	/**
235
+	 * @return JavascriptAsset|null
236
+	 */
237
+	public function getScript()
238
+	{
239
+		return $this->assets->getJavascriptAsset($this->script_handle);
240
+	}
241
+
242
+
243
+	/**
244
+	 * @return StylesheetAsset|null
245
+	 */
246
+	public function getStyle()
247
+	{
248
+		return $this->assets->getStylesheetAsset($this->style_handle);
249
+	}
250
+
251
+
252
+	/**
253
+	 * @return  void
254
+	 */
255
+	public function enqueueAssets()
256
+	{
257
+		$assets = array(
258
+			$this->getEditorScript(),
259
+			$this->getEditorStyle(),
260
+			$this->getScript(),
261
+			$this->getStyle(),
262
+		);
263
+		foreach ($assets as $asset) {
264
+			if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
265
+				$asset->enqueueAsset();
266
+			}
267
+		}
268
+	}
269 269
 
270 270
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function setEditorScriptHandle($editor_script_handle)
59 59
     {
60
-        if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
61
-            $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
60
+        if (strpos($editor_script_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
61
+            $editor_script_handle = BlockInterface::NAME_SPACE.'-'.$editor_script_handle;
62 62
         }
63 63
         $this->editor_script_handle = $editor_script_handle;
64 64
     }
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function setEditorStyleHandle($editor_style_handle)
80 80
     {
81
-        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
82
-            $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
81
+        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
82
+            $editor_style_handle = BlockInterface::NAME_SPACE.'-'.$editor_style_handle;
83 83
         }
84 84
         $this->editor_style_handle = $editor_style_handle;
85 85
     }
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function setScriptHandle($script_handle)
101 101
     {
102
-        if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
103
-            $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
102
+        if (strpos($script_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
103
+            $script_handle = BlockInterface::NAME_SPACE.'-'.$script_handle;
104 104
         }
105 105
         $this->script_handle = $script_handle;
106 106
     }
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function setStyleHandle($style_handle)
122 122
     {
123
-        if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
124
-            $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
123
+        if (strpos($style_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
124
+            $style_handle = BlockInterface::NAME_SPACE.'-'.$style_handle;
125 125
         }
126 126
         $this->style_handle = $style_handle;
127 127
     }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function addEditorScript($handle, array $dependencies = array())
154 154
     {
155
-        if ($this->assets->hasJavascriptAsset($handle)){
155
+        if ($this->assets->hasJavascriptAsset($handle)) {
156 156
             return $this->assets->getJavascriptAsset($handle);
157 157
         }
158 158
         return $this->addJs($handle, $dependencies)->setRequiresTranslation();
Please login to merge, or discard this patch.
core/services/assets/Registry.php 2 patches
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 $script->version(),
185 185
                 $script->loadInFooter()
186 186
             );
187
-            if (! $registered && $this->debug()) {
187
+            if ( ! $registered && $this->debug()) {
188 188
                 throw new AssetRegistrationException($script->handle());
189 189
             }
190 190
             $script->setRegistered($registered);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         $this->removeAlreadyRegisteredDataForScriptHandles();
245 245
         wp_add_inline_script(
246 246
             'eejs-core',
247
-            'var eejsdata=' . wp_json_encode(array('data' => $this->jsdata)),
247
+            'var eejsdata='.wp_json_encode(array('data' => $this->jsdata)),
248 248
             'before'
249 249
         );
250 250
         $scripts = $this->assets->getJavascriptAssetsWithData();
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
     public function addData($key, $value)
275 275
     {
276 276
         if ($this->verifyDataNotExisting($key)) {
277
-            $this->jsdata[ $key ] = $value;
277
+            $this->jsdata[$key] = $value;
278 278
         }
279 279
     }
280 280
 
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
      */
300 300
     public function pushData($key, $value)
301 301
     {
302
-        if (isset($this->jsdata[ $key ])
303
-            && ! is_array($this->jsdata[ $key ])
302
+        if (isset($this->jsdata[$key])
303
+            && ! is_array($this->jsdata[$key])
304 304
         ) {
305
-            if (! $this->debug()) {
305
+            if ( ! $this->debug()) {
306 306
                 return;
307 307
             }
308 308
             throw new InvalidArgumentException(
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
                 )
318 318
             );
319 319
         }
320
-        if ( ! isset( $this->jsdata[ $key ] ) ) {
321
-            $this->jsdata[ $key ] = is_array($value) ? $value : [$value];
320
+        if ( ! isset($this->jsdata[$key])) {
321
+            $this->jsdata[$key] = is_array($value) ? $value : [$value];
322 322
         } else {
323
-            $this->jsdata[ $key ] = array_merge( $this->jsdata[$key], (array) $value);
323
+            $this->jsdata[$key] = array_merge($this->jsdata[$key], (array) $value);
324 324
         }
325 325
     }
326 326
 
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
      */
336 336
     public function addTemplate($template_reference, $template_content)
337 337
     {
338
-        if (! isset($this->jsdata['templates'])) {
338
+        if ( ! isset($this->jsdata['templates'])) {
339 339
             $this->jsdata['templates'] = array();
340 340
         }
341 341
         //no overrides allowed.
342
-        if (isset($this->jsdata['templates'][ $template_reference ])) {
343
-            if (! $this->debug()) {
342
+        if (isset($this->jsdata['templates'][$template_reference])) {
343
+            if ( ! $this->debug()) {
344 344
                 return;
345 345
             }
346 346
             throw new InvalidArgumentException(
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
                 )
354 354
             );
355 355
         }
356
-        $this->jsdata['templates'][ $template_reference ] = $template_content;
356
+        $this->jsdata['templates'][$template_reference] = $template_content;
357 357
     }
358 358
 
359 359
 
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
      */
366 366
     public function getTemplate($template_reference)
367 367
     {
368
-        return isset($this->jsdata['templates'][ $template_reference ])
369
-            ? $this->jsdata['templates'][ $template_reference ]
368
+        return isset($this->jsdata['templates'][$template_reference])
369
+            ? $this->jsdata['templates'][$template_reference]
370 370
             : '';
371 371
     }
372 372
 
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
      */
380 380
     public function getData($key)
381 381
     {
382
-        return isset($this->jsdata[ $key ])
383
-            ? $this->jsdata[ $key ]
382
+        return isset($this->jsdata[$key])
383
+            ? $this->jsdata[$key]
384 384
             : false;
385 385
     }
386 386
 
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
      */
396 396
     protected function verifyDataNotExisting($key)
397 397
     {
398
-        if (isset($this->jsdata[ $key ])) {
399
-            if (! $this->debug()) {
398
+        if (isset($this->jsdata[$key])) {
399
+            if ( ! $this->debug()) {
400 400
                 return false;
401 401
             }
402
-            if (is_array($this->jsdata[ $key ])) {
402
+            if (is_array($this->jsdata[$key])) {
403 403
                 throw new InvalidArgumentException(
404 404
                     sprintf(
405 405
                         __(
@@ -442,11 +442,11 @@  discard block
 block discarded – undo
442 442
     public function getAssetUrl($namespace, $chunk_name, $asset_type)
443 443
     {
444 444
         $url = isset(
445
-            $this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ],
446
-            $this->manifest_data[ $namespace ]['url_base']
445
+            $this->manifest_data[$namespace][$chunk_name.'.'.$asset_type],
446
+            $this->manifest_data[$namespace]['url_base']
447 447
         )
448
-            ? $this->manifest_data[ $namespace ]['url_base']
449
-              . $this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ]
448
+            ? $this->manifest_data[$namespace]['url_base']
449
+              . $this->manifest_data[$namespace][$chunk_name.'.'.$asset_type]
450 450
             : $chunk_name;
451 451
 
452 452
         return apply_filters(
@@ -497,21 +497,21 @@  discard block
 block discarded – undo
497 497
      */
498 498
     private function getDependenciesForAsset($namespace, $chunk_name, $asset_type)
499 499
     {
500
-        $asset_index = $chunk_name . '.' . $asset_type;
501
-        if (! isset( $this->dependencies_data[ $namespace ][ $asset_index ])) {
502
-            $path = isset($this->manifest_data[ $namespace ]['path'])
503
-                ? $this->manifest_data[ $namespace ]['path']
500
+        $asset_index = $chunk_name.'.'.$asset_type;
501
+        if ( ! isset($this->dependencies_data[$namespace][$asset_index])) {
502
+            $path = isset($this->manifest_data[$namespace]['path'])
503
+                ? $this->manifest_data[$namespace]['path']
504 504
                 : '';
505
-            $dependencies_index = $chunk_name . '.' . Asset::TYPE_JSON;
506
-            $file_path = isset($this->manifest_data[ $namespace ][ $dependencies_index ])
507
-                ? $path . $this->manifest_data[ $namespace ][ $dependencies_index ]
505
+            $dependencies_index = $chunk_name.'.'.Asset::TYPE_JSON;
506
+            $file_path = isset($this->manifest_data[$namespace][$dependencies_index])
507
+                ? $path.$this->manifest_data[$namespace][$dependencies_index]
508 508
                 :
509 509
                 '';
510
-            $this->dependencies_data[ $namespace ][ $asset_index ] = $file_path !== '' && file_exists($file_path)
510
+            $this->dependencies_data[$namespace][$asset_index] = $file_path !== '' && file_exists($file_path)
511 511
                 ? $this->getDependenciesForAssetType($namespace, $asset_type, $file_path, $chunk_name)
512 512
                 : [];
513 513
         }
514
-        return $this->dependencies_data[ $namespace ][ $asset_index ];
514
+        return $this->dependencies_data[$namespace][$asset_index];
515 515
     }
516 516
 
517 517
 
@@ -533,32 +533,32 @@  discard block
 block discarded – undo
533 533
         if ($asset_type === Asset::TYPE_JS) {
534 534
             return $chunk_name === 'eejs-core' ? $asset_dependencies : array_merge(
535 535
                 $asset_dependencies,
536
-                [ CoreAssetManager::JS_HANDLE_JS_CORE ]
536
+                [CoreAssetManager::JS_HANDLE_JS_CORE]
537 537
             );
538 538
         }
539 539
         // for css we need to make sure there is actually a css file related to this chunk.
540
-        if (isset($this->manifest_data[ $namespace ])) {
540
+        if (isset($this->manifest_data[$namespace])) {
541 541
             // array of css chunk files for ee.
542 542
             $css_chunks = array_map(
543
-                function ($value) {
543
+                function($value) {
544 544
                     return str_replace('.css', '', $value);
545 545
                 },
546 546
                 array_filter(
547
-                    array_keys($this->manifest_data[ $namespace ]),
548
-                    function ($value) {
547
+                    array_keys($this->manifest_data[$namespace]),
548
+                    function($value) {
549 549
                         return strpos($value, '.css') !== false;
550 550
                     }
551 551
                 )
552 552
             );
553 553
             // add known wp chunks with css
554
-            $css_chunks = array_merge( $css_chunks, $this->wp_css_handle_dependencies);
554
+            $css_chunks = array_merge($css_chunks, $this->wp_css_handle_dependencies);
555 555
             // flip for easier search
556 556
             $css_chunks = array_flip($css_chunks);
557 557
             // now let's filter the dependencies for the incoming chunk to actual chunks that have styles
558 558
             return array_filter(
559 559
                 $asset_dependencies,
560
-                function ($chunk_name) use ($css_chunks) {
561
-                    return isset($css_chunks[ $chunk_name ]);
560
+                function($chunk_name) use ($css_chunks) {
561
+                    return isset($css_chunks[$chunk_name]);
562 562
                 }
563 563
             );
564 564
         }
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
             $this->registerManifestFile(
607 607
                 $manifest_file->assetNamespace(),
608 608
                 $manifest_file->urlBase(),
609
-                $manifest_file->filepath() . Registry::FILE_NAME_BUILD_MANIFEST,
609
+                $manifest_file->filepath().Registry::FILE_NAME_BUILD_MANIFEST,
610 610
                 $manifest_file->filepath()
611 611
             );
612 612
         }
@@ -627,8 +627,8 @@  discard block
 block discarded – undo
627 627
      */
628 628
     public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '')
629 629
     {
630
-        if (isset($this->manifest_data[ $namespace ])) {
631
-            if (! $this->debug()) {
630
+        if (isset($this->manifest_data[$namespace])) {
631
+            if ( ! $this->debug()) {
632 632
                 return;
633 633
             }
634 634
             throw new InvalidArgumentException(
@@ -661,12 +661,12 @@  discard block
 block discarded – undo
661 661
             }
662 662
             return;
663 663
         }
664
-        $this->manifest_data[ $namespace ] = $this->decodeManifestFile($manifest_file);
665
-        if (! isset($this->manifest_data[ $namespace ]['url_base'])) {
666
-            $this->manifest_data[ $namespace ]['url_base'] = trailingslashit($url_base);
664
+        $this->manifest_data[$namespace] = $this->decodeManifestFile($manifest_file);
665
+        if ( ! isset($this->manifest_data[$namespace]['url_base'])) {
666
+            $this->manifest_data[$namespace]['url_base'] = trailingslashit($url_base);
667 667
         }
668
-        if (! isset($this->manifest_data[ $namespace ]['path'])) {
669
-            $this->manifest_data[ $namespace ]['path'] = $manifest_file_path;
668
+        if ( ! isset($this->manifest_data[$namespace]['path'])) {
669
+            $this->manifest_data[$namespace]['path'] = $manifest_file_path;
670 670
         }
671 671
     }
672 672
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
      */
682 682
     private function decodeManifestFile($manifest_file)
683 683
     {
684
-        if (! file_exists($manifest_file)) {
684
+        if ( ! file_exists($manifest_file)) {
685 685
             throw new InvalidFilePathException($manifest_file);
686 686
         }
687 687
         return json_decode(file_get_contents($manifest_file), true);
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
      */
696 696
     private function addRegisteredScriptHandlesWithData($script_handle)
697 697
     {
698
-        $this->script_handles_with_data[ $script_handle ] = $script_handle;
698
+        $this->script_handles_with_data[$script_handle] = $script_handle;
699 699
     }
700 700
 
701 701
 
@@ -721,23 +721,23 @@  discard block
 block discarded – undo
721 721
      */
722 722
     private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
723 723
     {
724
-        if (isset($this->script_handles_with_data[ $script_handle ])) {
724
+        if (isset($this->script_handles_with_data[$script_handle])) {
725 725
             global $wp_scripts;
726 726
             $unset_handle = false;
727 727
             if ($wp_scripts->get_data($script_handle, 'data')) {
728
-                unset($wp_scripts->registered[ $script_handle ]->extra['data']);
728
+                unset($wp_scripts->registered[$script_handle]->extra['data']);
729 729
                 $unset_handle = true;
730 730
             }
731 731
             //deal with inline_scripts
732 732
             if ($wp_scripts->get_data($script_handle, 'before')) {
733
-                unset($wp_scripts->registered[ $script_handle ]->extra['before']);
733
+                unset($wp_scripts->registered[$script_handle]->extra['before']);
734 734
                 $unset_handle = true;
735 735
             }
736 736
             if ($wp_scripts->get_data($script_handle, 'after')) {
737
-                unset($wp_scripts->registered[ $script_handle ]->extra['after']);
737
+                unset($wp_scripts->registered[$script_handle]->extra['after']);
738 738
             }
739 739
             if ($unset_handle) {
740
-                unset($this->script_handles_with_data[ $script_handle ]);
740
+                unset($this->script_handles_with_data[$script_handle]);
741 741
             }
742 742
         }
743 743
     }
Please login to merge, or discard this patch.
Indentation   +731 added lines, -731 removed lines patch added patch discarded remove patch
@@ -27,742 +27,742 @@
 block discarded – undo
27 27
 class Registry
28 28
 {
29 29
 
30
-    const FILE_NAME_BUILD_MANIFEST = 'build-manifest.json';
31
-
32
-    /**
33
-     * @var AssetCollection $assets
34
-     */
35
-    protected $assets;
36
-
37
-    /**
38
-     * @var I18nRegistry
39
-     */
40
-    private $i18n_registry;
41
-
42
-    /**
43
-     * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.
44
-     *
45
-     * @var array
46
-     */
47
-    protected $jsdata = array();
48
-
49
-    /**
50
-     * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
51
-     * page source.
52
-     *
53
-     * @var array
54
-     */
55
-    private $script_handles_with_data = array();
56
-
57
-
58
-    /**
59
-     * Holds the manifest data obtained from registered manifest files.
60
-     * Manifests are maps of asset chunk name to actual built asset file names.
61
-     * Shape of this array is:
62
-     * array(
63
-     *  'some_namespace_slug' => array(
64
-     *      'some_chunk_name' => array(
65
-     *          'js' => 'filename.js'
66
-     *          'css' => 'filename.js'
67
-     *      ),
68
-     *      'url_base' => 'https://baseurl.com/to/assets
69
-     *  )
70
-     * )
71
-     *
72
-     * @var array
73
-     */
74
-    private $manifest_data = array();
75
-
76
-
77
-    /**
78
-     * Holds any dependency data obtained from registered dependency map json.
79
-     * Dependency map json is generated via the @wordpress/dependency-extraction-webpack-plugin via the webpack config.
80
-     * @see https://github.com/WordPress/gutenberg/tree/master/packages/dependency-extraction-webpack-plugin
81
-     *
82
-     * @var array
83
-     */
84
-    private $dependencies_data = [];
85
-
86
-
87
-    /**
88
-     * This is a known array of possible wp css handles that correspond to what may be exposed as dependencies in our
89
-     * build process.  Currently the dependency export process in webpack does not consider css imports, so we derive
90
-     * them via the js dependencies (WP uses the same handle for both js and css). This is a list of known handles that
91
-     * are used for both js and css.
92
-     * @var array
93
-     */
94
-    private $wp_css_handle_dependencies = [
95
-        'wp-components',
96
-        'wp-block-editor',
97
-        'wp-block-library',
98
-        'wp-edit-post',
99
-        'wp-edit-widgets',
100
-        'wp-editor',
101
-        'wp-format-library',
102
-        'wp-list-reusable-blocks',
103
-        'wp-nux',
104
-    ];
105
-
106
-
107
-    /**
108
-     * Registry constructor.
109
-     * Hooking into WP actions for script registry.
110
-     *
111
-     * @param AssetCollection      $assets
112
-     * @param I18nRegistry         $i18n_registry
113
-     * @throws InvalidArgumentException
114
-     * @throws InvalidDataTypeException
115
-     * @throws InvalidInterfaceException
116
-     */
117
-    public function __construct(AssetCollection $assets, I18nRegistry $i18n_registry)
118
-    {
119
-        $this->assets = $assets;
120
-        $this->i18n_registry = $i18n_registry;
121
-        add_action('wp_enqueue_scripts', array($this, 'registerManifestFiles'), 1);
122
-        add_action('admin_enqueue_scripts', array($this, 'registerManifestFiles'), 1);
123
-        add_action('wp_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 3);
124
-        add_action('admin_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 3);
125
-        add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 4);
126
-        add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 4);
127
-        add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1);
128
-        add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1);
129
-    }
130
-
131
-
132
-    /**
133
-     * For classes that have Registry as a dependency, this provides a handy way to register script handles for i18n
134
-     * translation handling.
135
-     *
136
-     * @return I18nRegistry
137
-     */
138
-    public function getI18nRegistry()
139
-    {
140
-        return $this->i18n_registry;
141
-    }
142
-
143
-
144
-    /**
145
-     * Callback for the wp_enqueue_scripts actions used to register assets.
146
-     *
147
-     * @since 4.9.62.p
148
-     * @throws Exception
149
-     */
150
-    public function registerScriptsAndStyles()
151
-    {
152
-        try {
153
-            $this->registerScripts($this->assets->getJavascriptAssets());
154
-            $this->registerStyles($this->assets->getStylesheetAssets());
155
-        } catch (Exception $exception) {
156
-            new ExceptionStackTraceDisplay($exception);
157
-        }
158
-    }
159
-
160
-
161
-    /**
162
-     * Registers JS assets with WP core
163
-     *
164
-     * @since 4.9.62.p
165
-     * @param JavascriptAsset[] $scripts
166
-     * @throws AssetRegistrationException
167
-     * @throws InvalidDataTypeException
168
-     */
169
-    public function registerScripts(array $scripts)
170
-    {
171
-        foreach ($scripts as $script) {
172
-            // skip to next script if this has already been done
173
-            if ($script->isRegistered()) {
174
-                continue;
175
-            }
176
-            do_action(
177
-                'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
178
-                $script
179
-            );
180
-            $registered = wp_register_script(
181
-                $script->handle(),
182
-                $script->source(),
183
-                $script->dependencies(),
184
-                $script->version(),
185
-                $script->loadInFooter()
186
-            );
187
-            if (! $registered && $this->debug()) {
188
-                throw new AssetRegistrationException($script->handle());
189
-            }
190
-            $script->setRegistered($registered);
191
-            if ($script->requiresTranslation()) {
192
-                $this->registerTranslation($script->handle());
193
-            }
194
-            do_action(
195
-                'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__after_script',
196
-                $script
197
-            );
198
-        }
199
-    }
200
-
201
-
202
-    /**
203
-     * Registers CSS assets with WP core
204
-     *
205
-     * @since 4.9.62.p
206
-     * @param StylesheetAsset[] $styles
207
-     * @throws InvalidDataTypeException
208
-     */
209
-    public function registerStyles(array $styles)
210
-    {
211
-        foreach ($styles as $style) {
212
-            // skip to next style if this has already been done
213
-            if ($style->isRegistered()) {
214
-                continue;
215
-            }
216
-            do_action(
217
-                'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__before_style',
218
-                $style
219
-            );
220
-            wp_register_style(
221
-                $style->handle(),
222
-                $style->source(),
223
-                $style->dependencies(),
224
-                $style->version(),
225
-                $style->media()
226
-            );
227
-            $style->setRegistered();
228
-            do_action(
229
-                'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__after_style',
230
-                $style
231
-            );
232
-        }
233
-    }
234
-
235
-
236
-    /**
237
-     * Call back for the script print in frontend and backend.
238
-     * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
239
-     *
240
-     * @since 4.9.31.rc.015
241
-     */
242
-    public function enqueueData()
243
-    {
244
-        $this->removeAlreadyRegisteredDataForScriptHandles();
245
-        wp_add_inline_script(
246
-            'eejs-core',
247
-            'var eejsdata=' . wp_json_encode(array('data' => $this->jsdata)),
248
-            'before'
249
-        );
250
-        $scripts = $this->assets->getJavascriptAssetsWithData();
251
-        foreach ($scripts as $script) {
252
-            $this->addRegisteredScriptHandlesWithData($script->handle());
253
-            if ($script->hasInlineDataCallback()) {
254
-                $localize = $script->inlineDataCallback();
255
-                $localize();
256
-            }
257
-        }
258
-    }
259
-
260
-
261
-    /**
262
-     * Used to add data to eejs.data object.
263
-     * Note:  Overriding existing data is not allowed.
264
-     * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
265
-     * If the data you add is something like this:
266
-     *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
267
-     * It will be exposed in the page source as:
268
-     *  eejs.data.my_plugin_data.foo == gar
269
-     *
270
-     * @param string       $key   Key used to access your data
271
-     * @param string|array $value Value to attach to key
272
-     * @throws InvalidArgumentException
273
-     */
274
-    public function addData($key, $value)
275
-    {
276
-        if ($this->verifyDataNotExisting($key)) {
277
-            $this->jsdata[ $key ] = $value;
278
-        }
279
-    }
280
-
281
-
282
-    /**
283
-     * Similar to addData except this allows for users to push values to an existing key where the values on key are
284
-     * elements in an array.
285
-     *
286
-     * When you use this method, the value you include will be merged with the array on $key.
287
-     * So if the $key was 'test' and you added a value of ['my_data'] then it would be represented in the javascript
288
-     * object like this, eejs.data.test = [ my_data,
289
-     * ]
290
-     * If there has already been a scalar value attached to the data object given key (via addData for instance), then
291
-     * this will throw an exception.
292
-     *
293
-     * Caution: Only add data using this method if you are okay with the potential for additional data added on the same
294
-     * key potentially overriding the existing data on merge (specifically with associative arrays).
295
-     *
296
-     * @param string       $key   Key to attach data to.
297
-     * @param string|array $value Value being registered.
298
-     * @throws InvalidArgumentException
299
-     */
300
-    public function pushData($key, $value)
301
-    {
302
-        if (isset($this->jsdata[ $key ])
303
-            && ! is_array($this->jsdata[ $key ])
304
-        ) {
305
-            if (! $this->debug()) {
306
-                return;
307
-            }
308
-            throw new InvalidArgumentException(
309
-                sprintf(
310
-                    __(
311
-                        'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
30
+	const FILE_NAME_BUILD_MANIFEST = 'build-manifest.json';
31
+
32
+	/**
33
+	 * @var AssetCollection $assets
34
+	 */
35
+	protected $assets;
36
+
37
+	/**
38
+	 * @var I18nRegistry
39
+	 */
40
+	private $i18n_registry;
41
+
42
+	/**
43
+	 * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.
44
+	 *
45
+	 * @var array
46
+	 */
47
+	protected $jsdata = array();
48
+
49
+	/**
50
+	 * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
51
+	 * page source.
52
+	 *
53
+	 * @var array
54
+	 */
55
+	private $script_handles_with_data = array();
56
+
57
+
58
+	/**
59
+	 * Holds the manifest data obtained from registered manifest files.
60
+	 * Manifests are maps of asset chunk name to actual built asset file names.
61
+	 * Shape of this array is:
62
+	 * array(
63
+	 *  'some_namespace_slug' => array(
64
+	 *      'some_chunk_name' => array(
65
+	 *          'js' => 'filename.js'
66
+	 *          'css' => 'filename.js'
67
+	 *      ),
68
+	 *      'url_base' => 'https://baseurl.com/to/assets
69
+	 *  )
70
+	 * )
71
+	 *
72
+	 * @var array
73
+	 */
74
+	private $manifest_data = array();
75
+
76
+
77
+	/**
78
+	 * Holds any dependency data obtained from registered dependency map json.
79
+	 * Dependency map json is generated via the @wordpress/dependency-extraction-webpack-plugin via the webpack config.
80
+	 * @see https://github.com/WordPress/gutenberg/tree/master/packages/dependency-extraction-webpack-plugin
81
+	 *
82
+	 * @var array
83
+	 */
84
+	private $dependencies_data = [];
85
+
86
+
87
+	/**
88
+	 * This is a known array of possible wp css handles that correspond to what may be exposed as dependencies in our
89
+	 * build process.  Currently the dependency export process in webpack does not consider css imports, so we derive
90
+	 * them via the js dependencies (WP uses the same handle for both js and css). This is a list of known handles that
91
+	 * are used for both js and css.
92
+	 * @var array
93
+	 */
94
+	private $wp_css_handle_dependencies = [
95
+		'wp-components',
96
+		'wp-block-editor',
97
+		'wp-block-library',
98
+		'wp-edit-post',
99
+		'wp-edit-widgets',
100
+		'wp-editor',
101
+		'wp-format-library',
102
+		'wp-list-reusable-blocks',
103
+		'wp-nux',
104
+	];
105
+
106
+
107
+	/**
108
+	 * Registry constructor.
109
+	 * Hooking into WP actions for script registry.
110
+	 *
111
+	 * @param AssetCollection      $assets
112
+	 * @param I18nRegistry         $i18n_registry
113
+	 * @throws InvalidArgumentException
114
+	 * @throws InvalidDataTypeException
115
+	 * @throws InvalidInterfaceException
116
+	 */
117
+	public function __construct(AssetCollection $assets, I18nRegistry $i18n_registry)
118
+	{
119
+		$this->assets = $assets;
120
+		$this->i18n_registry = $i18n_registry;
121
+		add_action('wp_enqueue_scripts', array($this, 'registerManifestFiles'), 1);
122
+		add_action('admin_enqueue_scripts', array($this, 'registerManifestFiles'), 1);
123
+		add_action('wp_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 3);
124
+		add_action('admin_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 3);
125
+		add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 4);
126
+		add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 4);
127
+		add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1);
128
+		add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1);
129
+	}
130
+
131
+
132
+	/**
133
+	 * For classes that have Registry as a dependency, this provides a handy way to register script handles for i18n
134
+	 * translation handling.
135
+	 *
136
+	 * @return I18nRegistry
137
+	 */
138
+	public function getI18nRegistry()
139
+	{
140
+		return $this->i18n_registry;
141
+	}
142
+
143
+
144
+	/**
145
+	 * Callback for the wp_enqueue_scripts actions used to register assets.
146
+	 *
147
+	 * @since 4.9.62.p
148
+	 * @throws Exception
149
+	 */
150
+	public function registerScriptsAndStyles()
151
+	{
152
+		try {
153
+			$this->registerScripts($this->assets->getJavascriptAssets());
154
+			$this->registerStyles($this->assets->getStylesheetAssets());
155
+		} catch (Exception $exception) {
156
+			new ExceptionStackTraceDisplay($exception);
157
+		}
158
+	}
159
+
160
+
161
+	/**
162
+	 * Registers JS assets with WP core
163
+	 *
164
+	 * @since 4.9.62.p
165
+	 * @param JavascriptAsset[] $scripts
166
+	 * @throws AssetRegistrationException
167
+	 * @throws InvalidDataTypeException
168
+	 */
169
+	public function registerScripts(array $scripts)
170
+	{
171
+		foreach ($scripts as $script) {
172
+			// skip to next script if this has already been done
173
+			if ($script->isRegistered()) {
174
+				continue;
175
+			}
176
+			do_action(
177
+				'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
178
+				$script
179
+			);
180
+			$registered = wp_register_script(
181
+				$script->handle(),
182
+				$script->source(),
183
+				$script->dependencies(),
184
+				$script->version(),
185
+				$script->loadInFooter()
186
+			);
187
+			if (! $registered && $this->debug()) {
188
+				throw new AssetRegistrationException($script->handle());
189
+			}
190
+			$script->setRegistered($registered);
191
+			if ($script->requiresTranslation()) {
192
+				$this->registerTranslation($script->handle());
193
+			}
194
+			do_action(
195
+				'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__after_script',
196
+				$script
197
+			);
198
+		}
199
+	}
200
+
201
+
202
+	/**
203
+	 * Registers CSS assets with WP core
204
+	 *
205
+	 * @since 4.9.62.p
206
+	 * @param StylesheetAsset[] $styles
207
+	 * @throws InvalidDataTypeException
208
+	 */
209
+	public function registerStyles(array $styles)
210
+	{
211
+		foreach ($styles as $style) {
212
+			// skip to next style if this has already been done
213
+			if ($style->isRegistered()) {
214
+				continue;
215
+			}
216
+			do_action(
217
+				'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__before_style',
218
+				$style
219
+			);
220
+			wp_register_style(
221
+				$style->handle(),
222
+				$style->source(),
223
+				$style->dependencies(),
224
+				$style->version(),
225
+				$style->media()
226
+			);
227
+			$style->setRegistered();
228
+			do_action(
229
+				'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__after_style',
230
+				$style
231
+			);
232
+		}
233
+	}
234
+
235
+
236
+	/**
237
+	 * Call back for the script print in frontend and backend.
238
+	 * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
239
+	 *
240
+	 * @since 4.9.31.rc.015
241
+	 */
242
+	public function enqueueData()
243
+	{
244
+		$this->removeAlreadyRegisteredDataForScriptHandles();
245
+		wp_add_inline_script(
246
+			'eejs-core',
247
+			'var eejsdata=' . wp_json_encode(array('data' => $this->jsdata)),
248
+			'before'
249
+		);
250
+		$scripts = $this->assets->getJavascriptAssetsWithData();
251
+		foreach ($scripts as $script) {
252
+			$this->addRegisteredScriptHandlesWithData($script->handle());
253
+			if ($script->hasInlineDataCallback()) {
254
+				$localize = $script->inlineDataCallback();
255
+				$localize();
256
+			}
257
+		}
258
+	}
259
+
260
+
261
+	/**
262
+	 * Used to add data to eejs.data object.
263
+	 * Note:  Overriding existing data is not allowed.
264
+	 * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
265
+	 * If the data you add is something like this:
266
+	 *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
267
+	 * It will be exposed in the page source as:
268
+	 *  eejs.data.my_plugin_data.foo == gar
269
+	 *
270
+	 * @param string       $key   Key used to access your data
271
+	 * @param string|array $value Value to attach to key
272
+	 * @throws InvalidArgumentException
273
+	 */
274
+	public function addData($key, $value)
275
+	{
276
+		if ($this->verifyDataNotExisting($key)) {
277
+			$this->jsdata[ $key ] = $value;
278
+		}
279
+	}
280
+
281
+
282
+	/**
283
+	 * Similar to addData except this allows for users to push values to an existing key where the values on key are
284
+	 * elements in an array.
285
+	 *
286
+	 * When you use this method, the value you include will be merged with the array on $key.
287
+	 * So if the $key was 'test' and you added a value of ['my_data'] then it would be represented in the javascript
288
+	 * object like this, eejs.data.test = [ my_data,
289
+	 * ]
290
+	 * If there has already been a scalar value attached to the data object given key (via addData for instance), then
291
+	 * this will throw an exception.
292
+	 *
293
+	 * Caution: Only add data using this method if you are okay with the potential for additional data added on the same
294
+	 * key potentially overriding the existing data on merge (specifically with associative arrays).
295
+	 *
296
+	 * @param string       $key   Key to attach data to.
297
+	 * @param string|array $value Value being registered.
298
+	 * @throws InvalidArgumentException
299
+	 */
300
+	public function pushData($key, $value)
301
+	{
302
+		if (isset($this->jsdata[ $key ])
303
+			&& ! is_array($this->jsdata[ $key ])
304
+		) {
305
+			if (! $this->debug()) {
306
+				return;
307
+			}
308
+			throw new InvalidArgumentException(
309
+				sprintf(
310
+					__(
311
+						'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
312 312
                          push values to this data element when it is an array.',
313
-                        'event_espresso'
314
-                    ),
315
-                    $key,
316
-                    __METHOD__
317
-                )
318
-            );
319
-        }
320
-        if ( ! isset( $this->jsdata[ $key ] ) ) {
321
-            $this->jsdata[ $key ] = is_array($value) ? $value : [$value];
322
-        } else {
323
-            $this->jsdata[ $key ] = array_merge( $this->jsdata[$key], (array) $value);
324
-        }
325
-    }
326
-
327
-
328
-    /**
329
-     * Used to set content used by javascript for a template.
330
-     * Note: Overrides of existing registered templates are not allowed.
331
-     *
332
-     * @param string $template_reference
333
-     * @param string $template_content
334
-     * @throws InvalidArgumentException
335
-     */
336
-    public function addTemplate($template_reference, $template_content)
337
-    {
338
-        if (! isset($this->jsdata['templates'])) {
339
-            $this->jsdata['templates'] = array();
340
-        }
341
-        //no overrides allowed.
342
-        if (isset($this->jsdata['templates'][ $template_reference ])) {
343
-            if (! $this->debug()) {
344
-                return;
345
-            }
346
-            throw new InvalidArgumentException(
347
-                sprintf(
348
-                    __(
349
-                        'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
350
-                        'event_espresso'
351
-                    ),
352
-                    $template_reference
353
-                )
354
-            );
355
-        }
356
-        $this->jsdata['templates'][ $template_reference ] = $template_content;
357
-    }
358
-
359
-
360
-    /**
361
-     * Retrieve the template content already registered for the given reference.
362
-     *
363
-     * @param string $template_reference
364
-     * @return string
365
-     */
366
-    public function getTemplate($template_reference)
367
-    {
368
-        return isset($this->jsdata['templates'][ $template_reference ])
369
-            ? $this->jsdata['templates'][ $template_reference ]
370
-            : '';
371
-    }
372
-
373
-
374
-    /**
375
-     * Retrieve registered data.
376
-     *
377
-     * @param string $key Name of key to attach data to.
378
-     * @return mixed                If there is no for the given key, then false is returned.
379
-     */
380
-    public function getData($key)
381
-    {
382
-        return isset($this->jsdata[ $key ])
383
-            ? $this->jsdata[ $key ]
384
-            : false;
385
-    }
386
-
387
-
388
-    /**
389
-     * Verifies whether the given data exists already on the jsdata array.
390
-     * Overriding data is not allowed.
391
-     *
392
-     * @param string $key Index for data.
393
-     * @return bool        If valid then return true.
394
-     * @throws InvalidArgumentException if data already exists.
395
-     */
396
-    protected function verifyDataNotExisting($key)
397
-    {
398
-        if (isset($this->jsdata[ $key ])) {
399
-            if (! $this->debug()) {
400
-                return false;
401
-            }
402
-            if (is_array($this->jsdata[ $key ])) {
403
-                throw new InvalidArgumentException(
404
-                    sprintf(
405
-                        __(
406
-                            'The value for %1$s already exists in the Registry::eejs object.
313
+						'event_espresso'
314
+					),
315
+					$key,
316
+					__METHOD__
317
+				)
318
+			);
319
+		}
320
+		if ( ! isset( $this->jsdata[ $key ] ) ) {
321
+			$this->jsdata[ $key ] = is_array($value) ? $value : [$value];
322
+		} else {
323
+			$this->jsdata[ $key ] = array_merge( $this->jsdata[$key], (array) $value);
324
+		}
325
+	}
326
+
327
+
328
+	/**
329
+	 * Used to set content used by javascript for a template.
330
+	 * Note: Overrides of existing registered templates are not allowed.
331
+	 *
332
+	 * @param string $template_reference
333
+	 * @param string $template_content
334
+	 * @throws InvalidArgumentException
335
+	 */
336
+	public function addTemplate($template_reference, $template_content)
337
+	{
338
+		if (! isset($this->jsdata['templates'])) {
339
+			$this->jsdata['templates'] = array();
340
+		}
341
+		//no overrides allowed.
342
+		if (isset($this->jsdata['templates'][ $template_reference ])) {
343
+			if (! $this->debug()) {
344
+				return;
345
+			}
346
+			throw new InvalidArgumentException(
347
+				sprintf(
348
+					__(
349
+						'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
350
+						'event_espresso'
351
+					),
352
+					$template_reference
353
+				)
354
+			);
355
+		}
356
+		$this->jsdata['templates'][ $template_reference ] = $template_content;
357
+	}
358
+
359
+
360
+	/**
361
+	 * Retrieve the template content already registered for the given reference.
362
+	 *
363
+	 * @param string $template_reference
364
+	 * @return string
365
+	 */
366
+	public function getTemplate($template_reference)
367
+	{
368
+		return isset($this->jsdata['templates'][ $template_reference ])
369
+			? $this->jsdata['templates'][ $template_reference ]
370
+			: '';
371
+	}
372
+
373
+
374
+	/**
375
+	 * Retrieve registered data.
376
+	 *
377
+	 * @param string $key Name of key to attach data to.
378
+	 * @return mixed                If there is no for the given key, then false is returned.
379
+	 */
380
+	public function getData($key)
381
+	{
382
+		return isset($this->jsdata[ $key ])
383
+			? $this->jsdata[ $key ]
384
+			: false;
385
+	}
386
+
387
+
388
+	/**
389
+	 * Verifies whether the given data exists already on the jsdata array.
390
+	 * Overriding data is not allowed.
391
+	 *
392
+	 * @param string $key Index for data.
393
+	 * @return bool        If valid then return true.
394
+	 * @throws InvalidArgumentException if data already exists.
395
+	 */
396
+	protected function verifyDataNotExisting($key)
397
+	{
398
+		if (isset($this->jsdata[ $key ])) {
399
+			if (! $this->debug()) {
400
+				return false;
401
+			}
402
+			if (is_array($this->jsdata[ $key ])) {
403
+				throw new InvalidArgumentException(
404
+					sprintf(
405
+						__(
406
+							'The value for %1$s already exists in the Registry::eejs object.
407 407
                             Overrides are not allowed. Since the value of this data is an array, you may want to use the
408 408
                             %2$s method to push your value to the array.',
409
-                            'event_espresso'
410
-                        ),
411
-                        $key,
412
-                        'pushData()'
413
-                    )
414
-                );
415
-            }
416
-            throw new InvalidArgumentException(
417
-                sprintf(
418
-                    __(
419
-                        'The value for %1$s already exists in the Registry::eejs object. Overrides are not
409
+							'event_espresso'
410
+						),
411
+						$key,
412
+						'pushData()'
413
+					)
414
+				);
415
+			}
416
+			throw new InvalidArgumentException(
417
+				sprintf(
418
+					__(
419
+						'The value for %1$s already exists in the Registry::eejs object. Overrides are not
420 420
                         allowed.  Consider attaching your value to a different key',
421
-                        'event_espresso'
422
-                    ),
423
-                    $key
424
-                )
425
-            );
426
-        }
427
-        return true;
428
-    }
429
-
430
-
431
-    /**
432
-     * Get the actual asset path for asset manifests.
433
-     * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.
434
-     *
435
-     * @param string $namespace  The namespace associated with the manifest file hosting the map of chunk_name to actual
436
-     *                           asset file location.
437
-     * @param string $chunk_name
438
-     * @param string $asset_type
439
-     * @return string
440
-     * @since 4.9.59.p
441
-     */
442
-    public function getAssetUrl($namespace, $chunk_name, $asset_type)
443
-    {
444
-        $url = isset(
445
-            $this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ],
446
-            $this->manifest_data[ $namespace ]['url_base']
447
-        )
448
-            ? $this->manifest_data[ $namespace ]['url_base']
449
-              . $this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ]
450
-            : $chunk_name;
451
-
452
-        return apply_filters(
453
-            'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',
454
-            $url,
455
-            $namespace,
456
-            $chunk_name,
457
-            $asset_type
458
-        );
459
-    }
460
-
461
-
462
-
463
-    /**
464
-     * Return the url to a js file for the given namespace and chunk name.
465
-     *
466
-     * @param string $namespace
467
-     * @param string $chunk_name
468
-     * @return string
469
-     */
470
-    public function getJsUrl($namespace, $chunk_name)
471
-    {
472
-        return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_JS);
473
-    }
474
-
475
-
476
-    /**
477
-     * Return the url to a css file for the given namespace and chunk name.
478
-     *
479
-     * @param string $namespace
480
-     * @param string $chunk_name
481
-     * @return string
482
-     */
483
-    public function getCssUrl($namespace, $chunk_name)
484
-    {
485
-        return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_CSS);
486
-    }
487
-
488
-
489
-    /**
490
-     * Return the dependencies for a given asset $chunk_name
491
-     *
492
-     * @param string $namespace
493
-     * @param string $chunk_name
494
-     * @param string $asset_type
495
-     * @return array
496
-     * @since 4.9.82.p
497
-     */
498
-    private function getDependenciesForAsset($namespace, $chunk_name, $asset_type)
499
-    {
500
-        $asset_index = $chunk_name . '.' . $asset_type;
501
-        if (! isset( $this->dependencies_data[ $namespace ][ $asset_index ])) {
502
-            $path = isset($this->manifest_data[ $namespace ]['path'])
503
-                ? $this->manifest_data[ $namespace ]['path']
504
-                : '';
505
-            $dependencies_index = $chunk_name . '.' . Asset::TYPE_JSON;
506
-            $file_path = isset($this->manifest_data[ $namespace ][ $dependencies_index ])
507
-                ? $path . $this->manifest_data[ $namespace ][ $dependencies_index ]
508
-                :
509
-                '';
510
-            $this->dependencies_data[ $namespace ][ $asset_index ] = $file_path !== '' && file_exists($file_path)
511
-                ? $this->getDependenciesForAssetType($namespace, $asset_type, $file_path, $chunk_name)
512
-                : [];
513
-        }
514
-        return $this->dependencies_data[ $namespace ][ $asset_index ];
515
-    }
516
-
517
-
518
-    /**
519
-     * Return dependencies according to asset type.
520
-     *
521
-     * For css assets, this filters the auto generated dependencies by css type.
522
-     *
523
-     * @param string $namespace
524
-     * @param string $asset_type
525
-     * @param string $file_path
526
-     * @param string $chunk_name
527
-     * @return array
528
-     * @since 4.9.82.p
529
-     */
530
-    private function getDependenciesForAssetType($namespace, $asset_type, $file_path, $chunk_name)
531
-    {
532
-        $asset_dependencies = json_decode(file_get_contents($file_path), true);
533
-        if ($asset_type === Asset::TYPE_JS) {
534
-            return $chunk_name === 'eejs-core' ? $asset_dependencies : array_merge(
535
-                $asset_dependencies,
536
-                [ CoreAssetManager::JS_HANDLE_JS_CORE ]
537
-            );
538
-        }
539
-        // for css we need to make sure there is actually a css file related to this chunk.
540
-        if (isset($this->manifest_data[ $namespace ])) {
541
-            // array of css chunk files for ee.
542
-            $css_chunks = array_map(
543
-                function ($value) {
544
-                    return str_replace('.css', '', $value);
545
-                },
546
-                array_filter(
547
-                    array_keys($this->manifest_data[ $namespace ]),
548
-                    function ($value) {
549
-                        return strpos($value, '.css') !== false;
550
-                    }
551
-                )
552
-            );
553
-            // add known wp chunks with css
554
-            $css_chunks = array_merge( $css_chunks, $this->wp_css_handle_dependencies);
555
-            // flip for easier search
556
-            $css_chunks = array_flip($css_chunks);
557
-            // now let's filter the dependencies for the incoming chunk to actual chunks that have styles
558
-            return array_filter(
559
-                $asset_dependencies,
560
-                function ($chunk_name) use ($css_chunks) {
561
-                    return isset($css_chunks[ $chunk_name ]);
562
-                }
563
-            );
564
-        }
565
-        return [];
566
-    }
567
-
568
-
569
-    /**
570
-     * Get the dependencies array for the given js asset chunk name
571
-     *
572
-     * @param string $namespace
573
-     * @param string $chunk_name
574
-     * @return array
575
-     * @since 4.9.82.p
576
-     */
577
-    public function getJsDependencies($namespace, $chunk_name)
578
-    {
579
-        return $this->getDependenciesForAsset($namespace, $chunk_name, Asset::TYPE_JS);
580
-    }
581
-
582
-
583
-    /**
584
-     * Get the dependencies array for the given css asset chunk name
585
-     *
586
-     * @param string $namespace
587
-     * @param string $chunk_name
588
-     * @return array
589
-     * @since 4.9.82.p
590
-     */
591
-    public function getCssDependencies($namespace, $chunk_name)
592
-    {
593
-        return $this->getDependenciesForAsset($namespace, $chunk_name, Asset::TYPE_CSS);
594
-    }
595
-
596
-
597
-    /**
598
-     * @since 4.9.62.p
599
-     * @throws InvalidArgumentException
600
-     * @throws InvalidFilePathException
601
-     */
602
-    public function registerManifestFiles()
603
-    {
604
-        $manifest_files = $this->assets->getManifestFiles();
605
-        foreach ($manifest_files as $manifest_file) {
606
-            $this->registerManifestFile(
607
-                $manifest_file->assetNamespace(),
608
-                $manifest_file->urlBase(),
609
-                $manifest_file->filepath() . Registry::FILE_NAME_BUILD_MANIFEST,
610
-                $manifest_file->filepath()
611
-            );
612
-        }
613
-    }
614
-
615
-
616
-    /**
617
-     * Used to register a js/css manifest file with the registered_manifest_files property.
618
-     *
619
-     * @param string $namespace     Provided to associate the manifest file with a specific namespace.
620
-     * @param string $url_base      The url base for the manifest file location.
621
-     * @param string $manifest_file The absolute path to the manifest file.
622
-     * @param string $manifest_file_path  The path to the folder containing the manifest file. If not provided will be
623
-     *                                    default to `plugin_root/assets/dist`.
624
-     * @throws InvalidArgumentException
625
-     * @throws InvalidFilePathException
626
-     * @since 4.9.59.p
627
-     */
628
-    public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '')
629
-    {
630
-        if (isset($this->manifest_data[ $namespace ])) {
631
-            if (! $this->debug()) {
632
-                return;
633
-            }
634
-            throw new InvalidArgumentException(
635
-                sprintf(
636
-                    esc_html__(
637
-                        'The namespace for this manifest file has already been registered, choose a namespace other than %s',
638
-                        'event_espresso'
639
-                    ),
640
-                    $namespace
641
-                )
642
-            );
643
-        }
644
-        if (filter_var($url_base, FILTER_VALIDATE_URL) === false) {
645
-            if (is_admin()) {
646
-                EE_Error::add_error(
647
-                    sprintf(
648
-                        esc_html__(
649
-                            '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',
650
-                            'event_espresso'
651
-                        ),
652
-                        'Event Espresso',
653
-                        $url_base,
654
-                        'plugins_url',
655
-                        'WP_PLUGIN_URL'
656
-                    ),
657
-                    __FILE__,
658
-                    __FUNCTION__,
659
-                    __LINE__
660
-                );
661
-            }
662
-            return;
663
-        }
664
-        $this->manifest_data[ $namespace ] = $this->decodeManifestFile($manifest_file);
665
-        if (! isset($this->manifest_data[ $namespace ]['url_base'])) {
666
-            $this->manifest_data[ $namespace ]['url_base'] = trailingslashit($url_base);
667
-        }
668
-        if (! isset($this->manifest_data[ $namespace ]['path'])) {
669
-            $this->manifest_data[ $namespace ]['path'] = $manifest_file_path;
670
-        }
671
-    }
672
-
673
-
674
-    /**
675
-     * Decodes json from the provided manifest file.
676
-     *
677
-     * @since 4.9.59.p
678
-     * @param string $manifest_file Path to manifest file.
679
-     * @return array
680
-     * @throws InvalidFilePathException
681
-     */
682
-    private function decodeManifestFile($manifest_file)
683
-    {
684
-        if (! file_exists($manifest_file)) {
685
-            throw new InvalidFilePathException($manifest_file);
686
-        }
687
-        return json_decode(file_get_contents($manifest_file), true);
688
-    }
689
-
690
-
691
-    /**
692
-     * This is used to set registered script handles that have data.
693
-     *
694
-     * @param string $script_handle
695
-     */
696
-    private function addRegisteredScriptHandlesWithData($script_handle)
697
-    {
698
-        $this->script_handles_with_data[ $script_handle ] = $script_handle;
699
-    }
700
-
701
-
702
-    /**i
421
+						'event_espresso'
422
+					),
423
+					$key
424
+				)
425
+			);
426
+		}
427
+		return true;
428
+	}
429
+
430
+
431
+	/**
432
+	 * Get the actual asset path for asset manifests.
433
+	 * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.
434
+	 *
435
+	 * @param string $namespace  The namespace associated with the manifest file hosting the map of chunk_name to actual
436
+	 *                           asset file location.
437
+	 * @param string $chunk_name
438
+	 * @param string $asset_type
439
+	 * @return string
440
+	 * @since 4.9.59.p
441
+	 */
442
+	public function getAssetUrl($namespace, $chunk_name, $asset_type)
443
+	{
444
+		$url = isset(
445
+			$this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ],
446
+			$this->manifest_data[ $namespace ]['url_base']
447
+		)
448
+			? $this->manifest_data[ $namespace ]['url_base']
449
+			  . $this->manifest_data[ $namespace ][ $chunk_name . '.' . $asset_type ]
450
+			: $chunk_name;
451
+
452
+		return apply_filters(
453
+			'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',
454
+			$url,
455
+			$namespace,
456
+			$chunk_name,
457
+			$asset_type
458
+		);
459
+	}
460
+
461
+
462
+
463
+	/**
464
+	 * Return the url to a js file for the given namespace and chunk name.
465
+	 *
466
+	 * @param string $namespace
467
+	 * @param string $chunk_name
468
+	 * @return string
469
+	 */
470
+	public function getJsUrl($namespace, $chunk_name)
471
+	{
472
+		return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_JS);
473
+	}
474
+
475
+
476
+	/**
477
+	 * Return the url to a css file for the given namespace and chunk name.
478
+	 *
479
+	 * @param string $namespace
480
+	 * @param string $chunk_name
481
+	 * @return string
482
+	 */
483
+	public function getCssUrl($namespace, $chunk_name)
484
+	{
485
+		return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_CSS);
486
+	}
487
+
488
+
489
+	/**
490
+	 * Return the dependencies for a given asset $chunk_name
491
+	 *
492
+	 * @param string $namespace
493
+	 * @param string $chunk_name
494
+	 * @param string $asset_type
495
+	 * @return array
496
+	 * @since 4.9.82.p
497
+	 */
498
+	private function getDependenciesForAsset($namespace, $chunk_name, $asset_type)
499
+	{
500
+		$asset_index = $chunk_name . '.' . $asset_type;
501
+		if (! isset( $this->dependencies_data[ $namespace ][ $asset_index ])) {
502
+			$path = isset($this->manifest_data[ $namespace ]['path'])
503
+				? $this->manifest_data[ $namespace ]['path']
504
+				: '';
505
+			$dependencies_index = $chunk_name . '.' . Asset::TYPE_JSON;
506
+			$file_path = isset($this->manifest_data[ $namespace ][ $dependencies_index ])
507
+				? $path . $this->manifest_data[ $namespace ][ $dependencies_index ]
508
+				:
509
+				'';
510
+			$this->dependencies_data[ $namespace ][ $asset_index ] = $file_path !== '' && file_exists($file_path)
511
+				? $this->getDependenciesForAssetType($namespace, $asset_type, $file_path, $chunk_name)
512
+				: [];
513
+		}
514
+		return $this->dependencies_data[ $namespace ][ $asset_index ];
515
+	}
516
+
517
+
518
+	/**
519
+	 * Return dependencies according to asset type.
520
+	 *
521
+	 * For css assets, this filters the auto generated dependencies by css type.
522
+	 *
523
+	 * @param string $namespace
524
+	 * @param string $asset_type
525
+	 * @param string $file_path
526
+	 * @param string $chunk_name
527
+	 * @return array
528
+	 * @since 4.9.82.p
529
+	 */
530
+	private function getDependenciesForAssetType($namespace, $asset_type, $file_path, $chunk_name)
531
+	{
532
+		$asset_dependencies = json_decode(file_get_contents($file_path), true);
533
+		if ($asset_type === Asset::TYPE_JS) {
534
+			return $chunk_name === 'eejs-core' ? $asset_dependencies : array_merge(
535
+				$asset_dependencies,
536
+				[ CoreAssetManager::JS_HANDLE_JS_CORE ]
537
+			);
538
+		}
539
+		// for css we need to make sure there is actually a css file related to this chunk.
540
+		if (isset($this->manifest_data[ $namespace ])) {
541
+			// array of css chunk files for ee.
542
+			$css_chunks = array_map(
543
+				function ($value) {
544
+					return str_replace('.css', '', $value);
545
+				},
546
+				array_filter(
547
+					array_keys($this->manifest_data[ $namespace ]),
548
+					function ($value) {
549
+						return strpos($value, '.css') !== false;
550
+					}
551
+				)
552
+			);
553
+			// add known wp chunks with css
554
+			$css_chunks = array_merge( $css_chunks, $this->wp_css_handle_dependencies);
555
+			// flip for easier search
556
+			$css_chunks = array_flip($css_chunks);
557
+			// now let's filter the dependencies for the incoming chunk to actual chunks that have styles
558
+			return array_filter(
559
+				$asset_dependencies,
560
+				function ($chunk_name) use ($css_chunks) {
561
+					return isset($css_chunks[ $chunk_name ]);
562
+				}
563
+			);
564
+		}
565
+		return [];
566
+	}
567
+
568
+
569
+	/**
570
+	 * Get the dependencies array for the given js asset chunk name
571
+	 *
572
+	 * @param string $namespace
573
+	 * @param string $chunk_name
574
+	 * @return array
575
+	 * @since 4.9.82.p
576
+	 */
577
+	public function getJsDependencies($namespace, $chunk_name)
578
+	{
579
+		return $this->getDependenciesForAsset($namespace, $chunk_name, Asset::TYPE_JS);
580
+	}
581
+
582
+
583
+	/**
584
+	 * Get the dependencies array for the given css asset chunk name
585
+	 *
586
+	 * @param string $namespace
587
+	 * @param string $chunk_name
588
+	 * @return array
589
+	 * @since 4.9.82.p
590
+	 */
591
+	public function getCssDependencies($namespace, $chunk_name)
592
+	{
593
+		return $this->getDependenciesForAsset($namespace, $chunk_name, Asset::TYPE_CSS);
594
+	}
595
+
596
+
597
+	/**
598
+	 * @since 4.9.62.p
599
+	 * @throws InvalidArgumentException
600
+	 * @throws InvalidFilePathException
601
+	 */
602
+	public function registerManifestFiles()
603
+	{
604
+		$manifest_files = $this->assets->getManifestFiles();
605
+		foreach ($manifest_files as $manifest_file) {
606
+			$this->registerManifestFile(
607
+				$manifest_file->assetNamespace(),
608
+				$manifest_file->urlBase(),
609
+				$manifest_file->filepath() . Registry::FILE_NAME_BUILD_MANIFEST,
610
+				$manifest_file->filepath()
611
+			);
612
+		}
613
+	}
614
+
615
+
616
+	/**
617
+	 * Used to register a js/css manifest file with the registered_manifest_files property.
618
+	 *
619
+	 * @param string $namespace     Provided to associate the manifest file with a specific namespace.
620
+	 * @param string $url_base      The url base for the manifest file location.
621
+	 * @param string $manifest_file The absolute path to the manifest file.
622
+	 * @param string $manifest_file_path  The path to the folder containing the manifest file. If not provided will be
623
+	 *                                    default to `plugin_root/assets/dist`.
624
+	 * @throws InvalidArgumentException
625
+	 * @throws InvalidFilePathException
626
+	 * @since 4.9.59.p
627
+	 */
628
+	public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '')
629
+	{
630
+		if (isset($this->manifest_data[ $namespace ])) {
631
+			if (! $this->debug()) {
632
+				return;
633
+			}
634
+			throw new InvalidArgumentException(
635
+				sprintf(
636
+					esc_html__(
637
+						'The namespace for this manifest file has already been registered, choose a namespace other than %s',
638
+						'event_espresso'
639
+					),
640
+					$namespace
641
+				)
642
+			);
643
+		}
644
+		if (filter_var($url_base, FILTER_VALIDATE_URL) === false) {
645
+			if (is_admin()) {
646
+				EE_Error::add_error(
647
+					sprintf(
648
+						esc_html__(
649
+							'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',
650
+							'event_espresso'
651
+						),
652
+						'Event Espresso',
653
+						$url_base,
654
+						'plugins_url',
655
+						'WP_PLUGIN_URL'
656
+					),
657
+					__FILE__,
658
+					__FUNCTION__,
659
+					__LINE__
660
+				);
661
+			}
662
+			return;
663
+		}
664
+		$this->manifest_data[ $namespace ] = $this->decodeManifestFile($manifest_file);
665
+		if (! isset($this->manifest_data[ $namespace ]['url_base'])) {
666
+			$this->manifest_data[ $namespace ]['url_base'] = trailingslashit($url_base);
667
+		}
668
+		if (! isset($this->manifest_data[ $namespace ]['path'])) {
669
+			$this->manifest_data[ $namespace ]['path'] = $manifest_file_path;
670
+		}
671
+	}
672
+
673
+
674
+	/**
675
+	 * Decodes json from the provided manifest file.
676
+	 *
677
+	 * @since 4.9.59.p
678
+	 * @param string $manifest_file Path to manifest file.
679
+	 * @return array
680
+	 * @throws InvalidFilePathException
681
+	 */
682
+	private function decodeManifestFile($manifest_file)
683
+	{
684
+		if (! file_exists($manifest_file)) {
685
+			throw new InvalidFilePathException($manifest_file);
686
+		}
687
+		return json_decode(file_get_contents($manifest_file), true);
688
+	}
689
+
690
+
691
+	/**
692
+	 * This is used to set registered script handles that have data.
693
+	 *
694
+	 * @param string $script_handle
695
+	 */
696
+	private function addRegisteredScriptHandlesWithData($script_handle)
697
+	{
698
+		$this->script_handles_with_data[ $script_handle ] = $script_handle;
699
+	}
700
+
701
+
702
+	/**i
703 703
      * Checks WP_Scripts for all of each script handle registered internally as having data and unsets from the
704 704
      * Dependency stored in WP_Scripts if its set.
705 705
      */
706
-    private function removeAlreadyRegisteredDataForScriptHandles()
707
-    {
708
-        if (empty($this->script_handles_with_data)) {
709
-            return;
710
-        }
711
-        foreach ($this->script_handles_with_data as $script_handle) {
712
-            $this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
713
-        }
714
-    }
715
-
716
-
717
-    /**
718
-     * Removes any data dependency registered in WP_Scripts if its set.
719
-     *
720
-     * @param string $script_handle
721
-     */
722
-    private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
723
-    {
724
-        if (isset($this->script_handles_with_data[ $script_handle ])) {
725
-            global $wp_scripts;
726
-            $unset_handle = false;
727
-            if ($wp_scripts->get_data($script_handle, 'data')) {
728
-                unset($wp_scripts->registered[ $script_handle ]->extra['data']);
729
-                $unset_handle = true;
730
-            }
731
-            //deal with inline_scripts
732
-            if ($wp_scripts->get_data($script_handle, 'before')) {
733
-                unset($wp_scripts->registered[ $script_handle ]->extra['before']);
734
-                $unset_handle = true;
735
-            }
736
-            if ($wp_scripts->get_data($script_handle, 'after')) {
737
-                unset($wp_scripts->registered[ $script_handle ]->extra['after']);
738
-            }
739
-            if ($unset_handle) {
740
-                unset($this->script_handles_with_data[ $script_handle ]);
741
-            }
742
-        }
743
-    }
744
-
745
-
746
-    /**
747
-     * register translations for a registered script
748
-     *
749
-     * @param string $handle
750
-     */
751
-    public function registerTranslation($handle)
752
-    {
753
-        $this->i18n_registry->registerScriptI18n($handle);
754
-    }
755
-
756
-
757
-    /**
758
-     * @since 4.9.63.p
759
-     * @return bool
760
-     */
761
-    private function debug()
762
-    {
763
-        return apply_filters(
764
-            'FHEE__EventEspresso_core_services_assets_Registry__debug',
765
-            defined('EE_DEBUG') && EE_DEBUG
766
-        );
767
-    }
706
+	private function removeAlreadyRegisteredDataForScriptHandles()
707
+	{
708
+		if (empty($this->script_handles_with_data)) {
709
+			return;
710
+		}
711
+		foreach ($this->script_handles_with_data as $script_handle) {
712
+			$this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
713
+		}
714
+	}
715
+
716
+
717
+	/**
718
+	 * Removes any data dependency registered in WP_Scripts if its set.
719
+	 *
720
+	 * @param string $script_handle
721
+	 */
722
+	private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
723
+	{
724
+		if (isset($this->script_handles_with_data[ $script_handle ])) {
725
+			global $wp_scripts;
726
+			$unset_handle = false;
727
+			if ($wp_scripts->get_data($script_handle, 'data')) {
728
+				unset($wp_scripts->registered[ $script_handle ]->extra['data']);
729
+				$unset_handle = true;
730
+			}
731
+			//deal with inline_scripts
732
+			if ($wp_scripts->get_data($script_handle, 'before')) {
733
+				unset($wp_scripts->registered[ $script_handle ]->extra['before']);
734
+				$unset_handle = true;
735
+			}
736
+			if ($wp_scripts->get_data($script_handle, 'after')) {
737
+				unset($wp_scripts->registered[ $script_handle ]->extra['after']);
738
+			}
739
+			if ($unset_handle) {
740
+				unset($this->script_handles_with_data[ $script_handle ]);
741
+			}
742
+		}
743
+	}
744
+
745
+
746
+	/**
747
+	 * register translations for a registered script
748
+	 *
749
+	 * @param string $handle
750
+	 */
751
+	public function registerTranslation($handle)
752
+	{
753
+		$this->i18n_registry->registerScriptI18n($handle);
754
+	}
755
+
756
+
757
+	/**
758
+	 * @since 4.9.63.p
759
+	 * @return bool
760
+	 */
761
+	private function debug()
762
+	{
763
+		return apply_filters(
764
+			'FHEE__EventEspresso_core_services_assets_Registry__debug',
765
+			defined('EE_DEBUG') && EE_DEBUG
766
+		);
767
+	}
768 768
 }
Please login to merge, or discard this patch.
ticket_selector_caff/templates/ticket_selector_price_details.template.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -7,39 +7,39 @@  discard block
 block discarded – undo
7 7
 if ($display_ticket_price) { ?>
8 8
     <section class="tckt-slctr-tkt-price-sctn">
9 9
         <h5><?php
10
-            echo apply_filters(
11
-                'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading',
12
-                esc_html__('Price', 'event_espresso')
13
-            ); ?></h5>
10
+			echo apply_filters(
11
+				'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading',
12
+				esc_html__('Price', 'event_espresso')
13
+			); ?></h5>
14 14
         <div class="tckt-slctr-tkt-details-tbl-wrap-dv">
15 15
             <table class="tckt-slctr-tkt-details-tbl">
16 16
                 <thead>
17 17
                 <tr>
18 18
                     <th class="ee-third-width"><span class="small-text">
19 19
                             <?php
20
-                            esc_html_e(
21
-                                'Name',
22
-                                'event_espresso'
23
-                            ); ?></span>
20
+							esc_html_e(
21
+								'Name',
22
+								'event_espresso'
23
+							); ?></span>
24 24
                     </th>
25 25
                     <th class="jst-cntr"><span class="small-text">
26 26
                             <?php
27
-                            esc_html_e(
28
-                                'Description',
29
-                                'event_espresso'
30
-                            ); ?></span>
27
+							esc_html_e(
28
+								'Description',
29
+								'event_espresso'
30
+							); ?></span>
31 31
                     </th>
32 32
                     <th class="ee-fourth-width jst-rght"><span class="small-text">
33 33
                             <?php
34
-                            esc_html_e(
35
-                                'Amount',
36
-                                'event_espresso'
37
-                            ); ?></span></th>
34
+							esc_html_e(
35
+								'Amount',
36
+								'event_espresso'
37
+							); ?></span></th>
38 38
                 </tr>
39 39
                 </thead>
40 40
                 <tbody>
41 41
                 <?php
42
-                if ($ticket->base_price() instanceof EE_Price) { ?>
42
+				if ($ticket->base_price() instanceof EE_Price) { ?>
43 43
                     <tr>
44 44
                         <td data-th="<?php esc_html_e('Name', 'event_espresso'); ?>" class="small-text" colspan="2">
45 45
                             <b><?php echo $ticket->base_price()->name(); ?></b></td>
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
                             class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
48 48
                     </tr>
49 49
                     <?php
50
-                    $running_total = $ticket->base_price()->amount();
51
-                } else {
52
-                    $running_total = 0;
53
-                }
54
-                // now add price modifiers
55
-                foreach ($ticket->price_modifiers() as $price_mod) { ?>
50
+					$running_total = $ticket->base_price()->amount();
51
+				} else {
52
+					$running_total = 0;
53
+				}
54
+				// now add price modifiers
55
+				foreach ($ticket->price_modifiers() as $price_mod) { ?>
56 56
                     <tr>
57 57
                         <td data-th="<?php esc_html_e('Name', 'event_espresso'); ?>"
58 58
                             class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
                                 %
63 63
                             </td>
64 64
                             <?php
65
-                            $new_sub_total = $running_total * ($price_mod->amount() / 100);
66
-                            $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total;
67
-                            ?>
65
+							$new_sub_total = $running_total * ($price_mod->amount() / 100);
66
+							$new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total;
67
+							?>
68 68
                         <?php } else { ?>
69 69
                             <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1
70
-                                : $price_mod->amount(); ?>
70
+								: $price_mod->amount(); ?>
71 71
                             <td data-th="<?php esc_html_e('Description', 'event_espresso'); ?>"
72 72
                                 class="small-text"><?php echo $price_mod->desc(); ?></td>
73 73
                             <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1
74
-                                : $price_mod->amount(); ?>
74
+								: $price_mod->amount(); ?>
75 75
                         <?php } ?>
76 76
                         <td data-th="<?php esc_html_e('Amount', 'event_espresso'); ?>"
77 77
                             class="jst-rght small-text">
78 78
                             <?php
79
-                            echo EEH_Template::format_currency(
80
-                                $new_sub_total
81
-                            ); ?></td>
79
+							echo EEH_Template::format_currency(
80
+								$new_sub_total
81
+							); ?></td>
82 82
                         <?php $running_total += $new_sub_total; ?>
83 83
                     </tr>
84 84
                 <?php } ?>
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
                     <tr>
88 88
                         <td colspan="2" class="jst-rght small-text sbttl"><b>
89 89
                                 <?php
90
-                                esc_html_e(
91
-                                    'subtotal',
92
-                                    'event_espresso'
93
-                                ); ?></b></td>
90
+								esc_html_e(
91
+									'subtotal',
92
+									'event_espresso'
93
+								); ?></b></td>
94 94
                         <td data-th="<?php esc_html_e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text">
95 95
                             <b><?php echo EEH_Template::format_currency($running_total); ?></b></td>
96 96
                     </tr>
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
                             <td data-th="<?php esc_html_e('Amount', 'event_espresso'); ?>"
107 107
                                 class="jst-rght small-text">
108 108
                                 <?php
109
-                                echo EEH_Template::format_currency(
110
-                                    $tax_amount
111
-                                ); ?></td>
109
+								echo EEH_Template::format_currency(
110
+									$tax_amount
111
+								); ?></td>
112 112
                             <?php $running_total += $tax_amount; ?>
113 113
                         </tr>
114 114
                     <?php } ?>
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
                 <tr>
117 117
                     <td colspan="2" class="jst-rght small-text ttl-lbl-td">
118 118
                         <b><?php
119
-                            echo apply_filters(
120
-                                'FHEE__ticket_selector_chart_template__ticket_details_total_price',
121
-                                esc_html__('Total', 'event_espresso')
122
-                            ); ?></b></td>
119
+							echo apply_filters(
120
+								'FHEE__ticket_selector_chart_template__ticket_details_total_price',
121
+								esc_html__('Total', 'event_espresso')
122
+							); ?></b></td>
123 123
                     <td data-th="<?php
124
-                                    echo apply_filters(
125
-                                        'FHEE__ticket_selector_chart_template__ticket_details_total_price',
126
-                                        esc_html__('Total', 'event_espresso')
127
-                                    ); ?>" class="jst-rght small-text">
124
+									echo apply_filters(
125
+										'FHEE__ticket_selector_chart_template__ticket_details_total_price',
126
+										esc_html__('Total', 'event_espresso')
127
+									); ?>" class="jst-rght small-text">
128 128
                         <b><?php echo EEH_Template::format_currency($running_total); ?></b></td>
129 129
                 </tr>
130 130
                 </tbody>
Please login to merge, or discard this patch.