コード例 #1
0
ファイル: API.php プロジェクト: nnnnathann/piwik
 /**
  * @return Piwik_SEO_API
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: SEO.test.php プロジェクト: nnnnathann/piwik
 function test_API()
 {
     $dataTable = Piwik_SEO_API::getInstance()->getRank('http://forum.piwik.org/');
     $renderer = Piwik_DataTable_Renderer::factory('php');
     $renderer->setSerialize(false);
     $ranks = $renderer->render($dataTable);
     foreach ($ranks as $rank) {
         $this->assertTrue(!empty($rank['rank']), $rank['id'] . ' expected non-zero rank, got [' . $rank['rank'] . ']');
     }
 }
コード例 #3
0
ファイル: SEOTest.php プロジェクト: nomoto-ubicast/piwik
 /**
  * tell us when the API is broken
  *
  * @group Plugins
  * @group SEO
  */
 public function test_API()
 {
     $dataTable = Piwik_SEO_API::getInstance()->getRank('http://www.microsoft.com/');
     $renderer = Piwik_DataTable_Renderer::factory('php');
     $renderer->setSerialize(false);
     $ranks = $renderer->render($dataTable);
     foreach ($ranks as $rank) {
         $this->assertNotEmpty($rank['rank'], $rank['id'] . ' expected non-zero rank, got [' . $rank['rank'] . ']');
     }
 }
コード例 #4
0
ファイル: Controller.php プロジェクト: neolf/PIWIK4MOBILE
 function getRank()
 {
     $idSite = Piwik_Common::getRequestVar('idSite');
     $site = new Piwik_Site($idSite);
     $url = urldecode(Piwik_Common::getRequestVar('url', '', 'string'));
     if (!empty($url) && strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
         $url = 'http://' . $url;
     }
     if (empty($url) || !Piwik_Common::isLookLikeUrl($url)) {
         $url = $site->getMainUrl();
     }
     $dataTable = Piwik_SEO_API::getInstance()->getRank($url);
     $view = Piwik_View::factory('index');
     $view->urlToRank = Piwik_SEO_RankChecker::extractDomainFromUrl($url);
     $renderer = Piwik_DataTable_Renderer::factory('php');
     $renderer->setSerialize(false);
     $view->ranks = $renderer->render($dataTable);
     echo $view->render();
 }
コード例 #5
0
	function getRank()
	{
		$idSite = Piwik_Common::getRequestVar('idSite'); 
		$site = new Piwik_Site($idSite);

		$url = urldecode(Piwik_Common::getRequestVar('url', '', 'string'));

		if(empty($url) || @parse_url($url) === false)
		{
			$url = $site->getMainUrl();
		}

		$dataTable = Piwik_SEO_API::getInstance()->getRank($url);
		
		$view = Piwik_View::factory('index');
		$view->urlToRank = $url;
		
		$renderer = Piwik_DataTable_Renderer::factory('php');
		$renderer->setSerialize(false);
		$view->ranks = $renderer->render($dataTable);
		echo $view->render();
	}