diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php index a13c9f53..f1cbe32d 100644 --- a/bl-kernel/boot/init.php +++ b/bl-kernel/boot/init.php @@ -143,6 +143,9 @@ define('DIR_PERMISSIONS', 0755); // Admin URI filter define('ADMIN_URI_FILTER', '/admin/'); +// Default language file, in this case is English +define('DEFAULT_LANGUAGE_FILE', 'en_US.json'); + // Set internal character encoding mb_internal_encoding(CHARSET); diff --git a/bl-kernel/boot/rules/60.plugins.php b/bl-kernel/boot/rules/60.plugins.php index 6ebc5e87..2259bdad 100644 --- a/bl-kernel/boot/rules/60.plugins.php +++ b/bl-kernel/boot/rules/60.plugins.php @@ -54,14 +54,13 @@ function buildPlugins() // List plugins directories $list = Filesystem::listDirectories(PATH_PLUGINS); - // Get declared clasess before load plugins clasess, this list doesn't have the plugins clasess. + // Get declared clasess BEFORE load plugins clasess $currentDeclaredClasess = get_declared_classes(); // Load each plugin clasess foreach($list as $pluginPath) { - // Check if the directory has the plugin.php - if(file_exists($pluginPath.DS.'plugin.php')) { + if (file_exists($pluginPath.DS.'plugin.php')) { include($pluginPath.DS.'plugin.php'); } } @@ -69,38 +68,36 @@ function buildPlugins() // Get plugins clasess loaded $pluginsDeclaredClasess = array_diff(get_declared_classes(), $currentDeclaredClasess); - foreach($pluginsDeclaredClasess as $pluginClass) - { + foreach ($pluginsDeclaredClasess as $pluginClass) { $Plugin = new $pluginClass; - // Check if the plugin is translated. + // 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'; + $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.DEFAULT_LANGUAGE_FILE; } $database = file_get_contents($languageFilename); $database = json_decode($database, true); - // Set name and description from the language file. + // 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. + // Remove name and description from the language file loaded and add new words if there are + // This function overwrite the key=>value unset($database['plugin-data']); - if(!empty($database)) { + if (!empty($database)) { $Language->add($database); } - // Array with plugin all plugins, installed and not installed + // $plugins['all'] Array with all plugins, installed and not installed $plugins['all'][$pluginClass] = $Plugin; - // If the plugin is installed, order by hooks. - if($Plugin->installed()) { - - foreach($pluginsEvents as $event=>$value) { - - if(method_exists($Plugin, $event)) { + // If the plugin is installed insert on the hooks + if ($Plugin->installed()) { + foreach ($pluginsEvents as $event=>$value) { + if (method_exists($Plugin, $event)) { array_push($plugins[$event], $Plugin); } } diff --git a/bl-kernel/dblanguage.class.php b/bl-kernel/dblanguage.class.php index 504bc492..42782905 100644 --- a/bl-kernel/dblanguage.class.php +++ b/bl-kernel/dblanguage.class.php @@ -76,6 +76,8 @@ class dbLanguage extends dbJSON echo $this->get($string); } + // Add more keys=>values to the current dicionary + // Will be overwrite if exist the key with the new value public function add($array) { $this->db = array_merge($array, $this->db); diff --git a/bl-kernel/helpers/theme.class.php b/bl-kernel/helpers/theme.class.php index e89e9580..8f75023a 100644 --- a/bl-kernel/helpers/theme.class.php +++ b/bl-kernel/helpers/theme.class.php @@ -131,7 +131,7 @@ class Theme { public static function plugins($type) { global $plugins; - foreach($plugins[$type] as $plugin) { + foreach ($plugins[$type] as $plugin) { echo call_user_func(array($plugin, $type)); } } diff --git a/bl-plugins/disqus/plugin.php b/bl-plugins/disqus/plugin.php index 047db1f3..d5973604 100644 --- a/bl-plugins/disqus/plugin.php +++ b/bl-plugins/disqus/plugin.php @@ -23,9 +23,15 @@ class pluginDisqus extends Plugin { public function pageEnd() { - global $page; + global $pages; + global $Url; - if( ($page->key()!='error') && ($page->allowComments()) ) { + $page = $pages[0]; + if (empty($page)) { + return false; + } + + if ( (!$Url->notFound()) && ($Url->whereAmI()=='page') && ($page->allowComments()) ) { $html = '
'; $html .= ' - - '; return $html; } diff --git a/bl-themes/kernel-panic/index.php b/bl-themes/kernel-panic/index.php index 7a9189b5..caeebc82 100755 --- a/bl-themes/kernel-panic/index.php +++ b/bl-themes/kernel-panic/index.php @@ -7,6 +7,7 @@ +