From 9f35bfbd69455bacfbfe9f04a21fd2d590d7a25f Mon Sep 17 00:00:00 2001 From: torkel104 Date: Sun, 6 Nov 2016 20:31:01 +0100 Subject: [PATCH 1/7] Fix for class 'is-loading' The class 'is-loading' was not properly removed from the body tag, disabling animations on the page. --- bl-themes/log/assets/js/main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bl-themes/log/assets/js/main.js b/bl-themes/log/assets/js/main.js index 1cde899f..9169087f 100644 --- a/bl-themes/log/assets/js/main.js +++ b/bl-themes/log/assets/js/main.js @@ -4,6 +4,12 @@ Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) */ +$( window ).on( 'load', function() { + setTimeout( function() { + $('body').removeClass('is-loading'); + }) +}); + (function($) { skel.breakpoints({ @@ -25,12 +31,6 @@ // Disable animations/transitions until the page has loaded. $body.addClass('is-loading'); - $window.on('load', function() { - window.setTimeout(function() { - $body.removeClass('is-loading'); - }, 100); - }); - // Fix: Placeholder polyfill. $('form').placeholder(); From af47e845b5b5199b1e68328809765b5c1e0d8b8a Mon Sep 17 00:00:00 2001 From: torkel104 Date: Mon, 7 Nov 2016 20:07:42 +0100 Subject: [PATCH 2/7] Compartmentalize plugin localisation --- bl-kernel/abstract/plugin.class.php | 24 ++++++++++++++++++--- bl-kernel/boot/rules/60.plugins.php | 33 +++++++++++++++-------------- 2 files changed, 38 insertions(+), 19 deletions(-) mode change 100644 => 100755 bl-kernel/abstract/plugin.class.php mode change 100644 => 100755 bl-kernel/boot/rules/60.plugins.php diff --git a/bl-kernel/abstract/plugin.class.php b/bl-kernel/abstract/plugin.class.php old mode 100644 new mode 100755 index 13acf26c..ef1908a8 --- a/bl-kernel/abstract/plugin.class.php +++ b/bl-kernel/abstract/plugin.class.php @@ -21,8 +21,11 @@ class Plugin { // (array) Plugin's information. public $metadata; + + // (array) Plugin's localisation. + public $language; - function __construct() + function __construct($locale) { $this->dbFields = array(); @@ -40,6 +43,17 @@ class Plugin { // Init empty database $this->db = $this->dbFields; + // Load localisation + $tmp = new dbLanguage($locale, PATH_PLUGINS.$this->directoryName.DS.'languages'.DS); + + // Set name and description from the language file. + $this->setMetadata('name',$tmp->db['plugin-data']['name']); + $this->setMetadata('description',$tmp->db['plugin-data']['description']); + + // Remove name and description + unset($tmp->db['plugin-data']); + $this->language = $tmp; + $this->filenameDb = PATH_PLUGINS_DATABASES.$this->directoryName.DS.'db.php'; // --- Metadata --- @@ -218,8 +232,12 @@ class Plugin { public function init() { - // This method is used on childre classes. - // The user can define your own dbFields. + // This method is used on child classes. + // The user can define their own dbFields. } + public function L($key) + { + return $this->language->get($key); + } } \ No newline at end of file diff --git a/bl-kernel/boot/rules/60.plugins.php b/bl-kernel/boot/rules/60.plugins.php old mode 100644 new mode 100755 index e54d7699..fc0482ea --- a/bl-kernel/boot/rules/60.plugins.php +++ b/bl-kernel/boot/rules/60.plugins.php @@ -75,26 +75,27 @@ function buildPlugins() foreach($pluginsDeclaredClasess as $pluginClass) { - $Plugin = new $pluginClass; + $Plugin = new $pluginClass($Site->locale()); - // Check if the plugin is translated. - $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.$Site->locale().'.json'; - if( !Sanitize::pathFile($languageFilename) ) { - $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.'en_US.json'; - } + // Deprecated + // // Check if the plugin is translated. + // $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.$Site->locale().'.json'; + // if( !Sanitize::pathFile($languageFilename) ) { + // $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.'en_US.json'; + // } - $database = file_get_contents($languageFilename); - $database = json_decode($database, true); + // $database = file_get_contents($languageFilename); + // $database = json_decode($database, true); - // Set name and description from the language file. - $Plugin->setMetadata('name',$database['plugin-data']['name']); - $Plugin->setMetadata('description',$database['plugin-data']['description']); + // // Set name and description from the language file. + // $Plugin->setMetadata('name',$database['plugin-data']['name']); + // $Plugin->setMetadata('description',$database['plugin-data']['description']); - // Remove name and description, and add new words if there are. - unset($database['plugin-data']); - if(!empty($database)) { - $Language->add($database); - } + // // Remove name and description, and add new words if there are. + // unset($database['plugin-data']); + // if(!empty($database)) { + // $Language->add($database); + // } // Push Plugin to array all plugins installed and not installed. $plugins['all'][$pluginClass] = $Plugin; From c65193aa42426a4a2601ca4d2fdf4f39906aab7c Mon Sep 17 00:00:00 2001 From: torkel104 Date: Mon, 7 Nov 2016 20:10:37 +0100 Subject: [PATCH 3/7] correction --- bl-kernel/abstract/plugin.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bl-kernel/abstract/plugin.class.php b/bl-kernel/abstract/plugin.class.php index ef1908a8..3b42cf7d 100755 --- a/bl-kernel/abstract/plugin.class.php +++ b/bl-kernel/abstract/plugin.class.php @@ -22,7 +22,7 @@ class Plugin { // (array) Plugin's information. public $metadata; - // (array) Plugin's localisation. + // (dbLanguage) Plugin's localisation. public $language; function __construct($locale) From fddf1210323b441e83daabd48928d6a75d613cc5 Mon Sep 17 00:00:00 2001 From: torkel104 Date: Mon, 7 Nov 2016 20:58:26 +0100 Subject: [PATCH 4/7] Fixes for new l10n --- bl-kernel/abstract/plugin.class.php | 21 +++++++++++---------- bl-kernel/boot/rules/60.plugins.php | 2 +- bl-kernel/dblanguage.class.php | 17 +++++++++++------ 3 files changed, 23 insertions(+), 17 deletions(-) mode change 100644 => 100755 bl-kernel/dblanguage.class.php diff --git a/bl-kernel/abstract/plugin.class.php b/bl-kernel/abstract/plugin.class.php index 3b42cf7d..eacaeaf7 100755 --- a/bl-kernel/abstract/plugin.class.php +++ b/bl-kernel/abstract/plugin.class.php @@ -25,8 +25,10 @@ class Plugin { // (dbLanguage) Plugin's localisation. public $language; - function __construct($locale) + function __construct() { + global $Site; + $this->dbFields = array(); $reflector = new ReflectionClass(get_class($this)); @@ -43,9 +45,15 @@ class Plugin { // Init empty database $this->db = $this->dbFields; - // Load localisation - $tmp = new dbLanguage($locale, PATH_PLUGINS.$this->directoryName.DS.'languages'.DS); + $this->filenameDb = PATH_PLUGINS_DATABASES.$this->directoryName.DS.'db.php'; + // --- Metadata --- + $this->filenameMetadata = PATH_PLUGINS.$this->directoryName().DS.'metadata.json'; + $metadataString = file_get_contents($this->filenameMetadata); + $this->metadata = json_decode($metadataString, true); + + // Load localisation + $tmp = new dbLanguage($Site->locale(), PATH_PLUGINS.$this->directoryName.DS.'languages'.DS); // Set name and description from the language file. $this->setMetadata('name',$tmp->db['plugin-data']['name']); $this->setMetadata('description',$tmp->db['plugin-data']['description']); @@ -54,13 +62,6 @@ class Plugin { unset($tmp->db['plugin-data']); $this->language = $tmp; - $this->filenameDb = PATH_PLUGINS_DATABASES.$this->directoryName.DS.'db.php'; - - // --- Metadata --- - $this->filenameMetadata = PATH_PLUGINS.$this->directoryName().DS.'metadata.json'; - $metadataString = file_get_contents($this->filenameMetadata); - $this->metadata = json_decode($metadataString, true); - // If the plugin is installed then get the database. if($this->installed()) { diff --git a/bl-kernel/boot/rules/60.plugins.php b/bl-kernel/boot/rules/60.plugins.php index fc0482ea..77611470 100755 --- a/bl-kernel/boot/rules/60.plugins.php +++ b/bl-kernel/boot/rules/60.plugins.php @@ -75,7 +75,7 @@ function buildPlugins() foreach($pluginsDeclaredClasess as $pluginClass) { - $Plugin = new $pluginClass($Site->locale()); + $Plugin = new $pluginClass(); // Deprecated // // Check if the plugin is translated. diff --git a/bl-kernel/dblanguage.class.php b/bl-kernel/dblanguage.class.php old mode 100644 new mode 100755 index 2801391b..2e80a44e --- a/bl-kernel/dblanguage.class.php +++ b/bl-kernel/dblanguage.class.php @@ -6,22 +6,24 @@ class dbLanguage extends dbJSON public $db; public $currentLocale; - function __construct($locale) + function __construct( $locale, $path = null ) { + $path = $path ? $path : PATH_LANGUAGES; + $this->data = array(); $this->db = array(); $this->currentLocale = 'en_US'; // Default language en_US - $filename = PATH_LANGUAGES.'en_US.json'; + $filename = $path.'en_US.json'; if( Sanitize::pathFile($filename) ) { $Tmp = new dbJSON($filename, false); - $this->db = array_merge($this->db, $Tmp->db); + $this->db = $Tmp->db; } // User language - $filename = PATH_LANGUAGES.$locale.'.json'; + $filename = $path.$locale.'.json'; if( Sanitize::pathFile($filename) && ($locale!=="en_US") ) { $this->currentLocale = $locale; @@ -29,8 +31,11 @@ class dbLanguage extends dbJSON $this->db = array_merge($this->db, $Tmp->db); } - $this->data = $this->db['language-data']; - unset($this->db['language-data']); + if ( $this->data ) + { + $this->data = $this->db['language-data']; + unset($this->db['language-data']); + } } public function getCurrentLocale() From ff8fe8dc02aa4272ac52419cdc89c2e154a6773e Mon Sep 17 00:00:00 2001 From: torkel104 Date: Mon, 7 Nov 2016 20:58:47 +0100 Subject: [PATCH 5/7] Update plugins to use the new l10n function --- bl-plugins/about/plugin.php | 6 ++---- bl-plugins/disqus/plugin.php | 10 ++++------ bl-plugins/googletools/plugin.php | 10 ++++------ bl-plugins/latest_posts/plugin.php | 6 ++---- bl-plugins/maintenancemode/plugin.php | 6 ++---- bl-plugins/pages/plugin.php | 9 +++------ bl-plugins/simplemde/plugin.php | 12 ++++-------- bl-plugins/tags/plugin.php | 11 ++++------- 8 files changed, 25 insertions(+), 45 deletions(-) mode change 100644 => 100755 bl-plugins/about/plugin.php mode change 100644 => 100755 bl-plugins/disqus/plugin.php mode change 100644 => 100755 bl-plugins/googletools/plugin.php mode change 100644 => 100755 bl-plugins/latest_posts/plugin.php mode change 100644 => 100755 bl-plugins/maintenancemode/plugin.php mode change 100644 => 100755 bl-plugins/pages/plugin.php mode change 100644 => 100755 bl-plugins/simplemde/plugin.php mode change 100644 => 100755 bl-plugins/tags/plugin.php diff --git a/bl-plugins/about/plugin.php b/bl-plugins/about/plugin.php old mode 100644 new mode 100755 index bb3eccb1..3ef91ad4 --- a/bl-plugins/about/plugin.php +++ b/bl-plugins/about/plugin.php @@ -12,14 +12,12 @@ class pluginAbout extends Plugin { public function form() { - global $Language; - $html = '
'; - $html .= ''; + $html .= ''; $html .= ''; $html .= '
'; $html .= '
'; - $html .= ''; + $html .= ''; $html .= ''; $html .= '
'; diff --git a/bl-plugins/disqus/plugin.php b/bl-plugins/disqus/plugin.php old mode 100644 new mode 100755 index d5861887..fe754b96 --- a/bl-plugins/disqus/plugin.php +++ b/bl-plugins/disqus/plugin.php @@ -36,29 +36,27 @@ class pluginDisqus extends Plugin { public function form() { - global $Language; - $html = '
'; - $html .= ''; + $html .= ''; $html .= ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= 'getDbField('enablePages')?'checked':'').'>'; - $html .= ''; + $html .= ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= 'getDbField('enablePosts')?'checked':'').'>'; - $html .= ''; + $html .= ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= 'getDbField('enableDefaultHomePage')?'checked':'').'>'; - $html .= ''; + $html .= ''; $html .= '
'; return $html; diff --git a/bl-plugins/googletools/plugin.php b/bl-plugins/googletools/plugin.php old mode 100644 new mode 100755 index 34c93996..0f4a5326 --- a/bl-plugins/googletools/plugin.php +++ b/bl-plugins/googletools/plugin.php @@ -12,18 +12,16 @@ class pluginGoogleTools extends Plugin { public function form() { - global $Language; - $html = '
'; - $html .= ''; + $html .= ''; $html .= ''; - $html .= '
'.$Language->get('complete-this-field-with-the-google-site-verification').'
'; + $html .= '
'.$this->L('complete-this-field-with-the-google-site-verification').'
'; $html .= '
'; $html .= '
'; - $html .= ''; + $html .= ''; $html .= ''; - $html .= '
'.$Language->get('complete-this-field-with-the-tracking-id').'
'; + $html .= '
'.$this->L('complete-this-field-with-the-tracking-id').'
'; $html .= '
'; return $html; diff --git a/bl-plugins/latest_posts/plugin.php b/bl-plugins/latest_posts/plugin.php old mode 100644 new mode 100755 index d8dc1af5..190a1a4a --- a/bl-plugins/latest_posts/plugin.php +++ b/bl-plugins/latest_posts/plugin.php @@ -12,15 +12,13 @@ class pluginLatestPosts extends Plugin { public function form() { - global $Language; - $html = '
'; - $html .= ''; + $html .= ''; $html .= ''; $html .= '
'; $html .= '
'; - $html .= ''; + $html .= ''; $html .= ''; $html .= '
'; diff --git a/bl-plugins/maintenancemode/plugin.php b/bl-plugins/maintenancemode/plugin.php old mode 100644 new mode 100755 index 5a36614e..b01e8603 --- a/bl-plugins/maintenancemode/plugin.php +++ b/bl-plugins/maintenancemode/plugin.php @@ -12,16 +12,14 @@ class pluginMaintenanceMode extends Plugin { public function form() { - global $Language; - $html = '
'; $html .= ''; $html .= 'getDbField('enable')?'checked':'').'>'; - $html .= ''; + $html .= ''; $html .= '
'; $html .= '
'; - $html .= ''; + $html .= ''; $html .= ''; $html .= '
'; diff --git a/bl-plugins/pages/plugin.php b/bl-plugins/pages/plugin.php old mode 100644 new mode 100755 index 16b84896..74a61c2c --- a/bl-plugins/pages/plugin.php +++ b/bl-plugins/pages/plugin.php @@ -12,17 +12,15 @@ class pluginPages extends Plugin { public function form() { - global $Language; - $html = '
'; - $html .= ''; + $html .= ''; $html .= ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= 'getDbField('homeLink')?'checked':'').'>'; - $html .= ''; + $html .= ''; $html .= '
'; return $html; @@ -30,7 +28,6 @@ class pluginPages extends Plugin { public function siteSidebar() { - global $Language; global $pagesParents; global $Site, $Url; @@ -48,7 +45,7 @@ class pluginPages extends Plugin { // Show home link ? if($this->getDbField('homeLink')) { $html .= '
  • '; - $html .= ''.$Language->get('Home').''; + $html .= ''.$this->L('Home').''; $html .= '
  • '; } diff --git a/bl-plugins/simplemde/plugin.php b/bl-plugins/simplemde/plugin.php old mode 100644 new mode 100755 index 5b976cfc..629ed84e --- a/bl-plugins/simplemde/plugin.php +++ b/bl-plugins/simplemde/plugin.php @@ -20,22 +20,20 @@ class pluginsimpleMDE extends Plugin { public function form() { - global $Language; - $html = '
    '; - $html .= ''; + $html .= ''; $html .= ''; $html .= '
    '; $html .= '
    '; - $html .= ''; + $html .= ''; $html .= ''; $html .= '
    '; $html .= '
    '; $html .= ''; $html .= 'getDbField('autosave')?'checked':'').'>'; - $html .= ''; + $html .= ''; $html .= '
    '; return $html; @@ -78,8 +76,6 @@ class pluginsimpleMDE extends Plugin { public function adminBodyEnd() { global $layout; - global $Language; - $html = ''; // Load CSS and JS only on Controllers in array. @@ -109,7 +105,7 @@ class pluginsimpleMDE extends Plugin { // This function is necesary on each Editor, it is used by Bludit Images v8. $html .= 'function editorAddImage(filename) { - addContentSimpleMDE("!['.$Language->get('Image description').']("+filename+")"); + addContentSimpleMDE("!['.$this->L('Image description').']("+filename+")"); }'.PHP_EOL; $html .= '$(document).ready(function() { '.PHP_EOL; diff --git a/bl-plugins/tags/plugin.php b/bl-plugins/tags/plugin.php old mode 100644 new mode 100755 index 978fbd64..3f7f4664 --- a/bl-plugins/tags/plugin.php +++ b/bl-plugins/tags/plugin.php @@ -12,23 +12,21 @@ class pluginTags extends Plugin { public function form() { - global $Language; - $html = '
    '; - $html .= ''; + $html .= ''; $html .= ''; $html .= '
    '; $html .= '
    '; - $html .= $Language->get('Sort the tag list by').': '; foreach(array('alpha' => 'Alphabetical order', 'count' => 'Number of times each tag has been used', 'date' => 'Date each tag was first used') as $key=>$value) { if ($key == $this->getDbField('sort')) { - $html .= ''; + $html .= ''; } else { - $html .= ''; + $html .= ''; } } $html .= ''; @@ -39,7 +37,6 @@ class pluginTags extends Plugin { public function siteSidebar() { - global $Language; global $dbTags; global $Url; From d105fdf6d8191d43e6978291b77c28e9e68102e7 Mon Sep 17 00:00:00 2001 From: torkel104 Date: Wed, 9 Nov 2016 16:43:16 +0100 Subject: [PATCH 6/7] Only load plugins derived from 'Plugin' class --- bl-kernel/boot/rules/60.plugins.php | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/bl-kernel/boot/rules/60.plugins.php b/bl-kernel/boot/rules/60.plugins.php index 77611470..1311fcc9 100755 --- a/bl-kernel/boot/rules/60.plugins.php +++ b/bl-kernel/boot/rules/60.plugins.php @@ -75,27 +75,13 @@ function buildPlugins() foreach($pluginsDeclaredClasess as $pluginClass) { - $Plugin = new $pluginClass(); - - // Deprecated - // // Check if the plugin is translated. - // $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.$Site->locale().'.json'; - // if( !Sanitize::pathFile($languageFilename) ) { - // $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.'en_US.json'; - // } - - // $database = file_get_contents($languageFilename); - // $database = json_decode($database, true); - - // // Set name and description from the language file. - // $Plugin->setMetadata('name',$database['plugin-data']['name']); - // $Plugin->setMetadata('description',$database['plugin-data']['description']); - - // // Remove name and description, and add new words if there are. - // unset($database['plugin-data']); - // if(!empty($database)) { - // $Language->add($database); - // } + // Ignore non-plugin classes + if ( !is_subclass_of( $pluginClass, 'Plugin' ) ) + { + continue; + } + + $Plugin = new $pluginClass(); // Push Plugin to array all plugins installed and not installed. $plugins['all'][$pluginClass] = $Plugin; From 3737623dd75e0890cba58bd954ad3ad5f5b6ca6e Mon Sep 17 00:00:00 2001 From: torkel104 Date: Wed, 9 Nov 2016 17:40:14 +0100 Subject: [PATCH 7/7] close unclosed
    in admin theme --- bl-kernel/admin/themes/default/index.php | 242 ++++++++++++----------- 1 file changed, 122 insertions(+), 120 deletions(-) mode change 100644 => 100755 bl-kernel/admin/themes/default/index.php diff --git a/bl-kernel/admin/themes/default/index.php b/bl-kernel/admin/themes/default/index.php old mode 100644 new mode 100755 index 5c78acac..ef631a7c --- a/bl-kernel/admin/themes/default/index.php +++ b/bl-kernel/admin/themes/default/index.php @@ -30,134 +30,136 @@ - - + + - - - -
    - -
    - - - - - -
    - -
    - -
    - -
    - -
    - - - -
    - -
    + + + +
    + +
    + + + + + +
    + +
    + +
    + +
    + +
    + + + +
    + +
    + +
    +
    -
    +
    - - + + - - + + \ No newline at end of file