Bug fixes and plugins features
This commit is contained in:
parent
3f9c38adac
commit
6af40b3dfe
|
@ -2,17 +2,22 @@
|
|||
<html>
|
||||
<head>
|
||||
<base href="<?php echo HTML_PATH_ADMIN_THEME ?>">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Your page title</title>
|
||||
<title>Your page title</title>
|
||||
|
||||
<link rel="stylesheet" href="./css/kube.min.css">
|
||||
<link rel="stylesheet" href="./css/default.css">
|
||||
<link rel="stylesheet" href="./css/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="./css/kube.min.css">
|
||||
<link rel="stylesheet" href="./css/default.css">
|
||||
<link rel="stylesheet" href="./css/css/font-awesome.css">
|
||||
|
||||
<script src="./js/jquery.min.js"></script>
|
||||
<script src="./js/kube.min.js"></script>
|
||||
<script src="./js/jquery.min.js"></script>
|
||||
<script src="./js/kube.min.js"></script>
|
||||
|
||||
<!-- Plugins -->
|
||||
<?php
|
||||
Theme::plugins('onAdminHead');
|
||||
?>
|
||||
|
||||
</head>
|
||||
|
||||
|
@ -86,8 +91,13 @@ $(document).ready(function() {
|
|||
include(PATH_JS.'functions.php');
|
||||
?>
|
||||
|
||||
<!-- Plugins -->
|
||||
<?php
|
||||
Theme::plugins('onAdminBody');
|
||||
?>
|
||||
|
||||
<?php
|
||||
echo "DEBUG: Load time: ".(microtime(true) - $loadTime).'<br>';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
|
@ -153,7 +153,12 @@ class Plugin {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function onSidebar()
|
||||
public function onSiteSidebar()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onAdminSidebar()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ if( $Login->isLogged() && ($layout['slug']==='ajax') )
|
|||
else
|
||||
{
|
||||
// Boot rules
|
||||
include(PATH_RULES.'60.plugins.php');
|
||||
include(PATH_RULES.'70.build_posts.php');
|
||||
include(PATH_RULES.'70.build_pages.php');
|
||||
include(PATH_RULES.'80.plugins.php');
|
||||
include(PATH_RULES.'99.header.php');
|
||||
|
||||
if($Url->notFound() || !$Login->isLogged() || ($Url->slug()==='login') )
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Variables
|
||||
// ============================================================================
|
||||
|
||||
$plugins = array(
|
||||
'onSiteHead'=>array(),
|
||||
'onSiteBody'=>array(),
|
||||
'onSiteSidebar'=>array(),
|
||||
'onAdminHead'=>array(),
|
||||
'onAdminBody'=>array(),
|
||||
'onAdminSidebar'=>array(),
|
||||
'beforePostsLoad'=>array(),
|
||||
'afterPostsLoad'=>array(),
|
||||
'beforePagesLoad'=>array(),
|
||||
'afterPagesLoad'=>array(),
|
||||
'all'=>array()
|
||||
);
|
||||
|
||||
$pluginsEvents = $plugins;
|
||||
unset($pluginsEvents['all']);
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
function build_plugins()
|
||||
{
|
||||
global $plugins;
|
||||
global $pluginsEvents;
|
||||
|
||||
// List plugins directories
|
||||
$list = Filesystem::listDirectories(PATH_PLUGINS);
|
||||
|
||||
// Get declared clasess before load plugins clasess, this list doesn't have the plugins clasess.
|
||||
$currentDeclaredClasess = get_declared_classes();
|
||||
|
||||
// Load each plugin clasess
|
||||
foreach($list as $pluginPath) {
|
||||
include($pluginPath.'/plugin.php');
|
||||
}
|
||||
|
||||
// Get plugins clasess loaded
|
||||
$pluginsDeclaredClasess = array_diff(get_declared_classes(), $currentDeclaredClasess);
|
||||
|
||||
foreach($pluginsDeclaredClasess as $pluginClass)
|
||||
{
|
||||
$Plugin = new $pluginClass;
|
||||
|
||||
// All plugins installed and not installed.
|
||||
array_push($plugins['all'], $Plugin);
|
||||
|
||||
// If the plugin installed, then add the plugin on the arrays.
|
||||
if($Plugin->installed())
|
||||
{
|
||||
foreach($pluginsEvents as $event=>$value)
|
||||
{
|
||||
/*
|
||||
if($Plugin->onSiteHead()!==false)
|
||||
array_push($plugins['onSiteHead'], $Plugin);
|
||||
*/
|
||||
if($Plugin->{$event}()!==false) {
|
||||
array_push($plugins[$event], $Plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main
|
||||
// ============================================================================
|
||||
|
||||
build_plugins();
|
|
@ -1,8 +1,16 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Variables
|
||||
// ============================================================================
|
||||
|
||||
$pages = array();
|
||||
$pagesParents = array(NO_PARENT_CHAR=>array());
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
function orderChildren($a, $b)
|
||||
{
|
||||
if ($a->position() == $b->position()) {
|
||||
|
@ -130,6 +138,13 @@ function build_all_pages()
|
|||
$pagesParents = array(NO_PARENT_CHAR=>$tmpNoParents) + $tmp;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main
|
||||
// ============================================================================
|
||||
|
||||
// Plugins before load pages
|
||||
Theme::plugins('beforePagesLoad');
|
||||
|
||||
// Filter by page, then build it
|
||||
if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) )
|
||||
{
|
||||
|
@ -170,4 +185,7 @@ if($Url->notFound())
|
|||
}
|
||||
|
||||
// Build all pages
|
||||
build_all_pages();
|
||||
build_all_pages();
|
||||
|
||||
// Plugins after load pages
|
||||
Theme::plugins('afterPagesLoad');
|
|
@ -1,7 +1,15 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Variables
|
||||
// ============================================================================
|
||||
|
||||
$posts = array();
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
function buildPost($key)
|
||||
{
|
||||
global $dbPosts;
|
||||
|
@ -80,6 +88,13 @@ function build_posts_per_page($pageNumber=0, $amount=5, $draftPosts=false)
|
|||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main
|
||||
// ============================================================================
|
||||
|
||||
// Plugins before load posts
|
||||
Theme::plugins('beforePostsLoad');
|
||||
|
||||
// Filter by post, then build it
|
||||
if( ($Url->whereAmI()==='post') && ($Url->notFound()===false) )
|
||||
{
|
||||
|
@ -114,3 +129,6 @@ else
|
|||
build_posts_per_page($Url->pageNumber(), $Site->postsPerPage(), false);
|
||||
}
|
||||
}
|
||||
|
||||
// Plugins after load posts
|
||||
Theme::plugins('afterPostsLoad');
|
|
@ -1,58 +0,0 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
$plugins = array(
|
||||
'onSiteHead'=>array(),
|
||||
'onSiteBody'=>array(),
|
||||
'onSidebar'=>array(),
|
||||
'onAdminHead'=>array(),
|
||||
'onAdminBody'=>array(),
|
||||
'all'=>array()
|
||||
);
|
||||
|
||||
function build_plugins()
|
||||
{
|
||||
global $plugins;
|
||||
|
||||
// List plugins directories
|
||||
$list = Filesystem::listDirectories(PATH_PLUGINS);
|
||||
|
||||
// Get declared clasess before load plugins clasess, this list doesn't have the plugins clasess.
|
||||
$currentDeclaredClasess = get_declared_classes();
|
||||
|
||||
// Load each plugin clasess
|
||||
foreach($list as $pluginPath) {
|
||||
include($pluginPath.'/plugin.php');
|
||||
}
|
||||
|
||||
// Get plugins clasess loaded
|
||||
$pluginsDeclaredClasess = array_diff(get_declared_classes(), $currentDeclaredClasess);
|
||||
|
||||
foreach($pluginsDeclaredClasess as $pluginClass)
|
||||
{
|
||||
$Plugin = new $pluginClass;
|
||||
|
||||
// All plugins installed and not installed.
|
||||
array_push($plugins['all'], $Plugin);
|
||||
|
||||
// If the plugin installed, then add the plugin on the arrays.
|
||||
if($Plugin->installed())
|
||||
{
|
||||
if($Plugin->onSiteHead()!==false)
|
||||
array_push($plugins['onSiteHead'], $Plugin);
|
||||
|
||||
if($Plugin->onSiteBody()!==false)
|
||||
array_push($plugins['onSiteBody'], $Plugin);
|
||||
|
||||
if($Plugin->onSidebar()!==false)
|
||||
array_push($plugins['onSidebar'], $Plugin);
|
||||
|
||||
if($Plugin->onAdminHead()!==false)
|
||||
array_push($plugins['onAdminHead'], $Plugin);
|
||||
|
||||
if($Plugin->onAdminBody()!==false)
|
||||
array_push($plugins['onAdminBody'], $Plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build_plugins();
|
|
@ -1,9 +1,9 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// Boot rules
|
||||
include(PATH_RULES.'60.plugins.php');
|
||||
include(PATH_RULES.'70.build_posts.php');
|
||||
include(PATH_RULES.'70.build_pages.php');
|
||||
include(PATH_RULES.'80.plugins.php');
|
||||
include(PATH_RULES.'99.header.php');
|
||||
|
||||
// Theme init.php
|
||||
|
|
|
@ -84,7 +84,6 @@ class Theme {
|
|||
return $tmp;
|
||||
}
|
||||
|
||||
// OLD
|
||||
public static function plugins($type)
|
||||
{
|
||||
global $plugins;
|
||||
|
@ -96,6 +95,7 @@ class Theme {
|
|||
}
|
||||
|
||||
|
||||
// OLD
|
||||
|
||||
public static function url($relative = true)
|
||||
{
|
||||
|
@ -105,10 +105,6 @@ class Theme {
|
|||
return BLOG_URL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function jquery($path=JS_JQUERY)
|
||||
{
|
||||
$tmp = '<script src="'.$path.'"></script>'.PHP_EOL;
|
||||
|
|
Loading…
Reference in New Issue