Improves on Navigation and Static Pages plugin
This commit is contained in:
parent
b80053e6d5
commit
acae61f9d8
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Último contenido",
|
||||
"description": "Cree su propio menú de navegación con las últimas páginas o páginas estáticas."
|
||||
"name": "Barra de Navegación",
|
||||
"description": "Cree tu propio menú de navegación"
|
||||
},
|
||||
"home-link": "Enlace Home",
|
||||
"show-the-home-link-on-the-sidebar": "Mostrar el vínculo de inicio en la barra lateral.",
|
||||
"home-link": "Enlace de inicio",
|
||||
"show-the-home-link-on-the-sidebar": "Mostrar el vínculo de inicio en la barra de navegación.",
|
||||
"amount-of-items": "Cantidad de artículos"
|
||||
}
|
|
@ -8,9 +8,7 @@ class pluginNavigation extends Plugin {
|
|||
$this->dbFields = array(
|
||||
'label'=>'Navigation',
|
||||
'homeLink'=>true,
|
||||
'amountOfItems'=>5,
|
||||
'staticPages'=>true,
|
||||
'pages'=>true
|
||||
'amountOfItems'=>5
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -33,22 +31,6 @@ class pluginNavigation extends Plugin {
|
|||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Show static pages').'</label>';
|
||||
$html .= '<select name="staticPages">';
|
||||
$html .= '<option value="true" '.($this->getValue('staticPages')===true?'selected':'').'>'.$Language->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('staticPages')===false?'selected':'').'>'.$Language->get('Disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Show pages').'</label>';
|
||||
$html .= '<select name="pages">';
|
||||
$html .= '<option value="true" '.($this->getValue('pages')===true?'selected':'').'>'.$Language->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('pages')===false?'selected':'').'>'.$Language->get('Disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
if (ORDER_BY=='date') {
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Amount of items').'</label>';
|
||||
|
@ -86,24 +68,13 @@ class pluginNavigation extends Plugin {
|
|||
$html .= '</li>';
|
||||
}
|
||||
|
||||
// Show static pages
|
||||
if ($this->getValue('staticPages')) {
|
||||
$staticPages = buildStaticPages();
|
||||
foreach ($staticPages as $page) {
|
||||
$html .= '<li>';
|
||||
$html .= '<a href="' . $page->permalink() . '">' . $page->title() . '</a>';
|
||||
$html .= '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
// Show pages
|
||||
if ($this->getValue('pages')) {
|
||||
// Pages order by position
|
||||
if (ORDER_BY=='position') {
|
||||
// Get parents
|
||||
$parents = buildParentPages();
|
||||
foreach ($parents as $parent) {
|
||||
$html .= '<li class="parent">';
|
||||
$html .= '<b><a href="' . $parent->permalink() . '">' . $parent->title() . '</a></b>';
|
||||
$html .= '<a href="' . $parent->permalink() . '">' . $parent->title() . '</a>';
|
||||
|
||||
if ($parent->hasChildren()) {
|
||||
// Get children
|
||||
|
@ -118,7 +89,9 @@ class pluginNavigation extends Plugin {
|
|||
}
|
||||
$html .= '</li>';
|
||||
}
|
||||
} else {
|
||||
}
|
||||
// Pages order by date
|
||||
else {
|
||||
// List of published pages
|
||||
$onlyPublished = true;
|
||||
$pageNumber = 1;
|
||||
|
@ -132,7 +105,6 @@ class pluginNavigation extends Plugin {
|
|||
$html .= '</li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Static Pages",
|
||||
"description": "Create your own navigation menu with static pages."
|
||||
},
|
||||
"home-link": "Home link",
|
||||
"show-the-home-link-on-the-sidebar": "Show the home link on the sidebar."
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "2.3",
|
||||
"releaseDate": "2018-03-07",
|
||||
"license": "MIT",
|
||||
"compatible": "2.3",
|
||||
"notes": ""
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
class pluginStaticPages extends Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Fields and default values for the database of this plugin
|
||||
$this->dbFields = array(
|
||||
'label'=>'Static Pages',
|
||||
'homeLink'=>true
|
||||
);
|
||||
}
|
||||
|
||||
// Method called on the settings of the plugin on the admin area
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$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>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$Language->get('Home link').'</label>';
|
||||
$html .= '<select name="homeLink">';
|
||||
$html .= '<option value="true" '.($this->getValue('homeLink')===true?'selected':'').'>'.$Language->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('homeLink')===false?'selected':'').'>'.$Language->get('Disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
// Method called on the sidebar of the website
|
||||
public function siteSidebar()
|
||||
{
|
||||
global $Language;
|
||||
global $Url;
|
||||
global $Site;
|
||||
global $dbPages;
|
||||
|
||||
// HTML for sidebar
|
||||
$html = '<div class="plugin plugin-static-pages">';
|
||||
|
||||
// Print the label if not empty
|
||||
$label = $this->getValue('label');
|
||||
if (!empty($label)) {
|
||||
$html .= '<h2 class="plugin-label">'.$label.'</h2>';
|
||||
}
|
||||
|
||||
$html .= '<div class="plugin-content">';
|
||||
$html .= '<ul>';
|
||||
|
||||
// Show Home page link
|
||||
if ($this->getValue('homeLink')) {
|
||||
$html .= '<li>';
|
||||
$html .= '<a href="' . $Site->url() . '">' . $Language->get('Home page') . '</a>';
|
||||
$html .= '</li>';
|
||||
}
|
||||
|
||||
// Show static pages
|
||||
if ($this->getValue('staticPages')) {
|
||||
$staticPages = buildStaticPages();
|
||||
foreach ($staticPages as $page) {
|
||||
$html .= '<li>';
|
||||
$html .= '<a href="' . $page->permalink() . '">' . $page->title() . '</a>';
|
||||
$html .= '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue