Completed
Branch jed-i18n-for-js (f5884a)
by
unknown
25:34 queued 16:38
created
core/domain/entities/routing/handlers/admin/GutenbergEditor.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -18,69 +18,69 @@
 block discarded – undo
18 18
 class GutenbergEditor extends AdminRoute
19 19
 {
20 20
 
21
-    /**
22
-     * returns true if the current request matches this route
23
-     *
24
-     * @return bool
25
-     * @since   $VID:$
26
-     */
27
-    public function matchesCurrentRequest()
28
-    {
29
-        global $pagenow;
30
-        return parent::matchesCurrentRequest()
31
-               && $pagenow
32
-               && (
33
-                   $pagenow === 'post-new.php'
34
-                   || (
35
-                       $pagenow === 'post.php'
36
-                       && $this->request->getRequestParam('action') === 'edit'
37
-                   )
38
-               );
39
-    }
21
+	/**
22
+	 * returns true if the current request matches this route
23
+	 *
24
+	 * @return bool
25
+	 * @since   $VID:$
26
+	 */
27
+	public function matchesCurrentRequest()
28
+	{
29
+		global $pagenow;
30
+		return parent::matchesCurrentRequest()
31
+			   && $pagenow
32
+			   && (
33
+				   $pagenow === 'post-new.php'
34
+				   || (
35
+					   $pagenow === 'post.php'
36
+					   && $this->request->getRequestParam('action') === 'edit'
37
+				   )
38
+			   );
39
+	}
40 40
 
41 41
 
42
-    /**
43
-     * @since $VID:$
44
-     */
45
-    protected function registerDependencies()
46
-    {
47
-        $this->dependency_map->registerDependencies(
48
-            'EventEspresso\core\domain\entities\routing\data_nodes\domains\GutenbergEditorData',
49
-            [
50
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
51
-            ]
52
-        );
53
-        $this->dependency_map->registerDependencies(
54
-            'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager',
55
-            [
56
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
57
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
58
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
59
-            ]
60
-        );
61
-        $this->loader->getShared(
62
-            'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData'
63
-        );
64
-        /** @var EventEditor $data_node */
65
-        $data_node = $this->loader->getShared(
66
-            'EventEspresso\core\domain\entities\routing\data_nodes\domains\GutenbergEditorData'
67
-        );
68
-        $this->setDataNode($data_node);
69
-    }
42
+	/**
43
+	 * @since $VID:$
44
+	 */
45
+	protected function registerDependencies()
46
+	{
47
+		$this->dependency_map->registerDependencies(
48
+			'EventEspresso\core\domain\entities\routing\data_nodes\domains\GutenbergEditorData',
49
+			[
50
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
51
+			]
52
+		);
53
+		$this->dependency_map->registerDependencies(
54
+			'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager',
55
+			[
56
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
57
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
58
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
59
+			]
60
+		);
61
+		$this->loader->getShared(
62
+			'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData'
63
+		);
64
+		/** @var EventEditor $data_node */
65
+		$data_node = $this->loader->getShared(
66
+			'EventEspresso\core\domain\entities\routing\data_nodes\domains\GutenbergEditorData'
67
+		);
68
+		$this->setDataNode($data_node);
69
+	}
70 70
 
71 71
 
72
-    /**
73
-     * implements logic required to run during request
74
-     *
75
-     * @return bool
76
-     * @since   $VID:$
77
-     */
78
-    protected function requestHandler()
79
-    {
80
-        $this->asset_manager = $this->loader->getShared(
81
-            'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'
82
-        );
83
-        add_action('admin_enqueue_scripts', [$this->asset_manager, 'enqueueBrowserAssets'], 100);
84
-        return true;
85
-    }
72
+	/**
73
+	 * implements logic required to run during request
74
+	 *
75
+	 * @return bool
76
+	 * @since   $VID:$
77
+	 */
78
+	protected function requestHandler()
79
+	{
80
+		$this->asset_manager = $this->loader->getShared(
81
+			'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'
82
+		);
83
+		add_action('admin_enqueue_scripts', [$this->asset_manager, 'enqueueBrowserAssets'], 100);
84
+		return true;
85
+	}
86 86
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/admin/WordPressPluginsPage.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -20,77 +20,77 @@
 block discarded – undo
20 20
 class WordPressPluginsPage extends Route
21 21
 {
22 22
 
23
-    /**
24
-     * returns true if the current request matches this route
25
-     *
26
-     * @return bool
27
-     * @since   $VID:$
28
-     */
29
-    public function matchesCurrentRequest()
30
-    {
31
-        global $pagenow;
32
-        return $this->request->isAdmin() && $pagenow && $pagenow === 'plugins.php';
33
-    }
23
+	/**
24
+	 * returns true if the current request matches this route
25
+	 *
26
+	 * @return bool
27
+	 * @since   $VID:$
28
+	 */
29
+	public function matchesCurrentRequest()
30
+	{
31
+		global $pagenow;
32
+		return $this->request->isAdmin() && $pagenow && $pagenow === 'plugins.php';
33
+	}
34 34
 
35 35
 
36
-    /**
37
-     * @since $VID:$
38
-     */
39
-    protected function registerDependencies()
40
-    {
41
-        $this->dependency_map->registerDependencies(
42
-            'EventEspresso\core\domain\services\assets\WordPressPluginsPageAssetManager',
43
-            [
44
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
45
-                'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
46
-                'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
47
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
48
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
49
-            ]
50
-        );
51
-        $this->dependency_map->registerDependencies(
52
-            'EventEspresso\core\domain\entities\routing\data_nodes\domains\WordPressPluginsPageData',
53
-            [
54
-                'EventEspresso\core\domain\services\admin\ExitModal'     => EE_Dependency_Map::load_from_cache,
55
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
56
-            ]
57
-        );
58
-        $this->dependency_map->registerDependencies(
59
-            'EventEspresso\core\domain\services\admin\ExitModal',
60
-            ['EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache]
61
-        );
62
-        $this->dependency_map->registerDependencies(
63
-            'EventEspresso\core\domain\services\admin\PluginUpsells',
64
-            ['EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache]
65
-        );
36
+	/**
37
+	 * @since $VID:$
38
+	 */
39
+	protected function registerDependencies()
40
+	{
41
+		$this->dependency_map->registerDependencies(
42
+			'EventEspresso\core\domain\services\assets\WordPressPluginsPageAssetManager',
43
+			[
44
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
45
+				'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
46
+				'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
47
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
48
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
49
+			]
50
+		);
51
+		$this->dependency_map->registerDependencies(
52
+			'EventEspresso\core\domain\entities\routing\data_nodes\domains\WordPressPluginsPageData',
53
+			[
54
+				'EventEspresso\core\domain\services\admin\ExitModal'     => EE_Dependency_Map::load_from_cache,
55
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
56
+			]
57
+		);
58
+		$this->dependency_map->registerDependencies(
59
+			'EventEspresso\core\domain\services\admin\ExitModal',
60
+			['EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache]
61
+		);
62
+		$this->dependency_map->registerDependencies(
63
+			'EventEspresso\core\domain\services\admin\PluginUpsells',
64
+			['EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache]
65
+		);
66 66
 
67
-        $this->loader->getShared(
68
-            'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData'
69
-        );
70
-        /** @var WordPressPluginsPageData $data_node */
71
-        $data_node = $this->loader->getShared(
72
-            'EventEspresso\core\domain\entities\routing\data_nodes\domains\WordPressPluginsPageData'
73
-        );
74
-        $this->setDataNode($data_node);
75
-        /** @var PluginUpsells $plugin_upsells */
76
-        $plugin_upsells = $this->loader->getShared('EventEspresso\core\domain\services\admin\PluginUpsells');
77
-        $plugin_upsells->decafUpsells();
78
-    }
67
+		$this->loader->getShared(
68
+			'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData'
69
+		);
70
+		/** @var WordPressPluginsPageData $data_node */
71
+		$data_node = $this->loader->getShared(
72
+			'EventEspresso\core\domain\entities\routing\data_nodes\domains\WordPressPluginsPageData'
73
+		);
74
+		$this->setDataNode($data_node);
75
+		/** @var PluginUpsells $plugin_upsells */
76
+		$plugin_upsells = $this->loader->getShared('EventEspresso\core\domain\services\admin\PluginUpsells');
77
+		$plugin_upsells->decafUpsells();
78
+	}
79 79
 
80 80
 
81
-    /**
82
-     * implements logic required to run during request
83
-     *
84
-     * @return bool
85
-     * @since   $VID:$
86
-     */
87
-    protected function requestHandler()
88
-    {
89
-        /** @var WordPressPluginsPageAssetManager $asset_manager */
90
-        $asset_manager = $this->loader->getShared(
91
-            'EventEspresso\core\domain\services\assets\WordPressPluginsPageAssetManager'
92
-        );
93
-        add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueAssets']);
94
-        return true;
95
-    }
81
+	/**
82
+	 * implements logic required to run during request
83
+	 *
84
+	 * @return bool
85
+	 * @since   $VID:$
86
+	 */
87
+	protected function requestHandler()
88
+	{
89
+		/** @var WordPressPluginsPageAssetManager $asset_manager */
90
+		$asset_manager = $this->loader->getShared(
91
+			'EventEspresso\core\domain\services\assets\WordPressPluginsPageAssetManager'
92
+		);
93
+		add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueAssets']);
94
+		return true;
95
+	}
96 96
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/data_nodes/EventEspressoData.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -21,49 +21,49 @@
 block discarded – undo
21 21
 class EventEspressoData extends PrimaryJsonDataNode
22 22
 {
23 23
 
24
-    const NODE_NAME = 'eventEspressoData';
24
+	const NODE_NAME = 'eventEspressoData';
25 25
 
26
-    /**
27
-     * @var Api $api
28
-     */
29
-    private $api;
26
+	/**
27
+	 * @var Api $api
28
+	 */
29
+	private $api;
30 30
 
31
-    /**
32
-     * @var Config $config
33
-     */
34
-    private $config;
31
+	/**
32
+	 * @var Config $config
33
+	 */
34
+	private $config;
35 35
 
36
-    /**
37
-     * @var JedLocaleData $jed_locale
38
-     */
39
-    private $jed_locale;
36
+	/**
37
+	 * @var JedLocaleData $jed_locale
38
+	 */
39
+	private $jed_locale;
40 40
 
41 41
 
42
-    /**
43
-     * @param Api $api
44
-     * @param Config $config
45
-     * @param JedLocaleData         $jed_locale
46
-     * @param JsonDataNodeValidator $validator
47
-     */
48
-    public function __construct(Api $api, Config $config, JedLocaleData $jed_locale, JsonDataNodeValidator $validator)
49
-    {
50
-        parent::__construct($validator);
51
-        $this->api = $api;
52
-        $this->config = $config;
53
-        $this->jed_locale = $jed_locale;
54
-        $this->setNodeName(EventEspressoData::NODE_NAME);
55
-    }
42
+	/**
43
+	 * @param Api $api
44
+	 * @param Config $config
45
+	 * @param JedLocaleData         $jed_locale
46
+	 * @param JsonDataNodeValidator $validator
47
+	 */
48
+	public function __construct(Api $api, Config $config, JedLocaleData $jed_locale, JsonDataNodeValidator $validator)
49
+	{
50
+		parent::__construct($validator);
51
+		$this->api = $api;
52
+		$this->config = $config;
53
+		$this->jed_locale = $jed_locale;
54
+		$this->setNodeName(EventEspressoData::NODE_NAME);
55
+	}
56 56
 
57 57
 
58
-    /**
59
-     * @throws DomainException
60
-     * @since $VID:$
61
-     */
62
-    public function initialize()
63
-    {
64
-        $this->addDataNode($this->api);
65
-        $this->addDataNode($this->config);
66
-        $this->addData('i18n', $this->jed_locale->getData(Domain::TEXT_DOMAIN));
67
-        $this->setInitialized(true);
68
-    }
58
+	/**
59
+	 * @throws DomainException
60
+	 * @since $VID:$
61
+	 */
62
+	public function initialize()
63
+	{
64
+		$this->addDataNode($this->api);
65
+		$this->addDataNode($this->config);
66
+		$this->addData('i18n', $this->jed_locale->getData(Domain::TEXT_DOMAIN));
67
+		$this->setInitialized(true);
68
+	}
69 69
 }
Please login to merge, or discard this patch.
core/domain/Domain.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -15,70 +15,70 @@
 block discarded – undo
15 15
  */
16 16
 class Domain extends DomainBase implements CaffeinatedInterface
17 17
 {
18
-    /**
19
-     * URL path component used to denote an API request
20
-     */
21
-    const API_NAMESPACE = 'ee/v';
22
-
23
-    const ASSET_NAMESPACE = 'eventespresso';
24
-
25
-    const TEXT_DOMAIN = 'event_espresso';
26
-
27
-    /**
28
-     * Slug used for the context where a registration status is changed from a manual trigger in the Registration Admin
29
-     * Page ui.
30
-     */
31
-    const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN
32
-        = 'manual_registration_status_change_from_registration_admin';
33
-
34
-    const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY
35
-        = 'manual_registration_status_change_from_registration_admin_and_notify';
36
-
37
-
38
-    /**
39
-     * Whether or not EE core is the full premium version.
40
-     * @since 4.9.59.p
41
-     * @var bool
42
-     */
43
-    private $caffeinated;
44
-
45
-
46
-    public function __construct(FilePath $plugin_file, Version $version)
47
-    {
48
-        parent::__construct($plugin_file, $version);
49
-        $this->setCaffeinated();
50
-    }
51
-
52
-    /**
53
-     * Whether or not EE core is the full premium version.
54
-     * @since 4.9.59.p
55
-     * @return bool
56
-     */
57
-    public function isCaffeinated()
58
-    {
59
-        return $this->caffeinated;
60
-    }
61
-
62
-
63
-    /**
64
-     * Setter for $is_caffeinated property.
65
-     * @since 4.9.59.p
66
-     */
67
-    private function setCaffeinated()
68
-    {
69
-        $this->caffeinated = (! defined('EE_DECAF') || EE_DECAF !== true)
70
-            && is_readable($this->pluginPath() . 'caffeinated/brewing_regular.php');
71
-    }
72
-
73
-
74
-    /**
75
-     * This should be used everywhere the Event Espresso brand name is referenced in public facing interfaces
76
-     * to allow for filtering the brand.
77
-     *
78
-     * @return string
79
-     */
80
-    public static function brandName()
81
-    {
82
-        return (string) apply_filters('FHEE__EventEspresso_core_domain_Domain__brandName', 'Event Espresso');
83
-    }
18
+	/**
19
+	 * URL path component used to denote an API request
20
+	 */
21
+	const API_NAMESPACE = 'ee/v';
22
+
23
+	const ASSET_NAMESPACE = 'eventespresso';
24
+
25
+	const TEXT_DOMAIN = 'event_espresso';
26
+
27
+	/**
28
+	 * Slug used for the context where a registration status is changed from a manual trigger in the Registration Admin
29
+	 * Page ui.
30
+	 */
31
+	const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN
32
+		= 'manual_registration_status_change_from_registration_admin';
33
+
34
+	const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY
35
+		= 'manual_registration_status_change_from_registration_admin_and_notify';
36
+
37
+
38
+	/**
39
+	 * Whether or not EE core is the full premium version.
40
+	 * @since 4.9.59.p
41
+	 * @var bool
42
+	 */
43
+	private $caffeinated;
44
+
45
+
46
+	public function __construct(FilePath $plugin_file, Version $version)
47
+	{
48
+		parent::__construct($plugin_file, $version);
49
+		$this->setCaffeinated();
50
+	}
51
+
52
+	/**
53
+	 * Whether or not EE core is the full premium version.
54
+	 * @since 4.9.59.p
55
+	 * @return bool
56
+	 */
57
+	public function isCaffeinated()
58
+	{
59
+		return $this->caffeinated;
60
+	}
61
+
62
+
63
+	/**
64
+	 * Setter for $is_caffeinated property.
65
+	 * @since 4.9.59.p
66
+	 */
67
+	private function setCaffeinated()
68
+	{
69
+		$this->caffeinated = (! defined('EE_DECAF') || EE_DECAF !== true)
70
+			&& is_readable($this->pluginPath() . 'caffeinated/brewing_regular.php');
71
+	}
72
+
73
+
74
+	/**
75
+	 * This should be used everywhere the Event Espresso brand name is referenced in public facing interfaces
76
+	 * to allow for filtering the brand.
77
+	 *
78
+	 * @return string
79
+	 */
80
+	public static function brandName()
81
+	{
82
+		return (string) apply_filters('FHEE__EventEspresso_core_domain_Domain__brandName', 'Event Espresso');
83
+	}
84 84
 }
Please login to merge, or discard this patch.
core/domain/values/assets/JavascriptAsset.php 2 patches
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -18,172 +18,172 @@
 block discarded – undo
18 18
 class JavascriptAsset extends BrowserAsset
19 19
 {
20 20
 
21
-    /**
22
-     * @var boolean $load_in_footer
23
-     */
24
-    private $load_in_footer = false;
25
-
26
-    /**
27
-     * @var boolean $requires_translation
28
-     */
29
-    private $requires_translation = false;
30
-
31
-    /**
32
-     * @var boolean $has_inline_data
33
-     */
34
-    private $has_inline_data = false;
35
-
36
-    /**
37
-     * @var Closure $inline_data_callback
38
-     */
39
-    private $inline_data_callback;
40
-
41
-
42
-    /**
43
-     * Asset constructor.
44
-     *
45
-     * @param string          $handle
46
-     * @param string          $source
47
-     * @param array           $dependencies
48
-     * @param bool            $load_in_footer
49
-     * @param DomainInterface $domain
50
-     * @param string          $version
51
-     * @throws InvalidDataTypeException
52
-     * @throws DomainException
53
-     */
54
-    public function __construct(
55
-        $handle,
56
-        $source,
57
-        array $dependencies,
58
-        $load_in_footer,
59
-        DomainInterface $domain,
60
-        $version = ''
61
-    ) {
62
-        parent::__construct(Asset::TYPE_JS, $handle, $source, $dependencies, $domain, $version);
63
-        $this->setLoadInFooter($load_in_footer);
64
-    }
65
-
66
-
67
-    /**
68
-     * @return bool
69
-     */
70
-    public function loadInFooter()
71
-    {
72
-        return $this->load_in_footer;
73
-    }
74
-
75
-
76
-    /**
77
-     * @param bool $load_in_footer
78
-     */
79
-    private function setLoadInFooter($load_in_footer = true)
80
-    {
81
-        $this->load_in_footer = filter_var($load_in_footer, FILTER_VALIDATE_BOOLEAN);
82
-    }
83
-
84
-
85
-    /**
86
-     * @return bool
87
-     */
88
-    public function requiresTranslation()
89
-    {
90
-        return $this->requires_translation;
91
-    }
92
-
93
-
94
-    /**
95
-     * @return bool
96
-     */
97
-    public function hasInlineData()
98
-    {
99
-        return $this->has_inline_data;
100
-    }
101
-
102
-
103
-    /**
104
-     * @param bool $has_inline_data
105
-     * @return JavascriptAsset
106
-     */
107
-    public function setHasInlineData($has_inline_data = true)
108
-    {
109
-        $this->has_inline_data = filter_var($has_inline_data, FILTER_VALIDATE_BOOLEAN);
110
-        return $this;
111
-    }
112
-
113
-
114
-    /**
115
-     * @return Closure
116
-     */
117
-    public function inlineDataCallback()
118
-    {
119
-        return $this->inline_data_callback;
120
-    }
121
-
122
-
123
-    /**
124
-     * @return bool
125
-     */
126
-    public function hasInlineDataCallback()
127
-    {
128
-        return $this->inline_data_callback instanceof Closure;
129
-    }
130
-
131
-
132
-    /**
133
-     * @param Closure $inline_data_callback
134
-     * @return JavascriptAsset
135
-     */
136
-    public function setInlineDataCallback(Closure $inline_data_callback)
137
-    {
138
-        $this->inline_data_callback = $inline_data_callback;
139
-        $this->setHasInlineData();
140
-        return $this;
141
-    }
142
-
143
-
144
-    /**
145
-     * @since 4.9.62.p
146
-     */
147
-    public function enqueueAsset()
148
-    {
149
-        if ($this->source() === '') {
150
-            return;
151
-        }
152
-        $attributes = $this->getAttributes();
153
-        if (!empty($attributes)) {
154
-            add_filter('script_loader_tag', [$this, 'addAttributeTagsToScript'], 10, 2);
155
-        }
156
-        wp_enqueue_script($this->handle());
157
-    }
158
-
159
-
160
-    public function addAttributeTagsToScript($tag, $handle)
161
-    {
162
-        if ($handle === $this->handle()) {
163
-            $attributes = $this->getAttributes();
164
-            $attributes_string = '';
165
-            foreach ($attributes as $key => $value) {
166
-                if (is_int($key)) {
167
-                    $attributes_string .= " {$value}";
168
-                } else {
169
-                    $attributes_string .= " {$key}='{$value}'";
170
-                }
171
-            }
172
-            $tag = str_replace('></script>', $attributes_string . '></script>', $tag);
173
-        }
174
-
175
-        return $tag;
176
-    }
177
-
178
-
179
-    /**
180
-     * @deprecated $VID:$
181
-     * @param bool $requires_translation
182
-     * @return JavascriptAsset
183
-     */
184
-    public function setRequiresTranslation($requires_translation = true)
185
-    {
186
-        $this->requires_translation = filter_var($requires_translation, FILTER_VALIDATE_BOOLEAN);
187
-        return $this;
188
-    }
21
+	/**
22
+	 * @var boolean $load_in_footer
23
+	 */
24
+	private $load_in_footer = false;
25
+
26
+	/**
27
+	 * @var boolean $requires_translation
28
+	 */
29
+	private $requires_translation = false;
30
+
31
+	/**
32
+	 * @var boolean $has_inline_data
33
+	 */
34
+	private $has_inline_data = false;
35
+
36
+	/**
37
+	 * @var Closure $inline_data_callback
38
+	 */
39
+	private $inline_data_callback;
40
+
41
+
42
+	/**
43
+	 * Asset constructor.
44
+	 *
45
+	 * @param string          $handle
46
+	 * @param string          $source
47
+	 * @param array           $dependencies
48
+	 * @param bool            $load_in_footer
49
+	 * @param DomainInterface $domain
50
+	 * @param string          $version
51
+	 * @throws InvalidDataTypeException
52
+	 * @throws DomainException
53
+	 */
54
+	public function __construct(
55
+		$handle,
56
+		$source,
57
+		array $dependencies,
58
+		$load_in_footer,
59
+		DomainInterface $domain,
60
+		$version = ''
61
+	) {
62
+		parent::__construct(Asset::TYPE_JS, $handle, $source, $dependencies, $domain, $version);
63
+		$this->setLoadInFooter($load_in_footer);
64
+	}
65
+
66
+
67
+	/**
68
+	 * @return bool
69
+	 */
70
+	public function loadInFooter()
71
+	{
72
+		return $this->load_in_footer;
73
+	}
74
+
75
+
76
+	/**
77
+	 * @param bool $load_in_footer
78
+	 */
79
+	private function setLoadInFooter($load_in_footer = true)
80
+	{
81
+		$this->load_in_footer = filter_var($load_in_footer, FILTER_VALIDATE_BOOLEAN);
82
+	}
83
+
84
+
85
+	/**
86
+	 * @return bool
87
+	 */
88
+	public function requiresTranslation()
89
+	{
90
+		return $this->requires_translation;
91
+	}
92
+
93
+
94
+	/**
95
+	 * @return bool
96
+	 */
97
+	public function hasInlineData()
98
+	{
99
+		return $this->has_inline_data;
100
+	}
101
+
102
+
103
+	/**
104
+	 * @param bool $has_inline_data
105
+	 * @return JavascriptAsset
106
+	 */
107
+	public function setHasInlineData($has_inline_data = true)
108
+	{
109
+		$this->has_inline_data = filter_var($has_inline_data, FILTER_VALIDATE_BOOLEAN);
110
+		return $this;
111
+	}
112
+
113
+
114
+	/**
115
+	 * @return Closure
116
+	 */
117
+	public function inlineDataCallback()
118
+	{
119
+		return $this->inline_data_callback;
120
+	}
121
+
122
+
123
+	/**
124
+	 * @return bool
125
+	 */
126
+	public function hasInlineDataCallback()
127
+	{
128
+		return $this->inline_data_callback instanceof Closure;
129
+	}
130
+
131
+
132
+	/**
133
+	 * @param Closure $inline_data_callback
134
+	 * @return JavascriptAsset
135
+	 */
136
+	public function setInlineDataCallback(Closure $inline_data_callback)
137
+	{
138
+		$this->inline_data_callback = $inline_data_callback;
139
+		$this->setHasInlineData();
140
+		return $this;
141
+	}
142
+
143
+
144
+	/**
145
+	 * @since 4.9.62.p
146
+	 */
147
+	public function enqueueAsset()
148
+	{
149
+		if ($this->source() === '') {
150
+			return;
151
+		}
152
+		$attributes = $this->getAttributes();
153
+		if (!empty($attributes)) {
154
+			add_filter('script_loader_tag', [$this, 'addAttributeTagsToScript'], 10, 2);
155
+		}
156
+		wp_enqueue_script($this->handle());
157
+	}
158
+
159
+
160
+	public function addAttributeTagsToScript($tag, $handle)
161
+	{
162
+		if ($handle === $this->handle()) {
163
+			$attributes = $this->getAttributes();
164
+			$attributes_string = '';
165
+			foreach ($attributes as $key => $value) {
166
+				if (is_int($key)) {
167
+					$attributes_string .= " {$value}";
168
+				} else {
169
+					$attributes_string .= " {$key}='{$value}'";
170
+				}
171
+			}
172
+			$tag = str_replace('></script>', $attributes_string . '></script>', $tag);
173
+		}
174
+
175
+		return $tag;
176
+	}
177
+
178
+
179
+	/**
180
+	 * @deprecated $VID:$
181
+	 * @param bool $requires_translation
182
+	 * @return JavascriptAsset
183
+	 */
184
+	public function setRequiresTranslation($requires_translation = true)
185
+	{
186
+		$this->requires_translation = filter_var($requires_translation, FILTER_VALIDATE_BOOLEAN);
187
+		return $this;
188
+	}
189 189
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             return;
151 151
         }
152 152
         $attributes = $this->getAttributes();
153
-        if (!empty($attributes)) {
153
+        if ( ! empty($attributes)) {
154 154
             add_filter('script_loader_tag', [$this, 'addAttributeTagsToScript'], 10, 2);
155 155
         }
156 156
         wp_enqueue_script($this->handle());
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                     $attributes_string .= " {$key}='{$value}'";
170 170
                 }
171 171
             }
172
-            $tag = str_replace('></script>', $attributes_string . '></script>', $tag);
172
+            $tag = str_replace('></script>', $attributes_string.'></script>', $tag);
173 173
         }
174 174
 
175 175
         return $tag;
Please login to merge, or discard this patch.
core/domain/DomainInterface.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -14,80 +14,80 @@
 block discarded – undo
14 14
 interface DomainInterface extends InterminableInterface
15 15
 {
16 16
 
17
-    /**
18
-     * @param string $asset_namespace
19
-     * @return void
20
-     * @since $VID:$
21
-     */
22
-    public function initialize($asset_namespace = 'eventespresso');
17
+	/**
18
+	 * @param string $asset_namespace
19
+	 * @return void
20
+	 * @since $VID:$
21
+	 */
22
+	public function initialize($asset_namespace = 'eventespresso');
23 23
 
24 24
 
25
-    /**
26
-     * @param string $asset_namespace
27
-     * @return void
28
-     */
29
-    public function setAssetNamespace($asset_namespace = 'eventespresso');
25
+	/**
26
+	 * @param string $asset_namespace
27
+	 * @return void
28
+	 */
29
+	public function setAssetNamespace($asset_namespace = 'eventespresso');
30 30
 
31 31
 
32
-    /**
33
-     * @return string
34
-     */
35
-    public function pluginFile();
32
+	/**
33
+	 * @return string
34
+	 */
35
+	public function pluginFile();
36 36
 
37 37
 
38
-    /**
39
-     * @return string
40
-     */
41
-    public function pluginBasename();
38
+	/**
39
+	 * @return string
40
+	 */
41
+	public function pluginBasename();
42 42
 
43 43
 
44
-    /**
45
-     * @param string $additional_path
46
-     * @return string
47
-     */
48
-    public function pluginPath($additional_path = '');
44
+	/**
45
+	 * @param string $additional_path
46
+	 * @return string
47
+	 */
48
+	public function pluginPath($additional_path = '');
49 49
 
50 50
 
51
-    /**
52
-     * @return string
53
-     */
54
-    public function pluginUrl();
51
+	/**
52
+	 * @return string
53
+	 */
54
+	public function pluginUrl();
55 55
 
56 56
 
57
-    /**
58
-     * @return string
59
-     */
60
-    public function version();
57
+	/**
58
+	 * @return string
59
+	 */
60
+	public function version();
61 61
 
62 62
 
63
-    /**
64
-     * @return Version
65
-     */
66
-    public function versionValueObject();
63
+	/**
64
+	 * @return Version
65
+	 */
66
+	public function versionValueObject();
67 67
 
68 68
 
69
-    /**
70
-     * @return string
71
-     */
72
-    public function distributionAssetsFolder();
69
+	/**
70
+	 * @return string
71
+	 */
72
+	public function distributionAssetsFolder();
73 73
 
74 74
 
75
-    /**
76
-     * @param string $additional_path
77
-     * @return string
78
-     */
79
-    public function distributionAssetsPath($additional_path = '');
75
+	/**
76
+	 * @param string $additional_path
77
+	 * @return string
78
+	 */
79
+	public function distributionAssetsPath($additional_path = '');
80 80
 
81 81
 
82
-    /**
83
-     * @param string $additional_path
84
-     * @return string
85
-     */
86
-    public function distributionAssetsUrl($additional_path = '');
82
+	/**
83
+	 * @param string $additional_path
84
+	 * @return string
85
+	 */
86
+	public function distributionAssetsUrl($additional_path = '');
87 87
 
88 88
 
89
-    /**
90
-     * @return string
91
-     */
92
-    public function assetNamespace();
89
+	/**
90
+	 * @return string
91
+	 */
92
+	public function assetNamespace();
93 93
 }
Please login to merge, or discard this patch.
core/domain/services/assets/EventEditorAssetManager.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@
 block discarded – undo
14 14
  */
15 15
 class EventEditorAssetManager extends ReactAssetManager
16 16
 {
17
-    const DOMAIN = 'eventEditor';
17
+	const DOMAIN = 'eventEditor';
18 18
 
19
-    const ASSET_HANDLE_EVENT_EDITOR = Domain::ASSET_NAMESPACE . '-' . EventEditorAssetManager::DOMAIN;
19
+	const ASSET_HANDLE_EVENT_EDITOR = Domain::ASSET_NAMESPACE . '-' . EventEditorAssetManager::DOMAIN;
20 20
 
21 21
 
22
-    /**
23
-     * @throws DomainException
24
-     */
25
-    public function enqueueEventEditor()
26
-    {
27
-        if ($this->verifyAssetIsRegistered(EventEditorAssetManager::ASSET_HANDLE_EVENT_EDITOR)) {
28
-            wp_enqueue_script(EventEditorAssetManager::ASSET_HANDLE_EVENT_EDITOR);
29
-            wp_enqueue_style(EventEditorAssetManager::ASSET_HANDLE_EVENT_EDITOR);
30
-        }
31
-    }
22
+	/**
23
+	 * @throws DomainException
24
+	 */
25
+	public function enqueueEventEditor()
26
+	{
27
+		if ($this->verifyAssetIsRegistered(EventEditorAssetManager::ASSET_HANDLE_EVENT_EDITOR)) {
28
+			wp_enqueue_script(EventEditorAssetManager::ASSET_HANDLE_EVENT_EDITOR);
29
+			wp_enqueue_style(EventEditorAssetManager::ASSET_HANDLE_EVENT_EDITOR);
30
+		}
31
+	}
32 32
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 {
17 17
     const DOMAIN = 'eventEditor';
18 18
 
19
-    const ASSET_HANDLE_EVENT_EDITOR = Domain::ASSET_NAMESPACE . '-' . EventEditorAssetManager::DOMAIN;
19
+    const ASSET_HANDLE_EVENT_EDITOR = Domain::ASSET_NAMESPACE.'-'.EventEditorAssetManager::DOMAIN;
20 20
 
21 21
 
22 22
     /**
Please login to merge, or discard this patch.
core/domain/services/assets/WordPressPluginsPageAssetManager.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,18 +15,18 @@
 block discarded – undo
15 15
  */
16 16
 class WordPressPluginsPageAssetManager extends ReactAssetManager
17 17
 {
18
-    const DOMAIN = 'wpPluginsPage';
18
+	const DOMAIN = 'wpPluginsPage';
19 19
 
20
-    const ASSET_HANDLE_WP_PLUGINS_PAGE = Domain::ASSET_NAMESPACE . '-' . WordPressPluginsPageAssetManager::DOMAIN;
20
+	const ASSET_HANDLE_WP_PLUGINS_PAGE = Domain::ASSET_NAMESPACE . '-' . WordPressPluginsPageAssetManager::DOMAIN;
21 21
 
22
-    /**
23
-     * @throws DomainException
24
-     */
25
-    public function enqueueAssets()
26
-    {
27
-        if ($this->verifyAssetIsRegistered(WordPressPluginsPageAssetManager::ASSET_HANDLE_WP_PLUGINS_PAGE)) {
28
-            wp_enqueue_script(WordPressPluginsPageAssetManager::ASSET_HANDLE_WP_PLUGINS_PAGE);
29
-            wp_enqueue_style(WordPressPluginsPageAssetManager::ASSET_HANDLE_WP_PLUGINS_PAGE);
30
-        }
31
-    }
22
+	/**
23
+	 * @throws DomainException
24
+	 */
25
+	public function enqueueAssets()
26
+	{
27
+		if ($this->verifyAssetIsRegistered(WordPressPluginsPageAssetManager::ASSET_HANDLE_WP_PLUGINS_PAGE)) {
28
+			wp_enqueue_script(WordPressPluginsPageAssetManager::ASSET_HANDLE_WP_PLUGINS_PAGE);
29
+			wp_enqueue_style(WordPressPluginsPageAssetManager::ASSET_HANDLE_WP_PLUGINS_PAGE);
30
+		}
31
+	}
32 32
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 {
18 18
     const DOMAIN = 'wpPluginsPage';
19 19
 
20
-    const ASSET_HANDLE_WP_PLUGINS_PAGE = Domain::ASSET_NAMESPACE . '-' . WordPressPluginsPageAssetManager::DOMAIN;
20
+    const ASSET_HANDLE_WP_PLUGINS_PAGE = Domain::ASSET_NAMESPACE.'-'.WordPressPluginsPageAssetManager::DOMAIN;
21 21
 
22 22
     /**
23 23
      * @throws DomainException
Please login to merge, or discard this patch.
core/domain/DomainBase.php 2 patches
Indentation   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -17,218 +17,218 @@
 block discarded – undo
17 17
 abstract class DomainBase implements DomainInterface
18 18
 {
19 19
 
20
-    const ASSETS_FOLDER = 'assets/';
21
-
22
-    /**
23
-     * Equivalent to `__FILE__` for main plugin file.
24
-     *
25
-     * @var FilePath
26
-     */
27
-    private $plugin_file;
28
-
29
-    /**
30
-     * String indicating version for plugin
31
-     *
32
-     * @var string
33
-     */
34
-    private $version;
35
-
36
-    /**
37
-     * @var string $plugin_basename
38
-     */
39
-    private $plugin_basename;
40
-
41
-    /**
42
-     * @var string $plugin_path
43
-     */
44
-    private $plugin_path;
45
-
46
-    /**
47
-     * @var string $plugin_url
48
-     */
49
-    private $plugin_url;
50
-
51
-    /**
52
-     * @var string $asset_namespace
53
-     */
54
-    private $asset_namespace;
55
-
56
-    /**
57
-     * @var string $assets_path
58
-     */
59
-    private $assets_path;
60
-
61
-    /**
62
-     * @var bool
63
-     */
64
-    protected $initialized = false;
65
-
66
-
67
-    /**
68
-     * Initializes internal properties.
69
-     *
70
-     * @param FilePath $plugin_file
71
-     * @param Version  $version
72
-     * @param string $asset_namespace
73
-     */
74
-    public function __construct(FilePath $plugin_file, Version $version, $asset_namespace = Domain::ASSET_NAMESPACE)
75
-    {
76
-        $this->plugin_file = $plugin_file;
77
-        $this->version     = $version;
78
-        $this->initialize($asset_namespace);
79
-    }
80
-
81
-
82
-    /**
83
-     * @param string $asset_namespace
84
-     * @return void
85
-     * @since $VID:$
86
-     */
87
-    public function initialize($asset_namespace = Domain::ASSET_NAMESPACE)
88
-    {
89
-        if (! $this->initialized) {
90
-            $this->plugin_basename = plugin_basename($this->pluginFile());
91
-            $this->plugin_path     = plugin_dir_path($this->pluginFile());
92
-            $this->plugin_url      = plugin_dir_url($this->pluginFile());
93
-            $this->setAssetNamespace($asset_namespace);
94
-            $this->setDistributionAssetsPath();
95
-            $this->initialized = true;
96
-        }
97
-    }
98
-
99
-
100
-    /**
101
-     * @param string $asset_namespace
102
-     * @return void
103
-     */
104
-    public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE)
105
-    {
106
-        if (! $this->asset_namespace) {
107
-            $this->asset_namespace = sanitize_key(
108
-                // convert directory separators to dashes and remove file extension
109
-                str_replace(['/', '.php'], ['-', ''], $asset_namespace)
110
-            );
111
-        }
112
-    }
113
-
114
-
115
-    /**
116
-     * @throws DomainException
117
-     * @since $VID:$
118
-     */
119
-    private function setDistributionAssetsPath()
120
-    {
121
-        $assets_path = $this->pluginPath() . DomainBase::ASSETS_FOLDER;
122
-        if (! is_readable($assets_path)) {
123
-            throw new DomainException(
124
-                sprintf(
125
-                    esc_html__(
126
-                        'The assets distribution folder was not found or is not readable. Please verify that "%1$s" exists and has valid permissions.',
127
-                        'event_espresso'
128
-                    ),
129
-                    $assets_path
130
-                )
131
-            );
132
-        }
133
-        $this->assets_path = trailingslashit($assets_path);
134
-    }
135
-
136
-
137
-    /**
138
-     * @return string
139
-     */
140
-    public function pluginFile()
141
-    {
142
-        return (string) $this->plugin_file;
143
-    }
144
-
145
-
146
-    /**
147
-     * @return string
148
-     */
149
-    public function pluginBasename()
150
-    {
151
-        return $this->plugin_basename;
152
-    }
153
-
154
-
155
-    /**
156
-     * @param string $additional_path
157
-     * @return string
158
-     */
159
-    public function pluginPath($additional_path = '')
160
-    {
161
-        return is_string($additional_path) && $additional_path !== ''
162
-            ? $this->plugin_path . $additional_path
163
-            : $this->plugin_path;
164
-    }
165
-
166
-
167
-    /**
168
-     * @return string
169
-     */
170
-    public function pluginUrl()
171
-    {
172
-        return $this->plugin_url;
173
-    }
174
-
175
-
176
-    /**
177
-     * @return string
178
-     */
179
-    public function version()
180
-    {
181
-        return (string) $this->version;
182
-    }
183
-
184
-
185
-    /**
186
-     * @return Version
187
-     */
188
-    public function versionValueObject()
189
-    {
190
-        return $this->version;
191
-    }
192
-
193
-
194
-    /**
195
-     * @return string
196
-     */
197
-    public function distributionAssetsFolder()
198
-    {
199
-        return DomainBase::ASSETS_FOLDER;
200
-    }
201
-
202
-
203
-    /**
204
-     * @param string $additional_path
205
-     * @return string
206
-     */
207
-    public function distributionAssetsPath($additional_path = '')
208
-    {
209
-        return is_string($additional_path) && $additional_path !== ''
210
-            ? $this->assets_path . $additional_path
211
-            : $this->assets_path;
212
-    }
213
-
214
-
215
-    /**
216
-     * @param string $additional_path
217
-     * @return string
218
-     */
219
-    public function distributionAssetsUrl($additional_path = '')
220
-    {
221
-        return is_string($additional_path) && $additional_path !== ''
222
-            ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path
223
-            : $this->plugin_url . DomainBase::ASSETS_FOLDER;
224
-    }
225
-
226
-
227
-    /**
228
-     * @return string
229
-     */
230
-    public function assetNamespace()
231
-    {
232
-        return $this->asset_namespace;
233
-    }
20
+	const ASSETS_FOLDER = 'assets/';
21
+
22
+	/**
23
+	 * Equivalent to `__FILE__` for main plugin file.
24
+	 *
25
+	 * @var FilePath
26
+	 */
27
+	private $plugin_file;
28
+
29
+	/**
30
+	 * String indicating version for plugin
31
+	 *
32
+	 * @var string
33
+	 */
34
+	private $version;
35
+
36
+	/**
37
+	 * @var string $plugin_basename
38
+	 */
39
+	private $plugin_basename;
40
+
41
+	/**
42
+	 * @var string $plugin_path
43
+	 */
44
+	private $plugin_path;
45
+
46
+	/**
47
+	 * @var string $plugin_url
48
+	 */
49
+	private $plugin_url;
50
+
51
+	/**
52
+	 * @var string $asset_namespace
53
+	 */
54
+	private $asset_namespace;
55
+
56
+	/**
57
+	 * @var string $assets_path
58
+	 */
59
+	private $assets_path;
60
+
61
+	/**
62
+	 * @var bool
63
+	 */
64
+	protected $initialized = false;
65
+
66
+
67
+	/**
68
+	 * Initializes internal properties.
69
+	 *
70
+	 * @param FilePath $plugin_file
71
+	 * @param Version  $version
72
+	 * @param string $asset_namespace
73
+	 */
74
+	public function __construct(FilePath $plugin_file, Version $version, $asset_namespace = Domain::ASSET_NAMESPACE)
75
+	{
76
+		$this->plugin_file = $plugin_file;
77
+		$this->version     = $version;
78
+		$this->initialize($asset_namespace);
79
+	}
80
+
81
+
82
+	/**
83
+	 * @param string $asset_namespace
84
+	 * @return void
85
+	 * @since $VID:$
86
+	 */
87
+	public function initialize($asset_namespace = Domain::ASSET_NAMESPACE)
88
+	{
89
+		if (! $this->initialized) {
90
+			$this->plugin_basename = plugin_basename($this->pluginFile());
91
+			$this->plugin_path     = plugin_dir_path($this->pluginFile());
92
+			$this->plugin_url      = plugin_dir_url($this->pluginFile());
93
+			$this->setAssetNamespace($asset_namespace);
94
+			$this->setDistributionAssetsPath();
95
+			$this->initialized = true;
96
+		}
97
+	}
98
+
99
+
100
+	/**
101
+	 * @param string $asset_namespace
102
+	 * @return void
103
+	 */
104
+	public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE)
105
+	{
106
+		if (! $this->asset_namespace) {
107
+			$this->asset_namespace = sanitize_key(
108
+				// convert directory separators to dashes and remove file extension
109
+				str_replace(['/', '.php'], ['-', ''], $asset_namespace)
110
+			);
111
+		}
112
+	}
113
+
114
+
115
+	/**
116
+	 * @throws DomainException
117
+	 * @since $VID:$
118
+	 */
119
+	private function setDistributionAssetsPath()
120
+	{
121
+		$assets_path = $this->pluginPath() . DomainBase::ASSETS_FOLDER;
122
+		if (! is_readable($assets_path)) {
123
+			throw new DomainException(
124
+				sprintf(
125
+					esc_html__(
126
+						'The assets distribution folder was not found or is not readable. Please verify that "%1$s" exists and has valid permissions.',
127
+						'event_espresso'
128
+					),
129
+					$assets_path
130
+				)
131
+			);
132
+		}
133
+		$this->assets_path = trailingslashit($assets_path);
134
+	}
135
+
136
+
137
+	/**
138
+	 * @return string
139
+	 */
140
+	public function pluginFile()
141
+	{
142
+		return (string) $this->plugin_file;
143
+	}
144
+
145
+
146
+	/**
147
+	 * @return string
148
+	 */
149
+	public function pluginBasename()
150
+	{
151
+		return $this->plugin_basename;
152
+	}
153
+
154
+
155
+	/**
156
+	 * @param string $additional_path
157
+	 * @return string
158
+	 */
159
+	public function pluginPath($additional_path = '')
160
+	{
161
+		return is_string($additional_path) && $additional_path !== ''
162
+			? $this->plugin_path . $additional_path
163
+			: $this->plugin_path;
164
+	}
165
+
166
+
167
+	/**
168
+	 * @return string
169
+	 */
170
+	public function pluginUrl()
171
+	{
172
+		return $this->plugin_url;
173
+	}
174
+
175
+
176
+	/**
177
+	 * @return string
178
+	 */
179
+	public function version()
180
+	{
181
+		return (string) $this->version;
182
+	}
183
+
184
+
185
+	/**
186
+	 * @return Version
187
+	 */
188
+	public function versionValueObject()
189
+	{
190
+		return $this->version;
191
+	}
192
+
193
+
194
+	/**
195
+	 * @return string
196
+	 */
197
+	public function distributionAssetsFolder()
198
+	{
199
+		return DomainBase::ASSETS_FOLDER;
200
+	}
201
+
202
+
203
+	/**
204
+	 * @param string $additional_path
205
+	 * @return string
206
+	 */
207
+	public function distributionAssetsPath($additional_path = '')
208
+	{
209
+		return is_string($additional_path) && $additional_path !== ''
210
+			? $this->assets_path . $additional_path
211
+			: $this->assets_path;
212
+	}
213
+
214
+
215
+	/**
216
+	 * @param string $additional_path
217
+	 * @return string
218
+	 */
219
+	public function distributionAssetsUrl($additional_path = '')
220
+	{
221
+		return is_string($additional_path) && $additional_path !== ''
222
+			? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path
223
+			: $this->plugin_url . DomainBase::ASSETS_FOLDER;
224
+	}
225
+
226
+
227
+	/**
228
+	 * @return string
229
+	 */
230
+	public function assetNamespace()
231
+	{
232
+		return $this->asset_namespace;
233
+	}
234 234
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function initialize($asset_namespace = Domain::ASSET_NAMESPACE)
88 88
     {
89
-        if (! $this->initialized) {
89
+        if ( ! $this->initialized) {
90 90
             $this->plugin_basename = plugin_basename($this->pluginFile());
91 91
             $this->plugin_path     = plugin_dir_path($this->pluginFile());
92 92
             $this->plugin_url      = plugin_dir_url($this->pluginFile());
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE)
105 105
     {
106
-        if (! $this->asset_namespace) {
106
+        if ( ! $this->asset_namespace) {
107 107
             $this->asset_namespace = sanitize_key(
108 108
                 // convert directory separators to dashes and remove file extension
109 109
                 str_replace(['/', '.php'], ['-', ''], $asset_namespace)
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
      */
119 119
     private function setDistributionAssetsPath()
120 120
     {
121
-        $assets_path = $this->pluginPath() . DomainBase::ASSETS_FOLDER;
122
-        if (! is_readable($assets_path)) {
121
+        $assets_path = $this->pluginPath().DomainBase::ASSETS_FOLDER;
122
+        if ( ! is_readable($assets_path)) {
123 123
             throw new DomainException(
124 124
                 sprintf(
125 125
                     esc_html__(
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     public function pluginPath($additional_path = '')
160 160
     {
161 161
         return is_string($additional_path) && $additional_path !== ''
162
-            ? $this->plugin_path . $additional_path
162
+            ? $this->plugin_path.$additional_path
163 163
             : $this->plugin_path;
164 164
     }
165 165
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     public function distributionAssetsPath($additional_path = '')
208 208
     {
209 209
         return is_string($additional_path) && $additional_path !== ''
210
-            ? $this->assets_path . $additional_path
210
+            ? $this->assets_path.$additional_path
211 211
             : $this->assets_path;
212 212
     }
213 213
 
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
     public function distributionAssetsUrl($additional_path = '')
220 220
     {
221 221
         return is_string($additional_path) && $additional_path !== ''
222
-            ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path
223
-            : $this->plugin_url . DomainBase::ASSETS_FOLDER;
222
+            ? $this->plugin_url.DomainBase::ASSETS_FOLDER.$additional_path
223
+            : $this->plugin_url.DomainBase::ASSETS_FOLDER;
224 224
     }
225 225
 
226 226
 
Please login to merge, or discard this patch.