diff options
author | sgiehl <stefan@piwik.org> | 2015-10-15 22:06:48 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2015-10-15 23:26:38 +0300 |
commit | ccefdb1d5451133709edcc468577de39a343c00a (patch) | |
tree | 49053827ef60f141f5dd262d76d4180425ed22e4 /core/Site.php | |
parent | 5b64e37e82cab28cac0998910dccefd73668400e (diff) |
use number format for currency in all websites dashboard
Diffstat (limited to 'core/Site.php')
-rw-r--r-- | core/Site.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/core/Site.php b/core/Site.php index a975268ad1..3bc535fc2d 100644 --- a/core/Site.php +++ b/core/Site.php @@ -10,7 +10,9 @@ namespace Piwik; use Exception; +use Piwik\Container\StaticContainer; use Piwik\Exception\UnexpectedWebsiteFoundException; +use Piwik\Intl\Data\Provider\CurrencyDataProvider; use Piwik\Plugins\SitesManager\API; /** @@ -559,6 +561,42 @@ class Site } /** + * Returns the currency of the site with the specified ID. + * + * @param int $idsite The site ID. + * @return string + */ + public static function getCurrencySymbolFor($idsite) + { + $currency = self::getCurrencyFor($idsite); + $symbols = self::getCurrencyList(); + + if (isset($symbols[$currency])) { + return $symbols[$currency][0]; + } + + return ''; + } + + + /** + * Returns the list of all known currency symbols. + * + * @return array An array mapping currency codes to their respective currency symbols + * and a description, eg, `array('USD' => array('$', 'US dollar'))`. + * + * @deprecated Use Piwik\Intl\Data\Provider\CurrencyDataProvider instead. + * @see \Piwik\Intl\Data\Provider\CurrencyDataProvider::getCurrencyList() + * @api + */ + public static function getCurrencyList() + { + /** @var CurrencyDataProvider $dataProvider */ + $dataProvider = StaticContainer::get('Piwik\Intl\Data\Provider\CurrencyDataProvider'); + return $dataProvider->getCurrencyList(); + } + + /** * Returns the excluded IP addresses of the site with the specified ID. * * @param int $idsite The site ID. |