From 06cf5890218bd0ec9173dc85a5f28a8972f4e9fe Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Fri, 25 Jan 2019 16:25:41 +0100 Subject: [PATCH] Disqus plugin improves --- bl-plugins/disqus/languages/bg_BG.json | 16 ----- bl-plugins/disqus/languages/de_CH.json | 8 ++- bl-plugins/disqus/languages/de_DE.json | 8 ++- bl-plugins/disqus/languages/en.json | 8 ++- bl-plugins/disqus/languages/es.json | 8 ++- bl-plugins/disqus/languages/fr_FR.json | 7 +- bl-plugins/disqus/languages/it.json | 8 ++- bl-plugins/disqus/languages/ja_JP.json | 8 +-- bl-plugins/disqus/languages/nl_NL.json | 10 +-- bl-plugins/disqus/languages/pl_PL.json | 7 +- bl-plugins/disqus/languages/ru_RU.json | 8 ++- bl-plugins/disqus/languages/tr_TR.json | 11 +-- bl-plugins/disqus/languages/uk_UA.json | 8 +-- bl-plugins/disqus/plugin.php | 96 ++++++++++++++++---------- 14 files changed, 120 insertions(+), 91 deletions(-) delete mode 100644 bl-plugins/disqus/languages/bg_BG.json diff --git a/bl-plugins/disqus/languages/bg_BG.json b/bl-plugins/disqus/languages/bg_BG.json deleted file mode 100644 index 94536a36..00000000 --- a/bl-plugins/disqus/languages/bg_BG.json +++ /dev/null @@ -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 на начална страница" -} \ No newline at end of file diff --git a/bl-plugins/disqus/languages/de_CH.json b/bl-plugins/disqus/languages/de_CH.json index 2f42ebf6..1f47bbd5 100644 --- a/bl-plugins/disqus/languages/de_CH.json +++ b/bl-plugins/disqus/languages/de_CH.json @@ -4,5 +4,9 @@ "name": "Disqus", "description": "Disqus ist eine Kommentar-Plattform für Websites. Um das Plugin verwenden zu können, muss ein Konto bei Disqus 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" +} \ No newline at end of file diff --git a/bl-plugins/disqus/languages/de_DE.json b/bl-plugins/disqus/languages/de_DE.json index 2f42ebf6..1f47bbd5 100644 --- a/bl-plugins/disqus/languages/de_DE.json +++ b/bl-plugins/disqus/languages/de_DE.json @@ -4,5 +4,9 @@ "name": "Disqus", "description": "Disqus ist eine Kommentar-Plattform für Websites. Um das Plugin verwenden zu können, muss ein Konto bei Disqus 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" +} \ No newline at end of file diff --git a/bl-plugins/disqus/languages/en.json b/bl-plugins/disqus/languages/en.json index b4b6f9af..17cd2339 100644 --- a/bl-plugins/disqus/languages/en.json +++ b/bl-plugins/disqus/languages/en.json @@ -5,6 +5,8 @@ "description": "Disqus is a comment hosting service for web sites.
It's necessary to be registered on Disqus to use this service." }, "disqus-shortname": "Disqus shortname", - "enable-disqus-on-pages": "Disqus on static", - "enable-disqus-on-posts": "Disqus on published" -} + "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" +} \ No newline at end of file diff --git a/bl-plugins/disqus/languages/es.json b/bl-plugins/disqus/languages/es.json index 6bed6004..9119cf0d 100644 --- a/bl-plugins/disqus/languages/es.json +++ b/bl-plugins/disqus/languages/es.json @@ -2,7 +2,11 @@ "plugin-data": { "name": "Disqus", - "description": "Disqus es un servicio de comentarios online.
Es necesario registrarse en Disqus.com antes de utilizar este plugin." + "description": "Disqus es un servicio de comentarios online.
Es necesario registrarse en Disqus 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." } \ No newline at end of file diff --git a/bl-plugins/disqus/languages/fr_FR.json b/bl-plugins/disqus/languages/fr_FR.json index ffe5c999..fdb26199 100644 --- a/bl-plugins/disqus/languages/fr_FR.json +++ b/bl-plugins/disqus/languages/fr_FR.json @@ -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." }, "disqus-shortname": "Votre ID Disqus", - "enable-disqus-on-pages": "Activer Disqus sur les pages", - "enable-disqus-on-posts": "Activer Disqus sur les articles", - "enable-disqus-on-default-home-page": "Activer Disqus sur la page d’accueil" + "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" } \ No newline at end of file diff --git a/bl-plugins/disqus/languages/it.json b/bl-plugins/disqus/languages/it.json index 0b7defde..50b678b2 100644 --- a/bl-plugins/disqus/languages/it.json +++ b/bl-plugins/disqus/languages/it.json @@ -5,6 +5,8 @@ "description": "Disqus è un servizio di hosting per i commenti sui siti web.
E' neccesario essere resitrati su Disqus per utilizzare questo servizio." }, "disqus-shortname": "Nome Breve Disqus ", - "enable-disqus-on-pages": "Disqus su statico", - "enable-disqus-on-posts": "Disqus su pubblicato" -} + "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" +} \ No newline at end of file diff --git a/bl-plugins/disqus/languages/ja_JP.json b/bl-plugins/disqus/languages/ja_JP.json index e956511f..49f458b1 100644 --- a/bl-plugins/disqus/languages/ja_JP.json +++ b/bl-plugins/disqus/languages/ja_JP.json @@ -4,9 +4,9 @@ "name": "Disqus comment system", "description": "Disqusはブログにコメント機能を提供するWebサイトです。プラグインを使用するにはDisqus.comに登録する必要があります。" }, - "disqus-shortname": "Disqusサイト名(ショートネーム)", - "enable-disqus-on-pages": "ページのDisqusを有効", - "enable-disqus-on-posts": "記事ページのDisqusを有効", - "enable-disqus-on-default-home-page": "規定のホームページのDisqusを有効" + "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" } \ No newline at end of file diff --git a/bl-plugins/disqus/languages/nl_NL.json b/bl-plugins/disqus/languages/nl_NL.json index 6b968e35..fecb752d 100644 --- a/bl-plugins/disqus/languages/nl_NL.json +++ b/bl-plugins/disqus/languages/nl_NL.json @@ -4,9 +4,9 @@ "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." }, - "disqus-shortname": "Disqus shortname", - "enable-disqus-on-pages": "Schakel Disqus in op pagina's", - "enable-disqus-on-posts": "Schakel Disqus in op posts", - "enable-disqus-on-default-home-page": "Schakel Disqus in op de startpagina" -} + "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" +} \ No newline at end of file diff --git a/bl-plugins/disqus/languages/pl_PL.json b/bl-plugins/disqus/languages/pl_PL.json index 13fb0fad..b02aeac0 100644 --- a/bl-plugins/disqus/languages/pl_PL.json +++ b/bl-plugins/disqus/languages/pl_PL.json @@ -5,7 +5,8 @@ "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", - "enable-disqus-on-pages": "Włącz Disqus na wszystkich stronach", - "enable-disqus-on-posts": "Włącz Disqus we wszystkich wpisach", - "enable-disqus-on-default-home-page": "Włącz Disqus na domyślnej stronie głównej" + "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" } \ No newline at end of file diff --git a/bl-plugins/disqus/languages/ru_RU.json b/bl-plugins/disqus/languages/ru_RU.json index f96a82f1..c959e10c 100644 --- a/bl-plugins/disqus/languages/ru_RU.json +++ b/bl-plugins/disqus/languages/ru_RU.json @@ -5,6 +5,8 @@ "description": "Disqus это сервис комментариев для сайтов и блогов. Необходимо быть зарегистрированным на Disqus.com перед использованием плагина." }, "disqus-shortname": "Disqus shortname", - "enable-disqus-on-pages": "Disqus на страницах", - "enable-disqus-on-posts": "Disqus в записях" -} + "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" +} \ No newline at end of file diff --git a/bl-plugins/disqus/languages/tr_TR.json b/bl-plugins/disqus/languages/tr_TR.json index c7b87fc1..21ded716 100644 --- a/bl-plugins/disqus/languages/tr_TR.json +++ b/bl-plugins/disqus/languages/tr_TR.json @@ -4,8 +4,9 @@ "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." }, - "disqus-shortname": "Disqus", - "enable-disqus-on-pages": "Sayfalar için Disqus'ı etkinleştir", - "enable-disqus-on-posts": "Yazılar için Disqus'ı etkinleştir", - "enable-disqus-on-default-home-page": "Geçerli ana sayfa için Disqus'ı etkinleştir" -} + "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" +} \ No newline at end of file diff --git a/bl-plugins/disqus/languages/uk_UA.json b/bl-plugins/disqus/languages/uk_UA.json index 979cb6bc..f41c5146 100644 --- a/bl-plugins/disqus/languages/uk_UA.json +++ b/bl-plugins/disqus/languages/uk_UA.json @@ -4,9 +4,9 @@ "name": "Система коментарів Disqus", "description": "Disqus надає послуги хостингу коментарів для веб-сайтів. Необхідно зареєструватися на Disqus.com перед використанням цього плагіна." }, - "disqus-shortname": "Коротке ім'я в Disqus", - "enable-disqus-on-pages": "Включити Disqus на сторінках", - "enable-disqus-on-posts": "Включити Disqus у публікаціях", - "enable-disqus-on-default-home-page": "Включити Disqus на домашній сторінці" + "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" } \ No newline at end of file diff --git a/bl-plugins/disqus/plugin.php b/bl-plugins/disqus/plugin.php index 817252f4..4ae5e506 100644 --- a/bl-plugins/disqus/plugin.php +++ b/bl-plugins/disqus/plugin.php @@ -6,8 +6,9 @@ class pluginDisqus extends Plugin { { $this->dbFields = array( 'shortname'=>'', - 'enablePages'=>false, - 'enablePosts'=>true + 'enablePages'=>true, + 'enableStatic'=>true, + 'enableSticky'=>true ); } @@ -22,6 +23,7 @@ class pluginDisqus extends Plugin { $html .= '
'; $html .= ''; $html .= ''; + $html .= ''.$L->get('Get the shortname from the Disqus general settings').''; $html .= '
'; $html .= '
'; @@ -30,12 +32,21 @@ class pluginDisqus extends Plugin { $html .= ''; $html .= ''; $html .= ''; - $html .= '
'; + $html .= ''; + $html .= '
'; - $html .= ''; - $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; $html .= '
'; @@ -44,39 +55,52 @@ class pluginDisqus extends Plugin { public function pageEnd() { - global $content; - global $url, $page; + global $WHERE_AM_I; - $page = $content[0]; - if (empty($page)) { - return false; - } - - if ( !$url->notFound() && - ( $url->whereAmI()=='page' && - (($this->getValue('enablePosts') && $page->published()) || - ($this->getValue('enablePages') && $page->isStatic())) - ) && - $page->allowComments() ) { - $html = '
'; - $html .= ' - '; - return $html; + if ($WHERE_AM_I==='page') { + global $page; + if ($page->published() && $this->getValue('enablePages')) { + return $this->javascript(); + } + if ($page->isStatic() && $this->getValue('enableStatic')) { + return $this->javascript(); + } + if ($page->sticky() && $this->getValue('enableSticky')) { + return $this->javascript(); + } } return false; } + private function javascript() + { + global $page; + $pageURL = $page->permalink(); + $pageID = $page->uuid(); + $shortname = $this->getValue('shortname'); + +$code = << +
+ + + +EOF; + return $code; + } + }