Plugin label and position
This commit is contained in:
parent
15ddb13229
commit
bef0f55b53
|
@ -17,10 +17,11 @@ if($Login->role()!=='admin') {
|
|||
// Main before POST
|
||||
// ============================================================================
|
||||
$_Plugin = false;
|
||||
$pluginClassName = $layout['parameters'];
|
||||
|
||||
foreach($plugins['all'] as $P)
|
||||
{
|
||||
if($P->className()==$layout['parameters']) {
|
||||
if($P->className()==$pluginClassName) {
|
||||
$_Plugin = $P;
|
||||
}
|
||||
}
|
||||
|
@ -30,11 +31,6 @@ if($_Plugin===false) {
|
|||
Redirect::page('admin', 'plugins');
|
||||
}
|
||||
|
||||
// Check if the plugin has the method form.
|
||||
if($_Plugin->form()===false) {
|
||||
Redirect::page('admin', 'plugins');
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
|
|
@ -22,7 +22,11 @@ if($Login->role()!=='admin') {
|
|||
// ============================================================================
|
||||
$pluginClassName = $layout['parameters'];
|
||||
|
||||
$Plugin = new $pluginClassName;
|
||||
$Plugin->install();
|
||||
foreach($plugins['all'] as $P)
|
||||
{
|
||||
if($P->className()==$pluginClassName) {
|
||||
$P->install();
|
||||
}
|
||||
}
|
||||
|
||||
Redirect::page('admin', 'plugins');
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
<title><?php echo $layout['title'] ?></title>
|
||||
|
||||
<link rel="stylesheet" href="./css/kube.min.css">
|
||||
<link rel="stylesheet" href="./css/default.css">
|
||||
<link rel="stylesheet" href="./css/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="./css/kube.min.css?version=<?php echo BLUDIT_VERSION ?>">
|
||||
<link rel="stylesheet" href="./css/default.css?version=<?php echo BLUDIT_VERSION ?>">
|
||||
<link rel="stylesheet" href="./css/css/font-awesome.css?version=<?php echo BLUDIT_VERSION ?>">
|
||||
|
||||
<script src="./js/jquery.min.js"></script>
|
||||
<script src="./js/kube.min.js"></script>
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
|
||||
<input type="hidden" id="jskey" name="key" value="">
|
||||
|
||||
<div>
|
||||
<label><?php $Language->p('Plugin label') ?></label>
|
||||
<input name="label" type="text" value="<?php echo $_Plugin->getDbField('label') ?>">
|
||||
</div>
|
||||
|
||||
<?php
|
||||
echo $_Plugin->form();
|
||||
?>
|
||||
|
|
|
@ -5,15 +5,13 @@
|
|||
{
|
||||
echo '<div class="pluginBox">';
|
||||
|
||||
echo '<p>'.$Plugin->name().' <span class="version">'.$Language->g('Version').': '.$Plugin->version().'</span></p>';
|
||||
echo '<p>'.$Plugin->name().'<span class="version">'.$Language->g('Version').': '.$Plugin->version().'</span></p>';
|
||||
echo '<p>'.$Plugin->description().'</p>';
|
||||
|
||||
if($Plugin->installed()) {
|
||||
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$Plugin->className().'" class="btn btn-red btn-small">'.$Language->g('Uninstall plugin').'</a>';
|
||||
if($Plugin->form()) {
|
||||
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$Plugin->className().'" class="btn btn-small">'.$Language->g('Configure plugin').'</a>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'install-plugin/'.$Plugin->className().'" class="btn btn-blue btn-small">'.$Language->g('Install plugin').'</a>';
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ class Plugin {
|
|||
}
|
||||
|
||||
// Return TRUE if the installation success, otherwise FALSE.
|
||||
public function install()
|
||||
public function install($position=0)
|
||||
{
|
||||
if($this->installed()) {
|
||||
return false;
|
||||
|
@ -157,7 +157,8 @@ class Plugin {
|
|||
// Create database
|
||||
$Tmp = new dbJSON($this->filenameDb);
|
||||
$Tmp->db = $this->dbFields;
|
||||
$Tmp->db['position'] = 0;
|
||||
$Tmp->db['position'] = $position;
|
||||
$Tmp->db['label'] = $this->name();
|
||||
$Tmp->save();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -130,5 +130,6 @@
|
|||
"show-blog": "Show blog",
|
||||
"default-home-page": "Default home page",
|
||||
"version": "Version",
|
||||
"there-are-no-drafts": "There are no drafts."
|
||||
"there-are-no-drafts": "There are no drafts.",
|
||||
"plugin-label": "Plugin label"
|
||||
}
|
|
@ -12,6 +12,5 @@
|
|||
|
||||
"pages": "Pages",
|
||||
"home": "Home",
|
||||
"show-home-link": "Show home link",
|
||||
"label-text-to-display": "Label text to display"
|
||||
"show-home-link": "Show home link"
|
||||
}
|
|
@ -12,6 +12,5 @@
|
|||
|
||||
"pages": "Pages",
|
||||
"home": "Accueil",
|
||||
"show-home-link": "Afficher le lien de la page d’accueil",
|
||||
"label-text-to-display": "Texte à afficher"
|
||||
"show-home-link": "Afficher le lien de la page d’accueil"
|
||||
}
|
|
@ -5,8 +5,7 @@ class pluginPages extends Plugin {
|
|||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'homeLink'=>true,
|
||||
'label'=> 'Pages'
|
||||
'homeLink'=>true
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -18,11 +17,6 @@ class pluginPages extends Plugin {
|
|||
$html .= '<input name="homeLink" id="jshomeLink" type="checkbox" value="true" '.($this->getDbField('homeLink')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
|
||||
$html .= '</div>';
|
||||
$html .= '<div>';
|
||||
$html .= '<label for="label">'.$Language->get('Label text to display');
|
||||
$html .= '<input type="text" name="label" value="'.$this->getDbField('label').'" />';
|
||||
$html .= '</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
@ -63,12 +57,9 @@ class pluginPages extends Plugin {
|
|||
}
|
||||
$html .= '</ul></li>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$html .= '</ul>';
|
||||
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
|
|
Loading…
Reference in New Issue