_post = false;
//Get post from WordPress
add_filter('sq_post', array($this, 'getWpPost'), 11, 1);
//Get post details
add_filter('sq_post', array($this, 'getPostDetails'), 12, 1);
//Call the pattern class to replace the patterns for current post
add_filter('sq_post', array(SQ_Classes_ObjController::getClass('SQ_Controllers_Patterns'), 'replacePatterns'), 13, 1);
//add page in URL if post is pages
add_filter('sq_post', array($this, 'addPaged'), 14, 1);
//change the buffer
add_filter('sq_buffer', array($this, 'setMetaInBuffer'), 10, 1);
//pack html prefix if needed
add_filter('sq_html_prefix', array($this, 'packPrefix'), 99);
}
public function setStart() {
return "\n\n\n";
}
/**
* End the signature
* @return string
*/
public function setEnd() {
return "\n\n";
}
/**
* Start the buffer record
* @return void
*/
public function startBuffer() {
ob_start(array($this, 'getBuffer'));
}
/**
* Get the loaded buffer and change it
*
* @param string $buffer
* @return string
*/
public function getBuffer($buffer) {
//prevend from loading again
if ($this->_loaded) {
return $buffer;
}
return apply_filters('sq_buffer', $buffer);
}
/**
* Change the title, description and keywords in site's buffer
* @param string $buffer
* @return string
*/
public function setMetaInBuffer($buffer) {
//if is enabled sq for this page
if ($this->runSEOForThisPage()) {
if (strpos($buffer, 'getHeader()) {
//set loaded true
$this->_loaded = true;
//clear the existing tags to avoid duplicates
if (SQ_Classes_Helpers_Tools::getOption('sq_auto_metas')) {
if (isset($header['sq_title']) && $header['sq_title'] <> '' && SQ_Classes_Helpers_Tools::getOption('sq_auto_title')) {
$buffer = @preg_replace('/