Disqus plugin improves
This commit is contained in:
parent
df9d09e810
commit
06cf589021
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"plugin-data":
|
|
||||||
{
|
|
||||||
"name": "Disqus коментари",
|
|
||||||
"description": "Disqus коментари е услуги за уеб сайтове и блогове. Трябва да сте регистрирани в Disqus.com, преди да използвате този плъгин.",
|
|
||||||
"author": "Bludit",
|
|
||||||
"email": "",
|
|
||||||
"website": "https://github.com/dignajar/bludit-plugins",
|
|
||||||
"version": "0.6",
|
|
||||||
"releaseDate": "2015-11-13"
|
|
||||||
},
|
|
||||||
"disqus-shortname": "Disqus shortname",
|
|
||||||
"enable-disqus-on-pages": "Активиране Disqus на страници",
|
|
||||||
"enable-disqus-on-posts": "Активиране Disqus на публикации",
|
|
||||||
"enable-disqus-on-default-home-page": "Активиране Disqus на начална страница"
|
|
||||||
}
|
|
|
@ -4,5 +4,9 @@
|
||||||
"name": "Disqus",
|
"name": "Disqus",
|
||||||
"description": "Disqus ist eine Kommentar-Plattform für Websites. Um das Plugin verwenden zu können, muss ein Konto bei <a href=\"https://disqus.com\">Disqus</a> eingerichtet werden."
|
"description": "Disqus ist eine Kommentar-Plattform für Websites. Um das Plugin verwenden zu können, muss ein Konto bei <a href=\"https://disqus.com\">Disqus</a> eingerichtet werden."
|
||||||
},
|
},
|
||||||
"disqus-shortname": "Disqus shortname"
|
"disqus-shortname": "Disqus shortname",
|
||||||
}
|
"enable-disqus-on-pages": "Disqus on pages",
|
||||||
|
"enable-disqus-on-static-pages": "Disqus on static pages",
|
||||||
|
"enable-disqus-on-sticky-pages": "Disqus on sticky pages",
|
||||||
|
"get-the-shortname-from-the-disqus-general-settings": "Get the shortname from the Disqus general settings"
|
||||||
|
}
|
|
@ -4,5 +4,9 @@
|
||||||
"name": "Disqus",
|
"name": "Disqus",
|
||||||
"description": "Disqus ist eine Kommentar-Plattform für Websites. Um das Plugin verwenden zu können, muss ein Konto bei <a href=\"https://disqus.com\">Disqus</a> eingerichtet werden."
|
"description": "Disqus ist eine Kommentar-Plattform für Websites. Um das Plugin verwenden zu können, muss ein Konto bei <a href=\"https://disqus.com\">Disqus</a> eingerichtet werden."
|
||||||
},
|
},
|
||||||
"disqus-shortname": "Disqus shortname"
|
"disqus-shortname": "Disqus shortname",
|
||||||
}
|
"enable-disqus-on-pages": "Disqus on pages",
|
||||||
|
"enable-disqus-on-static-pages": "Disqus on static pages",
|
||||||
|
"enable-disqus-on-sticky-pages": "Disqus on sticky pages",
|
||||||
|
"get-the-shortname-from-the-disqus-general-settings": "Get the shortname from the Disqus general settings"
|
||||||
|
}
|
|
@ -5,6 +5,8 @@
|
||||||
"description": "Disqus is a comment hosting service for web sites.<br>It's necessary to be registered on <a href=\"https://disqus.com\">Disqus</a> to use this service."
|
"description": "Disqus is a comment hosting service for web sites.<br>It's necessary to be registered on <a href=\"https://disqus.com\">Disqus</a> to use this service."
|
||||||
},
|
},
|
||||||
"disqus-shortname": "Disqus shortname",
|
"disqus-shortname": "Disqus shortname",
|
||||||
"enable-disqus-on-pages": "Disqus on static",
|
"enable-disqus-on-pages": "Disqus on pages",
|
||||||
"enable-disqus-on-posts": "Disqus on published"
|
"enable-disqus-on-static-pages": "Disqus on static pages",
|
||||||
}
|
"enable-disqus-on-sticky-pages": "Disqus on sticky pages",
|
||||||
|
"get-the-shortname-from-the-disqus-general-settings": "Get the shortname from the Disqus general settings"
|
||||||
|
}
|
|
@ -2,7 +2,11 @@
|
||||||
"plugin-data":
|
"plugin-data":
|
||||||
{
|
{
|
||||||
"name": "Disqus",
|
"name": "Disqus",
|
||||||
"description": "Disqus es un servicio de comentarios online.<br>Es necesario registrarse en Disqus.com antes de utilizar este plugin."
|
"description": "Disqus es un servicio de comentarios online.<br>Es necesario registrarse en <a href=\"https://disqus.com\">Disqus</a> antes de utilizar este plugin."
|
||||||
},
|
},
|
||||||
"disqus-shortname": "Disqus shortname"
|
"disqus-shortname": "Disqus shortname",
|
||||||
|
"enable-disqus-on-pages": "Disqus en página",
|
||||||
|
"enable-disqus-on-static-pages": "Disqus en página estaticas",
|
||||||
|
"enable-disqus-on-sticky-pages": "Disqus en página sticky",
|
||||||
|
"get-the-shortname-from-the-disqus-general-settings": "Puede obtener el shortname en la página de configuración de Disqus."
|
||||||
}
|
}
|
|
@ -5,7 +5,8 @@
|
||||||
"description": "Disqus est un service Web de discussion et de commentaires d'articles centralisé avec authentification unique. Il est nécessaire de s’inscrire sur Disqus.com avant d’utiliser ce plugin."
|
"description": "Disqus est un service Web de discussion et de commentaires d'articles centralisé avec authentification unique. Il est nécessaire de s’inscrire sur Disqus.com avant d’utiliser ce plugin."
|
||||||
},
|
},
|
||||||
"disqus-shortname": "Votre ID Disqus",
|
"disqus-shortname": "Votre ID Disqus",
|
||||||
"enable-disqus-on-pages": "Activer Disqus sur les pages",
|
"enable-disqus-on-pages": "Disqus on pages",
|
||||||
"enable-disqus-on-posts": "Activer Disqus sur les articles",
|
"enable-disqus-on-static-pages": "Disqus on static pages",
|
||||||
"enable-disqus-on-default-home-page": "Activer Disqus sur la page d’accueil"
|
"enable-disqus-on-sticky-pages": "Disqus on sticky pages",
|
||||||
|
"get-the-shortname-from-the-disqus-general-settings": "Get the shortname from the Disqus general settings"
|
||||||
}
|
}
|
|
@ -5,6 +5,8 @@
|
||||||
"description": "Disqus è un servizio di hosting per i commenti sui siti web.<br>E' neccesario essere resitrati su <a href=\"https://disqus.com\">Disqus</a> per utilizzare questo servizio."
|
"description": "Disqus è un servizio di hosting per i commenti sui siti web.<br>E' neccesario essere resitrati su <a href=\"https://disqus.com\">Disqus</a> per utilizzare questo servizio."
|
||||||
},
|
},
|
||||||
"disqus-shortname": "Nome Breve Disqus ",
|
"disqus-shortname": "Nome Breve Disqus ",
|
||||||
"enable-disqus-on-pages": "Disqus su statico",
|
"enable-disqus-on-pages": "Disqus on pages",
|
||||||
"enable-disqus-on-posts": "Disqus su pubblicato"
|
"enable-disqus-on-static-pages": "Disqus on static pages",
|
||||||
}
|
"enable-disqus-on-sticky-pages": "Disqus on sticky pages",
|
||||||
|
"get-the-shortname-from-the-disqus-general-settings": "Get the shortname from the Disqus general settings"
|
||||||
|
}
|
|
@ -4,9 +4,9 @@
|
||||||
"name": "Disqus comment system",
|
"name": "Disqus comment system",
|
||||||
"description": "Disqusはブログにコメント機能を提供するWebサイトです。プラグインを使用するにはDisqus.comに登録する必要があります。"
|
"description": "Disqusはブログにコメント機能を提供するWebサイトです。プラグインを使用するにはDisqus.comに登録する必要があります。"
|
||||||
},
|
},
|
||||||
|
|
||||||
"disqus-shortname": "Disqusサイト名(ショートネーム)",
|
"disqus-shortname": "Disqusサイト名(ショートネーム)",
|
||||||
"enable-disqus-on-pages": "ページのDisqusを有効",
|
"enable-disqus-on-pages": "Disqus on pages",
|
||||||
"enable-disqus-on-posts": "記事ページのDisqusを有効",
|
"enable-disqus-on-static-pages": "Disqus on static pages",
|
||||||
"enable-disqus-on-default-home-page": "規定のホームページのDisqusを有効"
|
"enable-disqus-on-sticky-pages": "Disqus on sticky pages",
|
||||||
|
"get-the-shortname-from-the-disqus-general-settings": "Get the shortname from the Disqus general settings"
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@
|
||||||
"name": "Disqus commentaar systeem",
|
"name": "Disqus commentaar systeem",
|
||||||
"description": "Disqus is een blog commentaar hosting service voor web sites. Het is wel nodig om jezelf te registreren op Disqus.com voordat je deze plugin kan gebruiken."
|
"description": "Disqus is een blog commentaar hosting service voor web sites. Het is wel nodig om jezelf te registreren op Disqus.com voordat je deze plugin kan gebruiken."
|
||||||
},
|
},
|
||||||
|
|
||||||
"disqus-shortname": "Disqus shortname",
|
"disqus-shortname": "Disqus shortname",
|
||||||
"enable-disqus-on-pages": "Schakel Disqus in op pagina's",
|
"enable-disqus-on-pages": "Disqus on pages",
|
||||||
"enable-disqus-on-posts": "Schakel Disqus in op posts",
|
"enable-disqus-on-static-pages": "Disqus on static pages",
|
||||||
"enable-disqus-on-default-home-page": "Schakel Disqus in op de startpagina"
|
"enable-disqus-on-sticky-pages": "Disqus on sticky pages",
|
||||||
}
|
"get-the-shortname-from-the-disqus-general-settings": "Get the shortname from the Disqus general settings"
|
||||||
|
}
|
|
@ -5,7 +5,8 @@
|
||||||
"description": "System komentarzy Disqus przechowuje komentarze dla serwisów internetowych. Korzystanie z tej wtyczki wymaga rejestracji w serwisie disqus.com."
|
"description": "System komentarzy Disqus przechowuje komentarze dla serwisów internetowych. Korzystanie z tej wtyczki wymaga rejestracji w serwisie disqus.com."
|
||||||
},
|
},
|
||||||
"disqus-shortname": "Nazwa użytkownika Disqus",
|
"disqus-shortname": "Nazwa użytkownika Disqus",
|
||||||
"enable-disqus-on-pages": "Włącz Disqus na wszystkich stronach",
|
"enable-disqus-on-pages": "Disqus on pages",
|
||||||
"enable-disqus-on-posts": "Włącz Disqus we wszystkich wpisach",
|
"enable-disqus-on-static-pages": "Disqus on static pages",
|
||||||
"enable-disqus-on-default-home-page": "Włącz Disqus na domyślnej stronie głównej"
|
"enable-disqus-on-sticky-pages": "Disqus on sticky pages",
|
||||||
|
"get-the-shortname-from-the-disqus-general-settings": "Get the shortname from the Disqus general settings"
|
||||||
}
|
}
|
|
@ -5,6 +5,8 @@
|
||||||
"description": "Disqus это сервис комментариев для сайтов и блогов. Необходимо быть зарегистрированным на Disqus.com перед использованием плагина."
|
"description": "Disqus это сервис комментариев для сайтов и блогов. Необходимо быть зарегистрированным на Disqus.com перед использованием плагина."
|
||||||
},
|
},
|
||||||
"disqus-shortname": "Disqus shortname",
|
"disqus-shortname": "Disqus shortname",
|
||||||
"enable-disqus-on-pages": "Disqus на страницах",
|
"enable-disqus-on-pages": "Disqus on pages",
|
||||||
"enable-disqus-on-posts": "Disqus в записях"
|
"enable-disqus-on-static-pages": "Disqus on static pages",
|
||||||
}
|
"enable-disqus-on-sticky-pages": "Disqus on sticky pages",
|
||||||
|
"get-the-shortname-from-the-disqus-general-settings": "Get the shortname from the Disqus general settings"
|
||||||
|
}
|
|
@ -4,8 +4,9 @@
|
||||||
"name": "Disqus Yorum Sistemi",
|
"name": "Disqus Yorum Sistemi",
|
||||||
"description": "Disqus siteler için yorum barındırması yapan bir firmadır. Eklentiyi kullanmadan önce Disqus.com adresine kayıt olmanız gerekmektedir."
|
"description": "Disqus siteler için yorum barındırması yapan bir firmadır. Eklentiyi kullanmadan önce Disqus.com adresine kayıt olmanız gerekmektedir."
|
||||||
},
|
},
|
||||||
"disqus-shortname": "Disqus",
|
"disqus-shortname": "Disqus shortname",
|
||||||
"enable-disqus-on-pages": "Sayfalar için Disqus'ı etkinleştir",
|
"enable-disqus-on-pages": "Disqus on pages",
|
||||||
"enable-disqus-on-posts": "Yazılar için Disqus'ı etkinleştir",
|
"enable-disqus-on-static-pages": "Disqus on static pages",
|
||||||
"enable-disqus-on-default-home-page": "Geçerli ana sayfa için Disqus'ı etkinleştir"
|
"enable-disqus-on-sticky-pages": "Disqus on sticky pages",
|
||||||
}
|
"get-the-shortname-from-the-disqus-general-settings": "Get the shortname from the Disqus general settings"
|
||||||
|
}
|
|
@ -4,9 +4,9 @@
|
||||||
"name": "Система коментарів Disqus",
|
"name": "Система коментарів Disqus",
|
||||||
"description": "Disqus надає послуги хостингу коментарів для веб-сайтів. Необхідно зареєструватися на Disqus.com перед використанням цього плагіна."
|
"description": "Disqus надає послуги хостингу коментарів для веб-сайтів. Необхідно зареєструватися на Disqus.com перед використанням цього плагіна."
|
||||||
},
|
},
|
||||||
|
|
||||||
"disqus-shortname": "Коротке ім'я в Disqus",
|
"disqus-shortname": "Коротке ім'я в Disqus",
|
||||||
"enable-disqus-on-pages": "Включити Disqus на сторінках",
|
"enable-disqus-on-pages": "Disqus on pages",
|
||||||
"enable-disqus-on-posts": "Включити Disqus у публікаціях",
|
"enable-disqus-on-static-pages": "Disqus on static pages",
|
||||||
"enable-disqus-on-default-home-page": "Включити Disqus на домашній сторінці"
|
"enable-disqus-on-sticky-pages": "Disqus on sticky pages",
|
||||||
|
"get-the-shortname-from-the-disqus-general-settings": "Get the shortname from the Disqus general settings"
|
||||||
}
|
}
|
|
@ -6,8 +6,9 @@ class pluginDisqus extends Plugin {
|
||||||
{
|
{
|
||||||
$this->dbFields = array(
|
$this->dbFields = array(
|
||||||
'shortname'=>'',
|
'shortname'=>'',
|
||||||
'enablePages'=>false,
|
'enablePages'=>true,
|
||||||
'enablePosts'=>true
|
'enableStatic'=>true,
|
||||||
|
'enableSticky'=>true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ class pluginDisqus extends Plugin {
|
||||||
$html .= '<div>';
|
$html .= '<div>';
|
||||||
$html .= '<label>'.$L->get('disqus-shortname').'</label>';
|
$html .= '<label>'.$L->get('disqus-shortname').'</label>';
|
||||||
$html .= '<input name="shortname" id="jsshortname" type="text" value="'.$this->getValue('shortname').'">';
|
$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 .= '</div>';
|
$html .= '</div>';
|
||||||
|
|
||||||
$html .= '<div>';
|
$html .= '<div>';
|
||||||
|
@ -30,12 +32,21 @@ class pluginDisqus extends Plugin {
|
||||||
$html .= '<option value="true" '.($this->getValue('enablePages')===true?'selected':'').'>'.$L->get('enabled').'</option>';
|
$html .= '<option value="true" '.($this->getValue('enablePages')===true?'selected':'').'>'.$L->get('enabled').'</option>';
|
||||||
$html .= '<option value="false" '.($this->getValue('enablePages')===false?'selected':'').'>'.$L->get('disabled').'</option>';
|
$html .= '<option value="false" '.($this->getValue('enablePages')===false?'selected':'').'>'.$L->get('disabled').'</option>';
|
||||||
$html .= '</select>';
|
$html .= '</select>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
|
||||||
$html .= '<div>';
|
$html .= '<div>';
|
||||||
$html .= '<label>'.$L->get('enable-disqus-on-posts').'</label>';
|
$html .= '<label>'.$L->get('enable-disqus-on-static-pages').'</label>';
|
||||||
$html .= '<select name="enablePosts">';
|
$html .= '<select name="enableStatic">';
|
||||||
$html .= '<option value="true" '.($this->getValue('enablePosts')===true?'selected':'').'>'.$L->get('enabled').'</option>';
|
$html .= '<option value="true" '.($this->getValue('enableStatic')===true?'selected':'').'>'.$L->get('enabled').'</option>';
|
||||||
$html .= '<option value="false" '.($this->getValue('enablePosts')===false?'selected':'').'>'.$L->get('disabled').'</option>';
|
$html .= '<option value="false" '.($this->getValue('enableStatic')===false?'selected':'').'>'.$L->get('disabled').'</option>';
|
||||||
|
$html .= '</select>';
|
||||||
|
$html .= '</div>';
|
||||||
|
|
||||||
|
$html .= '<div>';
|
||||||
|
$html .= '<label>'.$L->get('enable-disqus-on-sticky-pages').'</label>';
|
||||||
|
$html .= '<select name="enableSticky">';
|
||||||
|
$html .= '<option value="true" '.($this->getValue('enableSticky')===true?'selected':'').'>'.$L->get('enabled').'</option>';
|
||||||
|
$html .= '<option value="false" '.($this->getValue('enableSticky')===false?'selected':'').'>'.$L->get('disabled').'</option>';
|
||||||
$html .= '</select>';
|
$html .= '</select>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
|
||||||
|
@ -44,39 +55,52 @@ class pluginDisqus extends Plugin {
|
||||||
|
|
||||||
public function pageEnd()
|
public function pageEnd()
|
||||||
{
|
{
|
||||||
global $content;
|
global $WHERE_AM_I;
|
||||||
global $url, $page;
|
|
||||||
|
|
||||||
$page = $content[0];
|
if ($WHERE_AM_I==='page') {
|
||||||
if (empty($page)) {
|
global $page;
|
||||||
return false;
|
if ($page->published() && $this->getValue('enablePages')) {
|
||||||
}
|
return $this->javascript();
|
||||||
|
}
|
||||||
if ( !$url->notFound() &&
|
if ($page->isStatic() && $this->getValue('enableStatic')) {
|
||||||
( $url->whereAmI()=='page' &&
|
return $this->javascript();
|
||||||
(($this->getValue('enablePosts') && $page->published()) ||
|
}
|
||||||
($this->getValue('enablePages') && $page->isStatic()))
|
if ($page->sticky() && $this->getValue('enableSticky')) {
|
||||||
) &&
|
return $this->javascript();
|
||||||
$page->allowComments() ) {
|
}
|
||||||
$html = '<div id="disqus_thread"></div>';
|
|
||||||
$html .= '<script type="text/javascript">
|
|
||||||
var disqus_config = function () {
|
|
||||||
this.page.url = "'.$page->permalink().'";
|
|
||||||
this.page.identifier = "'.$page->uuid().'";
|
|
||||||
};
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
var d = document, s = d.createElement("script");
|
|
||||||
s.src = "https://'.$this->getValue('shortname').'.disqus.com/embed.js";
|
|
||||||
s.setAttribute("data-timestamp", +new Date());
|
|
||||||
(d.head || d.body).appendChild(s);
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
';
|
|
||||||
return $html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function javascript()
|
||||||
|
{
|
||||||
|
global $page;
|
||||||
|
$pageURL = $page->permalink();
|
||||||
|
$pageID = $page->uuid();
|
||||||
|
$shortname = $this->getValue('shortname');
|
||||||
|
|
||||||
|
$code = <<<EOF
|
||||||
|
<!-- Disqus plugin -->
|
||||||
|
<div id="disqus_thread"></div>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var disqus_config = function () {
|
||||||
|
this.page.url = '$pageURL';
|
||||||
|
this.page.identifier = '$pageID';
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() { // DON'T EDIT BELOW THIS LINE
|
||||||
|
var d = document, s = d.createElement('script');
|
||||||
|
s.src = 'https://$shortname.disqus.com/embed.js';
|
||||||
|
s.setAttribute('data-timestamp', +new Date());
|
||||||
|
(d.head || d.body).appendChild(s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||||
|
<!-- /Disqus plugin -->
|
||||||
|
EOF;
|
||||||
|
return $code;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue