コード例 #1
0
ファイル: API.php プロジェクト: KiwiJuicer/handball-dachau
 /**
  * Returns SEO statistics for a URL.
  *
  * @param string $url URL to request SEO stats for
  * @return DataTable
  */
 public function getRank($url)
 {
     Piwik::checkUserHasSomeViewAccess();
     $rank = new RankChecker($url);
     $linkToMajestic = MajesticClient::getLinkForUrl($url);
     $data = array('Google PageRank' => array('rank' => $rank->getPageRank(), 'logo' => \Piwik\Plugins\Referrers\getSearchEngineLogoFromUrl('http://google.com'), 'id' => 'pagerank'), Piwik::translate('SEO_Google_IndexedPages') => array('rank' => $rank->getIndexedPagesGoogle(), 'logo' => \Piwik\Plugins\Referrers\getSearchEngineLogoFromUrl('http://google.com'), 'id' => 'google-index'), Piwik::translate('SEO_Bing_IndexedPages') => array('rank' => $rank->getIndexedPagesBing(), 'logo' => \Piwik\Plugins\Referrers\getSearchEngineLogoFromUrl('http://bing.com'), 'id' => 'bing-index'), Piwik::translate('SEO_AlexaRank') => array('rank' => $rank->getAlexaRank(), 'logo' => \Piwik\Plugins\Referrers\getSearchEngineLogoFromUrl('http://alexa.com'), 'id' => 'alexa'), Piwik::translate('SEO_DomainAge') => array('rank' => $rank->getAge(), 'logo' => 'plugins/SEO/images/whois.png', 'id' => 'domain-age'), Piwik::translate('SEO_ExternalBacklinks') => array('rank' => $rank->getExternalBacklinkCount(), 'logo' => 'plugins/SEO/images/majesticseo.png', 'logo_link' => $linkToMajestic, 'logo_tooltip' => Piwik::translate('SEO_ViewBacklinksOnMajesticSEO'), 'id' => 'external-backlinks'), Piwik::translate('SEO_ReferrerDomains') => array('rank' => $rank->getReferrerDomainCount(), 'logo' => 'plugins/SEO/images/majesticseo.png', 'logo_link' => $linkToMajestic, 'logo_tooltip' => Piwik::translate('SEO_ViewBacklinksOnMajesticSEO'), 'id' => 'referrer-domains'));
     // Add DMOZ only if > 0 entries found
     $dmozRank = array('rank' => $rank->getDmoz(), 'logo' => \Piwik\Plugins\Referrers\getSearchEngineLogoFromUrl('http://dmoz.org'), 'id' => 'dmoz');
     if ($dmozRank['rank'] > 0) {
         $data[Piwik::translate('SEO_Dmoz')] = $dmozRank;
     }
     return DataTable::makeFromIndexedArray($data);
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: kreynen/elmsln
 function getRank()
 {
     $idSite = Common::getRequestVar('idSite');
     $site = new Site($idSite);
     $url = urldecode(Common::getRequestVar('url', '', 'string'));
     if (!empty($url) && strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
         $url = 'http://' . $url;
     }
     if (empty($url) || !UrlHelper::isLookLikeUrl($url)) {
         $url = $site->getMainUrl();
     }
     $dataTable = API::getInstance()->getRank($url);
     $view = new View('@SEO/getRank');
     $view->urlToRank = RankChecker::extractDomainFromUrl($url);
     /** @var \Piwik\DataTable\Renderer\Php $renderer */
     $renderer = Renderer::factory('php');
     $renderer->setSerialize(false);
     $view->ranks = $renderer->render($dataTable);
     return $view->render();
 }