saturationchecker.ctrl.php (seopanel.v.4.7.0) | : | saturationchecker.ctrl.php (seopanel.v.4.8.0) | ||
---|---|---|---|---|
skipping to change at line 64 | skipping to change at line 64 | |||
} | } | |||
function printSearchEngineSaturation($saturationInfo){ | function printSearchEngineSaturation($saturationInfo){ | |||
$this->url = $saturationInfo['url']; | $this->url = $saturationInfo['url']; | |||
$saturationCount = $this->__getSaturationRank($saturationInfo['en gine']); | $saturationCount = $this->__getSaturationRank($saturationInfo['en gine']); | |||
$websiteUrl = urldecode($this->url); | $websiteUrl = urldecode($this->url); | |||
$saturationUrl = $this->saturationUrlList[$saturationInfo['engine ']] . $websiteUrl; | $saturationUrl = $this->saturationUrlList[$saturationInfo['engine ']] . $websiteUrl; | |||
echo "<a href='$saturationUrl' target='_blank'>$saturationCount</ a>"; | echo "<a href='$saturationUrl' target='_blank'>$saturationCount</ a>"; | |||
} | } | |||
function __getSaturationRank ($engine) { | function __getSaturationRank ($engine, $cron = false) { | |||
if (SP_DEMO && !empty($_SERVER['REQUEST_METHOD'])) return 0; | if (SP_DEMO && !empty($_SERVER['REQUEST_METHOD'])) return 0; | |||
// check whether any api source is enabled for crawl keyword | ||||
$searchInfo = ['name' => "site:$this->url", "engine" => $engine]; | ||||
list($resDataStatus, $resData) = SettingsController::getSearchRes | ||||
ultCount($searchInfo, $cron); | ||||
if ($resDataStatus) { | ||||
return $resData['count']; | ||||
} | ||||
$saturationCount = 0; | $saturationCount = 0; | |||
$r = []; | ||||
switch ($engine) { | switch ($engine) { | |||
case 'google': | case 'google': | |||
$url = $this->saturationUrlList[$engine] . urlenc ode($this->url); | $url = $this->saturationUrlList[$engine] . urlenc ode($this->url); | |||
$v = $this->spider->getContent($url); | $v = $this->spider->getContent($url); | |||
$pageContent = empty($v['page']) ? '' : $v['page ']; | $pageContent = empty($v['page']) ? '' : $v['page ']; | |||
if (preg_match('/about ([0-9\,]+) result/si', $pa geContent, $r)){ | if (preg_match('/about ([0-9\,]+) result/si', $pa geContent, $r)){ | |||
} elseif (preg_match('/<div id=resultStats>([0-9\ ,]+) result/si', $pageContent, $r)){ | } elseif (preg_match('/<div id=resultStats>([0-9\ ,]+) result/si', $pageContent, $r)){ | |||
skipping to change at line 111 | skipping to change at line 120 | |||
$saturationCount = !empty($r[1]) ? str_replace(', ', '', $r[1]) : 0; | $saturationCount = !empty($r[1]) ? str_replace(', ', '', $r[1]) : 0; | |||
break; | break; | |||
} | } | |||
// update crawl log | // update crawl log | |||
$crawlLogCtrl = new CrawlLogController(); | $crawlLogCtrl = new CrawlLogController(); | |||
$crawlInfo['crawl_type'] = 'saturation'; | $crawlInfo['crawl_type'] = 'saturation'; | |||
$crawlInfo['ref_id'] = $this->url; | $crawlInfo['ref_id'] = $this->url; | |||
$crawlInfo['subject'] = $engine; | $crawlInfo['subject'] = $engine; | |||
$crawlLogCtrl->updateCrawlLog($v['log_id'], $crawlInfo); | $crawlLogCtrl->updateCrawlLog($v['log_id'], $crawlInfo); | |||
return $saturationCount; | return $saturationCount; | |||
} | } | |||
# func to show genearte reports interface | # func to show genearte reports interface | |||
function showGenerateReports($searchInfo = '') { | function showGenerateReports($searchInfo = '') { | |||
$userId = isLoggedIn(); | $userId = isLoggedIn(); | |||
$websiteController = New WebsiteController(); | $websiteController = New WebsiteController(); | |||
$websiteList = $websiteController->__getAllWebsites($userId, true ); | $websiteList = $websiteController->__getAllWebsites($userId, true ); | |||
$this->set('websiteList', $websiteList); | $this->set('websiteList', $websiteList); | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 11 lines changed or added |