bug fixes
This commit is contained in:
parent
2f31752fa8
commit
258e7304ab
|
@ -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);
|
||||
|
||||
|
|
|
@ -54,12 +54,11 @@ 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')) {
|
||||
include($pluginPath.DS.'plugin.php');
|
||||
|
@ -69,37 +68,35 @@ 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)) {
|
||||
$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 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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 = '<div id="disqus_thread"></div>';
|
||||
$html .= '<script type="text/javascript">
|
||||
var disqus_config = function () {
|
||||
|
@ -40,8 +46,6 @@ class pluginDisqus extends Plugin {
|
|||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
';
|
||||
return $html;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<?php include(THEME_DIR_PHP.'head.php') ?>
|
||||
</head>
|
||||
<body>
|
||||
<?php Theme::plugins('siteBodyBegin') ?>
|
||||
|
||||
<div id="fh5co-main">
|
||||
<div class="fh5co-intro text-center">
|
||||
|
@ -57,5 +58,6 @@
|
|||
</div>
|
||||
</footer>
|
||||
|
||||
<?php Theme::plugins('siteBodyEnd') ?>
|
||||
</body>
|
||||
</html>
|
|
@ -2,6 +2,7 @@
|
|||
<section class="content">
|
||||
<?php foreach ($pages as $page): ?>
|
||||
<article class="page">
|
||||
<?php Theme::plugins('pageBegin') ?>
|
||||
<header>
|
||||
<a href="<?php echo $page->permalink() ?>">
|
||||
<h2><?php echo $page->title() ?></h2>
|
||||
|
@ -21,6 +22,7 @@
|
|||
</div>
|
||||
<?php } ?>
|
||||
</footer>
|
||||
<?php Theme::plugins('pageEnd') ?>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</section>
|
|
@ -1,6 +1,7 @@
|
|||
<!-- Section -->
|
||||
<section class="content">
|
||||
<article class="page">
|
||||
<?php Theme::plugins('pageBegin') ?>
|
||||
<header>
|
||||
<a href="<?php echo $page->permalink() ?>">
|
||||
<h2><?php echo $page->title() ?></h2>
|
||||
|
@ -14,5 +15,6 @@
|
|||
<footer>
|
||||
<div class="date"><i class="fa fa-clock-o"></i> <?php echo $page->date() ?></div>
|
||||
</footer>
|
||||
<?php Theme::plugins('pageEnd') ?>
|
||||
</article>
|
||||
</section>
|
|
@ -5,6 +5,8 @@
|
|||
<?php include(THEME_DIR_PHP.'head.php') ?>
|
||||
</head>
|
||||
<body>
|
||||
<?php Theme::plugins('siteBodyBegin') ?>
|
||||
|
||||
<div id="wrapper">
|
||||
|
||||
<!-- Header -->
|
||||
|
@ -68,9 +70,7 @@
|
|||
|
||||
<!-- Sidebar -->
|
||||
<section id="sidebar">
|
||||
<?php
|
||||
include(THEME_DIR_PHP.'sidebar.php');
|
||||
?>
|
||||
<?php include(THEME_DIR_PHP.'sidebar.php') ?>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
@ -84,9 +84,8 @@
|
|||
echo Theme::js('assets/js/ie/respond.min.js');
|
||||
echo '<![endif]-->';
|
||||
echo Theme::js('assets/js/main.js');
|
||||
|
||||
Theme::plugins('siteBodyEnd');
|
||||
?>
|
||||
|
||||
<?php Theme::plugins('siteBodyEnd') ?>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue