Files
sean 0e8a8b3028
Some checks failed
deploy-testing / deploy (push) Has been cancelled
Initial testing snapshot
2026-11-17 16:15:01 -05:00

41 lines
1.1 KiB
PHP

<?php
class SQ_Models_Services_Noindex extends SQ_Models_Abstract_Seo {
public function __construct() {
parent::__construct();
if ($this->_post->sq->doseo) {
add_filter('sq_noindex', array($this, 'generateNoindex'));
add_filter('sq_noindex', array($this, 'packNoindex'), 99);
} else {
add_filter('sq_noindex', array($this, 'returnFalse'));
}
}
public function generateNoindex($robots = array()) {
if (get_option( 'blog_public' ) == 0) {
return $robots;
}
if ((int)$this->_post->sq->noindex == 1) {
$robots[] = 'noindex';
}else{
$robots[] = 'index';
}
if ((int)$this->_post->sq->nofollow == 1) {
$robots[] = 'nofollow';
} elseif (!empty($robots)) {
$robots[] = 'follow';
}
return $robots;
}
public function packNoindex($robots = array()) {
if (!empty($robots)) {
return sprintf("<meta name=\"robots\" content=\"%s\">", join(',', $robots));
}
return false;
}
}