PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.12.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.12.1
5.12.1 5.12.0 5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / core / AssetManager / UIAssetFetcher / StylesheetUIAssetFetcher.php
matomo / app / core / AssetManager / UIAssetFetcher Last commit date
Chunk.php 4 months ago JScriptUIAssetFetcher.php 2 years ago PluginUmdAssetFetcher.php 3 months ago StaticUIAssetFetcher.php 2 years ago StylesheetUIAssetFetcher.php 2 years ago
StylesheetUIAssetFetcher.php
84 lines
1 <?php
2
3 /**
4 * Matomo - free/libre analytics platform
5 *
6 * @link https://matomo.org
7 * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
8 */
9 namespace Piwik\AssetManager\UIAssetFetcher;
10
11 use Piwik\AssetManager\UIAssetFetcher;
12 use Piwik\Piwik;
13 class StylesheetUIAssetFetcher extends UIAssetFetcher
14 {
15 protected function getPriorityOrder()
16 {
17 $theme = $this->getTheme();
18 $themeName = $theme->getThemeName();
19 $order = array(
20 'plugins/Morpheus/stylesheets/base/bootstrap.css',
21 'plugins/Morpheus/stylesheets/base/icons.css',
22 'node_modules/',
23 'libs/',
24 'plugins/CoreHome/stylesheets/color_manager.css',
25 // must be before other Piwik stylesheets
26 'plugins/Morpheus/stylesheets/base.less',
27 );
28 if ($themeName === 'Morpheus') {
29 $order[] = 'plugins\\/((?!Morpheus).)*\\/';
30 } else {
31 $order[] = sprintf('plugins\\/((?!(Morpheus)|(%s)).)*\\/', $themeName);
32 }
33 $order = array_merge($order, array('plugins/Dashboard/stylesheets/dashboard.less', 'tests/'));
34 return $order;
35 }
36 protected function retrieveFileLocations()
37 {
38 /**
39 * Triggered when gathering the list of all stylesheets (CSS and LESS) needed by
40 * Piwik and its plugins.
41 *
42 * Plugins that have stylesheets should use this event to make those stylesheets
43 * load.
44 *
45 * Stylesheets should be placed within a **stylesheets** subdirectory in your plugin's
46 * root directory.
47 *
48 * **Example**
49 *
50 * public function getStylesheetFiles(&$stylesheets)
51 * {
52 * $stylesheets[] = "plugins/MyPlugin/stylesheets/myfile.less";
53 * $stylesheets[] = "plugins/MyPlugin/stylesheets/myotherfile.css";
54 * }
55 *
56 * @param string[] &$stylesheets The list of stylesheet paths.
57 */
58 Piwik::postEvent('AssetManager.getStylesheetFiles', array(&$this->fileLocations));
59 $this->addUmdCssFilesIfDetected($this->plugins);
60 $this->addThemeFiles();
61 $this->mapBowerComponentFilesForBC($this->fileLocations);
62 }
63 protected function addThemeFiles()
64 {
65 $theme = $this->getTheme();
66 if (!$theme) {
67 return;
68 }
69 $themeStylesheet = $theme->getStylesheet();
70 if ($themeStylesheet) {
71 $this->fileLocations[] = $themeStylesheet;
72 }
73 }
74 private function addUmdCssFilesIfDetected(array $plugins)
75 {
76 foreach ($plugins as $plugin) {
77 $css = "plugins/{$plugin}/vue/dist/{$plugin}.css";
78 if (is_file(PIWIK_INCLUDE_PATH . '/' . $css)) {
79 $this->fileLocations[] = $css;
80 }
81 }
82 }
83 }
84