diff options
author | robocoder <anthon.pang@gmail.com> | 2011-11-18 06:58:46 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2011-11-18 06:58:46 +0400 |
commit | 7330d7f00019c243110416ecea14a019f79a0fd2 (patch) | |
tree | 9342e742f404b5c486359f698e50b8cf07b22946 /plugins/UserCountry | |
parent | 52b06c5f3ba4f07bcdc9f150eeb436374252ca94 (diff) |
fixes #2771 - will revert this when the minimum requirements is php 5.3 and we can use anonymous functions *sigh*
git-svn-id: http://dev.piwik.org/svn/trunk@5446 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r-- | plugins/UserCountry/API.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/UserCountry/API.php b/plugins/UserCountry/API.php index 296f6a2bb6..52308892f3 100644 --- a/plugins/UserCountry/API.php +++ b/plugins/UserCountry/API.php @@ -31,11 +31,22 @@ class Piwik_UserCountry_API return self::$instance; } + /** + * A callback to return the label + * + * @param string $label + * @return string + */ + static public function getLabel($label) + { + return $label; + } + public function getCountry( $idSite, $period, $date, $segment = false ) { $dataTable = $this->getDataTable('UserCountry_country', $idSite, $period, $date, $segment); // apply filter on the whole datatable in order the inline search to work (searches are done on "beautiful" label) - $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'code', create_function('$label', 'return $label;'))); + $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'code', array('Piwik_UserCountry_API', 'getLabel'))); $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getFlagFromCode')); $dataTable->filter('ColumnCallbackReplace', array('label', 'Piwik_CountryTranslate')); $dataTable->queueFilter('AddConstantMetadata', array('logoWidth', 18)); @@ -47,7 +58,7 @@ class Piwik_UserCountry_API { $dataTable = $this->getDataTable('UserCountry_continent', $idSite, $period, $date, $segment); $dataTable->filter('ColumnCallbackReplace', array('label', 'Piwik_ContinentTranslate')); - $dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'code', create_function('$label', 'return $label;'))); + $dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'code', array('Piwik_UserCountry_API', 'getLabel'))); return $dataTable; } |