From dc56b4d8f9ccdb495cd2e58c163f84309a8fa6d7 Mon Sep 17 00:00:00 2001 From: Maximilian Ermer Date: Tue, 1 Nov 2016 21:01:15 +0100 Subject: [PATCH] first data for isso client --- languages/de_DE.json | 11 ++ languages/en_US.json | 15 +++ metadata.json | 10 ++ plugin.php | 237 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 273 insertions(+) create mode 100644 languages/de_DE.json create mode 100644 languages/en_US.json create mode 100644 metadata.json create mode 100644 plugin.php diff --git a/languages/de_DE.json b/languages/de_DE.json new file mode 100644 index 0000000..0709a3c --- /dev/null +++ b/languages/de_DE.json @@ -0,0 +1,11 @@ +{ + "plugin-data": + { + "name": "Isso comment client", + "description": "This is isso" + }, + + "enable-disqus-on-pages": "Isso auf Seiten verfügbar machen", + "enable-disqus-on-posts": "Enable Disqus on posts", + "enable-disqus-on-default-home-page": "Enable Disqus on default home page" +} diff --git a/languages/en_US.json b/languages/en_US.json new file mode 100644 index 0000000..744a79d --- /dev/null +++ b/languages/en_US.json @@ -0,0 +1,15 @@ +{ + "plugin-data": + { + "name": "Isso comment client", + "description": "Use isso comments in your bludit blog. (This requires a running isso server! Visit posativ.org/isso for more.) " + }, + + "enable-isso-on-pages": "Enable Isso on pages", + "enable-isso-on-posts": "Enable Disqus on posts", + "enable-isso-on-default-home-page": "Enable Disqus on default home page", + "path-to-isso-data": "Path to Isso data (e.g. your fcgi script)", + "path-to-isso-script": "Path to script source for Isso (e.g. embed.js)", + "isso-required-settings": "Required settings", + "isso-optional-settings": "Optional settings" +} diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..ba07bbc --- /dev/null +++ b/metadata.json @@ -0,0 +1,10 @@ +{ + "author": "Bludit", + "email": "", + "website": "https://plugins.bludit.com", + "version": "1.4", + "releaseDate": "2016-05-28", + "license": "MIT", + "compatible": "1.0,1.1,1.1.2,1.3,1.4", + "notes": "" +} diff --git a/plugin.php b/plugin.php new file mode 100644 index 0000000..caf8d3e --- /dev/null +++ b/plugin.php @@ -0,0 +1,237 @@ +dbFields = array( + 'enablePages'=>0, + 'enablePosts'=>0, + 'enableDefaultHomePage'=>1, + 'pathData'=>'', + 'pathSrc'=>'', + 'pathCss'=>'', + 'dataLang'=>'', + 'dataReplySelf'=>'', + 'dataRequireEmail'=>'', + 'dataCommentsTop'=>'', + 'dataCommentsNested'=>'', + 'dataRevealClick'=>'', + 'dataAvatar'=>'', + 'dataAvatarBg'=>'', + 'dataAvatarFg'=>'', + 'dataVote'=>'' + ); + } + + function __construct() + { + parent::__construct(); + + global $Url; + + $this->enable = false; + + if( $this->getDbField('enablePosts') && ($Url->whereAmI()=='post') ) { + $this->enable = true; + } + elseif( $this->getDbField('enablePages') && ($Url->whereAmI()=='page') ) { + $this->enable = true; + } + elseif( $this->getDbField('enableDefaultHomePage') && ($Url->whereAmI()=='home') ) { + $this->enable = true; + } + + if( Text::isEmpty($this->getDbField('pathCss')) ) { + $this->customCss = false; + } else { + $this->customCss = true; + } + } + + public function form() + { + global $Language; + + $html = '
'; + $html .= ''; + $html .= 'getDbField('enablePages')?'checked':'').'>'; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= 'getDbField('enablePosts')?'checked':'').'>'; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= 'getDbField('enableDefaultHomePage')?'checked':'').'>'; + $html .= ''; + $html .= '
'; + + $html .= '

'.$Language->get('Required settings').':

'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '

'.$Language->get('Optional settings').':

'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + return $html; + } + + public function postEnd() + { + if( $this->enable ) { + return '
'; + } + + return false; + } + + public function pageEnd() + { + global $Url; + + // Bludit check not-found page after the plugin method construct. + // It's necesary check here the page not-found. + + if( $this->enable && !$Url->notFound()) { + return '
'; + } + + return false; + } + + public function siteHead() + { + if( $this->enable ) { + $html = ''; + + if( $this->customCss ) { + $html .= ''; + } + + $html .= ''; + + return $html; + } + + return false; + } +}