dbFields = array( 'shortname'=>'', 'enablePages'=>0, 'enablePosts'=>0, 'enableDefaultHomePage'=>1 ); } function __construct() { parent::__construct(); global $Url; $this->enable = false; if( $this->getDbField('enablePosts') && ($Url->whereAmI()=='post') ) { $this->enable = true; } elseif( $this->getDbField('enablePages') && ($Url->whereAmI()=='page') ) { $this->enable = true; } elseif( $this->getDbField('enableDefaultHomePage') && ($Url->whereAmI()=='home') ) { $this->enable = true; } } public function form() { global $Language; $html = '
'; $html .= ''; $html .= ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= 'getDbField('enablePages')?'checked':'').'>'; $html .= ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= 'getDbField('enablePosts')?'checked':'').'>'; $html .= ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= 'getDbField('enableDefaultHomePage')?'checked':'').'>'; $html .= ''; $html .= '
'; return $html; } public function postEnd() { if( $this->enable ) { return '
'; } return false; } public function pageEnd() { global $Url; // Bludit check not-found page after the plugin method construct. // It's necesary check here the page not-found. if( $this->enable && !$Url->notFound()) { return '
'; } return false; } public function siteHead() { if( $this->enable ) { return ''; } return false; } public function siteBodyEnd() { global $Page, $Post, $Url, $posts; switch($Url->whereAmI()) { case 'post': $absolutePermalink = $Post->permalink(true); $uniqueId = $Post->uniqueId(); $disqusTitle = $Post->title(); break; case 'page': $absolutePermalink = $Page->permalink(true); $uniqueId = $Page->uniqueId(); $disqusTitle = $Page->title(); break; default: // Homepage - use the first post if(isset($posts[0])) { $absolutePermalink = $posts[0]->permalink(true); $uniqueId = $posts[0]->uniqueId(); $disqusTitle = $posts[0]->title(); } } if( $this->enable ) { $html = ' '; return $html; } return false; } }