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:
authorThomas Steur <thomas.steur@gmail.com>2013-12-16 01:42:23 +0400
committerThomas Steur <thomas.steur@gmail.com>2013-12-16 01:42:23 +0400
commit0d9be10b8ef6c6ae5a9c0cda354bc0a3230f1ed1 (patch)
tree848b4bf589f2810d5c42ebe4102e1d9aa0b538f3 /core/Loader.php
parent31ff5576638cedfe858a9dbdb9cf2e1d6da49264 (diff)
this could fix an autoloader issue if the classname begins with a leading backslash see http://forum.piwik.org/read.php?2,106854,page=1#msg-108319
Diffstat (limited to 'core/Loader.php')
-rw-r--r--core/Loader.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/core/Loader.php b/core/Loader.php
index 268aef32e7..6d6ffde700 100644
--- a/core/Loader.php
+++ b/core/Loader.php
@@ -46,15 +46,18 @@ class Loader
return $class;
}
- $class = self::removePrefix($class, 'Piwik/');
- $class = self::removePrefix($class, 'Plugins/');
+ $class = self::removeFirstMatchingPrefix($class, array('/Piwik/', 'Piwik/'));
+ $class = self::removeFirstMatchingPrefix($class, array('/Plugins/', 'Plugins/'));
+
return $class;
}
- protected static function removePrefix($class, $vendorPrefixToRemove)
+ protected static function removeFirstMatchingPrefix($class, $vendorPrefixesToRemove)
{
- if (strpos($class, $vendorPrefixToRemove) === 0) {
- return substr($class, strlen($vendorPrefixToRemove));
+ foreach ($vendorPrefixesToRemove as $prefix) {
+ if (strpos($class, $prefix) === 0) {
+ return substr($class, strlen($prefix));
+ }
}
return $class;