Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-08-11 21:17:21 +0400
committermattab <matthieu.aubry@gmail.com>2013-08-11 21:17:21 +0400
commit2340530c1109a37527f3b8ad0b82e54e7a6eb137 (patch)
treeb6df0edb4bec6fa11a74f47b219d33bb8ee571e8
parent7ef891e7ce058a9cb23de75690f6117181e06e45 (diff)
Refs #3942 Now themes don't need to have a PHP file, themes can simply specify a "stylesheet" entry in the plugin.piwik.json, this CSS/less file will be loaded as if it was registered with the css event
-rw-r--r--config/global.ini.php2
-rw-r--r--core/AssetManager.php11
-rw-r--r--core/PluginsManager.php11
-rw-r--r--core/ViewDataTable.php4
-rw-r--r--plugins/Goals/Archiver.php4
-rw-r--r--plugins/PleineLune/PleineLune.php32
-rw-r--r--plugins/PleineLune/plugin.piwik.json3
7 files changed, 23 insertions, 44 deletions
diff --git a/config/global.ini.php b/config/global.ini.php
index 1114efc681..a818c3248c 100644
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -236,7 +236,7 @@ datatable_archiving_maximum_rows_subtable_custom_variables = 1000
; maximum number of rows for any of the Actions tables (pages, downloads, outlinks)
datatable_archiving_maximum_rows_actions = 500
; maximum number of rows for pages in categories (sub pages, when clicking on the + for a page category)
-; note: should not exceed the display limit in Piwik_Actions_Controller::ACTIONS_REPORT_ROWS_DISPLAY
+; note: should not exceed the display limit in Piwik\Actions\Controller::ACTIONS_REPORT_ROWS_DISPLAY
; because each subdirectory doesn't have paging at the bottom, so all data should be displayed if possible.
datatable_archiving_maximum_rows_subtable_actions = 100
diff --git a/core/AssetManager.php b/core/AssetManager.php
index 79f81fafe1..086f538a3f 100644
--- a/core/AssetManager.php
+++ b/core/AssetManager.php
@@ -254,7 +254,18 @@ class AssetManager
{
$cssFiles = array();
Piwik_PostEvent(self::CSS_IMPORT_EVENT, array(&$cssFiles));
+
$cssFiles = self::sortCssFiles($cssFiles);
+
+ // We also look for the currently enabled theme and add CSS from the json
+ $theme = PluginsManager::getInstance()->getThemeEnabled();
+ if($theme) {
+ $info = $theme->getInformation();
+ if(isset($info['stylesheet'])) {
+ $themeStylesheetFile = 'plugins/'. $theme->getPluginName() . '/' . $info['stylesheet'];
+ }
+ $cssFiles[] = $themeStylesheetFile;
+ }
return $cssFiles;
}
diff --git a/core/PluginsManager.php b/core/PluginsManager.php
index 50ede0d98d..faea3d3b23 100644
--- a/core/PluginsManager.php
+++ b/core/PluginsManager.php
@@ -283,8 +283,9 @@ class PluginsManager
}
// Only one theme enabled at a time
- $themeAlreadyEnabled = $this->getThemeEnabled();
- if($themeAlreadyEnabled) {
+ $themeEnabled = $this->getThemeEnabled();
+ if($themeEnabled) {
+ $themeAlreadyEnabled = $themeEnabled->getPluginName();
$plugin = $this->loadPlugin($pluginName);
if($plugin->isTheme()) {
$plugins = $this->deactivatePlugin( $themeAlreadyEnabled, $plugins );
@@ -325,16 +326,16 @@ class PluginsManager
* Returns the name of the non default theme currently enabled.
* If Zeitgeist is enabled, returns false (nb: Zeitgeist cannot be disabled)
*
- * @return string
+ * @return Plugin
*/
- protected function getThemeEnabled()
+ public function getThemeEnabled()
{
$plugins = $this->getLoadedPlugins();
foreach($plugins as $plugin) {
/* @var $plugin Plugin */
if($plugin->isTheme()
&& $plugin->getPluginName() != self::DEFAULT_THEME) {
- return $plugin->getPluginName();
+ return $plugin;
}
}
return false;
diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php
index 3744eb7160..a75b2354d5 100644
--- a/core/ViewDataTable.php
+++ b/core/ViewDataTable.php
@@ -977,8 +977,7 @@ class ViewDataTable
$reportYear = $reportDate->toString('Y');
$reportMonth = $reportDate->toString('m');
- //TODOA
- if (class_exists('Piwik\Plugins\PrivacyManager\PrivacyManager')
+ if (PluginsManager::getInstance()->isPluginActivated('PrivacyManager')
&& Plugins\PrivacyManager\PrivacyManager::shouldReportBePurged($reportYear, $reportMonth)
) {
return true;
@@ -1013,7 +1012,6 @@ class ViewDataTable
*/
static public function renderReport($pluginName, $apiAction, $fetch = true)
{
- //TODOA
$namespacedApiClassName = "\\Piwik\\Plugins\\$pluginName\\API";
if (!method_exists($namespacedApiClassName::getInstance(), $apiAction)) {
throw new \Exception("$namespacedApiClassName Invalid action name '$apiAction' for '$pluginName' plugin.");
diff --git a/plugins/Goals/Archiver.php b/plugins/Goals/Archiver.php
index ae0cbf3b07..efb26854bc 100644
--- a/plugins/Goals/Archiver.php
+++ b/plugins/Goals/Archiver.php
@@ -16,6 +16,7 @@ use Piwik\Metrics;
use Piwik\DataTable;
use Piwik\DataArray;
use Piwik\PluginsArchiver;
+use Piwik\PluginsManager;
use Piwik\Tracker\GoalManager;
use Piwik\Plugins\Goals\Goals;
@@ -333,8 +334,7 @@ class Archiver extends PluginsArchiver
}
$label = "Value not defined";
// Product Name/Category not defined"
- //TODOA : working?
- if (class_exists('Piwik\Plugins\CustomVariables\CustomVariables')) {
+ if (PluginsManager::getInstance()->isPluginActivated('CustomVariables')) {
$label = \Piwik\Plugins\CustomVariables\Archiver::LABEL_CUSTOM_VALUE_NOT_DEFINED;
}
}
diff --git a/plugins/PleineLune/PleineLune.php b/plugins/PleineLune/PleineLune.php
deleted file mode 100644
index c1189727ba..0000000000
--- a/plugins/PleineLune/PleineLune.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- *
- * @category Piwik_Plugins
- * @package PleineLune
- */
-namespace Piwik\Plugins\PleineLune;
-
-use Piwik\AssetManager;
-
-/**
- *
- * @package PleineLune
- */
-class PleineLune extends \Piwik\Plugin
-{
- public function getListHooksRegistered()
- {
- return array(
- AssetManager::CSS_IMPORT_EVENT => 'getCssFiles',
- );
- }
-
- public function getCssFiles(&$cssFiles)
- {
- $cssFiles[] = "plugins/PleineLune/stylesheets/theme.less";
- }
-}
diff --git a/plugins/PleineLune/plugin.piwik.json b/plugins/PleineLune/plugin.piwik.json
index d0718e1737..b3ab4ac732 100644
--- a/plugins/PleineLune/plugin.piwik.json
+++ b/plugins/PleineLune/plugin.piwik.json
@@ -1,5 +1,6 @@
{
"name": "PleineLune",
"description": "A dark theme for Piwik, ideal to view your analytics reports before sunrise.",
- "theme": true
+ "theme": true,
+ "stylesheet": "stylesheets/theme.less"
} \ No newline at end of file