diff --git a/core/Translate.php b/core/Translate.php index adc3379cf4cb25737d29f5f23404d3521c651b9a..1877478679fcc42a477c2c4e3c8a2ff628149c42 100644 --- a/core/Translate.php +++ b/core/Translate.php @@ -38,6 +38,12 @@ class Piwik_Translate $this->setLocale(); $this->englishLanguageLoaded = true; } + + public function unloadEnglishTranslation() + { + $GLOBALS['Piwik_translations'] = array(); + $this->englishLanguageLoaded = false; + } public function loadUserTranslation() { diff --git a/plugins/Referers/images/searchEngines/search.yahoo.com.png b/plugins/Referers/images/searchEngines/search.yahoo.com.png index 20ba5ed665b6204d96209c9185ae5e8ac7e5960f..1c1d11bc91b6fee17fd65964b534a1bd0d3ab73e 100644 Binary files a/plugins/Referers/images/searchEngines/search.yahoo.com.png and b/plugins/Referers/images/searchEngines/search.yahoo.com.png differ diff --git a/plugins/Referers/images/searchEngines/www.alexa.com.png b/plugins/Referers/images/searchEngines/www.alexa.com.png index 61855bc7709d5dfcbe57dedef97e7c4c11dc2304..da07a4398a179e40a46c84a0d807754660c39991 100644 Binary files a/plugins/Referers/images/searchEngines/www.alexa.com.png and b/plugins/Referers/images/searchEngines/www.alexa.com.png differ diff --git a/tests/core/Piwik.test.php b/tests/core/Piwik.test.php index 3b60a6d29108fa7f2d0dbb72ee2f108ab4ca1fc1..95a2ab9ac94df895be1c24c611fd607583667dcd 100644 --- a/tests/core/Piwik.test.php +++ b/tests/core/Piwik.test.php @@ -44,4 +44,25 @@ class Test_Piwik extends UnitTestCase $this->assertTrue( Piwik::secureDiv( 11.0, 'a' ) === 0 ); } + + public function test_getPrettyTimeFromSeconds() + { + Piwik_Translate::getInstance()->loadEnglishTranslation(); + $tests = array( + 30 => '30s', + 60 => '1 min 0s', + 100 => '1 min 40s', + 3600 => '1 hours 0 min', + 3700 => '1 hours 1 min', + 86400 + 3600 * 10 => '1 days 10 hours', + 86400 * 365 => '365 days 0 hours', + (86400 * (365.25 + 10)) => '1 years 10 days', + + ); + foreach($tests as $seconds => $expected) + { + $this->assertEqual( Piwik::getPrettyTimeFromSeconds($seconds), str_replace(' ',' ', $expected)); + } + Piwik_Translate::getInstance()->unloadEnglishTranslation(); + } }