Files
YuCheng Hu 7ae2f6a4be 添加 Piwik 到代码库中。
+YUCHENG HU+

git-svn-id: https://svn.code.sf.net/p/hawebs/svn@455 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
2010-07-10 02:43:06 +00:00

60 lines
1.5 KiB
PHP

<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
* @version $Id: functions.php 1534 2009-10-23 08:42:51Z vipsoft $
*
* @category Piwik_Plugins
* @package Piwik_UserCountry
*/
/**
* Return the flag image path for a given country
*
* @param string $code ISO country code
* @return string Flag image path
*/
function Piwik_getFlagFromCode($code)
{
$pathInPiwik = 'plugins/UserCountry/flags/%s.png';
$pathWithCode = sprintf($pathInPiwik, $code);
$absolutePath = PIWIK_INCLUDE_PATH . '/' . $pathWithCode;
if(file_exists($absolutePath))
{
return $pathWithCode;
}
return sprintf($pathInPiwik, 'xx');
}
/**
* Returns the translated continent name for a given continent code
*
* @param string $label Continent code
* @return string Continent name
*/
function Piwik_ContinentTranslate($label)
{
if($label == 'unk')
{
return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8');
}
return html_entity_decode(Piwik_Translate('UserCountry_continent_'. $label), ENT_COMPAT, 'UTF-8');
}
/**
* Returns the translated country name for a given country code
*
* @param string $label country code
* @return string Country name
*/
function Piwik_CountryTranslate($label)
{
if($label == 'xx')
{
return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8');
}
return html_entity_decode(Piwik_Translate('UserCountry_country_'. $label), ENT_COMPAT, 'UTF-8');
}