💄 auto-handle plugin descriptions

This commit is contained in:
Kazhnuz 2025-01-18 22:09:15 +01:00
parent 35b2aa6559
commit 9818143bac
21 changed files with 35 additions and 100 deletions

View file

@ -219,7 +219,8 @@ body.login {
PLUGINS PLUGINS
*/ */
.plugin-form label { .plugin-form label:not(:first-child),
.plugin-form > div:not(:first-child) > label {
display: block; display: block;
margin-top: 1rem !important; margin-top: 1rem !important;
} }
@ -359,4 +360,4 @@ img.profilePicture {
.switch-icon-publish { .switch-icon-publish {
color: #1cb11c; color: #1cb11c;
} }

View file

@ -27,14 +27,23 @@
<?php endif; ?> <?php endif; ?>
</div> </div>
<div class="card"> <?php if ($plugin->description()): ?>
<div class="card-body"> <p class="alert alert-primary">
<?php <?php echo $plugin->description(); ?>
</p>
<?php endif; ?>
<?php
// Token CSRF // Token CSRF
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF', 'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF() 'value'=>$security->getTokenCSRF()
)); ));
?>
<div class="card">
<div class="card-body plugin-form">
<?php
// Print the plugin form // Print the plugin form
echo $plugin->form(); echo $plugin->form();

View file

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

View file

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

View file

