Namespace Plugin Pages
This commit is contained in:
parent
5187cbc4d0
commit
1214b12bf7
|
@ -80,8 +80,8 @@
|
||||||
<?php
|
<?php
|
||||||
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
|
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
|
||||||
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
|
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
|
||||||
} else if (isset($plugin) && method_exists($plugin, "adminView")) {
|
} else if (!empty($layout['plugin']) && method_exists($layout['plugin'], 'adminView')) {
|
||||||
echo $plugin->adminView();
|
echo $layout['plugin']->adminView();
|
||||||
} else {
|
} else {
|
||||||
echo '<h1 class="text-center">'.$L->g('Page not found').'</h1>';
|
echo '<h1 class="text-center">'.$L->g('Page not found').'</h1>';
|
||||||
echo '<h2 class="text-center">'.$L->g('Choose a page from the sidebar.').'</h2>';
|
echo '<h2 class="text-center">'.$L->g('Choose a page from the sidebar.').'</h2>';
|
||||||
|
|
|
@ -13,18 +13,24 @@ $layout = array(
|
||||||
'view'=>null,
|
'view'=>null,
|
||||||
'template'=>'index.php',
|
'template'=>'index.php',
|
||||||
'slug'=>null,
|
'slug'=>null,
|
||||||
|
'plugin'=>false,
|
||||||
'parameters'=>null,
|
'parameters'=>null,
|
||||||
'title'=>'Bludit'
|
'title'=>'Bludit'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get the view, controller, and the parameters from the URL.
|
// Get the Controller
|
||||||
$explodeSlug = $url->explodeSlug();
|
$explodeSlug = $url->explodeSlug();
|
||||||
$layout['controller'] = $layout['view'] = $layout['slug'] = empty($explodeSlug[0])?'dashboard':$explodeSlug[0];
|
$layout['controller'] = $layout['view'] = $layout['slug'] = empty($explodeSlug[0])?'dashboard':$explodeSlug[0];
|
||||||
unset($explodeSlug[0]);
|
unset($explodeSlug[0]);
|
||||||
$layout['parameters'] = implode('/', $explodeSlug);
|
|
||||||
|
|
||||||
// Boot plugins rules
|
// Get the Plugin
|
||||||
include(PATH_RULES.'60.plugins.php');
|
include(PATH_RULES.'60.plugins.php');
|
||||||
|
if ($layout['controller'] === 'plugin' && !empty($explodeSlug)) {
|
||||||
|
$layout['plugin'] = getPlugin(array_shift($explodeSlug));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the URL parameters
|
||||||
|
$layout['parameters'] = implode('/', $explodeSlug);
|
||||||
|
|
||||||
// --- AJAX ---
|
// --- AJAX ---
|
||||||
if ($layout['slug']==='ajax') {
|
if ($layout['slug']==='ajax') {
|
||||||
|
@ -77,10 +83,8 @@ else
|
||||||
// Load controller.
|
// Load controller.
|
||||||
if (Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php')) {
|
if (Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php')) {
|
||||||
include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php');
|
include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php');
|
||||||
} else if (($plugin = getPlugin($layout['controller'])) !== false) {
|
} else if(!empty($layout['plugin']) && method_exists($layout['plugin'], 'adminController')) {
|
||||||
if (method_exists($plugin, "adminController") && method_exists($plugin, "adminView")) {
|
$layout['plugin']->adminController();
|
||||||
$plugin->adminController();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load view and theme.
|
// Load view and theme.
|
||||||
|
|
Loading…
Reference in New Issue