Update plugin.php
This commit is contained in:
parent
c0a6caac90
commit
6e66fc28a4
|
@ -5,7 +5,9 @@ class pluginDisqus extends Plugin {
|
|||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'shortname'=>''
|
||||
'shortname'=>'',
|
||||
'enablePages'=>false,
|
||||
'enablePosts'=>true
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -14,24 +16,44 @@ class pluginDisqus extends Plugin {
|
|||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$Language->get('Disqus shortname').'</label>';
|
||||
$html .= '<label>'.$Language->get('disqus-shortname').'</label>';
|
||||
$html .= '<input name="shortname" id="jsshortname" type="text" value="'.$this->getValue('shortname').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('enable-disqus-on-pages').'</label>';
|
||||
$html .= '<select name="enablePages">';
|
||||
$html .= '<option value="true" '.($this->getValue('enablePages')===true?'selected':'').'>'.$Language->get('enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('enablePages')===false?'selected':'').'>'.$Language->get('disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('enable-disqus-on-posts').'</label>';
|
||||
$html .= '<select name="enablePosts">';
|
||||
$html .= '<option value="true" '.($this->getValue('enablePosts')===true?'selected':'').'>'.$Language->get('enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('enablePosts')===false?'selected':'').'>'.$Language->get('disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function pageEnd()
|
||||
{
|
||||
global $pages;
|
||||
global $Url;
|
||||
global $Url, $Page;
|
||||
|
||||
$page = $pages[0];
|
||||
if (empty($page)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( (!$Url->notFound()) && ($Url->whereAmI()=='page') && ($page->allowComments()) ) {
|
||||
if ( !$Url->notFound() &&
|
||||
(
|
||||
($this->getDbField('enablePosts') && $Page->status()=='published') ||
|
||||
($this->getDbField('enablePages') && $Page->status()=='static')
|
||||
) &&
|
||||
$page->allowComments() ) {
|
||||
$html = '<div id="disqus_thread"></div>';
|
||||
$html .= '<script type="text/javascript">
|
||||
var disqus_config = function () {
|
||||
|
|
Loading…
Reference in New Issue