possibility to add disqus on specific links (url)
Possibility to add disqus on specific links/url. This PR, leave possibility to add disqus on specific posts, static or sticky pages. Thanks Bludit.
This commit is contained in:
parent
b7c5ced470
commit
17958c8273
1 changed files with 20 additions and 7 deletions
|
@ -6,6 +6,7 @@ class pluginDisqus extends Plugin {
|
|||
{
|
||||
$this->dbFields = array(
|
||||
'shortname'=>'',
|
||||
'enableLinks'=>'',
|
||||
'enablePages'=>true,
|
||||
'enableStatic'=>true,
|
||||
'enableSticky'=>true
|
||||
|
@ -23,7 +24,12 @@ class pluginDisqus extends Plugin {
|
|||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('disqus-shortname').'</label>';
|
||||
$html .= '<input name="shortname" id="jsshortname" type="text" value="'.$this->getValue('shortname').'">';
|
||||
$html .= '<span class="tip">'.$L->get('Get the shortname from the Disqus general settings').'</span>';
|
||||
$html .= '<span class="tip">'.$L->get('get-the-shortname-from-the-disqus-general-settings').'</span>';
|
||||
|
||||
$html .= '<label>'.$L->get('enable-disqus-on-links').'</label>';
|
||||
$html .= '<input name="enableLinks" id="jsenablelinks" type="text" value="'.$this->getValue('enableLinks').'">';
|
||||
$html .= '<span class="tip">'.$L->get('tip-disqus-on-links').'</span>';
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
|
@ -65,6 +71,12 @@ class pluginDisqus extends Plugin {
|
|||
|
||||
if ($WHERE_AM_I==='page') {
|
||||
global $page;
|
||||
|
||||
$enableLinks = $this->getValue('enableLinks');
|
||||
if(strlen(trim($enableLinks)) > 0 && strpos($enableLinks, $page->key()) !== false){
|
||||
return $this->javascript();
|
||||
}
|
||||
else {
|
||||
if ($page->published() && $this->getValue('enablePages')) {
|
||||
return $this->javascript();
|
||||
}
|
||||
|
@ -75,6 +87,7 @@ class pluginDisqus extends Plugin {
|
|||
return $this->javascript();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue