diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-09-05 03:24:26 +0400 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-09-05 03:24:26 +0400 |
commit | 2df5feb0cd4a17f3243dc710aa76320be5f852c5 (patch) | |
tree | e3dbb8c697624c393bfbcc19afcbc23283cb8261 /plugins/Referers/API.php | |
parent | 911dfd6ec31de47eb05e8a87b535d9bda260265c (diff) |
Refactoring Widget and Menu code (in core and all plugins)
Commit patch by Maciej adding support for multiple lines plotting
Cleaning Date object
+ small other code improvements
Diffstat (limited to 'plugins/Referers/API.php')
-rw-r--r-- | plugins/Referers/API.php | 80 |
1 files changed, 1 insertions, 79 deletions
diff --git a/plugins/Referers/API.php b/plugins/Referers/API.php index 5925a3039d..b1e1f7d48f 100644 --- a/plugins/Referers/API.php +++ b/plugins/Referers/API.php @@ -9,6 +9,7 @@ * @package Piwik_Referers */ +require_once "Referers/functions.php"; /** * @@ -164,83 +165,4 @@ class Piwik_Referers_API extends Piwik_Apiable } } -function Piwik_getPathFromUrl($url) -{ - $path = Piwik_Common::getPathAndQueryFromUrl($url); - if(empty($path)) - { - return 'index'; - } - return $path; -} - -function Piwik_truncatePath( $path ) -{ - $limit = 27; - $path = htmlspecialchars_decode($path); - $len = strlen($path); - if($len > $limit) - { - $path = substr($path, 0, $limit-3) . "..."; - } - return htmlspecialchars($path); -} - -function Piwik_getSearchEngineUrlFromName($name) -{ - require_once "core/DataFiles/SearchEngines.php"; - if(isset($GLOBALS['Piwik_SearchEngines_NameToUrl'][$name])) - { - $url = 'http://'.$GLOBALS['Piwik_SearchEngines_NameToUrl'][$name]; - } - else - { - $url = 'URL unknown!'; - } - return $url; -} - - -function Piwik_getSearchEngineLogoFromName($url) -{ - require_once "core/DataFiles/SearchEngines.php"; - $path = 'plugins/Referers/images/searchEngines/%s.png'; - $beginningUrl = strpos($url,'//') + 2; - $normalPath = sprintf($path, substr($url,$beginningUrl)); - - // flags not in the package ! - if(!file_exists($normalPath)) - { - return sprintf($path, 'xx'); - } - return $normalPath; -} - - -function Piwik_getRefererTypeLabel($label) -{ - $indexTranslation = ''; - switch($label) - { - case Piwik_Common::REFERER_TYPE_DIRECT_ENTRY: - $indexTranslation = 'Referers_DirectEntry'; - break; - case Piwik_Common::REFERER_TYPE_SEARCH_ENGINE: - $indexTranslation = 'Referers_SearchEngines'; - break; - case Piwik_Common::REFERER_TYPE_WEBSITE: - $indexTranslation = 'Referers_Websites'; - break; - case Piwik_Common::REFERER_TYPE_PARTNER: - $indexTranslation = 'Referers_Partners'; - break; - case Piwik_Common::REFERER_TYPE_NEWSLETTER: - $indexTranslation = 'Referers_Newsletters'; - break; - case Piwik_Common::REFERER_TYPE_CAMPAIGN: - $indexTranslation = 'Referers_Campaigns'; - break; - } - return Piwik_Translate($indexTranslation); -} |