@@ -63,8 +63,8 @@ |
||
63 | 63 | */ |
64 | 64 | private function setCaffeinated() |
65 | 65 | { |
66 | - $this->caffeinated = (! defined('EE_DECAF') || EE_DECAF !== true) |
|
67 | - && is_readable($this->pluginPath() . 'caffeinated/brewing_regular.php'); |
|
66 | + $this->caffeinated = ( ! defined('EE_DECAF') || EE_DECAF !== true) |
|
67 | + && is_readable($this->pluginPath().'caffeinated/brewing_regular.php'); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 |
@@ -15,66 +15,66 @@ |
||
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'; |
|
18 | + /** |
|
19 | + * URL path component used to denote an API request |
|
20 | + */ |
|
21 | + const API_NAMESPACE = 'ee/v'; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Slug used for the context where a registration status is changed from a manual trigger in the Registration Admin |
|
25 | - * Page ui. |
|
26 | - */ |
|
27 | - const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN |
|
28 | - = 'manual_registration_status_change_from_registration_admin'; |
|
23 | + /** |
|
24 | + * Slug used for the context where a registration status is changed from a manual trigger in the Registration Admin |
|
25 | + * Page ui. |
|
26 | + */ |
|
27 | + const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN |
|
28 | + = 'manual_registration_status_change_from_registration_admin'; |
|
29 | 29 | |
30 | - const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY |
|
31 | - = 'manual_registration_status_change_from_registration_admin_and_notify'; |
|
30 | + const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY |
|
31 | + = 'manual_registration_status_change_from_registration_admin_and_notify'; |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * Whether or not EE core is the full premium version. |
|
36 | - * @since 4.9.59.p |
|
37 | - * @var bool |
|
38 | - */ |
|
39 | - private $caffeinated; |
|
34 | + /** |
|
35 | + * Whether or not EE core is the full premium version. |
|
36 | + * @since 4.9.59.p |
|
37 | + * @var bool |
|
38 | + */ |
|
39 | + private $caffeinated; |
|
40 | 40 | |
41 | 41 | |
42 | - public function __construct(FilePath $plugin_file, Version $version) |
|
43 | - { |
|
44 | - parent::__construct($plugin_file, $version); |
|
45 | - $this->setCaffeinated(); |
|
46 | - } |
|
42 | + public function __construct(FilePath $plugin_file, Version $version) |
|
43 | + { |
|
44 | + parent::__construct($plugin_file, $version); |
|
45 | + $this->setCaffeinated(); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Whether or not EE core is the full premium version. |
|
50 | - * @since 4.9.59.p |
|
51 | - * @return bool |
|
52 | - */ |
|
53 | - public function isCaffeinated() |
|
54 | - { |
|
55 | - return $this->caffeinated; |
|
56 | - } |
|
48 | + /** |
|
49 | + * Whether or not EE core is the full premium version. |
|
50 | + * @since 4.9.59.p |
|
51 | + * @return bool |
|
52 | + */ |
|
53 | + public function isCaffeinated() |
|
54 | + { |
|
55 | + return $this->caffeinated; |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Setter for $is_caffeinated property. |
|
61 | - * @since 4.9.59.p |
|
62 | - */ |
|
63 | - private function setCaffeinated() |
|
64 | - { |
|
65 | - $this->caffeinated = (! defined('EE_DECAF') || EE_DECAF !== true) |
|
66 | - && is_readable($this->pluginPath() . 'caffeinated/brewing_regular.php'); |
|
67 | - } |
|
59 | + /** |
|
60 | + * Setter for $is_caffeinated property. |
|
61 | + * @since 4.9.59.p |
|
62 | + */ |
|
63 | + private function setCaffeinated() |
|
64 | + { |
|
65 | + $this->caffeinated = (! defined('EE_DECAF') || EE_DECAF !== true) |
|
66 | + && is_readable($this->pluginPath() . 'caffeinated/brewing_regular.php'); |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | - /** |
|
71 | - * This should be used everywhere the Event Espresso brand name is referenced in public facing interfaces |
|
72 | - * to allow for filtering the brand. |
|
73 | - * |
|
74 | - * @return string |
|
75 | - */ |
|
76 | - public static function brandName() |
|
77 | - { |
|
78 | - return (string) apply_filters('FHEE__EventEspresso_core_domain_Domain__brandName', 'Event Espresso'); |
|
79 | - } |
|
70 | + /** |
|
71 | + * This should be used everywhere the Event Espresso brand name is referenced in public facing interfaces |
|
72 | + * to allow for filtering the brand. |
|
73 | + * |
|
74 | + * @return string |
|
75 | + */ |
|
76 | + public static function brandName() |
|
77 | + { |
|
78 | + return (string) apply_filters('FHEE__EventEspresso_core_domain_Domain__brandName', 'Event Espresso'); |
|
79 | + } |
|
80 | 80 | } |
@@ -4,8 +4,8 @@ |
||
4 | 4 | <p><strong><?php esc_html_e('Add New Price Type', 'event_espresso'); ?></strong></p> |
5 | 5 | <p> |
6 | 6 | <?php printf( |
7 | - esc_html__('This page allows you to create a new price type for %s.', 'event_espresso'), |
|
8 | - Domain::brandName() |
|
7 | + esc_html__('This page allows you to create a new price type for %s.', 'event_espresso'), |
|
8 | + Domain::brandName() |
|
9 | 9 | ); ?> |
10 | 10 | </p> |
11 | 11 | <ul> |
@@ -4,8 +4,8 @@ |
||
4 | 4 | <p><strong><?php esc_html_e('Edit Default Price', 'event_espresso'); ?></strong></p> |
5 | 5 | <p> |
6 | 6 | <?php printf( |
7 | - esc_html__('This page allows you to edit a default price for %s.', 'event_espresso'), |
|
8 | - Domain::brandName() |
|
7 | + esc_html__('This page allows you to edit a default price for %s.', 'event_espresso'), |
|
8 | + Domain::brandName() |
|
9 | 9 | ); ?> |
10 | 10 | </p> |
11 | 11 | <ul> |
@@ -4,8 +4,8 @@ |
||
4 | 4 | <p><strong><?php esc_html_e('Edit Price Type', 'event_espresso'); ?></strong></p> |
5 | 5 | <p> |
6 | 6 | <?php printf( |
7 | - esc_html__('This page allows you to edit a price type for %s.', 'event_espresso'), |
|
8 | - Domain::brandName() |
|
7 | + esc_html__('This page allows you to edit a price type for %s.', 'event_espresso'), |
|
8 | + Domain::brandName() |
|
9 | 9 | ); ?> |
10 | 10 | </p> |
11 | 11 | <ul> |
@@ -4,8 +4,8 @@ |
||
4 | 4 | <p><strong><?php esc_html_e('Add New Default Price', 'event_espresso'); ?></strong></p> |
5 | 5 | <p> |
6 | 6 | <?php printf( |
7 | - esc_html__('This page allows you to create a new default price for %s.', 'event_espresso'), |
|
8 | - Domain::brandName() |
|
7 | + esc_html__('This page allows you to create a new default price for %s.', 'event_espresso'), |
|
8 | + Domain::brandName() |
|
9 | 9 | ); ?> |
10 | 10 | </p> |
11 | 11 | <ul> |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $this->loader->getShared( |
60 | 60 | 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' |
61 | 61 | ); |
62 | - } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) { |
|
62 | + } elseif ($screenID === 'front' && ! empty($heartbeat_data[self::RESPONSE_KEY_THANK_YOU_PAGE])) { |
|
63 | 63 | $this->loader->getShared( |
64 | 64 | 'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor' |
65 | 65 | ); |
@@ -16,52 +16,52 @@ |
||
16 | 16 | */ |
17 | 17 | class WordpressHeartbeat |
18 | 18 | { |
19 | - const RESPONSE_KEY_THANK_YOU_PAGE = 'espresso_thank_you_page'; |
|
19 | + const RESPONSE_KEY_THANK_YOU_PAGE = 'espresso_thank_you_page'; |
|
20 | 20 | |
21 | - /** |
|
22 | - * @var LoaderInterface $loader |
|
23 | - */ |
|
24 | - protected $loader; |
|
21 | + /** |
|
22 | + * @var LoaderInterface $loader |
|
23 | + */ |
|
24 | + protected $loader; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var RequestInterface $request |
|
28 | - */ |
|
29 | - protected $request; |
|
26 | + /** |
|
27 | + * @var RequestInterface $request |
|
28 | + */ |
|
29 | + protected $request; |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * WordpressHeartbeat constructor. |
|
34 | - * |
|
35 | - * @param LoaderInterface $loader |
|
36 | - * @param RequestInterface $request |
|
37 | - */ |
|
38 | - public function __construct( |
|
39 | - LoaderInterface $loader, |
|
40 | - RequestInterface $request |
|
41 | - ) { |
|
42 | - $this->loader = $loader; |
|
43 | - $this->request = $request; |
|
44 | - do_action('AHEE__EventEspresso_core_domain_services_admin_ajax_WordpressHeartbeat__constructor', $this); |
|
45 | - add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'resolveRoutes')); |
|
46 | - } |
|
32 | + /** |
|
33 | + * WordpressHeartbeat constructor. |
|
34 | + * |
|
35 | + * @param LoaderInterface $loader |
|
36 | + * @param RequestInterface $request |
|
37 | + */ |
|
38 | + public function __construct( |
|
39 | + LoaderInterface $loader, |
|
40 | + RequestInterface $request |
|
41 | + ) { |
|
42 | + $this->loader = $loader; |
|
43 | + $this->request = $request; |
|
44 | + do_action('AHEE__EventEspresso_core_domain_services_admin_ajax_WordpressHeartbeat__constructor', $this); |
|
45 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'resolveRoutes')); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * @since 4.9.76.p |
|
51 | - * @throws InvalidClassException |
|
52 | - */ |
|
53 | - public function resolveRoutes() |
|
54 | - { |
|
55 | - $screenID = $this->request->getRequestParam('screen_id'); |
|
56 | - $heartbeat_data = $this->request->getRequestParam('data', [], 'string', true); |
|
57 | - if ($screenID === 'espresso_events') { |
|
58 | - $this->loader->getShared( |
|
59 | - 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' |
|
60 | - ); |
|
61 | - } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) { |
|
62 | - $this->loader->getShared( |
|
63 | - 'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor' |
|
64 | - ); |
|
65 | - } |
|
66 | - } |
|
49 | + /** |
|
50 | + * @since 4.9.76.p |
|
51 | + * @throws InvalidClassException |
|
52 | + */ |
|
53 | + public function resolveRoutes() |
|
54 | + { |
|
55 | + $screenID = $this->request->getRequestParam('screen_id'); |
|
56 | + $heartbeat_data = $this->request->getRequestParam('data', [], 'string', true); |
|
57 | + if ($screenID === 'espresso_events') { |
|
58 | + $this->loader->getShared( |
|
59 | + 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' |
|
60 | + ); |
|
61 | + } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) { |
|
62 | + $this->loader->getShared( |
|
63 | + 'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor' |
|
64 | + ); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | } |
@@ -7,24 +7,24 @@ |
||
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 | ); |
@@ -8,12 +8,12 @@ |
||
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); |
@@ -14,20 +14,20 @@ |
||
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 | } |
@@ -22,249 +22,249 @@ |
||
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 | } |
@@ -57,8 +57,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(); |