diff --git a/phpstan.neon b/phpstan.neon
index 2298851..b9d8473 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -5,3 +5,4 @@ parameters:
excludePaths:
analyse:
- src/Vendor
+ - src/Cache
diff --git a/src/AntCMS/AntCMS.php b/src/AntCMS/AntCMS.php
index db61324..f00314b 100644
--- a/src/AntCMS/AntCMS.php
+++ b/src/AntCMS/AntCMS.php
@@ -19,7 +19,6 @@ class AntCMS
{
$start_time = microtime(true);
$content = $this->getPage($page);
- $antTwig = new AntTwig;
if (!$content || !is_array($content)) {
$this->renderException("404");
@@ -36,7 +35,7 @@ class AntCMS
'AntCMSKeywords' => $content['keywords'],
);
$pageTemplate = str_replace('', $markdown, $pageTemplate);
- $pageTemplate = $antTwig->renderWithTiwg($pageTemplate, $params);
+ $pageTemplate = AntTwig::renderWithTiwg($pageTemplate, $params);
$end_time = microtime(true);
$elapsed_time = round($end_time - $start_time, 4);
diff --git a/src/AntCMS/AntPages.php b/src/AntCMS/AntPages.php
index 356ad86..9ab9724 100644
--- a/src/AntCMS/AntPages.php
+++ b/src/AntCMS/AntPages.php
@@ -94,8 +94,7 @@ class AntPages
}
}
- $antTwig = new AntTwig;
- $navHTML = $antTwig->renderWithTiwg($navTemplate, array('pages' => $pages));
+ $navHTML = AntTwig::renderWithTiwg($navTemplate, array('pages' => $pages));
$antCache->setCache($cacheKey, $navHTML);
return $navHTML;
diff --git a/src/AntCMS/AntTwig.php b/src/AntCMS/AntTwig.php
index 8f2017a..3377958 100644
--- a/src/AntCMS/AntTwig.php
+++ b/src/AntCMS/AntTwig.php
@@ -12,7 +12,7 @@ class AntTwig
* @param string|null $theme
* @return string
*/
- public function renderWithTiwg(string $content = '', array $params = array(), string $theme = null)
+ public static function renderWithTiwg(string $content = '', array $params = array(), string $theme = null)
{
$twigCache = AntConfig::currentConfig('enableCache') ? AntCachePath : false;
$theme = $theme ?? AntConfig::currentConfig('activeTheme');
diff --git a/src/Plugins/Admin/AdminPlugin.php b/src/Plugins/Admin/AdminPlugin.php
index 9e66d61..50d93a5 100644
--- a/src/Plugins/Admin/AdminPlugin.php
+++ b/src/Plugins/Admin/AdminPlugin.php
@@ -38,7 +38,6 @@ class AdminPlugin extends AntPlugin
$this->managePages($route);
default:
- $antTwig = new AntTwig;
$params = array(
'AntCMSTitle' => 'AntCMS Admin Dashboard',
'AntCMSDescription' => 'The AntCMS admin dashboard',
@@ -50,7 +49,7 @@ class AdminPlugin extends AntPlugin
$HTMLTemplate .= "AntCMS Configuration
\n";
$HTMLTemplate .= "Page management
\n";
$pageTemplate = str_replace('', $HTMLTemplate, $pageTemplate);
- $pageTemplate = $antTwig->renderWithTiwg($pageTemplate, $params);
+ $pageTemplate = AntTwig::renderWithTiwg($pageTemplate, $params);
echo $pageTemplate;
break;
@@ -68,7 +67,6 @@ class AdminPlugin extends AntPlugin
$HTMLTemplate = $antCMS->getThemeTemplate('textarea_edit_layout');
$currentConfig = AntConfig::currentConfig();
$currentConfigFile = file_get_contents(antConfigFile);
- $antTwig = new AntTwig;
$params = array(
'AntCMSTitle' => 'AntCMS Configuration',
'AntCMSDescription' => 'The AntCMS configuration screen',
@@ -119,7 +117,7 @@ class AdminPlugin extends AntPlugin
}
$pageTemplate = str_replace('', $HTMLTemplate, $pageTemplate);
- $pageTemplate = $antTwig->renderWithTiwg($pageTemplate, $params);
+ $pageTemplate = AntTwig::renderWithTiwg($pageTemplate, $params);
echo $pageTemplate;
exit;
@@ -135,7 +133,6 @@ class AdminPlugin extends AntPlugin
$pageTemplate = $antCMS->getPageLayout();
$HTMLTemplate = $antCMS->getThemeTemplate('markdown_edit_layout');
$pages = AntPages::getPages();
- $antTwig = new AntTwig;
$params = array(
'AntCMSTitle' => 'AntCMS Page Management',
'AntCMSDescription' => 'The AntCMS page management screen',
@@ -247,7 +244,7 @@ class AdminPlugin extends AntPlugin
}
$pageTemplate = str_replace('', $HTMLTemplate, $pageTemplate);
- $pageTemplate = $antTwig->renderWithTiwg($pageTemplate, $params);
+ $pageTemplate = AntTwig::renderWithTiwg($pageTemplate, $params);
echo $pageTemplate;
exit;