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:
mrddter 2021-04-12 16:45:29 +02:00 committed by GitHub
parent b7c5ced470
commit 17958c8273
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}