blob: 00abd8337e5dff61103d25fb801fd1ea7591b282 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
* @package Piwik_SEO
*/
use Piwik\Core\Piwik_Common;
/**
* @package Piwik_SEO
*/
class Piwik_SEO_Controller extends Piwik_Controller
{
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 = new Piwik_View('@SEO/getRank');
$view->urlToRank = Piwik_SEO_RankChecker::extractDomainFromUrl($url);
$renderer = Piwik_DataTable_Renderer::factory('php');
$renderer->setSerialize(false);
$view->ranks = $renderer->render($dataTable);
echo $view->render();
}
}
|