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:
authormattab <matthieu.aubry@gmail.com>2014-01-17 01:01:47 +0400
committermattab <matthieu.aubry@gmail.com>2014-01-17 01:01:47 +0400
commitfafc25e6bf9e64728349bf14d71899244493238e (patch)
tree3316939d3517431596949cafc3756bc119358c3e /plugins
parenta6a7288c597d28098894a50f574101a91efcfc08 (diff)
parent5d4a4cc65c0f1e33d15d7dd092448514a40ebc1c (diff)
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Referrers/API.php16
-rw-r--r--plugins/Referrers/functions.php59
-rw-r--r--plugins/Referrers/images/socials/fotolog.com.pngbin0 -> 184 bytes
-rw-r--r--plugins/Referrers/images/socials/last.fm.png (renamed from plugins/Referrers/images/socials/lastfm.ru.png)bin1265 -> 1265 bytes
-rw-r--r--plugins/Referrers/images/socials/login.tagged.com.pngbin0 -> 286 bytes
-rw-r--r--plugins/Referrers/images/socials/meinvz.net.pngbin0 -> 554 bytes
-rw-r--r--plugins/Referrers/images/socials/my.mail.ru.pngbin0 -> 750 bytes
-rw-r--r--plugins/Referrers/images/socials/netlog.com.pngbin0 -> 636 bytes
-rw-r--r--plugins/Referrers/images/socials/tumblr.com.pngbin0 -> 443 bytes
-rw-r--r--plugins/Referrers/images/socials/wayn.com.pngbin0 -> 648 bytes
-rw-r--r--plugins/Referrers/images/socials/weeworld.com.pngbin0 -> 492 bytes
-rw-r--r--plugins/Referrers/images/socials/xanga.com.pngbin0 -> 265 bytes
m---------plugins/TasksTimetable0
13 files changed, 28 insertions, 47 deletions
diff --git a/plugins/Referrers/API.php b/plugins/Referrers/API.php
index bc32fbfb99..fe8248fc89 100644
--- a/plugins/Referrers/API.php
+++ b/plugins/Referrers/API.php
@@ -316,13 +316,11 @@ 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); }));
- $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'url', __NAMESPACE__ . '\cleanSocialUrl'));
+ $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'url'));
$dataTable->filter('GroupBy', array('label', __NAMESPACE__ . '\getSocialNetworkFromDomain'));
$this->setSocialIdSubtables($dataTable);
@@ -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 c066ce0c10..12a175fbbd 100644
--- a/plugins/Referrers/functions.php
+++ b/plugins/Referrers/functions.php
@@ -30,19 +30,6 @@ function getPathFromUrl($url)
}
/**
- * Returns the last parts of the domain of a URL.
- *
- * @param string $url e.g. http://www.facebook.com/?sdlfk=lksdfj
- * @return string|false e.g. facebook.com
- */
-function cleanSocialUrl($url)
-{
- $segment = '[^.:\/]+';
- preg_match('/(?:https?:\/\/)?(?:' . $segment . '\.)?(' . $segment . '(?:\.' . $segment . ')+)/', $url, $matches);
- return isset($matches[1]) ? $matches[1] : false;
-}
-
-/**
* Get's social network name from URL.
*
* @param string $url
@@ -50,13 +37,15 @@ function cleanSocialUrl($url)
*/
function getSocialNetworkFromDomain($url)
{
- $domain = cleanSocialUrl($url);
+ foreach (Common::getSocialUrls() AS $domain => $name) {
- if (isset($GLOBALS['Piwik_socialUrl'][$domain])) {
- return $GLOBALS['Piwik_socialUrl'][$domain];
- } else {
- return Piwik::translate('General_Unknown');
+ if(preg_match('/(^|[\.\/])'.$domain.'([\.\/]|$)/', $url)) {
+
+ return $name;
+ }
}
+
+ return Piwik::translate('General_Unknown');
}
/**
@@ -69,13 +58,12 @@ function getSocialNetworkFromDomain($url)
*/
function isSocialUrl($url, $socialName = false)
{
- $domain = cleanSocialUrl($url);
+ foreach (Common::getSocialUrls() AS $domain => $name) {
+
+ if (preg_match('/(^|[\.\/])'.$domain.'([\.\/]|$)/', $url) && ($socialName === false || $name == $socialName)) {
- if (isset($GLOBALS['Piwik_socialUrl'][$domain])
- && ($socialName === false
- || $GLOBALS['Piwik_socialUrl'][$domain] == $socialName)
- ) {
- return true;
+ return true;
+ }
}
return false;
@@ -90,23 +78,18 @@ function isSocialUrl($url, $socialName = false)
*/
function getSocialsLogoFromUrl($domain)
{
- $domain = cleanSocialUrl($domain);
+ $social = getSocialNetworkFromDomain($domain);
+ $socialNetworks = Common::getSocialUrls();
- if (isset($GLOBALS['Piwik_socialUrl'][$domain])) {
- // image names are by first domain in list, so make sure we use the first if $domain isn't it
- $firstDomain = $domain;
- foreach ($GLOBALS['Piwik_socialUrl'] as $domainKey => $name) {
- if ($name == $GLOBALS['Piwik_socialUrl'][$domain]) {
- $firstDomain = $domainKey;
- break;
- }
- }
+ $filePattern = 'plugins/Referrers/images/socials/%s.png';
- $pathWithCode = 'plugins/Referrers/images/socials/' . $firstDomain . '.png';
- return $pathWithCode;
- } else {
- return 'plugins/Referrers/images/socials/xx.png';
+ foreach ($socialNetworks as $domainKey => $name) {
+ if ($social == $socialNetworks[$domainKey] && file_exists(PIWIK_DOCUMENT_ROOT . '/' . sprintf($filePattern, $domainKey))) {
+ return sprintf($filePattern, $domainKey);
+ }
}
+
+ return sprintf($filePattern, 'xx');
}
/**
diff --git a/plugins/Referrers/images/socials/fotolog.com.png b/plugins/Referrers/images/socials/fotolog.com.png
new file mode 100644
index 0000000000..03bb1dd8c4
--- /dev/null
+++ b/plugins/Referrers/images/socials/fotolog.com.png
Binary files differ
diff --git a/plugins/Referrers/images/socials/lastfm.ru.png b/plugins/Referrers/images/socials/last.fm.png
index 9362fd4eff..9362fd4eff 100644
--- a/plugins/Referrers/images/socials/lastfm.ru.png
+++ b/plugins/Referrers/images/socials/last.fm.png
Binary files differ
diff --git a/plugins/Referrers/images/socials/login.tagged.com.png b/plugins/Referrers/images/socials/login.tagged.com.png
new file mode 100644
index 0000000000..d2a0eb4237
--- /dev/null
+++ b/plugins/Referrers/images/socials/login.tagged.com.png
Binary files differ
diff --git a/plugins/Referrers/images/socials/meinvz.net.png b/plugins/Referrers/images/socials/meinvz.net.png
new file mode 100644
index 0000000000..167bbd5e20
--- /dev/null
+++ b/plugins/Referrers/images/socials/meinvz.net.png
Binary files differ
diff --git a/plugins/Referrers/images/socials/my.mail.ru.png b/plugins/Referrers/images/socials/my.mail.ru.png
new file mode 100644
index 0000000000..8d9d249518
--- /dev/null
+++ b/plugins/Referrers/images/socials/my.mail.ru.png
Binary files differ
diff --git a/plugins/Referrers/images/socials/netlog.com.png b/plugins/Referrers/images/socials/netlog.com.png
new file mode 100644
index 0000000000..549b3d798c
--- /dev/null
+++ b/plugins/Referrers/images/socials/netlog.com.png
Binary files differ
diff --git a/plugins/Referrers/images/socials/tumblr.com.png b/plugins/Referrers/images/socials/tumblr.com.png
new file mode 100644
index 0000000000..8bae05e917
--- /dev/null
+++ b/plugins/Referrers/images/socials/tumblr.com.png
Binary files differ
diff --git a/plugins/Referrers/images/socials/wayn.com.png b/plugins/Referrers/images/socials/wayn.com.png
new file mode 100644
index 0000000000..4932edc97f
--- /dev/null
+++ b/plugins/Referrers/images/socials/wayn.com.png
Binary files differ
diff --git a/plugins/Referrers/images/socials/weeworld.com.png b/plugins/Referrers/images/socials/weeworld.com.png
new file mode 100644
index 0000000000..267dfb74c4
--- /dev/null
+++ b/plugins/Referrers/images/socials/weeworld.com.png
Binary files differ
diff --git a/plugins/Referrers/images/socials/xanga.com.png b/plugins/Referrers/images/socials/xanga.com.png
new file mode 100644
index 0000000000..cc0a26090f
--- /dev/null
+++ b/plugins/Referrers/images/socials/xanga.com.png
Binary files differ
diff --git a/plugins/TasksTimetable b/plugins/TasksTimetable
-Subproject 8421464b011448fee498d6a585877736180760d
+Subproject b7f0eb31164be8ce88aa2f99a7f94bdf2d56c7e