/** * Return social network logo path by URL * * @param string $domain * @return string path * @see plugins/Referrers/images/socials/ */ function getSocialsLogoFromUrl($domain) { $social = getSocialNetworkFromDomain($domain); $socialNetworks = Common::getSocialUrls(); $filePattern = 'plugins/Referrers/images/socials/%s.png'; foreach ($socialNetworks as $domainKey => $name) { if ($social == $socialNetworks[$domainKey] && file_exists(PIWIK_INCLUDE_PATH . '/' . sprintf($filePattern, $domainKey))) { return sprintf($filePattern, $domainKey); } } return sprintf($filePattern, 'xx'); }
/** * Sets the subtable IDs for the DataTable returned by getSocial. * * The IDs are int indexes into the array in /core/DataFiles/Socials.php. * * @param DataTable $dataTable */ private function setSocialIdSubtables($dataTable) { if ($dataTable instanceof DataTable\Map) { foreach ($dataTable->getDataTables() as $childTable) { $this->setSocialIdSubtables($childTable); } } else { foreach ($dataTable->getRows() as $row) { $socialName = $row->getColumn('label'); $i = 1; // start at one because idSubtable=0 is equivalent to idSubtable=false foreach (Common::getSocialUrls() as $name) { if ($name == $socialName) { $row->c[Row::DATATABLE_ASSOCIATED] = $i; break; } ++$i; } } } }