clean up plugins and improve them

This commit is contained in:
Diego Najar 2018-07-01 14:17:24 +02:00
parent 597537bd0e
commit f253b833f2
20 changed files with 148 additions and 127 deletions

View File

@ -156,6 +156,11 @@ class Plugin {
return '';
}
public function label()
{
return $this->getMetadata('label');
}
public function name()
{
return $this->getMetadata('name');

View File

@ -99,7 +99,9 @@ body.login {
border-radius: 0px;
border: 0;
z-index: 1000;
width: 100%;
bottom: 0;
right: 0;
margin: 0;
}
.alert-success {

View File

@ -65,9 +65,9 @@
</div>
<div class="form-group mt-2">
<button id="jsbuttonSave" type="submit" class="btn btn-primary"><?php echo $page->draft()?$L->g('Publish'):$L->g('Save') ?></button>
<button id="jsbuttonDraft" type="button" class="btn"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn"><?php echo $L->g('Cancel') ?></a>
<button id="jsbuttonSave" type="submit" class="btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a>
</div>
</div>
@ -79,7 +79,7 @@
echo Bootstrap::formTitle(array('title'=>'Select images'));
?>
<button type="button" class="btn" data-toggle="modal" data-target="#jsbluditMediaModal">Media Manager</button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#jsbluditMediaModal">Media Manager</button>
<?php
echo Bootstrap::formTitle(array('title'=>'Cover image'));
@ -92,7 +92,7 @@
}
?>
<img class="img-thumbnail" alt="200x200" src="<?php echo $coverImage ?>" data-holder-rendered="true" style="width: 100px; height: 100px;">
<img id="jscoverImagePreview" style="width: 350px; height: 200px;" class="img-thumbnail" alt="coverImagePreview" src="<?php echo HTML_PATH_ADMIN_THEME_IMG ?>default.svg" />
<?php
echo Bootstrap::formTitle(array('title'=>'External Cover image'));

View File

@ -73,7 +73,7 @@
echo Bootstrap::formTitle(array('title'=>'Select images or upload images'));
?>
<button type="button" class="btn" data-toggle="modal" data-target="#jsbluditMediaModal">Media Manager</button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#jsbluditMediaModal">Media Manager</button>
<?php
echo Bootstrap::formTitle(array('title'=>'Cover image'));

View File

@ -295,5 +295,6 @@
"example-page-3-content": "Get information about news, new releases, new themes or new plugins on our social networks [Facebook](https:\/\/www.facebook.com\/bluditcms\/), [Twitter](https:\/\/twitter.com\/bludit) and [GooglePlus](https:\/\/plus.google.com\/+Bluditcms) or visit our [Blog](https:\/\/blog.bludit.com).",
"example-page-4-slug": "about",
"example-page-4-title": "About",
"example-page-4-content": "Your About page is typically one of the most visited pages on your site, need to be simple with a few key things, such as your name, who are you, how can contact you, a small story, etc."
"example-page-4-content": "Your About page is typically one of the most visited pages on your site, need to be simple with a few key things, such as your name, who are you, how can contact you, a small story, etc.",
"the-extension-zip-is-not-installed": "The extension zip is not installed, to use this plugin you need to install the extension."
}

View File

@ -19,7 +19,11 @@ class pluginAPI extends Plugin {
{
global $Language;
$html = '<div>';
$html = '<div class="alert alert-primary" role="alert">';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('API Token').'</label>';
$html .= '<input name="token" type="text" value="'.$this->getValue('token').'">';
$html .= '<span class="tip">'.$Language->get('This token is for read only and is regenerated every time you install the plugin').'</span>';

View File

@ -7,5 +7,6 @@
"create-backup": "Backup erstellen",
"download": "Backup herunterladen",
"restore-backup": "Backup wiederherstellen",
"delete-backup": "Backup löschen"
"delete-backup": "Backup löschen",
"there-are-no-backups-for-the-moment": "There are no backups for the moment"
}

View File

@ -7,5 +7,6 @@
"create-backup": "Backup erstellen",
"download": "Backup herunterladen",
"restore-backup": "Backup wiederherstellen",
"delete-backup": "Backup löschen"
"delete-backup": "Backup löschen",
"there-are-no-backups-for-the-moment": "There are no backups for the moment"
}

