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-07-31 01:31:17 +0400
committermattab <matthieu.aubry@gmail.com>2013-07-31 01:31:17 +0400
commitc35e613b7ff66c6c86a712f0fd3250692ed9d8a9 (patch)
tree4e56d45743fc85f80014518e5c5bd419cc4a8f7b /core/Plugin/MetadataLoader.php
parent765be0dc8f92a6d4bb3e678a0c23f2d4b95e0e18 (diff)
parent13f657ccfa6b58864291a173a0849d7169b031b2 (diff)
Merge branch 'master' into php-5.3-namespaces
Conflicts: core/Access.php core/Config.php core/EventDispatcher.php core/JqplotDataGenerator/Evolution.php core/Piwik.php core/Plugin/MetadataLoader.php core/ViewDataTable.php core/ViewDataTable/Cloud.php core/ViewDataTable/GenerateGraphHTML.php core/ViewDataTable/HtmlTable.php core/ViewDataTable/HtmlTable/AllColumns.php core/ViewDataTable/HtmlTable/Goals.php plugins/Actions/Controller.php plugins/CoreHome/Controller.php plugins/CoreHome/DataTableRowAction/RowEvolution.php plugins/CoreHome/templates/_dataTable.twig plugins/CustomVariables/Controller.php plugins/DBStats/Controller.php plugins/DevicesDetection/Controller.php plugins/ExampleUI/Controller.php plugins/Goals/Controller.php plugins/Live/Controller.php plugins/Provider/Controller.php plugins/Referers/Controller.php plugins/UserCountry/Controller.php plugins/UserCountryMap/Controller.php plugins/UserSettings/Archiver.php plugins/UserSettings/Controller.php plugins/VisitTime/Controller.php plugins/VisitTime/VisitTime.php plugins/VisitorInterest/Controller.php plugins/VisitsSummary/Controller.php tests/PHPUnit/proxy/index.php
Diffstat (limited to 'core/Plugin/MetadataLoader.php')
-rw-r--r--core/Plugin/MetadataLoader.php51
1 files changed, 2 insertions, 49 deletions
diff --git a/core/Plugin/MetadataLoader.php b/core/Plugin/MetadataLoader.php
index 5400fde01d..e0f198a505 100644
--- a/core/Plugin/MetadataLoader.php
+++ b/core/Plugin/MetadataLoader.php
@@ -22,16 +22,11 @@ require_once PIWIK_INCLUDE_PATH . '/core/Version.php';
/**
* Loads plugin metadata found in the following files:
* - plugin.piwik.json
- * - colors.piwik.json
*/
class MetadataLoader
{
const PLUGIN_JSON_FILENAME = 'plugin.piwik.json';
- const COLORS_JSON_FILENAME = 'colors.piwik.json';
-
- const SHORT_COLOR_LENGTH = 4;
- const LONG_COLOR_LENGTH = 7;
-
+
/**
* The name of the plugin whose metadata will be loaded.
*
@@ -58,8 +53,7 @@ class MetadataLoader
{
return array_merge(
$this->getDefaultPluginInformation(),
- $this->loadPluginInfoJson(),
- $this->loadPluginColorsJson()
+ $this->loadPluginInfoJson()
);
}
@@ -84,47 +78,6 @@ class MetadataLoader
return $this->loadJsonMetadata($path);
}
- private function loadPluginColorsJson()
- {
- $path = \Piwik\PluginsManager::getPluginsDirectory() . $this->pluginName . '/' . self::COLORS_JSON_FILENAME;
- $info = $this->loadJsonMetadata($path);
- $info = $this->cleanAndValidatePluginColorsJson($path, $info);
- return $info;
- }
-
- private function cleanAndValidatePluginColorsJson($path, $info)
- {
- // check that if "colors" exists, it is an array
- $colors = isset($info["colors"]) ? $info["colors"] : array();
- if (!is_array($colors)) {
- throw new Exception("The 'colors' value in '$path' must be an object mapping names with colors.");
- }
-
- // validate each color
- foreach ($colors as $color) {
- if (!$this->isStringColorValid($color)) {
- throw new Exception("Invalid color string '$color' in '$path'.");
- }
- }
-
- return array("colors" => $colors); // make sure only 'colors' element is loaded
- }
-
- private function isStringColorValid($color)
- {
- if (strlen($color) !== self::SHORT_COLOR_LENGTH
- && strlen($color) !== self::LONG_COLOR_LENGTH
- ) {
- return false;
- }
-
- if ($color[0] !== '#') {
- return false;
- }
-
- return ctype_xdigit(substr($color, 1)); // check if other digits are hex
- }
-
private function loadJsonMetadata($path)
{
if (!file_exists($path)) {