Improves on plugins, post method, improves on database for plugins, css styling
This commit is contained in:
parent
be02a51fcd
commit
ca9d1d81b9
|
@ -2,26 +2,32 @@
|
|||
|
||||
class Plugin {
|
||||
|
||||
// (string) Plugin's directory name
|
||||
// (string) directory name, just the name
|
||||
// Ex: sitemap
|
||||
public $directoryName;
|
||||
|
||||
// (string) Database path and filename
|
||||
// (string) Absoulute database filename and path
|
||||
// Ex: /www/bludit/bl-content/plugins/sitemap/db.php
|
||||
public $filenameDb;
|
||||
|
||||
// (string) Absoulute metadata filename and path
|
||||
// Ex: /www/bludit/bl-plugins/sitemap/metadata.json
|
||||
public $filenameMetadata;
|
||||
|
||||
// (array) Plugin metadata
|
||||
// Ex: array('author'=>'',...., 'notes'=>'')
|
||||
public $metadata;
|
||||
|
||||
// (string) Class name
|
||||
// Ex: pluginSitemap
|
||||
public $className;
|
||||
|
||||
// (array) Database unserialized
|
||||
public $db;
|
||||
|
||||
// (array) Database fields, only for initialize.
|
||||
// (array) Database fields, only for initialize
|
||||
public $dbFields;
|
||||
|
||||
// (string) Plugin's class name.
|
||||
public $className;
|
||||
|
||||
// (array) Plugin's information.
|
||||
public $metadata;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->dbFields = array();
|
||||
|
@ -34,10 +40,10 @@ class Plugin {
|
|||
// Class Name
|
||||
$this->className = $reflector->getName();
|
||||
|
||||
// Initialize dbFields from the children.
|
||||
// Call the method init() from the children
|
||||
$this->init();
|
||||
|
||||
// Init empty database
|
||||
// Init empty database with default values
|
||||
$this->db = $this->dbFields;
|
||||
|
||||
$this->filenameDb = PATH_PLUGINS_DATABASES.$this->directoryName.DS.'db.php';
|
||||
|
@ -47,9 +53,8 @@ class Plugin {
|
|||
$metadataString = file_get_contents($this->filenameMetadata);
|
||||
$this->metadata = json_decode($metadataString, true);
|
||||
|
||||
// If the plugin is installed then get the database.
|
||||
if($this->installed())
|
||||
{
|
||||
// If the plugin is installed then get the database
|
||||
if($this->installed()) {
|
||||
$Tmp = new dbJSON($this->filenameDb);
|
||||
$this->db = $Tmp->db;
|
||||
}
|
||||
|
@ -92,16 +97,17 @@ class Plugin {
|
|||
return PATH_PLUGINS_DATABASES.$this->directoryName.DS;
|
||||
}
|
||||
|
||||
// Returns the item from plugin-data.
|
||||
// Returns the value of the key from the metadata of the plugin, FALSE if the key doen't exit
|
||||
public function getMetadata($key)
|
||||
{
|
||||
if(isset($this->metadata[$key])) {
|
||||
return $this->metadata[$key];
|
||||
}
|
||||
|
||||
return '';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set a key / value on the metadata of the plugin
|
||||
public function setMetadata($key, $value)
|
||||
{
|
||||
$this->metadata[$key] = $value;
|
||||
|
@ -124,6 +130,8 @@ class Plugin {
|
|||
return false;
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
// 2017-06-16
|
||||
public function getDbField($key, $html=true)
|
||||
{
|
||||
if(isset($this->db[$key])) {
|
||||
|
@ -199,6 +207,7 @@ class Plugin {
|
|||
return $this->directoryName;
|
||||
}
|
||||
|
||||
// Returns the absolute path for PHP with the workspace for the plugin
|
||||
public function workspace()
|
||||
{
|
||||
return PATH_PLUGINS_DATABASES.$this->directoryName.DS;
|
||||
|
@ -241,7 +250,12 @@ class Plugin {
|
|||
public function init()
|
||||
{
|
||||
// This method is used on childre classes.
|
||||
// The user can define your own dbFields.
|
||||
// The user can define his own field of the database
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
$this->setDb($_POST);
|
||||
}
|
||||
|
||||
}
|
|
@ -38,7 +38,8 @@ if( !method_exists($plugin, 'form') ) {
|
|||
|
||||
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
||||
{
|
||||
$plugin->setDb($_POST);
|
||||
// Call the method post of the plugin
|
||||
$plugin->post();
|
||||
|
||||
// Add to syslog
|
||||
$Syslog->add(array(
|
||||
|
|
|
@ -26,8 +26,10 @@ if($Login->role()!=='admin') {
|
|||
// ============================================================================
|
||||
$pluginClassName = $layout['parameters'];
|
||||
|
||||
foreach($plugins['all'] as $plugin) {
|
||||
if($plugin->className()==$pluginClassName) {
|
||||
// Check if the plugin exists
|
||||
if( isset($plugins['all'][$pluginClassName]) ) {
|
||||
$plugin = $plugins['all'][$pluginClassName];
|
||||
|
||||
// Install plugin
|
||||
if( $plugin->install() ) {
|
||||
// Add to syslog
|
||||
|
@ -39,7 +41,6 @@ foreach($plugins['all'] as $plugin) {
|
|||
// Create an alert
|
||||
Alert::set($Language->g('Plugin installed'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Redirect::page('plugins');
|
||||
|
|
|
@ -665,43 +665,39 @@ div.plugin-links > span.separator {
|
|||
/* ----------- PLUGINS FORM ----------- */
|
||||
|
||||
#jsformplugin div {
|
||||
margin-bottom: 1.1em;
|
||||
margin-bottom: 15px;
|
||||
display: table;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#jsformplugin label {
|
||||
margin: 0 0 5px 0 !important;
|
||||
#jsformplugin > div > label,
|
||||
#jsformplugin > div > input[type=text],
|
||||
#jsformplugin > div > input[type=checkbox],
|
||||
#jsformplugin > div > textarea,
|
||||
#jsformplugin > div > select {
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
#jsformplugin > div > span.tip {
|
||||
color: #999;
|
||||
margin-top: 5px;
|
||||
font-size: 0.9em;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#jsformplugin div.tip {
|
||||
font-size: 0.9em;
|
||||
color: #AAAAAA;
|
||||
#jsformplugin > div > label {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
#jsformplugin textarea {
|
||||
min-width: 400px;
|
||||
width: 60%;
|
||||
#jsformplugin > div > textarea,
|
||||
#jsformplugin > div > input[type=text] {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
#jsformplugin > div > select {
|
||||
width: 35%;
|
||||
}
|
||||
|
||||
#jsformplugin > div > textarea {
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
#jsformplugin input[type=text] {
|
||||
min-width: 400px;
|
||||
width: 60%;
|
||||
height: 37px;
|
||||
}
|
||||
|
||||
#jsformplugin input[type="checkbox"] {
|
||||
vertical-align: middle;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#jsformplugin label.forCheckbox {
|
||||
margin-left: 3px;
|
||||
margin-bottom: 0px !important;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#jsformplugin p {
|
||||
margin-bottom: 0;
|
||||
}
|
|
@ -39,6 +39,42 @@ HTML::formOpen(array('class'=>'uk-form-horizontal'));
|
|||
'tip'=>$L->g('Order the content by date to create a Blog or order the content by position to create a Website')
|
||||
));
|
||||
|
||||
HTML::legend(array('value'=>$L->g('Special content')));
|
||||
|
||||
$options = array();
|
||||
foreach($dbPages->db as $key=>$fields) {
|
||||
$page = buildPage($key);
|
||||
$options[$key] = $page->title();
|
||||
}
|
||||
HTML::formSelect(array(
|
||||
'name'=>'pageError',
|
||||
'label'=>$L->g('404 Page Not Found'),
|
||||
'options'=>$options,
|
||||
'selected'=>$Site->pageError(),
|
||||
'class'=>'uk-width-1-3 uk-form-medium',
|
||||
'tip'=>$L->g('This page is showed only when the page does not exist anymore')
|
||||
));
|
||||
|
||||
HTML::formSelect(array(
|
||||
'name'=>'pageAbout',
|
||||
'label'=>$L->g('About page'),
|
||||
'options'=>$options,
|
||||
'addEmptySpace'=>true,
|
||||
'selected'=>$Site->pageAbout(),
|
||||
'class'=>'uk-width-1-3 uk-form-medium',
|
||||
'tip'=>$L->g('This page is to define a history about you or the content of your site')
|
||||
));
|
||||
|
||||
HTML::formSelect(array(
|
||||
'name'=>'pageContact',
|
||||
'label'=>$L->g('Contact page'),
|
||||
'options'=>$options,
|
||||
'addEmptySpace'=>true,
|
||||
'selected'=>$Site->pageContact(),
|
||||
'class'=>'uk-width-1-3 uk-form-medium',
|
||||
'tip'=>$L->g('Page for contact information')
|
||||
));
|
||||
|
||||
HTML::legend(array('value'=>$L->g('Email account settings')));
|
||||
|
||||
HTML::formInputText(array(
|
||||
|
|
|
@ -90,7 +90,7 @@ function buildPlugins()
|
|||
$Language->add($database);
|
||||
}
|
||||
|
||||
// Push Plugin to array all plugins installed and not installed.
|
||||
// Array with plugin all plugins, installed and not installed
|
||||
$plugins['all'][$pluginClass] = $Plugin;
|
||||
|
||||
// If the plugin is installed, order by hooks.
|
||||
|
|
|
@ -251,6 +251,18 @@ class dbPages extends dbJSON
|
|||
return $tmp;
|
||||
}
|
||||
|
||||
// Returns a database with drafts pages
|
||||
public function getDraftDB()
|
||||
{
|
||||
$tmp = $this->db;
|
||||
foreach($tmp as $key=>$fields) {
|
||||
if($fields['status']!='draft') {
|
||||
unset($tmp[$key]);
|
||||
}
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
// Return an array with the database for a page, FALSE otherwise.
|
||||
public function getPageDB($key)
|
||||
{
|
||||
|
@ -265,12 +277,8 @@ class dbPages extends dbJSON
|
|||
// (int) $pageNumber, the page number
|
||||
// (int) $amountOfItems, amount of items to return
|
||||
// (boolean) $onlyPublished, TRUE to return only published pages
|
||||
public function getList($pageNumber, $amountOfItems, $onlyPublished=true, $removeErrorPage=true)
|
||||
public function getList($pageNumber, $amountOfItems, $onlyPublished=true)
|
||||
{
|
||||
if( $removeErrorPage ) {
|
||||
unset($this->db['error']);
|
||||
}
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
if( $onlyPublished ) {
|
||||
|
|
|
@ -27,7 +27,10 @@ class dbSite extends dbJSON
|
|||
'googlePlus'=> array('inFile'=>false, 'value'=>''),
|
||||
'instagram'=> array('inFile'=>false, 'value'=>''),
|
||||
'github'=> array('inFile'=>false, 'value'=>''),
|
||||
'orderBy'=> array('inFile'=>false, 'value'=>'date') // date or position
|
||||
'orderBy'=> array('inFile'=>false, 'value'=>'date'), // date or position
|
||||
'pageError'=> array('inFile'=>false, 'value'=>'error'),
|
||||
'pageAbout'=> array('inFile'=>false, 'value'=>'about'),
|
||||
'pageContact'=> array('inFile'=>false, 'value'=>'contact')
|
||||
);
|
||||
|
||||
function __construct()
|
||||
|
@ -137,6 +140,21 @@ class dbSite extends dbJSON
|
|||
return $this->getField('orderBy');
|
||||
}
|
||||
|
||||
public function pageError()
|
||||
{
|
||||
return $this->getField('pageError');
|
||||
}
|
||||
|
||||
public function pageAbout()
|
||||
{
|
||||
return $this->getField('pageAbout');
|
||||
}
|
||||
|
||||
public function pageContact()
|
||||
{
|
||||
return $this->getField('pageContact');
|
||||
}
|
||||
|
||||
// Returns the site title
|
||||
public function title()
|
||||
{
|
||||
|
|
|
@ -127,14 +127,12 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false)
|
|||
if($for=='admin') {
|
||||
$onlyPublished = false;
|
||||
$amountOfItems = ITEMS_PER_PAGE_ADMIN;
|
||||
$removeErrorPage = false;
|
||||
$list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished, $removeErrorPage);
|
||||
$list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
}
|
||||
elseif($for=='home') {
|
||||
$onlyPublished = true;
|
||||
$amountOfItems = $Site->itemsPerPage();
|
||||
$removeErrorPage = true;
|
||||
$list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished, $removeErrorPage);
|
||||
$list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
}
|
||||
elseif($for=='category') {
|
||||
$amountOfItems = $Site->itemsPerPage();
|
||||
|
|
|
@ -17,6 +17,7 @@ class pluginAbout extends Plugin {
|
|||
$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('Title of the plugin for the sidebar').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
|
|
|
@ -18,13 +18,17 @@ class pluginCategories extends Plugin {
|
|||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$Language->get('Label').'</label>';
|
||||
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
|
||||
$html .= '<input name="label" type="text" value="'.$this->getValue('label').'">';
|
||||
$html .= '<span class="tip">'.$Language->get('Title of the plugin for the sidebar').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<input type="hidden" name="showCero" value="false">';
|
||||
$html .= '<input id="jsshowCero" name="showCero" type="checkbox" value="true" '.($this->getValue('showCero')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jsshowCero">'.$Language->get('Show categories without content').'</label>';
|
||||
$html .= '<label>'.$Language->get('Categories without content').'</label>';
|
||||
$html .= '<select name="showCero">';
|
||||
$html .= '<option value="true" '.($this->getValue('showCero')?'checked':'').'>Enabled</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('showCero')?'checked':'').'>Disabled</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<span class="tip">'.$Language->get('Show the categories without content').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
|
|
@ -18,19 +18,19 @@ class pluginGoogle extends Plugin {
|
|||
$html = '<div>';
|
||||
$html .= '<label for="jsgoogle-site-verification">'.$Language->get('Google Webmasters tools').'</label>';
|
||||
$html .= '<input id="jsgoogle-site-verification" type="text" name="google-site-verification" value="'.$this->getDbField('google-site-verification').'">';
|
||||
$html .= '<div class="tip">'.$Language->get('complete-this-field-with-the-google-site-verification').'</div>';
|
||||
$html .= '<span class="tip">'.$Language->get('complete-this-field-with-the-google-site-verification').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label for="jstracking-id">'.$Language->get('Google Analytics Tracking ID').'</label>';
|
||||
$html .= '<input id="jsgoogle-analytics-tracking-id" type="text" name="google-analytics-tracking-id" value="'.$this->getDbField('google-analytics-tracking-id').'">';
|
||||
$html .= '<div class="tip">'.$Language->get('complete-this-field-with-the-tracking-id').'</div>';
|
||||
$html .= '<span class="tip">'.$Language->get('complete-this-field-with-the-tracking-id').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label for="jsgoogle-tag-manager">'.$Language->get('Google Tag Manager').'</label>';
|
||||
$html .= '<input id="jsgoogle-tag-manager" type="text" name="google-tag-manager" value="'.$this->getDbField('google-tag-manager').'">';
|
||||
$html .= '<div class="tip">'.$Language->get('complete-this-field-with-the-tracking-id-google-tag').'</div>';
|
||||
$html .= '<span class="tip">'.$Language->get('complete-this-field-with-the-tracking-id-google-tag').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
|
|
@ -16,6 +16,20 @@ class pluginLinks extends Plugin {
|
|||
);
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
$jsondb = $this->getValue('jsondb', $unsanitized=false);
|
||||
$links = json_decode($jsondb, true);
|
||||
|
||||
$name = $_POST['linkName'];
|
||||
$url = $_POST['linkURL'];
|
||||
|
||||
$links[$url] = $name;
|
||||
|
||||
$this->db['jsondb'] = json_encode($links);
|
||||
$this->save();
|
||||
}
|
||||
|
||||
// Method called on plugin settings on the admin area
|
||||
public function form()
|
||||
{
|
||||
|
@ -26,6 +40,21 @@ class pluginLinks extends Plugin {
|
|||
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
// Get the JSON DB, getValue() with the option unsanitized HTML code
|
||||
$jsondb = $this->getValue('jsondb', $unsanitized=false);
|
||||
$links = json_decode($jsondb, true);
|
||||
foreach($links as $name=>$url) {
|
||||
$html .= '<div>';
|
||||
$html .= '<input name="'.$name.'" type="text" value="'.$name.'">';
|
||||
$html .= '<input name="'.$url.'" type="text" value="'.$url.'">';
|
||||
$html .= '</div>';
|
||||
}
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= 'Nombre <input name="linkName" type="text" value="">';
|
||||
$html .= '<br>URL <input name="linkURL" type="text" value="">';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ class pluginMenu extends Plugin {
|
|||
$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('Title of the plugin for the sidebar').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
|
|
@ -20,6 +20,16 @@ class pluginPages extends Plugin {
|
|||
$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('Title of the plugin for the sidebar').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Home link').'</label>';
|
||||
$html .= '<select name="homeLink">';
|
||||
$html .= '<option value="true" '.($this->getValue('showCero')?'checked':'').'>Enabled</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('showCero')?'checked':'').'>Disabled</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<span class="tip">'.$Language->get('Show the home link on the sidebar').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
|
@ -27,12 +37,6 @@ class pluginPages extends Plugin {
|
|||
$html .= '<input id="jsamountOfItems" name="amountOfItems" type="text" value="'.$this->getValue('amountOfItems').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<input type="hidden" name="homeLink" value="false">';
|
||||
$html .= '<input id="jshomeLink" name="homeLink" type="checkbox" value="true" '.($this->getValue('homeLink')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Страници",
|
||||
"description": "Показва списък на страниците."
|
||||
},
|
||||
|
||||
"home": "Начало",
|
||||
"show-home-link": "Покажи връзка към начало",
|
||||
"show-children": "Покажи подменю"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Menü aller Seiten",
|
||||
"description": "Anzeige eines Menüs aller Seiten in der Seitenleiste (bei Themes mit Seitenleiste)."
|
||||
},
|
||||
|
||||
"home": "Hauptseite",
|
||||
"show-home-link": "Hauptseite zeigen"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Menü aller Seiten",
|
||||
"description": "Anzeige eines Menüs aller Seiten in der Seitenleiste (bei Themes mit Seitenleiste)."
|
||||
},
|
||||
|
||||
"home": "Hauptseite",
|
||||
"show-home-link": "Hauptseite zeigen"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Special pages",
|
||||
"description": "Shows a list of pages, you can define the amount of items and the order depends of settings."
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Listado de páginas",
|
||||
"description": "Muestra las paginas en orden según la posición."
|
||||
},
|
||||
|
||||
"home": "Página de inicio",
|
||||
"show-home-link": "Mostrar página de inicio"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Page navigation",
|
||||
"description": "Constitue un menu avec les liens des pages dans la colonne du thème."
|
||||
},
|
||||
|
||||
"home": "Accueil",
|
||||
"show-home-link": "Afficher le lien de la page d’accueil"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Page list",
|
||||
"description": "ページをリストにして表示します。"
|
||||
},
|
||||
|
||||
"home": "ホーム",
|
||||
"show-home-link": "ホーム・リンクを表示"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Pagina lijst",
|
||||
"description": "Laat een lijst met alle pagina's op volgorde zien."
|
||||
},
|
||||
|
||||
"home": "Home",
|
||||
"show-home-link": "Laat de homepage link zien"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Lista stron",
|
||||
"description": "Wyświetla listę stron znajdujących się w witrynie."
|
||||
},
|
||||
|
||||
"home": "Strona główna",
|
||||
"show-home-link": "Pokaż odnośnik do strony głównek"
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Список страниц",
|
||||
"description": "Показывает упорядоченый список страниц."
|
||||
},
|
||||
|
||||
"home": "Главная",
|
||||
"show-home-link": "Показывать ссылку на главную",
|
||||
"show-children": "Показывать подменю"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Sayfa listesi",
|
||||
"description": "Sayfaları listeler."
|
||||
},
|
||||
|
||||
"home": "Anasayfa",
|
||||
"show-home-link": "Anasayfa linkini göster"
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Список сторінок",
|
||||
"description": "Показує список сторінок по порядку."
|
||||
},
|
||||
|
||||
"home": "Головна",
|
||||
"show-home-link": "Показувати лінк на головну сторінку",
|
||||
"show-children": "Показувати вкладені лінки"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "頁面列表",
|
||||
"description": "顯示所有頁面的列表"
|
||||
},
|
||||
|
||||
"home": "首頁",
|
||||
"show-home-link": "顯示首頁連結"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "2.0",
|
||||
"releaseDate": "2017-05-26",
|
||||
"license": "MIT",
|
||||
"compatible": "2.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
<?php
|
||||
|
||||
class pluginSpecialPages extends Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Fields and default values for the database of this plugin
|
||||
$this->dbFields = array(
|
||||
'label'=>'Pages',
|
||||
'homeLink'=>true,
|
||||
'pageAboutLabel'=>'About',
|
||||
'pageAbout'=>''
|
||||
);
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Method called on the settings of the plugin on the admin area
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
global $dbPages;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$Language->get('Label').'</label>';
|
||||
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<input type="hidden" name="homeLink" value="false">';
|
||||
$html .= '<input id="jshomeLink" name="homeLink" type="checkbox" value="true" '.($this->getValue('homeLink')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
$options = array();
|
||||
foreach($dbPages->db as $key=>$fields) {
|
||||
$page = buildPage($key);
|
||||
$options[$key] = $page->title();
|
||||
}
|
||||
|
||||
HTML::formOpen(array('class'=>'uk-form-horizontal'));
|
||||
|
||||
HTML::legend(array('value'=>$Language->g('About page')));
|
||||
|
||||
HTML::formInputText(array(
|
||||
'name'=>'title',
|
||||
'label'=>$Language->g('Site title'),
|
||||
'value'=>'test',
|
||||
'class'=>'uk-width-1-2 uk-form-medium',
|
||||
'tip'=>$Language->g('use-this-field-to-name-your-site')
|
||||
));
|
||||
|
||||
HTML::formClose();
|
||||
|
||||
$html .= '<legend>About page</legend>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Label').'</label>';
|
||||
$html .= '<input id="jspageAboutLabel" name="pageAboutLabel" type="text" value="'.$this->getValue('pageAboutLabel').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Select a page').'</label>';
|
||||
$html .= '<select id="jspageAbout" name="pageAbout">';
|
||||
$html .= '<option value=""></option>';
|
||||
foreach($options as $key=>$title) {
|
||||
$html .= '<option value="'.$key.'" '.($this->getValue('pageAbout')==$key?'selected':'').'>'.$title.'</option>';
|
||||
}
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<input type="hidden" name="pageAboutHide" value="false">';
|
||||
$html .= '<input id="jshomeLink" name="homeLink" type="checkbox" value="true" '.($this->getValue('homeLink')?'checked':'').'>';
|
||||
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show the page on the main').'</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<legend>Contact page</legend>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Label').'</label>';
|
||||
$html .= '<input id="jspageContactLabel" name="pageContactLabel" type="text" value="'.$this->getValue('pageContactLabel').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Select a page').'</label>';
|
||||
$html .= '<select id="jspageContact" name="pageContact">';
|
||||
$html .= '<option value=""></option>';
|
||||
foreach($options as $key=>$title) {
|
||||
$html .= '<option value="'.$key.'" '.($this->getValue('pageContact')==$key?'selected':'').'>'.$title.'</option>';
|
||||
}
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
// Method called on the sidebar of the website
|
||||
public function siteSidebar()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
// HTML for sidebar
|
||||
$html = '<div class="plugin plugin-special-pages">';
|
||||
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
|
||||
$html .= '<div class="plugin-content">';
|
||||
$html .= '<ul>';
|
||||
|
||||
// Show Home page link
|
||||
if( $this->getValue('homeLink') ) {
|
||||
$html .= '<li>';
|
||||
$html .= '<a href="'.$Site->url().'">';
|
||||
$html .= $Language->get('Home page');
|
||||
$html .= '</a>';
|
||||
$html .= '</li>';
|
||||
}
|
||||
|
||||
if( $this->getValue('pageAboutLabel') ) {
|
||||
$html .= '<li>';
|
||||
$html .= '<a href="'.$this->getValue('pageAbout').'">';
|
||||
$html .= $this->getValue('pageAboutLabel');
|
||||
$html .= '</a>';
|
||||
$html .= '</li>';
|
||||
}
|
||||
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@ class pluginTags extends Plugin {
|
|||
$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('Title of the plugin for the sidebar').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
|
Loading…
Reference in New Issue