diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-02-02 06:16:08 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-02-02 06:16:08 +0300 |
commit | 344b0fce2ca0e6d5634546b071526c2322bd878f (patch) | |
tree | 40a8a224e2c7ab97d4537cf817fe6f8a817165e4 /core/Period | |
parent | 03ea8fb3ec54285bdd63cdada015aa67aec1c6ee (diff) |
Replaced calls of static methods with dependency injection
Diffstat (limited to 'core/Period')
-rw-r--r-- | core/Period/Day.php | 4 | ||||
-rw-r--r-- | core/Period/Month.php | 4 | ||||
-rw-r--r-- | core/Period/Range.php | 6 | ||||
-rw-r--r-- | core/Period/Week.php | 8 |
4 files changed, 11 insertions, 11 deletions
diff --git a/core/Period/Day.php b/core/Period/Day.php index b8212844cd..551e5e65aa 100644 --- a/core/Period/Day.php +++ b/core/Period/Day.php @@ -38,7 +38,7 @@ class Day extends Period { //"Mon 15 Aug" $date = $this->getDateStart(); - $template = Piwik::translate('CoreHome_ShortDateFormat'); + $template = $this->translator->translate('CoreHome_ShortDateFormat'); $out = $date->getLocalized($template); return $out; @@ -53,7 +53,7 @@ class Day extends Period { //"Mon 15 Aug" $date = $this->getDateStart(); - $template = Piwik::translate('CoreHome_DateFormat'); + $template = $this->translator->translate('CoreHome_DateFormat'); $out = $date->getLocalized($template); return $out; diff --git a/core/Period/Month.php b/core/Period/Month.php index 4609180980..252d394db2 100644 --- a/core/Period/Month.php +++ b/core/Period/Month.php @@ -25,7 +25,7 @@ class Month extends Period public function getLocalizedShortString() { //"Aug 09" - $out = $this->getDateStart()->getLocalized(Piwik::translate('CoreHome_ShortMonthFormat')); + $out = $this->getDateStart()->getLocalized($this->translator->translate('CoreHome_ShortMonthFormat')); return $out; } @@ -37,7 +37,7 @@ class Month extends Period public function getLocalizedLongString() { //"August 2009" - $out = $this->getDateStart()->getLocalized(Piwik::translate('CoreHome_LongMonthFormat')); + $out = $this->getDateStart()->getLocalized($this->translator->translate('CoreHome_LongMonthFormat')); return $out; } diff --git a/core/Period/Range.php b/core/Period/Range.php index d88a5e2da7..588cabe05d 100644 --- a/core/Period/Range.php +++ b/core/Period/Range.php @@ -66,7 +66,7 @@ class Range extends Period //"30 Dec 08 - 26 Feb 09" $dateStart = $this->getDateStart(); $dateEnd = $this->getDateEnd(); - $template = Piwik::translate('CoreHome_ShortDateFormatWithYear'); + $template = $this->translator->translate('CoreHome_ShortDateFormatWithYear'); $shortDateStart = $dateStart->getLocalized($template); $shortDateEnd = $dateEnd->getLocalized($template); @@ -109,7 +109,7 @@ class Range extends Period */ public function getPrettyString() { - $out = Piwik::translate('General_DateRangeFromTo', array($this->getDateStart()->toString(), $this->getDateEnd()->toString())); + $out = $this->translator->translate('General_DateRangeFromTo', array($this->getDateStart()->toString(), $this->getDateEnd()->toString())); return $out; } @@ -209,7 +209,7 @@ class Range extends Period } $endDate = Date::factory($strDateEnd, $timezone); } else { - throw new Exception(Piwik::translate('General_ExceptionInvalidDateRange', array($this->strDate, ' \'lastN\', \'previousN\', \'YYYY-MM-DD,YYYY-MM-DD\''))); + throw new Exception($this->translator->translate('General_ExceptionInvalidDateRange', array($this->strDate, ' \'lastN\', \'previousN\', \'YYYY-MM-DD,YYYY-MM-DD\''))); } if ($this->strPeriod != 'range') { diff --git a/core/Period/Week.php b/core/Period/Week.php index 23f7ab32b6..a8af2fbed8 100644 --- a/core/Period/Week.php +++ b/core/Period/Week.php @@ -28,7 +28,7 @@ class Week extends Period $dateStart = $this->getDateStart(); $dateEnd = $this->getDateEnd(); - $string = Piwik::translate('CoreHome_ShortWeekFormat'); + $string = $this->translator->translate('CoreHome_ShortWeekFormat'); $string = self::getTranslatedRange($string, $dateStart, $dateEnd); return $string; } @@ -40,10 +40,10 @@ class Week extends Period */ public function getLocalizedLongString() { - $format = Piwik::translate('CoreHome_LongWeekFormat'); + $format = $this->translator->translate('CoreHome_LongWeekFormat'); $string = self::getTranslatedRange($format, $this->getDateStart(), $this->getDateEnd()); - return Piwik::translate('CoreHome_PeriodWeek') . " " . $string; + return $this->translator->translate('CoreHome_PeriodWeek') . " " . $string; } /** @@ -73,7 +73,7 @@ class Week extends Period $dateStart = $this->getDateStart(); $dateEnd = $this->getDateEnd(); - $out = Piwik::translate('General_DateRangeFromTo', array($dateStart->toString(), $dateEnd->toString())); + $out = $this->translator->translate('General_DateRangeFromTo', array($dateStart->toString(), $dateEnd->toString())); return $out; } |