update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Intl\Data\Provider;
|
||||
|
||||
/**
|
||||
* Provides currency data.
|
||||
*/
|
||||
class CurrencyDataProvider
|
||||
{
|
||||
private $currencyList;
|
||||
|
||||
/**
|
||||
* 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'))`.
|
||||
* @api
|
||||
*/
|
||||
public function getCurrencyList()
|
||||
{
|
||||
if ($this->currencyList === null) {
|
||||
$this->currencyList = require __DIR__ . '/../Resources/currencies.php';
|
||||
}
|
||||
|
||||
return $this->currencyList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Intl\Data\Provider;
|
||||
|
||||
/**
|
||||
* Provides date and time formats.
|
||||
*/
|
||||
class DateTimeFormatProvider
|
||||
{
|
||||
const DATETIME_FORMAT_LONG = 1;
|
||||
const DATETIME_FORMAT_SHORT = 2;
|
||||
const DATE_FORMAT_LONG = 10;
|
||||
const DATE_FORMAT_DAY_MONTH = 11;
|
||||
const DATE_FORMAT_SHORT = 12;
|
||||
const DATE_FORMAT_MONTH_SHORT = 13;
|
||||
const DATE_FORMAT_MONTH_LONG = 14;
|
||||
const DATE_FORMAT_YEAR = 15;
|
||||
const TIME_FORMAT = 20;
|
||||
|
||||
/**
|
||||
* Returns the format pattern for the given format type
|
||||
*
|
||||
* @param int $format one of the format constants
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormatPattern($format)
|
||||
{
|
||||
switch ($format) {
|
||||
case self::DATETIME_FORMAT_LONG:
|
||||
return 'EEEE, MMMM d, y HH:mm:ss';
|
||||
|
||||
case self::DATETIME_FORMAT_SHORT:
|
||||
return 'MMM d, y HH:mm:ss';
|
||||
|
||||
case self::DATE_FORMAT_LONG:
|
||||
return 'EEEE, MMMM d, y';
|
||||
|
||||
case self::DATE_FORMAT_DAY_MONTH:
|
||||
return 'E, MMM d';
|
||||
|
||||
case self::DATE_FORMAT_SHORT:
|
||||
return 'MMM d, y';
|
||||
|
||||
case self::DATE_FORMAT_MONTH_SHORT:
|
||||
return 'MMM y';
|
||||
|
||||
case self::DATE_FORMAT_MONTH_LONG:
|
||||
return 'MMMM y';
|
||||
|
||||
case self::DATE_FORMAT_YEAR:
|
||||
return 'y';
|
||||
|
||||
case self::TIME_FORMAT:
|
||||
return 'HH:mm:ss';
|
||||
}
|
||||
|
||||
return $format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns interval format pattern for the given format type
|
||||
*
|
||||
* @param bool $short whether to return short or long format pattern
|
||||
* @param string $maxDifference maximal difference in interval dates (Y, M or D)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRangeFormatPattern($short=false, $maxDifference='Y')
|
||||
{
|
||||
if ($short) {
|
||||
return 'MMM d, y – MMM d, y';
|
||||
}
|
||||
|
||||
return 'MMMM d, y – MMMM d, y';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Intl\Data\Provider;
|
||||
|
||||
/**
|
||||
* Provides language data.
|
||||
*/
|
||||
class LanguageDataProvider
|
||||
{
|
||||
private $languageList;
|
||||
private $languageToCountryList;
|
||||
|
||||
/**
|
||||
* Returns the list of valid language codes.
|
||||
*
|
||||
* @return string[] Array of 2 letter ISO code => language name (in english).
|
||||
* E.g. `array('en' => 'English', 'ja' => 'Japanese')`.
|
||||
* @api
|
||||
*/
|
||||
public function getLanguageList()
|
||||
{
|
||||
if ($this->languageList === null) {
|
||||
$this->languageList = require __DIR__ . '/../Resources/languages.php';
|
||||
}
|
||||
|
||||
return $this->languageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of language to country mappings.
|
||||
*
|
||||
* @return string[] Array of 2 letter ISO language code => 2 letter ISO country code.
|
||||
* E.g. `array('fr' => 'fr') // French => France`.
|
||||
* @api
|
||||
*/
|
||||
public function getLanguageToCountryList()
|
||||
{
|
||||
if ($this->languageToCountryList === null) {
|
||||
$this->languageToCountryList = require __DIR__ . '/../Resources/languages-to-countries.php';
|
||||
}
|
||||
|
||||
return $this->languageToCountryList;
|
||||
}
|
||||
}
|
||||
57
www/analytics/core/Intl/Data/Provider/RegionDataProvider.php
Normal file
57
www/analytics/core/Intl/Data/Provider/RegionDataProvider.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Intl\Data\Provider;
|
||||
|
||||
/**
|
||||
* Provides region related data (continents, countries, etc.).
|
||||
*/
|
||||
class RegionDataProvider
|
||||
{
|
||||
private $continentList;
|
||||
private $countryList;
|
||||
private $countryExtraList;
|
||||
|
||||
/**
|
||||
* Returns the list of continent codes.
|
||||
*
|
||||
* @return string[] Array of 3 letter continent codes
|
||||
* @api
|
||||
*/
|
||||
public function getContinentList()
|
||||
{
|
||||
if ($this->continentList === null) {
|
||||
$this->continentList = require __DIR__ . '/../Resources/continents.php';
|
||||
}
|
||||
|
||||
return $this->continentList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of valid country codes.
|
||||
*
|
||||
* @param bool $includeInternalCodes
|
||||
* @return string[] Array of 2 letter country ISO codes => 3 letter continent code
|
||||
* @api
|
||||
*/
|
||||
public function getCountryList($includeInternalCodes = false)
|
||||
{
|
||||
if ($this->countryList === null) {
|
||||
$this->countryList = require __DIR__ . '/../Resources/countries.php';
|
||||
}
|
||||
if ($this->countryExtraList === null) {
|
||||
$this->countryExtraList = require __DIR__ . '/../Resources/countries-extra.php';
|
||||
}
|
||||
|
||||
if ($includeInternalCodes) {
|
||||
return array_merge($this->countryList, $this->countryExtraList);
|
||||
}
|
||||
|
||||
return $this->countryList;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue