Merge pull request #525 from xm74/master

Disqus plugin update
This commit is contained in:
Diego Najar 2017-10-21 15:26:12 +02:00 committed by GitHub
commit d1a2627c65
5 changed files with 53 additions and 18 deletions

View File

@ -4,5 +4,7 @@
"name": "Disqus",
"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-posts": "Disqus on published"
}

View File

@ -5,7 +5,6 @@
"description": "Disqus это сервис комментариев для сайтов и блогов. Необходимо быть зарегистрированным на Disqus.com перед использованием плагина."
},
"disqus-shortname": "Disqus shortname",
"enable-disqus-on-pages": "Включить Disqus на страницах",
"enable-disqus-on-posts": "Включить Disqus в записях",
"enable-disqus-on-default-home-page": "Включить Disqus на домашней странице"
"enable-disqus-on-pages": "Disqus на страницах",
"enable-disqus-on-posts": "Disqus в записях"
}

View File

@ -5,7 +5,9 @@ class pluginDisqus extends Plugin {
public function init()
{
$this->dbFields = array(
'shortname'=>''
'shortname'=>'',
'enablePages'=>false,
'enablePosts'=>true
);
}
@ -14,24 +16,44 @@ class pluginDisqus extends Plugin {
global $Language;
$html = '<div>';
$html .= '<label>'.$Language->get('Disqus shortname').'</label>';
$html .= '<label>'.$Language->get('disqus-shortname').'</label>';
$html .= '<input name="shortname" id="jsshortname" type="text" value="'.$this->getValue('shortname').'">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('enable-disqus-on-pages').'</label>';
$html .= '<select name="enablePages">';
$html .= '<option value="true" '.($this->getValue('enablePages')===true?'selected':'').'>'.$Language->get('enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('enablePages')===false?'selected':'').'>'.$Language->get('disabled').'</option>';
$html .= '</select>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('enable-disqus-on-posts').'</label>';
$html .= '<select name="enablePosts">';
$html .= '<option value="true" '.($this->getValue('enablePosts')===true?'selected':'').'>'.$Language->get('enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('enablePosts')===false?'selected':'').'>'.$Language->get('disabled').'</option>';
$html .= '</select>';
$html .= '</div>';
return $html;
}
public function pageEnd()
{
global $pages;
global $Url;
global $Url, $Page;
$page = $pages[0];
if (empty($page)) {
return false;
}
if ( (!$Url->notFound()) && ($Url->whereAmI()=='page') && ($page->allowComments()) ) {
if ( !$Url->notFound() &&
( $Url->whereAmI()=='page' &&
(($this->getDbField('enablePosts') && $Page->status()=='published') ||
($this->getDbField('enablePages') && $Page->status()=='static'))
) &&
$page->allowComments() ) {
$html = '<div id="disqus_thread"></div>';
$html .= '<script type="text/javascript">
var disqus_config = function () {
@ -53,4 +75,4 @@ class pluginDisqus extends Plugin {
return false;
}
}
}

View File

@ -0,0 +1,12 @@
{
"plugin-data":
{
"name": "SimpleMDE",
"description": "Редактор с простым интерфейсом для создания markup разметки."
},
"toolbar": "Панель инструментов",
"tab-size": "Размер панели",
"autosave": "Автосохранения",
"spell-checker": "Проверка орфографии",
"content-here-supports-markdown-and-html-code": "Содержимое поддерживаем Markdown и HTML коды"
}

View File

@ -22,28 +22,28 @@ class pluginsimpleMDE extends Plugin {
global $Language;
$html = '<div>';
$html .= '<label>'.$Language->get('Toolbar').'</label>';
$html .= '<label>'.$Language->get('toolbar').'</label>';
$html .= '<input name="toolbar" id="jstoolbar" type="text" value="'.$this->getDbField('toolbar').'">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('Tab size').'</label>';
$html .= '<label>'.$Language->get('tab-size').'</label>';
$html .= '<input name="tabSize" id="jstabSize" type="text" value="'.$this->getDbField('tabSize').'">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('Autosave').'</label>';
$html .= '<label>'.$Language->get('autosave').'</label>';
$html .= '<select name="autosave">';
$html .= '<option value="true" '.($this->getValue('autosave')===true?'selected':'').'>Enabled</option>';
$html .= '<option value="false" '.($this->getValue('autosave')===false?'selected':'').'>Disabled</option>';
$html .= '<option value="true" '.($this->getValue('autosave')===true?'selected':'').'>'.$Language->get('enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('autosave')===false?'selected':'').'>'.$Language->get('disabled').'</option>';
$html .= '</select>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('Spell Checker').'</label>';
$html .= '<label>'.$Language->get('spell-checker').'</label>';
$html .= '<select name="spellChecker">';
$html .= '<option value="true" '.($this->getValue('spellChecker')===true?'selected':'').'>Enabled</option>';
$html .= '<option value="false" '.($this->getValue('spellChecker')===false?'selected':'').'>Disabled</option>';
$html .= '<option value="true" '.($this->getValue('spellChecker')===true?'selected':'').'>'.$Language->get('enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('spellChecker')===false?'selected':'').'>'.$Language->get('disabled').'</option>';
$html .= '</select>';
$html .= '</div>';
@ -116,7 +116,7 @@ class pluginsimpleMDE extends Plugin {
toolbarTips: true,
toolbarGuideIcon: true,
autofocus: false,
placeholder: "'.$Language->get('Content here Supports Markdown and HTML code').'",
placeholder: "'.$Language->get('content-here-supports-markdown-and-html-code').'",
lineWrapping: true,
autoDownloadFontAwesome: false,
indentWithTabs: true,