@ -15,10 +15,8 @@ class pluginCustomFieldsParser extends Plugin {
global $L; global $L;
global $site; global $site;
$html = '<div class="alert alert-primary" role="alert">'; $html = '';
$html .= $this->description();
$html .= '</div>';
$jsondb = $this->getValue('jsondb', false); $jsondb = $this->getValue('jsondb', false);
$database = json_decode($jsondb, true); $database = json_decode($jsondb, true);

View file

@ -17,11 +17,7 @@ class pluginDisqus extends Plugin
{ {
global $L; global $L;
$html = '<div class="alert alert-primary" role="alert">'; $html = '<div>';
$html .= $this->description();
$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" dir="auto" value="' . $this->getValue('shortname') . '">'; $html .= '<input name="shortname" id="jsshortname" type="text" dir="auto" value="' . $this->getValue('shortname') . '">';
$html .= '<span class="tip">' . $L->get('Get the shortname from the Disqus general settings') . '</span>'; $html .= '<span class="tip">' . $L->get('Get the shortname from the Disqus general settings') . '</span>';

View file

@ -28,13 +28,8 @@ class pluginHitCounter extends Plugin
return $html; return $html;
} }
// Show the description of the plugin in the settings
$html = '<div class="alert alert-primary" role="alert">';
$html .= $this->description();
$html .= '</div>';
// Label of the plugin to show in the sidebar // Label of the plugin to show in the sidebar
$html .= '<div>'; $html = '<div>';
$html .= '<label>' . $L->get('Label') . '</label>'; $html .= '<label>' . $L->get('Label') . '</label>';
$html .= '<input name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">'; $html .= '<input name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>'; $html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';

View file

@ -18,11 +18,7 @@ class pluginHTMLCode extends Plugin {
{ {
global $L; global $L;
$html = '<div class="alert alert-primary" role="alert">'; $html = '<h2>'.$L->g('Website').'</h2>';
$html .= $this->description();
$html .= '</div>';
$html .= '<h2>'.$L->g('Website').'</h2>';
$html .= '<div>'; $html .= '<div>';
$html .= '<label>Head</label>'; $html .= '<label>Head</label>';

View file

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

View file

@ -15,11 +15,7 @@ class pluginMaintenanceMode extends Plugin
{ {
global $L; global $L;
$html = '<div class="alert alert-primary" role="alert">'; $html = '<div>';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>' . $L->get('Enable maintenance mode') . '</label>'; $html .= '<label>' . $L->get('Enable maintenance mode') . '</label>';
$html .= '<select name="enable">'; $html .= '<select name="enable">';
$html .= '<option value="true" ' . ($this->getValue('enable') === true ? 'selected' : '') . '>Enabled</option>'; $html .= '<option value="true" ' . ($this->getValue('enable') === true ? 'selected' : '') . '>Enabled</option>';

View file

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

View file

@ -16,11 +16,7 @@ class pluginOpenGraph extends Plugin
{ {
global $L; global $L;
$html = '<div class="alert alert-primary" role="alert">'; $html = '<div>';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>' . $L->get('Default image') . '</label>'; $html .= '<label>' . $L->get('Default image') . '</label>';
$html .= '<input id="jsdefaultImage" name="defaultImage" type="text" dir="auto" value="' . $this->getValue('defaultImage') . '" placeholder="https://">'; $html .= '<input id="jsdefaultImage" name="defaultImage" type="text" dir="auto" value="' . $this->getValue('defaultImage') . '" placeholder="https://">';
$html .= '<span class="tip">' . $L->g('set-a-default-image-for-content') . '</span>'; $html .= '<span class="tip">' . $L->g('set-a-default-image-for-content') . '</span>';

View file

@ -24,11 +24,7 @@ class pluginRemoteContent extends Plugin
return '<div class="alert alert-success">' . $language->get('the-extension-zip-is-not-installed') . '</div>'; return '<div class="alert alert-success">' . $language->get('the-extension-zip-is-not-installed') . '</div>';
} }
$html = '<div class="alert alert-primary" role="alert">'; $html = '<div>';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>' . $language->get('Webhook') . '</label>'; $html .= '<label>' . $language->get('Webhook') . '</label>';
$html .= '<input id="jswebhook" name="webhook" type="text" dir="auto" value="' . $this->getValue('webhook') . '">'; $html .= '<input id="jswebhook" name="webhook" type="text" dir="auto" value="' . $this->getValue('webhook') . '">';
$html .= '<span class="tip">' . DOMAIN_BASE . $this->getValue('webhook') . '</span>'; $html .= '<span class="tip">' . DOMAIN_BASE . $this->getValue('webhook') . '</span>';

View file

@ -11,11 +11,7 @@ class pluginRobots extends Plugin {
public function form() public function form()
{ {
$html = '<div class="alert alert-primary" role="alert">'; $html = '<div>';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.DOMAIN.'/robots.txt</label>'; $html .= '<label>'.DOMAIN.'/robots.txt</label>';
$html .= '<textarea name="robotstxt" id="jsrobotstxt">'.$this->getValue('robotstxt').'</textarea>'; $html .= '<textarea name="robotstxt" id="jsrobotstxt">'.$this->getValue('robotstxt').'</textarea>';
$html .= '</div>'; $html .= '</div>';

View file

@ -16,11 +16,7 @@ class pluginRSS extends Plugin
{ {
global $L; global $L;
$html = '<div class="alert alert-primary" role="alert">'; $html = '<div>';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>' . $L->get('RSS URL') . '</label>'; $html .= '<label>' . $L->get('RSS URL') . '</label>';
$html .= '<a href="' . Theme::rssUrl() . '">' . Theme::rssUrl() . '</a>'; $html .= '<a href="' . Theme::rssUrl() . '">' . Theme::rssUrl() . '</a>';
$html .= '</div>'; $html .= '</div>';

View file

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

View file

@ -15,11 +15,7 @@ class pluginSitemap extends Plugin {
{ {
global $L; global $L;
$html = '<div class="alert alert-primary" role="alert">'; $html = '<div>';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Sitemap URL').'</label>'; $html .= '<label>'.$L->get('Sitemap URL').'</label>';
$html .= '<a href="'.Theme::sitemapUrl().'">'.Theme::sitemapUrl().'</a>'; $html .= '<a href="'.Theme::sitemapUrl().'">'.Theme::sitemapUrl().'</a>';
$html .= '</div>'; $html .= '</div>';

View file

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

View file

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

View file

@ -22,11 +22,7 @@ class pluginTinymce extends Plugin
{ {
global $L; global $L;
$html = '<div class="alert alert-primary" role="alert">'; $html = '<div>';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>' . $L->get('toolbar-top') . '</label>'; $html .= '<label>' . $L->get('toolbar-top') . '</label>';
$html .= '<input name="toolbar1" id="jstoolbar1" type="text" dir="auto" value="' . $this->getValue('toolbar1') . '">'; $html .= '<input name="toolbar1" id="jstoolbar1" type="text" dir="auto" value="' . $this->getValue('toolbar1') . '">';
$html .= '</div>'; $html .= '</div>';

View file

@ -15,11 +15,7 @@ class pluginTwitterCards extends Plugin
{ {
global $L; global $L;
$html = '<div class="alert alert-primary" role="alert">'; $html = '<div>';
$html .= $this->description();
$html .= '</div>';
$html .= '<div>';
$html .= '<label>' . $L->get('Default image') . '</label>'; $html .= '<label>' . $L->get('Default image') . '</label>';
$html .= '<input id="jsdefaultImage" name="defaultImage" type="text" dir="auto" value="' . $this->getValue('defaultImage') . '" placeholder="https://">'; $html .= '<input id="jsdefaultImage" name="defaultImage" type="text" dir="auto" value="' . $this->getValue('defaultImage') . '" placeholder="https://">';
$html .= '</div>'; $html .= '</div>';