Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsgiehl <stefan@piwik.org>2014-01-16 18:07:19 +0400
committersgiehl <stefan@piwik.org>2014-01-16 18:07:19 +0400
commitab3f264ff13a4887d577190ac8a5287b168d863e (patch)
treecd03d4e6897ac5457cdf47bb3d57bfdd14887293 /plugins
parent0c40ae911a3753ff7bddc68047b8cd46a735b57b (diff)
code cleanup; moved require of Socials.php to seperate method
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Referrers/API.php14
-rw-r--r--plugins/Referrers/functions.php9
2 files changed, 11 insertions, 12 deletions
diff --git a/plugins/Referrers/API.php b/plugins/Referrers/API.php
index 11975517ea..fe8248fc89 100644
--- a/plugins/Referrers/API.php
+++ b/plugins/Referrers/API.php
@@ -316,8 +316,6 @@ class API extends \Piwik\Plugin\API
*/
public function getSocials($idSite, $period, $date, $segment = false, $expanded = false)
{
- require PIWIK_INCLUDE_PATH . '/core/DataFiles/Socials.php';
-
$dataTable = $this->getDataTable(Archiver::WEBSITES_RECORD_NAME, $idSite, $period, $date, $segment, $expanded);
$dataTable->filter('ColumnCallbackDeleteRow', array('label', function ($url) { return !isSocialUrl($url); }));
@@ -349,21 +347,21 @@ class API extends \Piwik\Plugin\API
*/
public function getUrlsForSocial($idSite, $period, $date, $segment = false, $idSubtable = false)
{
- require PIWIK_INCLUDE_PATH . '/core/DataFiles/Socials.php';
-
$dataTable = $this->getDataTable(Archiver::WEBSITES_RECORD_NAME, $idSite, $period, $date, $segment, $expanded = true);
// get the social network domain referred to by $idSubtable
+ $socialNetworks = Common::getSocialUrls();
+
$social = false;
if ($idSubtable !== false) {
--$idSubtable;
- reset($GLOBALS['Piwik_socialUrl']);
+ reset($socialNetworks);
for ($i = 0; $i != (int)$idSubtable; ++$i) {
- next($GLOBALS['Piwik_socialUrl']);
+ next($socialNetworks);
}
- $social = current($GLOBALS['Piwik_socialUrl']);
+ $social = current($socialNetworks);
}
// filter out everything but social network indicated by $idSubtable
@@ -457,7 +455,7 @@ class API extends \Piwik\Plugin\API
$socialName = $row->getColumn('label');
$i = 1; // start at one because idSubtable=0 is equivalent to idSubtable=false
- foreach ($GLOBALS['Piwik_socialUrl'] as $domain => $name) {
+ foreach (Common::getSocialUrls() as $domain => $name) {
if ($name == $socialName) {
$row->c[Row::DATATABLE_ASSOCIATED] = $i;
break;
diff --git a/plugins/Referrers/functions.php b/plugins/Referrers/functions.php
index 96c231b8b3..12a175fbbd 100644
--- a/plugins/Referrers/functions.php
+++ b/plugins/Referrers/functions.php
@@ -37,7 +37,7 @@ function getPathFromUrl($url)
*/
function getSocialNetworkFromDomain($url)
{
- foreach ($GLOBALS['Piwik_socialUrl'] AS $domain => $name) {
+ foreach (Common::getSocialUrls() AS $domain => $name) {
if(preg_match('/(^|[\.\/])'.$domain.'([\.\/]|$)/', $url)) {
@@ -58,7 +58,7 @@ function getSocialNetworkFromDomain($url)
*/
function isSocialUrl($url, $socialName = false)
{
- foreach ($GLOBALS['Piwik_socialUrl'] AS $domain => $name) {
+ foreach (Common::getSocialUrls() AS $domain => $name) {
if (preg_match('/(^|[\.\/])'.$domain.'([\.\/]|$)/', $url) && ($socialName === false || $name == $socialName)) {
@@ -79,11 +79,12 @@ function isSocialUrl($url, $socialName = false)
function getSocialsLogoFromUrl($domain)
{
$social = getSocialNetworkFromDomain($domain);
+ $socialNetworks = Common::getSocialUrls();
$filePattern = 'plugins/Referrers/images/socials/%s.png';
- foreach ($GLOBALS['Piwik_socialUrl'] as $domainKey => $name) {
- if ($social == $GLOBALS['Piwik_socialUrl'][$domainKey] && file_exists(PIWIK_DOCUMENT_ROOT . '/' . sprintf($filePattern, $domainKey))) {
+ foreach ($socialNetworks as $domainKey => $name) {
+ if ($social == $socialNetworks[$domainKey] && file_exists(PIWIK_DOCUMENT_ROOT . '/' . sprintf($filePattern, $domainKey))) {
return sprintf($filePattern, $domainKey);
}
}