@@ -21,142 +21,142 @@ |
||
21 | 21 | abstract class AssetManager implements AssetManagerInterface |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var AssetCollection $assets |
|
26 | - */ |
|
27 | - protected $assets; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var DomainInterface |
|
31 | - */ |
|
32 | - protected $domain; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var Registry $registry |
|
36 | - */ |
|
37 | - protected $registry; |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * AssetRegister constructor. |
|
42 | - * |
|
43 | - * @param DomainInterface $domain |
|
44 | - * @param AssetCollection $assets |
|
45 | - * @param Registry $registry |
|
46 | - */ |
|
47 | - public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry) |
|
48 | - { |
|
49 | - $this->domain = $domain; |
|
50 | - $this->assets = $assets; |
|
51 | - $this->registry = $registry; |
|
52 | - add_action('wp_enqueue_scripts', array($this, 'addManifestFile'), 0); |
|
53 | - add_action('admin_enqueue_scripts', array($this, 'addManifestFile'), 0); |
|
54 | - add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2); |
|
55 | - add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2); |
|
56 | - } |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * @return void |
|
61 | - * @throws DuplicateCollectionIdentifierException |
|
62 | - * @throws InvalidDataTypeException |
|
63 | - * @throws InvalidEntityException |
|
64 | - * @since 4.9.62.p |
|
65 | - */ |
|
66 | - public function addManifestFile() |
|
67 | - { |
|
68 | - // if a manifest file has already been added for this domain, then just return that one |
|
69 | - if ($this->assets->has($this->domain->assetNamespace())) { |
|
70 | - return; |
|
71 | - } |
|
72 | - $asset = new ManifestFile($this->domain); |
|
73 | - $this->assets->add($asset, $this->domain->assetNamespace()); |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * @return ManifestFile[] |
|
79 | - * @since 4.9.62.p |
|
80 | - */ |
|
81 | - public function getManifestFile() |
|
82 | - { |
|
83 | - return $this->assets->getManifestFiles(); |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * @param string $handle |
|
89 | - * @param string $source |
|
90 | - * @param array $dependencies |
|
91 | - * @param bool $load_in_footer |
|
92 | - * @return JavascriptAsset |
|
93 | - * @throws DuplicateCollectionIdentifierException |
|
94 | - * @throws InvalidDataTypeException |
|
95 | - * @throws InvalidEntityException |
|
96 | - * @since 4.9.62.p |
|
97 | - */ |
|
98 | - public function addJavascript( |
|
99 | - $handle, |
|
100 | - $source, |
|
101 | - array $dependencies = array(), |
|
102 | - $load_in_footer = true |
|
103 | - ) { |
|
104 | - $asset = new JavascriptAsset( |
|
105 | - $handle, |
|
106 | - $source, |
|
107 | - $dependencies, |
|
108 | - $load_in_footer, |
|
109 | - $this->domain |
|
110 | - ); |
|
111 | - $this->assets->add($asset, $handle); |
|
112 | - return $asset; |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * @param string $handle |
|
119 | - * @param string $source |
|
120 | - * @param array $dependencies |
|
121 | - * @param string $media |
|
122 | - * @return StylesheetAsset |
|
123 | - * @throws DuplicateCollectionIdentifierException |
|
124 | - * @throws InvalidDataTypeException |
|
125 | - * @throws InvalidEntityException |
|
126 | - * @since 4.9.62.p |
|
127 | - */ |
|
128 | - public function addStylesheet( |
|
129 | - $handle, |
|
130 | - $source, |
|
131 | - array $dependencies = array(), |
|
132 | - $media = 'all' |
|
133 | - ) { |
|
134 | - $asset = new StylesheetAsset( |
|
135 | - $handle, |
|
136 | - $source, |
|
137 | - $dependencies, |
|
138 | - $this->domain, |
|
139 | - $media |
|
140 | - ); |
|
141 | - $this->assets->add($asset, $handle); |
|
142 | - return $asset; |
|
143 | - } |
|
144 | - |
|
145 | - |
|
146 | - /** |
|
147 | - * @param string $handle |
|
148 | - * @return bool |
|
149 | - * @since 4.9.62.p |
|
150 | - */ |
|
151 | - public function enqueueAsset($handle) |
|
152 | - { |
|
153 | - if ($this->assets->has($handle)) { |
|
154 | - $asset = $this->assets->get($handle); |
|
155 | - if ($asset->isRegistered()) { |
|
156 | - $asset->enqueueAsset(); |
|
157 | - return true; |
|
158 | - } |
|
159 | - } |
|
160 | - return false; |
|
161 | - } |
|
24 | + /** |
|
25 | + * @var AssetCollection $assets |
|
26 | + */ |
|
27 | + protected $assets; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var DomainInterface |
|
31 | + */ |
|
32 | + protected $domain; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var Registry $registry |
|
36 | + */ |
|
37 | + protected $registry; |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * AssetRegister constructor. |
|
42 | + * |
|
43 | + * @param DomainInterface $domain |
|
44 | + * @param AssetCollection $assets |
|
45 | + * @param Registry $registry |
|
46 | + */ |
|
47 | + public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry) |
|
48 | + { |
|
49 | + $this->domain = $domain; |
|
50 | + $this->assets = $assets; |
|
51 | + $this->registry = $registry; |
|
52 | + add_action('wp_enqueue_scripts', array($this, 'addManifestFile'), 0); |
|
53 | + add_action('admin_enqueue_scripts', array($this, 'addManifestFile'), 0); |
|
54 | + add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2); |
|
55 | + add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2); |
|
56 | + } |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * @return void |
|
61 | + * @throws DuplicateCollectionIdentifierException |
|
62 | + * @throws InvalidDataTypeException |
|
63 | + * @throws InvalidEntityException |
|
64 | + * @since 4.9.62.p |
|
65 | + */ |
|
66 | + public function addManifestFile() |
|
67 | + { |
|
68 | + // if a manifest file has already been added for this domain, then just return that one |
|
69 | + if ($this->assets->has($this->domain->assetNamespace())) { |
|
70 | + return; |
|
71 | + } |
|
72 | + $asset = new ManifestFile($this->domain); |
|
73 | + $this->assets->add($asset, $this->domain->assetNamespace()); |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * @return ManifestFile[] |
|
79 | + * @since 4.9.62.p |
|
80 | + */ |
|
81 | + public function getManifestFile() |
|
82 | + { |
|
83 | + return $this->assets->getManifestFiles(); |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * @param string $handle |
|
89 | + * @param string $source |
|
90 | + * @param array $dependencies |
|
91 | + * @param bool $load_in_footer |
|
92 | + * @return JavascriptAsset |
|
93 | + * @throws DuplicateCollectionIdentifierException |
|
94 | + * @throws InvalidDataTypeException |
|
95 | + * @throws InvalidEntityException |
|
96 | + * @since 4.9.62.p |
|
97 | + */ |
|
98 | + public function addJavascript( |
|
99 | + $handle, |
|
100 | + $source, |
|
101 | + array $dependencies = array(), |
|
102 | + $load_in_footer = true |
|
103 | + ) { |
|
104 | + $asset = new JavascriptAsset( |
|
105 | + $handle, |
|
106 | + $source, |
|
107 | + $dependencies, |
|
108 | + $load_in_footer, |
|
109 | + $this->domain |
|
110 | + ); |
|
111 | + $this->assets->add($asset, $handle); |
|
112 | + return $asset; |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * @param string $handle |
|
119 | + * @param string $source |
|
120 | + * @param array $dependencies |
|
121 | + * @param string $media |
|
122 | + * @return StylesheetAsset |
|
123 | + * @throws DuplicateCollectionIdentifierException |
|
124 | + * @throws InvalidDataTypeException |
|
125 | + * @throws InvalidEntityException |
|
126 | + * @since 4.9.62.p |
|
127 | + */ |
|
128 | + public function addStylesheet( |
|
129 | + $handle, |
|
130 | + $source, |
|
131 | + array $dependencies = array(), |
|
132 | + $media = 'all' |
|
133 | + ) { |
|
134 | + $asset = new StylesheetAsset( |
|
135 | + $handle, |
|
136 | + $source, |
|
137 | + $dependencies, |
|
138 | + $this->domain, |
|
139 | + $media |
|
140 | + ); |
|
141 | + $this->assets->add($asset, $handle); |
|
142 | + return $asset; |
|
143 | + } |
|
144 | + |
|
145 | + |
|
146 | + /** |
|
147 | + * @param string $handle |
|
148 | + * @return bool |
|
149 | + * @since 4.9.62.p |
|
150 | + */ |
|
151 | + public function enqueueAsset($handle) |
|
152 | + { |
|
153 | + if ($this->assets->has($handle)) { |
|
154 | + $asset = $this->assets->get($handle); |
|
155 | + if ($asset->isRegistered()) { |
|
156 | + $asset->enqueueAsset(); |
|
157 | + return true; |
|
158 | + } |
|
159 | + } |
|
160 | + return false; |
|
161 | + } |
|
162 | 162 | } |
@@ -20,72 +20,72 @@ |
||
20 | 20 | interface AssetManagerInterface |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @since 4.9.62.p |
|
25 | - */ |
|
26 | - public function addAssets(); |
|
23 | + /** |
|
24 | + * @since 4.9.62.p |
|
25 | + */ |
|
26 | + public function addAssets(); |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * @return ManifestFile |
|
31 | - * @throws DuplicateCollectionIdentifierException |
|
32 | - * @throws InvalidDataTypeException |
|
33 | - * @throws InvalidEntityException |
|
34 | - * @since 4.9.62.p |
|
35 | - */ |
|
36 | - public function addManifestFile(); |
|
29 | + /** |
|
30 | + * @return ManifestFile |
|
31 | + * @throws DuplicateCollectionIdentifierException |
|
32 | + * @throws InvalidDataTypeException |
|
33 | + * @throws InvalidEntityException |
|
34 | + * @since 4.9.62.p |
|
35 | + */ |
|
36 | + public function addManifestFile(); |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @return ManifestFile[] |
|
41 | - * @since 4.9.62.p |
|
42 | - */ |
|
43 | - public function getManifestFile(); |
|
39 | + /** |
|
40 | + * @return ManifestFile[] |
|
41 | + * @since 4.9.62.p |
|
42 | + */ |
|
43 | + public function getManifestFile(); |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * @param string $handle |
|
48 | - * @param string $source |
|
49 | - * @param array $dependencies |
|
50 | - * @param bool $load_in_footer |
|
51 | - * @return JavascriptAsset |
|
52 | - * @throws DuplicateCollectionIdentifierException |
|
53 | - * @throws InvalidDataTypeException |
|
54 | - * @throws InvalidEntityException |
|
55 | - * @since 4.9.62.p |
|
56 | - */ |
|
57 | - public function addJavascript( |
|
58 | - $handle, |
|
59 | - $source, |
|
60 | - array $dependencies = array(), |
|
61 | - $load_in_footer = true |
|
62 | - ); |
|
46 | + /** |
|
47 | + * @param string $handle |
|
48 | + * @param string $source |
|
49 | + * @param array $dependencies |
|
50 | + * @param bool $load_in_footer |
|
51 | + * @return JavascriptAsset |
|
52 | + * @throws DuplicateCollectionIdentifierException |
|
53 | + * @throws InvalidDataTypeException |
|
54 | + * @throws InvalidEntityException |
|
55 | + * @since 4.9.62.p |
|
56 | + */ |
|
57 | + public function addJavascript( |
|
58 | + $handle, |
|
59 | + $source, |
|
60 | + array $dependencies = array(), |
|
61 | + $load_in_footer = true |
|
62 | + ); |
|
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | - /** |
|
67 | - * @param string $handle |
|
68 | - * @param string $source |
|
69 | - * @param array $dependencies |
|
70 | - * @param string $media |
|
71 | - * @return StylesheetAsset |
|
72 | - * @throws DuplicateCollectionIdentifierException |
|
73 | - * @throws InvalidDataTypeException |
|
74 | - * @throws InvalidEntityException |
|
75 | - * @since 4.9.62.p |
|
76 | - */ |
|
77 | - public function addStylesheet( |
|
78 | - $handle, |
|
79 | - $source, |
|
80 | - array $dependencies = array(), |
|
81 | - $media = 'all' |
|
82 | - ); |
|
66 | + /** |
|
67 | + * @param string $handle |
|
68 | + * @param string $source |
|
69 | + * @param array $dependencies |
|
70 | + * @param string $media |
|
71 | + * @return StylesheetAsset |
|
72 | + * @throws DuplicateCollectionIdentifierException |
|
73 | + * @throws InvalidDataTypeException |
|
74 | + * @throws InvalidEntityException |
|
75 | + * @since 4.9.62.p |
|
76 | + */ |
|
77 | + public function addStylesheet( |
|
78 | + $handle, |
|
79 | + $source, |
|
80 | + array $dependencies = array(), |
|
81 | + $media = 'all' |
|
82 | + ); |
|
83 | 83 | |
84 | 84 | |
85 | - /** |
|
86 | - * @param string $handle |
|
87 | - * @return bool |
|
88 | - * @since 4.9.62.p |
|
89 | - */ |
|
90 | - public function enqueueAsset($handle); |
|
85 | + /** |
|
86 | + * @param string $handle |
|
87 | + * @return bool |
|
88 | + * @since 4.9.62.p |
|
89 | + */ |
|
90 | + public function enqueueAsset($handle); |
|
91 | 91 | } |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.63.rc.015'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.63.rc.015'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |