diff --git a/bl-plugins/navigation/languages/es.json b/bl-plugins/navigation/languages/es.json index 1b20f23c..7c248c52 100644 --- a/bl-plugins/navigation/languages/es.json +++ b/bl-plugins/navigation/languages/es.json @@ -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" } \ No newline at end of file diff --git a/bl-plugins/navigation/plugin.php b/bl-plugins/navigation/plugin.php index a493c083..05eb263a 100644 --- a/bl-plugins/navigation/plugin.php +++ b/bl-plugins/navigation/plugin.php @@ -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 .= ''; $html .= ''; - $html .= '
'; - $html .= ''; - $html .= ''; - $html .= '
'; - - $html .= '
'; - $html .= ''; - $html .= ''; - $html .= '
'; - if (ORDER_BY=='date') { $html .= '
'; $html .= ''; @@ -86,51 +68,41 @@ class pluginNavigation extends Plugin { $html .= ''; } - // Show static pages - if ($this->getValue('staticPages')) { - $staticPages = buildStaticPages(); - foreach ($staticPages as $page) { - $html .= '
  • '; - $html .= '' . $page->title() . ''; + // Pages order by position + if (ORDER_BY=='position') { + // Get parents + $parents = buildParentPages(); + foreach ($parents as $parent) { + $html .= '
  • '; + $html .= '' . $parent->title() . ''; + + if ($parent->hasChildren()) { + // Get children + $children = $parent->children(); + $html .= ''; + } $html .= '
  • '; } } + // Pages order by date + else { + // List of published pages + $onlyPublished = true; + $pageNumber = 1; + $amountOfItems = $this->getValue('amountOfItems'); + $publishedPages = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished); - // Show pages - if ($this->getValue('pages')) { - if (ORDER_BY=='position') { - // Get parents - $parents = buildParentPages(); - foreach ($parents as $parent) { - $html .= '
  • '; - $html .= '' . $parent->title() . ''; - - if ($parent->hasChildren()) { - // Get children - $children = $parent->children(); - $html .= ''; - } - $html .= '
  • '; - } - } else { - // List of published pages - $onlyPublished = true; - $pageNumber = 1; - $amountOfItems = $this->getValue('amountOfItems'); - $publishedPages = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished); - - foreach ($publishedPages as $pageKey) { - $page = buildPage($pageKey); - $html .= '
  • '; - $html .= '' . $page->title() . ''; - $html .= '
  • '; - } + foreach ($publishedPages as $pageKey) { + $page = buildPage($pageKey); + $html .= '
  • '; + $html .= '' . $page->title() . ''; + $html .= '
  • '; } } diff --git a/bl-plugins/static-pages/languages/en.json b/bl-plugins/static-pages/languages/en.json new file mode 100644 index 00000000..74e0663c --- /dev/null +++ b/bl-plugins/static-pages/languages/en.json @@ -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." +} \ No newline at end of file diff --git a/bl-plugins/static-pages/metadata.json b/bl-plugins/static-pages/metadata.json new file mode 100644 index 00000000..6cad204f --- /dev/null +++ b/bl-plugins/static-pages/metadata.json @@ -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": "" +} \ No newline at end of file diff --git a/bl-plugins/static-pages/plugin.php b/bl-plugins/static-pages/plugin.php new file mode 100644 index 00000000..709f04b8 --- /dev/null +++ b/bl-plugins/static-pages/plugin.php @@ -0,0 +1,79 @@ +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 = '
    '; + $html .= ''; + $html .= ''; + $html .= ''.$Language->get('This title is almost always used in the sidebar of the site').''; + $html .= '
    '; + + $html .= '
    '; + $html .= ''; + $html .= ''; + $html .= '
    '; + + 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 = '
    '; + + // Print the label if not empty + $label = $this->getValue('label'); + if (!empty($label)) { + $html .= '

    '.$label.'

    '; + } + + $html .= '
    '; + $html .= '
      '; + + // Show Home page link + if ($this->getValue('homeLink')) { + $html .= '
    • '; + $html .= '' . $Language->get('Home page') . ''; + $html .= '
    • '; + } + + // Show static pages + if ($this->getValue('staticPages')) { + $staticPages = buildStaticPages(); + foreach ($staticPages as $page) { + $html .= '
    • '; + $html .= '' . $page->title() . ''; + $html .= '
    • '; + } + } + + $html .= '
    '; + $html .= '
    '; + $html .= '
    '; + + return $html; + } +} \ No newline at end of file