Update admin plugin to render with twig
This commit is contained in:
parent
2a1af73f75
commit
cb0a1917a9
4 changed files with 32 additions and 35 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
||||||
/src/Vendor/
|
/src/Vendor/
|
||||||
node_modules
|
node_modules
|
||||||
src/Cache/*
|
src/Cache/*
|
||||||
src/config.yaml
|
src/Config/config.yaml
|
||||||
src/pages.yaml
|
src/Config/pages.yaml
|
|
@ -125,10 +125,10 @@ class AntCMS
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title><!--AntCMS-Title--></title>
|
<title>{{ AntCMSTitle }}</title>
|
||||||
<meta name="description" content="<!--AntCMS-Description-->">
|
<meta name="description" content="{{ AntCMSDescription }}">
|
||||||
<meta name="author" content="<!--AntCMS-Author-->">
|
<meta name="author" content="{{ AntCMSAuthor }}">
|
||||||
<meta name="keywords" content="<!--AntCMS-Keywords-->">
|
<meta name="keywords" content="{{ AntCMSKeywords }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>AntCMS had an error when fetching the page template, please contact the site administrator.</p>
|
<p>AntCMS had an error when fetching the page template, please contact the site administrator.</p>
|
||||||
|
|
|
@ -7,6 +7,7 @@ use AntCMS\AntPages;
|
||||||
use AntCMS\AntYaml;
|
use AntCMS\AntYaml;
|
||||||
use AntCMS\AntAuth;
|
use AntCMS\AntAuth;
|
||||||
use AntCMS\AntTools;
|
use AntCMS\AntTools;
|
||||||
|
use AntCMS\AntTwig;
|
||||||
|
|
||||||
class AdminPlugin extends AntPlugin
|
class AdminPlugin extends AntPlugin
|
||||||
{
|
{
|
||||||
|
@ -30,11 +31,19 @@ class AdminPlugin extends AntPlugin
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
$antTwig = new AntTwig;
|
||||||
|
$params = array(
|
||||||
|
'AntCMSTitle' => 'AntCMS Admin Dashboard',
|
||||||
|
'AntCMSDescription' => 'The AntCMS admin dashboard',
|
||||||
|
'AntCMSAuthor' => 'AntCMS',
|
||||||
|
'AntCMSKeywords' => 'N/A',
|
||||||
|
);
|
||||||
|
|
||||||
$HTMLTemplate = "<h1>AntCMS Admin Plugin</h1>\n";
|
$HTMLTemplate = "<h1>AntCMS Admin Plugin</h1>\n";
|
||||||
$HTMLTemplate .= "<a href='//" . $currentConfig['baseURL'] . "plugin/admin/config/'>AntCMS Configuration</a><br>\n";
|
$HTMLTemplate .= "<a href='//" . $currentConfig['baseURL'] . "plugin/admin/config/'>AntCMS Configuration</a><br>\n";
|
||||||
$HTMLTemplate .= "<a href='//" . $currentConfig['baseURL'] . "plugin/admin/pages/'>Page management</a><br>\n";
|
$HTMLTemplate .= "<a href='//" . $currentConfig['baseURL'] . "plugin/admin/pages/'>Page management</a><br>\n";
|
||||||
$pageTemplate = str_replace('<!--AntCMS-Title-->', 'AntCMS Configuration', $pageTemplate);
|
|
||||||
$pageTemplate = str_replace('<!--AntCMS-Body-->', $HTMLTemplate, $pageTemplate);
|
$pageTemplate = str_replace('<!--AntCMS-Body-->', $HTMLTemplate, $pageTemplate);
|
||||||
|
$pageTemplate = $antTwig->renderWithTiwg($pageTemplate, $params);
|
||||||
|
|
||||||
echo $pageTemplate;
|
echo $pageTemplate;
|
||||||
break;
|
break;
|
||||||
|
@ -53,6 +62,13 @@ class AdminPlugin extends AntPlugin
|
||||||
$HTMLTemplate = $antCMS->getThemeTemplate('textarea_edit_layout');
|
$HTMLTemplate = $antCMS->getThemeTemplate('textarea_edit_layout');
|
||||||
$currentConfig = AntConfig::currentConfig();
|
$currentConfig = AntConfig::currentConfig();
|
||||||
$currentConfigFile = file_get_contents(antConfigFile);
|
$currentConfigFile = file_get_contents(antConfigFile);
|
||||||
|
$antTwig = new AntTwig;
|
||||||
|
$params = array(
|
||||||
|
'AntCMSTitle' => 'AntCMS Configuration',
|
||||||
|
'AntCMSDescription' => 'The AntCMS configuration screen',
|
||||||
|
'AntCMSAuthor' => 'AntCMS',
|
||||||
|
'AntCMSKeywords' => 'N/A',
|
||||||
|
);
|
||||||
|
|
||||||
switch ($route[0] ?? 'none') {
|
switch ($route[0] ?? 'none') {
|
||||||
case 'edit':
|
case 'edit':
|
||||||
|
@ -91,8 +107,8 @@ class AdminPlugin extends AntPlugin
|
||||||
}
|
}
|
||||||
$HTMLTemplate .= "</ul>\n";
|
$HTMLTemplate .= "</ul>\n";
|
||||||
}
|
}
|
||||||
$pageTemplate = str_replace('<!--AntCMS-Title-->', 'AntCMS Configuration', $pageTemplate);
|
|
||||||
$pageTemplate = str_replace('<!--AntCMS-Body-->', $HTMLTemplate, $pageTemplate);
|
$pageTemplate = str_replace('<!--AntCMS-Body-->', $HTMLTemplate, $pageTemplate);
|
||||||
|
$pageTemplate = $antTwig->renderWithTiwg($pageTemplate, $params);
|
||||||
|
|
||||||
echo $pageTemplate;
|
echo $pageTemplate;
|
||||||
exit;
|
exit;
|
||||||
|
@ -105,6 +121,13 @@ class AdminPlugin extends AntPlugin
|
||||||
$HTMLTemplate = $antCMS->getThemeTemplate('markdown_edit_layout');
|
$HTMLTemplate = $antCMS->getThemeTemplate('markdown_edit_layout');
|
||||||
$pages = AntPages::getPages();
|
$pages = AntPages::getPages();
|
||||||
$currentConfig = AntConfig::currentConfig();
|
$currentConfig = AntConfig::currentConfig();
|
||||||
|
$antTwig = new AntTwig;
|
||||||
|
$params = array(
|
||||||
|
'AntCMSTitle' => 'AntCMS Page Management',
|
||||||
|
'AntCMSDescription' => 'The AntCMS page management screen',
|
||||||
|
'AntCMSAuthor' => 'AntCMS',
|
||||||
|
'AntCMSKeywords' => 'N/A',
|
||||||
|
);
|
||||||
|
|
||||||
switch ($route[0] ?? 'none') {
|
switch ($route[0] ?? 'none') {
|
||||||
case 'regenerate':
|
case 'regenerate':
|
||||||
|
@ -171,8 +194,8 @@ class AdminPlugin extends AntPlugin
|
||||||
$HTMLTemplate .= "</ul>\n";
|
$HTMLTemplate .= "</ul>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$pageTemplate = str_replace('<!--AntCMS-Title-->', 'AntCMS Page Management', $pageTemplate);
|
|
||||||
$pageTemplate = str_replace('<!--AntCMS-Body-->', $HTMLTemplate, $pageTemplate);
|
$pageTemplate = str_replace('<!--AntCMS-Body-->', $HTMLTemplate, $pageTemplate);
|
||||||
|
$pageTemplate = $antTwig->renderWithTiwg($pageTemplate, $params);
|
||||||
|
|
||||||
echo $pageTemplate;
|
echo $pageTemplate;
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -15,32 +15,6 @@
|
||||||
crossorigin="anonymous"></script>
|
crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<title>{{ AntCMSTitle }}</title>
|
<title>{{ AntCMSTitle }}</title>
|
||||||
|
|
||||||
<style>
|
|
||||||
html,
|
|
||||||
body {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#wrap {
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#main {
|
|
||||||
overflow: auto;
|
|
||||||
padding-bottom: 150px;
|
|
||||||
/* this needs to be bigger than footer height*/
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
position: relative;
|
|
||||||
margin-top: -150px;
|
|
||||||
/* negative value of footer height */
|
|
||||||
height: 150px;
|
|
||||||
clear: both;
|
|
||||||
padding-top: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in a new issue