From ca9d1d81b9067864d241678fdd5a500fdc8f850c Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sun, 18 Jun 2017 22:44:07 +0200 Subject: [PATCH] Improves on plugins, post method, improves on database for plugins, css styling --- bl-kernel/abstract/plugin.class.php | 48 ++++--- .../admin/controllers/configure-plugin.php | 3 +- .../admin/controllers/install-plugin.php | 25 ++-- .../admin/themes/default/css/default.css | 58 ++++---- bl-kernel/admin/views/settings-advanced.php | 36 +++++ bl-kernel/boot/rules/60.plugins.php | 2 +- bl-kernel/dbpages.class.php | 18 ++- bl-kernel/dbsite.class.php | 20 ++- bl-kernel/functions.php | 6 +- bl-plugins/about/plugin.php | 1 + bl-plugins/categories/plugin.php | 12 +- bl-plugins/google/plugin.php | 6 +- bl-plugins/links/plugin.php | 29 ++++ bl-plugins/menu/plugin.php | 1 + bl-plugins/pages/plugin.php | 16 ++- bl-plugins/specialpages/languages/bg_BG.json | 11 ++ bl-plugins/specialpages/languages/de_CH.json | 10 ++ bl-plugins/specialpages/languages/de_DE.json | 10 ++ bl-plugins/specialpages/languages/en_US.json | 7 + bl-plugins/specialpages/languages/es_AR.json | 10 ++ bl-plugins/specialpages/languages/fr_FR.json | 10 ++ bl-plugins/specialpages/languages/ja_JP.json | 10 ++ bl-plugins/specialpages/languages/nl_NL.json | 10 ++ bl-plugins/specialpages/languages/pl_PL.json | 10 ++ bl-plugins/specialpages/languages/ru_RU.json | 11 ++ bl-plugins/specialpages/languages/tr_TR.json | 10 ++ bl-plugins/specialpages/languages/uk_UA.json | 11 ++ bl-plugins/specialpages/languages/zh_TW.json | 10 ++ bl-plugins/specialpages/metadata.json | 10 ++ bl-plugins/specialpages/plugin.php | 135 ++++++++++++++++++ bl-plugins/tags/plugin.php | 1 + 31 files changed, 472 insertions(+), 85 deletions(-) create mode 100644 bl-plugins/specialpages/languages/bg_BG.json create mode 100644 bl-plugins/specialpages/languages/de_CH.json create mode 100644 bl-plugins/specialpages/languages/de_DE.json create mode 100644 bl-plugins/specialpages/languages/en_US.json create mode 100644 bl-plugins/specialpages/languages/es_AR.json create mode 100644 bl-plugins/specialpages/languages/fr_FR.json create mode 100644 bl-plugins/specialpages/languages/ja_JP.json create mode 100644 bl-plugins/specialpages/languages/nl_NL.json create mode 100644 bl-plugins/specialpages/languages/pl_PL.json create mode 100644 bl-plugins/specialpages/languages/ru_RU.json create mode 100644 bl-plugins/specialpages/languages/tr_TR.json create mode 100644 bl-plugins/specialpages/languages/uk_UA.json create mode 100644 bl-plugins/specialpages/languages/zh_TW.json create mode 100644 bl-plugins/specialpages/metadata.json create mode 100644 bl-plugins/specialpages/plugin.php diff --git a/bl-kernel/abstract/plugin.class.php b/bl-kernel/abstract/plugin.class.php index aeaa8de4..e1e13e2b 100644 --- a/bl-kernel/abstract/plugin.class.php +++ b/bl-kernel/abstract/plugin.class.php @@ -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); } } \ No newline at end of file diff --git a/bl-kernel/admin/controllers/configure-plugin.php b/bl-kernel/admin/controllers/configure-plugin.php index 822be86b..29b30d40 100644 --- a/bl-kernel/admin/controllers/configure-plugin.php +++ b/bl-kernel/admin/controllers/configure-plugin.php @@ -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( diff --git a/bl-kernel/admin/controllers/install-plugin.php b/bl-kernel/admin/controllers/install-plugin.php index 6f7166be..3d002046 100644 --- a/bl-kernel/admin/controllers/install-plugin.php +++ b/bl-kernel/admin/controllers/install-plugin.php @@ -26,19 +26,20 @@ if($Login->role()!=='admin') { // ============================================================================ $pluginClassName = $layout['parameters']; -foreach($plugins['all'] as $plugin) { - if($plugin->className()==$pluginClassName) { - // Install plugin - if( $plugin->install() ) { - // Add to syslog - $Syslog->add(array( - 'dictionaryKey'=>'plugin-installed', - 'notes'=>$plugin->name() - )); +// Check if the plugin exists +if( isset($plugins['all'][$pluginClassName]) ) { + $plugin = $plugins['all'][$pluginClassName]; - // Create an alert - Alert::set($Language->g('Plugin installed')); - } + // Install plugin + if( $plugin->install() ) { + // Add to syslog + $Syslog->add(array( + 'dictionaryKey'=>'plugin-installed', + 'notes'=>$plugin->name() + )); + + // Create an alert + Alert::set($Language->g('Plugin installed')); } } diff --git a/bl-kernel/admin/themes/default/css/default.css b/bl-kernel/admin/themes/default/css/default.css index 6fc949eb..10d53efc 100644 --- a/bl-kernel/admin/themes/default/css/default.css +++ b/bl-kernel/admin/themes/default/css/default.css @@ -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; } \ No newline at end of file diff --git a/bl-kernel/admin/views/settings-advanced.php b/bl-kernel/admin/views/settings-advanced.php index 2d7f9670..ecc86ddd 100644 --- a/bl-kernel/admin/views/settings-advanced.php +++ b/bl-kernel/admin/views/settings-advanced.php @@ -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( diff --git a/bl-kernel/boot/rules/60.plugins.php b/bl-kernel/boot/rules/60.plugins.php index 8520ac87..e1b1d3eb 100644 --- a/bl-kernel/boot/rules/60.plugins.php +++ b/bl-kernel/boot/rules/60.plugins.php @@ -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. diff --git a/bl-kernel/dbpages.class.php b/bl-kernel/dbpages.class.php index 2eecc2b2..a014025b 100644 --- a/bl-kernel/dbpages.class.php +++ b/bl-kernel/dbpages.class.php @@ -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 ) { diff --git a/bl-kernel/dbsite.class.php b/bl-kernel/dbsite.class.php index 83395946..4751502a 100644 --- a/bl-kernel/dbsite.class.php +++ b/bl-kernel/dbsite.class.php @@ -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() { diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php index fa37bf65..dd0e9094 100644 --- a/bl-kernel/functions.php +++ b/bl-kernel/functions.php @@ -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(); diff --git a/bl-plugins/about/plugin.php b/bl-plugins/about/plugin.php index 96af23d0..dce9effa 100644 --- a/bl-plugins/about/plugin.php +++ b/bl-plugins/about/plugin.php @@ -17,6 +17,7 @@ class pluginAbout extends Plugin { $html = '
'; $html .= ''; $html .= ''; + $html .= ''.$Language->get('Title of the plugin for the sidebar').''; $html .= '
'; $html .= '
'; diff --git a/bl-plugins/categories/plugin.php b/bl-plugins/categories/plugin.php index 9dc9e059..ed5dc631 100644 --- a/bl-plugins/categories/plugin.php +++ b/bl-plugins/categories/plugin.php @@ -18,13 +18,17 @@ class pluginCategories extends Plugin { $html = '
'; $html .= ''; - $html .= ''; + $html .= ''; + $html .= ''.$Language->get('Title of the plugin for the sidebar').''; $html .= '
'; $html .= '
'; - $html .= ''; - $html .= 'getValue('showCero')?'checked':'').'>'; - $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''.$Language->get('Show the categories without content').''; $html .= '
'; return $html; diff --git a/bl-plugins/google/plugin.php b/bl-plugins/google/plugin.php index 9dc4f3ca..a955e3da 100644 --- a/bl-plugins/google/plugin.php +++ b/bl-plugins/google/plugin.php @@ -18,19 +18,19 @@ class pluginGoogle extends Plugin { $html = '
'; $html .= ''; $html .= ''; - $html .= '
'.$Language->get('complete-this-field-with-the-google-site-verification').'
'; + $html .= ''.$Language->get('complete-this-field-with-the-google-site-verification').''; $html .= '
'; $html .= '
'; $html .= ''; $html .= ''; - $html .= '
'.$Language->get('complete-this-field-with-the-tracking-id').'
'; + $html .= ''.$Language->get('complete-this-field-with-the-tracking-id').''; $html .= '
'; $html .= '
'; $html .= ''; $html .= ''; - $html .= '
'.$Language->get('complete-this-field-with-the-tracking-id-google-tag').'
'; + $html .= ''.$Language->get('complete-this-field-with-the-tracking-id-google-tag').''; $html .= '
'; return $html; diff --git a/bl-plugins/links/plugin.php b/bl-plugins/links/plugin.php index 070ad12d..75a19980 100644 --- a/bl-plugins/links/plugin.php +++ b/bl-plugins/links/plugin.php @@ -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 .= ''; $html .= '
'; + // 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 .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + } + + $html .= '
'; + $html .= 'Nombre '; + $html .= '
URL '; + $html .= '
'; + return $html; } diff --git a/bl-plugins/menu/plugin.php b/bl-plugins/menu/plugin.php index c856551c..e824ee8b 100644 --- a/bl-plugins/menu/plugin.php +++ b/bl-plugins/menu/plugin.php @@ -18,6 +18,7 @@ class pluginMenu extends Plugin { $html = '
'; $html .= ''; $html .= ''; + $html .= ''.$Language->get('Title of the plugin for the sidebar').''; $html .= '
'; return $html; diff --git a/bl-plugins/pages/plugin.php b/bl-plugins/pages/plugin.php index 2b6285b1..d2d823b9 100644 --- a/bl-plugins/pages/plugin.php +++ b/bl-plugins/pages/plugin.php @@ -20,6 +20,16 @@ class pluginPages extends Plugin { $html = '
'; $html .= ''; $html .= ''; + $html .= ''.$Language->get('Title of the plugin for the sidebar').''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= ''.$Language->get('Show the home link on the sidebar').''; $html .= '
'; $html .= '
'; @@ -27,12 +37,6 @@ class pluginPages extends Plugin { $html .= ''; $html .= '
'; - $html .= '
'; - $html .= ''; - $html .= 'getValue('homeLink')?'checked':'').'>'; - $html .= ''; - $html .= '
'; - return $html; } diff --git a/bl-plugins/specialpages/languages/bg_BG.json b/bl-plugins/specialpages/languages/bg_BG.json new file mode 100644 index 00000000..5893d2da --- /dev/null +++ b/bl-plugins/specialpages/languages/bg_BG.json @@ -0,0 +1,11 @@ +{ + "plugin-data": + { + "name": "Страници", + "description": "Показва списък на страниците." + }, + + "home": "Начало", + "show-home-link": "Покажи връзка към начало", + "show-children": "Покажи подменю" +} diff --git a/bl-plugins/specialpages/languages/de_CH.json b/bl-plugins/specialpages/languages/de_CH.json new file mode 100644 index 00000000..063b55c5 --- /dev/null +++ b/bl-plugins/specialpages/languages/de_CH.json @@ -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" +} diff --git a/bl-plugins/specialpages/languages/de_DE.json b/bl-plugins/specialpages/languages/de_DE.json new file mode 100644 index 00000000..063b55c5 --- /dev/null +++ b/bl-plugins/specialpages/languages/de_DE.json @@ -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" +} diff --git a/bl-plugins/specialpages/languages/en_US.json b/bl-plugins/specialpages/languages/en_US.json new file mode 100644 index 00000000..16b9e567 --- /dev/null +++ b/bl-plugins/specialpages/languages/en_US.json @@ -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." + } +} diff --git a/bl-plugins/specialpages/languages/es_AR.json b/bl-plugins/specialpages/languages/es_AR.json new file mode 100644 index 00000000..6ee99a19 --- /dev/null +++ b/bl-plugins/specialpages/languages/es_AR.json @@ -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" +} \ No newline at end of file diff --git a/bl-plugins/specialpages/languages/fr_FR.json b/bl-plugins/specialpages/languages/fr_FR.json new file mode 100644 index 00000000..3efb4769 --- /dev/null +++ b/bl-plugins/specialpages/languages/fr_FR.json @@ -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" +} \ No newline at end of file diff --git a/bl-plugins/specialpages/languages/ja_JP.json b/bl-plugins/specialpages/languages/ja_JP.json new file mode 100644 index 00000000..613663ed --- /dev/null +++ b/bl-plugins/specialpages/languages/ja_JP.json @@ -0,0 +1,10 @@ +{ + "plugin-data": + { + "name": "Page list", + "description": "ページをリストにして表示します。" + }, + + "home": "ホーム", + "show-home-link": "ホーム・リンクを表示" +} \ No newline at end of file diff --git a/bl-plugins/specialpages/languages/nl_NL.json b/bl-plugins/specialpages/languages/nl_NL.json new file mode 100644 index 00000000..0183d5c7 --- /dev/null +++ b/bl-plugins/specialpages/languages/nl_NL.json @@ -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" +} diff --git a/bl-plugins/specialpages/languages/pl_PL.json b/bl-plugins/specialpages/languages/pl_PL.json new file mode 100644 index 00000000..74a469af --- /dev/null +++ b/bl-plugins/specialpages/languages/pl_PL.json @@ -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" +} \ No newline at end of file diff --git a/bl-plugins/specialpages/languages/ru_RU.json b/bl-plugins/specialpages/languages/ru_RU.json new file mode 100644 index 00000000..ab5a8045 --- /dev/null +++ b/bl-plugins/specialpages/languages/ru_RU.json @@ -0,0 +1,11 @@ +{ + "plugin-data": + { + "name": "Список страниц", + "description": "Показывает упорядоченый список страниц." + }, + + "home": "Главная", + "show-home-link": "Показывать ссылку на главную", + "show-children": "Показывать подменю" +} diff --git a/bl-plugins/specialpages/languages/tr_TR.json b/bl-plugins/specialpages/languages/tr_TR.json new file mode 100644 index 00000000..8a746a7d --- /dev/null +++ b/bl-plugins/specialpages/languages/tr_TR.json @@ -0,0 +1,10 @@ +{ + "plugin-data": + { + "name": "Sayfa listesi", + "description": "Sayfaları listeler." + }, + + "home": "Anasayfa", + "show-home-link": "Anasayfa linkini göster" +} diff --git a/bl-plugins/specialpages/languages/uk_UA.json b/bl-plugins/specialpages/languages/uk_UA.json new file mode 100644 index 00000000..7fc77940 --- /dev/null +++ b/bl-plugins/specialpages/languages/uk_UA.json @@ -0,0 +1,11 @@ +{ + "plugin-data": + { + "name": "Список сторінок", + "description": "Показує список сторінок по порядку." + }, + + "home": "Головна", + "show-home-link": "Показувати лінк на головну сторінку", + "show-children": "Показувати вкладені лінки" +} diff --git a/bl-plugins/specialpages/languages/zh_TW.json b/bl-plugins/specialpages/languages/zh_TW.json new file mode 100644 index 00000000..e5a6ccb2 --- /dev/null +++ b/bl-plugins/specialpages/languages/zh_TW.json @@ -0,0 +1,10 @@ +{ + "plugin-data": + { + "name": "頁面列表", + "description": "顯示所有頁面的列表" + }, + + "home": "首頁", + "show-home-link": "顯示首頁連結" +} \ No newline at end of file diff --git a/bl-plugins/specialpages/metadata.json b/bl-plugins/specialpages/metadata.json new file mode 100644 index 00000000..a5c64fc0 --- /dev/null +++ b/bl-plugins/specialpages/metadata.json @@ -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": "" +} \ No newline at end of file diff --git a/bl-plugins/specialpages/plugin.php b/bl-plugins/specialpages/plugin.php new file mode 100644 index 00000000..e398664a --- /dev/null +++ b/bl-plugins/specialpages/plugin.php @@ -0,0 +1,135 @@ +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 = '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= 'getValue('homeLink')?'checked':'').'>'; + $html .= ''; + $html .= '
'; + + $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 .= 'About page'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= 'getValue('homeLink')?'checked':'').'>'; + $html .= ''; + $html .= '
'; + + $html .= 'Contact page'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + return $html; + } + + // Method called on the sidebar of the website + public function siteSidebar() + { + global $Language; + + // HTML for sidebar + $html = '
'; + $html .= '

'.$this->getValue('label').'

'; + $html .= '
'; + $html .= ''; + $html .= '
'; + $html .= '
'; + + return $html; + } +} \ No newline at end of file diff --git a/bl-plugins/tags/plugin.php b/bl-plugins/tags/plugin.php index ef4ced08..03c4e5cc 100644 --- a/bl-plugins/tags/plugin.php +++ b/bl-plugins/tags/plugin.php @@ -16,6 +16,7 @@ class pluginTags extends Plugin { $html = '
'; $html .= ''; $html .= ''; + $html .= ''.$Language->get('Title of the plugin for the sidebar').''; $html .= '
'; return $html;