77 lines
3.2 KiB
PHP
77 lines
3.2 KiB
PHP
<?php
|
|
|
|
class SQ_Models_Focuspages_Nofollow extends SQ_Models_Abstract_Assistant {
|
|
|
|
protected $_category = 'nofollow';
|
|
|
|
protected $_permalink = false;
|
|
protected $_nofollow_links = false;
|
|
protected $_dofollow_links = false;
|
|
|
|
const INNERS_MINVAL = 100;
|
|
|
|
public function init() {
|
|
parent::init();
|
|
|
|
if (!isset($this->_audit->data)) {
|
|
$this->_error = true;
|
|
return;
|
|
}
|
|
|
|
$this->_permalink = (isset($this->_post->url) && $this->_post->url <> '' ? $this->_post->url : $this->_audit->permalink);
|
|
|
|
// if (isset($this->_audit->data->sq_seo_body->links_no_follow)) {
|
|
// $nofollow_links = json_decode($this->_audit->data->sq_seo_body->links_no_follow, true);
|
|
//
|
|
// if(!empty($nofollow_links)) {
|
|
// foreach ($nofollow_links as $link) {
|
|
// if (parse_url($link, PHP_URL_HOST)) {
|
|
// if (parse_url($link, PHP_URL_HOST) <> parse_url($this->_permalink, PHP_URL_HOST)) {
|
|
// $this->_nofollow_links[] = $link;
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
if (isset($this->_audit->data->sq_seo_body->links_do_follow)) {
|
|
$dofollow_links = json_decode($this->_audit->data->sq_seo_body->links_do_follow, true);
|
|
|
|
if(!empty($dofollow_links)) {
|
|
foreach ($dofollow_links as $link) {
|
|
if (parse_url($link, PHP_URL_HOST)) {
|
|
if (parse_url($link, PHP_URL_HOST) <> parse_url($this->_permalink, PHP_URL_HOST)) {
|
|
$this->_dofollow_links[] = $link;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public function setTasks($tasks) {
|
|
parent::setTasks($tasks);
|
|
|
|
$this->_tasks[$this->_category] = array(
|
|
'externallinks' => array(
|
|
'title' => __("Maintain authority", _SQ_PLUGIN_NAME_),
|
|
'value' => '<br />' . __("External Links", _SQ_PLUGIN_NAME_) . ':<br />' . ($this->_dofollow_links && !empty($this->_dofollow_links) ? join('<br />', array_unique($this->_dofollow_links)) : ''),
|
|
'penalty' => 5,
|
|
'description' => sprintf(__("TLDR: All outbound links need to have no-follow attribute. %s You've worked hard on your Focus Page. %s Now make sure that you're not letting that hard work go to waste, by sending out all your authority and Link Juice over to other pages from the web. %s The Focus Page needs to be the final page that Google Follows. It's an \"All Roads Lead to Rome\" kind of scenario. %s If you want your focus pages to get ranked better and have authority make sure that ALL outbound links have a no-follow attribute attached to them.", _SQ_PLUGIN_NAME_), '<br /><br />', '<br /><br />', '<br /><br />', '<br /><br />'),
|
|
),
|
|
);
|
|
|
|
}
|
|
|
|
/*********************************************/
|
|
|
|
public function checkExternallinks($task) {
|
|
if ($this->_dofollow_links && !empty($this->_dofollow_links)) {
|
|
$task['completed'] = false;
|
|
return $task;
|
|
}
|
|
|
|
return $task;
|
|
}
|
|
|
|
} |