View File

@ -7,5 +7,6 @@
"create-backup": "Create Backup",
"download": "Download",
"restore-backup": "Restore Backup",
"delete-backup": "Delete Backup"
"delete-backup": "Delete Backup",
"there-are-no-backups-for-the-moment": "There are no backups for the moment"
}

View File

@ -7,5 +7,6 @@
"create-backup": "Crear Backup",
"download": "Descargar",
"restore-backup": "Recuperar Backup",
"delete-backup": "Eliminar Backup"
"delete-backup": "Eliminar Backup",
"there-are-no-backups-for-the-moment": "There are no backups for the moment"
}

View File

@ -7,5 +7,6 @@
"create-backup": "Créer une sauvegarde",
"download": "Télécharger",
"restore-backup": "Restaurer la sauvegarde",
"delete-backup": "Supprimer la sauvegarde"
"delete-backup": "Supprimer la sauvegarde",
"there-are-no-backups-for-the-moment": "There are no backups for the moment"
}

View File

@ -7,5 +7,6 @@
"create-backup": "Crea Backup",
"download": "Scarica",
"restore-backup": "Ripristina Backup",
"delete-backup": "Elimina Backup"
"delete-backup": "Elimina Backup",
"there-are-no-backups-for-the-moment": "There are no backups for the moment"
}

View File

@ -7,5 +7,6 @@
"create-backup": "Yedek Al",
"download": "İndir",
"restore-backup": "Geri Yükle",
"delete-backup": "Delete Backup"
"delete-backup": "Delete Backup",
"there-are-no-backups-for-the-moment": "There are no backups for the moment"
}

View File

@ -2,7 +2,7 @@
class pluginBackup extends Plugin {
// List of directories to backup
// Directories to backup
private $directoriesToBackup = array(
PATH_PAGES,
PATH_DATABASES,
@ -65,8 +65,15 @@ class pluginBackup extends Plugin {
$backups = Filesystem::listFiles($this->workspace(), '*', 'zip', true);
}
$html = '<div>';
$html .= '<button name="createBackup" value="true" class="left small blue" type="submit"><i class="uk-icon-plus"></i> '.$Language->get('create-backup').'</button>';
$html = '';
if (empty($backups)) {
$html .= '<div class="alert alert-primary" role="alert">';
$html .= $Language->get('There are no backups for the moment');
$html .= '</div>';
}
$html .= '<div>';
$html .= '<button name="createBackup" value="true" class="btn btn-primary" type="submit"><span class="oi oi-play-circle"></span> '.$Language->get('create-backup').'</button>';
$html .= '</div>';
$html .= '<hr>';
@ -75,13 +82,13 @@ class pluginBackup extends Plugin {
$basename = pathinfo($backup,PATHINFO_BASENAME);
$html .= '<div>';
$html .= '<h3>'.Date::format($filename, BACKUP_DATE_FORMAT, 'F j, Y, g:i a').'</h3>';
$html .= '<h4 class="font-weight-normal">'.Date::format($filename, BACKUP_DATE_FORMAT, 'F j, Y, g:i a').'</h4>';
// Allow download if a zip file
if ($this->zip) {
$html .= '<a class="uk-button small left blue" href="'.DOMAIN_CONTENT.'backup/'.$filename.'.zip"><i class="uk-icon-download"></i> '.$Language->get('download').'</a>';
$html .= '<a class="btn btn-secondary mr-3" href="'.DOMAIN_CONTENT.'backup/'.$filename.'.zip"><span class="oi oi-data-transfer-download"></span> '.$Language->get('download').'</a>';
}
$html .= '<button name="restoreBackup" value="'.$filename.'" class="uk-button small left" type="submit"><i class="uk-icon-clock-o"></i> '.$Language->get('restore-backup').'</button>';
$html .= '<button name="deleteBackup" value="'.$filename.'" class="uk-button small left" type="submit"><i class="uk-icon-trash-o"></i> '.$Language->get('delete-backup').'</button>';
$html .= '<button name="restoreBackup" value="'.$filename.'" class="btn btn-secondary mr-3" type="submit"><span class="oi oi-timer"></span> '.$Language->get('restore-backup').'</button>';
$html .= '<button name="deleteBackup" value="'.$filename.'" class="btn btn-secondary mr-3" type="submit"><span class="oi oi-delete"></span> '.$Language->get('delete-backup').'</button>';
$html .= '</div>';
$html .= '<hr>';
}

View File

@ -71,7 +71,7 @@ class pluginLinks extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<button name="save" class="blue" type="submit">'.$Language->get('Save').'</button>';
$html .= '<button name="save" class="btn btn-primary" type="submit">'.$Language->get('Save').'</button>';
$html .= '</div>';
// New link, when the user click on save button this call the method post()

View File

@ -17,23 +17,9 @@ class pluginOpenGraph extends Plugin {
$html = '<div>';
$html .= '<label>'.$Language->get('Default image').'</label>';
$html .= '<input id="jsdefaultImage" name="defaultImage" type="text" value="'.$this->getValue('defaultImage').'" placeholder="https://">';
$html .= '<span class="tip">Set a default image for the content without pictures.</span>';
$html .= '</div>';
/*
$html = '<div>';
$html .= '<label>'.$Language->get('Default image').'</label>';
$html .= '<select name="defaultImage">';
$images = Filesystem::listFiles(PATH_UPLOADS);
foreach ($images as $image) {
$base = basename($image);
$html .= '<option value="'.$base.'" '.(($this->getValue('defaultImage')==$base)?'selected':'').'>'.$base.'</option>';
}
$html .= '</select>';
$html .= '</div>';
*/
return $html;
}

View File

@ -1,10 +1,10 @@
{
"author": "Quill",
"email": "",
"website": "https://www.quill.com",
"version": "4.7.5",
"releaseDate": "2018-01-22",
"license": "GPL v2",
"compatible": "2.3",
"website": "https://quilljs.com/",
"version": "1.3.6",
"releaseDate": "2018-03-12",
"license": "BSD 3-Clause",
"compatible": "3.0",
"notes": ""
}

View File

@ -22,7 +22,11 @@ class pluginSimpleStats extends Plugin {
{
global $Language;
$html = '<div>';
$html = '<div class="alert alert-primary" role="alert">';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('Label').'</label>';
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
$html .= '<span class="tip">'.$Language->get('This title is almost always used in the sidebar of the site').'</span>';

View File

@ -44,94 +44,99 @@ class pluginsimpleMDE extends Plugin {
public function adminHead()
{
if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
$html = '';
// Path plugin.
$pluginPath = $this->htmlPath();
// SimpleMDE css
$html .= '<link rel="stylesheet" href="'.$pluginPath.'css/simplemde.min.css">';
// SimpleMDE js
$html .= '<script src="'.$pluginPath.'js/simplemde.min.js"></script>';
// Hack for Bludit
$html .= '<style>
.editor-toolbar { background: #f1f1f1; border-radius: 0 !important; }
.editor-toolbar::before { margin-bottom: 2px !important }
.editor-toolbar::after { margin-top: 2px !important }
.CodeMirror, .CodeMirror-scroll { min-height: 400px !important; border-radius: 0 !important; }
</style>';
return $html;
if (!in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
return false;
}
return false;
$html = '';
// Path plugin.
$pluginPath = $this->htmlPath();
// SimpleMDE css
$html .= '<link rel="stylesheet" href="'.$pluginPath.'css/simplemde.min.css">';
// Hack for Bludit
$html .= '<style>
.editor-toolbar { background: #f1f1f1; border-radius: 0 !important; }
.editor-toolbar::before { margin-bottom: 2px !important }
.editor-toolbar::after { margin-top: 2px !important }
.CodeMirror, .CodeMirror-scroll { min-height: 500px !important; border-radius: 0 !important; }
</style>';
return $html;
}
public function adminBodyEnd()
{
if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
// Autosave
global $Page;
global $Language;
$autosaveID = $GLOBALS['ADMIN_CONTROLLER'];
$autosaveEnable = $this->getDbField('autosave')?'true':'false';
if (!empty($Page)) {
$autosaveID = $Page->key();
}
// Spell Checker
$spellCheckerEnable = $this->getDbField('spellChecker')?'true':'false';
$pluginPath = $this->htmlPath();
$html = '<script>'.PHP_EOL;
$html .= 'var simplemde = null;'.PHP_EOL;
$html .= 'function addContentSimpleMDE(content) {
var text = simplemde.value();
simplemde.value(text + content + "\n");
}'.PHP_EOL;
// This function is necesary on each Editor, it is used by Bludit Images v8.
$html .= 'function editorAddImage(filename) {
addContentSimpleMDE("!['.$Language->get('Image description').']("+filename+")");
}'.PHP_EOL;
$html .= '$(document).ready(function() { '.PHP_EOL;
$html .= 'simplemde = new SimpleMDE({
element: document.getElementById("jscontent"),
status: false,
toolbarTips: true,
toolbarGuideIcon: true,
autofocus: false,
placeholder: "'.$Language->get('content-here-supports-markdown-and-html-code').'",
lineWrapping: true,
autoDownloadFontAwesome: false,
indentWithTabs: true,
tabSize: '.$this->getDbField('tabSize').',
spellChecker: '.$spellCheckerEnable.',
toolbar: ['.Sanitize::htmlDecode($this->getDbField('toolbar')).',
"|",
{
name: "pageBreak",
action: function addPageBreak(editor){
var cm = editor.codemirror;
output = "\n'.PAGE_BREAK.'\n";
cm.replaceSelection(output);
},
className: "fa fa-scissors",
title: "'.$Language->get('Pagebreak').'",
}]
});';
$html .= '}); </script>';
return $html;
if (!in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
return false;
}
return false;
// Autosave
global $Page;
global $Language;
$autosaveID = $GLOBALS['ADMIN_CONTROLLER'];
$autosaveEnable = $this->getDbField('autosave')?'true':'false';
if (!empty($Page)) {
$autosaveID = $Page->key();
}
// Spell Checker
$spellCheckerEnable = $this->getDbField('spellChecker')?'true':'false';
$pluginPath = $this->htmlPath();
// SimpleMDE js
$html = '<script src="'.$pluginPath.'js/simplemde.min.js"></script>';
$html .= '<script>'.PHP_EOL;
$html .= 'var simplemde = null;'.PHP_EOL;
$html .= 'function addContentSimpleMDE(content) {
var text = simplemde.value();
simplemde.value(text + content + "\n");
}'.PHP_EOL;
// This function is necesary on each Editor, it is used by Bludit Images v8.
$html .= 'function editorAddImage(filename) {
addContentSimpleMDE("!['.$Language->get('Image description').']("+filename+")");
}'.PHP_EOL;
$html .= '$(document).ready(function() { '.PHP_EOL;
$html .= '
var content = $("#jscontent").html();
$("#jscontent").replaceWith("<textarea id=\"jscontent\" name=\"content\">"+content+"</textarea>");
simplemde = new SimpleMDE({
element: document.getElementById("jscontent"),
status: false,
toolbarTips: true,
toolbarGuideIcon: true,
autofocus: false,
placeholder: "'.$Language->get('content-here-supports-markdown-and-html-code').'",
lineWrapping: true,
autoDownloadFontAwesome: true,
indentWithTabs: true,
tabSize: '.$this->getDbField('tabSize').',
spellChecker: '.$spellCheckerEnable.',
toolbar: ['.Sanitize::htmlDecode($this->getDbField('toolbar')).',
"|",
{
name: "pageBreak",
action: function addPageBreak(editor){
var cm = editor.codemirror;
output = "\n'.PAGE_BREAK.'\n";
cm.replaceSelection(output);
},
className: "fa fa-scissors",
title: "'.$Language->get('Pagebreak').'",
}]
});';
$html .= '}); </script>';
return $html;
}
}

View File

@ -38,4 +38,4 @@ if ($Url->whereAmI()==='admin') {
// Site
else {
require(PATH_BOOT.'site.php');
}
}