Compare commits

..

2 commits

Author SHA1 Message Date
Belle Aerni
368aaa44e3 Use Lightning CSS for minimization
This produces slightly smaller files than sass does when minimizing, is also faster at it, and doesn't make changes that could effect the behavior of the CSS
2023-08-11 23:58:44 -07:00
Belle Aerni
a6591f5a70 Start replacing the usage of CDNs 2023-06-09 01:05:12 -07:00
19 changed files with 1653 additions and 1001 deletions

View file

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- uses: php-actions/phpstan@v3
with:

View file

@ -10,7 +10,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
with:
dev: no
@ -21,8 +21,7 @@ jobs:
working-directory: ./src
- run: |
npm install -D tailwindcss
rm -f ./src/Themes/Default/Assets/Dist/tailwind.css
npx tailwindcss -i ./src/Themes/Default/Assets/tailwind.css -o ./src/Themes/Default/Assets/Dist/tailwind.css --minify
npm run build
- uses: ncipollo/release-action@v1
with:
artifacts: "./src/AntCMS.zip"

View file

@ -14,7 +14,7 @@ jobs:
php_version: [8.0, 8.1, 8.2]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- run: |
cp ./tests/Includes/Config.yaml ./src/Config/Config.yaml

3
.gitignore vendored
View file

@ -2,4 +2,5 @@
node_modules
src/Cache/*
src/Config/Config.yaml
src/Config/Pages.yaml
src/Config/Pages.yaml
src/Themes/Bootstrap/Assets/Dist/styles.min.css

124
composer.lock generated
View file

@ -8,16 +8,16 @@
"packages": [
{
"name": "antcms/antloader",
"version": "2.0.2",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/AntCMS-org/AntLoader.git",
"reference": "ce5aeeb28544b85150382989d463b8dc71efec87"
"reference": "b0f3b484908ae438464e83e5098be815acf571c6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/AntCMS-org/AntLoader/zipball/ce5aeeb28544b85150382989d463b8dc71efec87",
"reference": "ce5aeeb28544b85150382989d463b8dc71efec87",
"url": "https://api.github.com/repos/AntCMS-org/AntLoader/zipball/b0f3b484908ae438464e83e5098be815acf571c6",
"reference": "b0f3b484908ae438464e83e5098be815acf571c6",
"shasum": ""
},
"require": {
@ -47,9 +47,9 @@
"description": "A small and simple autoloader for PHP applications",
"support": {
"issues": "https://github.com/AntCMS-org/AntLoader/issues",
"source": "https://github.com/AntCMS-org/AntLoader/tree/2.0.2"
"source": "https://github.com/AntCMS-org/AntLoader/tree/2.0.1"
},
"time": "2023-10-03T13:13:17+00:00"
"time": "2023-06-08T06:44:00+00:00"
},
{
"name": "composer/ca-bundle",
@ -129,22 +129,22 @@
},
{
"name": "composer/class-map-generator",
"version": "1.1.0",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/composer/class-map-generator.git",
"reference": "953cc4ea32e0c31f2185549c7d216d7921f03da9"
"reference": "1e1cb2b791facb2dfe32932a7718cf2571187513"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/class-map-generator/zipball/953cc4ea32e0c31f2185549c7d216d7921f03da9",
"reference": "953cc4ea32e0c31f2185549c7d216d7921f03da9",
"url": "https://api.github.com/repos/composer/class-map-generator/zipball/1e1cb2b791facb2dfe32932a7718cf2571187513",
"reference": "1e1cb2b791facb2dfe32932a7718cf2571187513",
"shasum": ""
},
"require": {
"composer/pcre": "^2.1 || ^3.1",
"composer/pcre": "^2 || ^3",
"php": "^7.2 || ^8.0",
"symfony/finder": "^4.4 || ^5.3 || ^6 || ^7"
"symfony/finder": "^4.4 || ^5.3 || ^6"
},
"require-dev": {
"phpstan/phpstan": "^1.6",
@ -182,7 +182,7 @@
],
"support": {
"issues": "https://github.com/composer/class-map-generator/issues",
"source": "https://github.com/composer/class-map-generator/tree/1.1.0"
"source": "https://github.com/composer/class-map-generator/tree/1.0.0"
},
"funding": [
{
@ -198,7 +198,7 @@
"type": "tidelift"
}
],
"time": "2023-06-30T13:58:57+00:00"
"time": "2022-06-19T11:31:27+00:00"
},
{
"name": "composer/pcre",
@ -475,16 +475,16 @@
},
{
"name": "league/commonmark",
"version": "2.4.1",
"version": "2.4.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark.git",
"reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5"
"reference": "d44a24690f16b8c1808bf13b1bd54ae4c63ea048"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/3669d6d5f7a47a93c08ddff335e6d945481a1dd5",
"reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d44a24690f16b8c1808bf13b1bd54ae4c63ea048",
"reference": "d44a24690f16b8c1808bf13b1bd54ae4c63ea048",
"shasum": ""
},
"require": {
@ -577,7 +577,7 @@
"type": "tidelift"
}
],
"time": "2023-08-30T16:55:00+00:00"
"time": "2023-03-24T15:16:10+00:00"
},
{
"name": "league/config",
@ -767,21 +767,21 @@
},
{
"name": "nette/schema",
"version": "v1.2.4",
"version": "v1.2.3",
"source": {
"type": "git",
"url": "https://github.com/nette/schema.git",
"reference": "c9ff517a53903b3d4e29ec547fb20feecb05b8ab"
"reference": "abbdbb70e0245d5f3bf77874cea1dfb0c930d06f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/schema/zipball/c9ff517a53903b3d4e29ec547fb20feecb05b8ab",
"reference": "c9ff517a53903b3d4e29ec547fb20feecb05b8ab",
"url": "https://api.github.com/repos/nette/schema/zipball/abbdbb70e0245d5f3bf77874cea1dfb0c930d06f",
"reference": "abbdbb70e0245d5f3bf77874cea1dfb0c930d06f",
"shasum": ""
},
"require": {
"nette/utils": "^2.5.7 || ^3.1.5 || ^4.0",
"php": "7.1 - 8.3"
"php": ">=7.1 <8.3"
},
"require-dev": {
"nette/tester": "^2.3 || ^2.4",
@ -823,26 +823,26 @@
],
"support": {
"issues": "https://github.com/nette/schema/issues",
"source": "https://github.com/nette/schema/tree/v1.2.4"
"source": "https://github.com/nette/schema/tree/v1.2.3"
},
"time": "2023-08-05T18:56:25+00:00"
"time": "2022-10-13T01:24:26+00:00"
},
{
"name": "nette/utils",
"version": "v4.0.1",
"version": "v4.0.0",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "9124157137da01b1f5a5a22d6486cb975f26db7e"
"reference": "cacdbf5a91a657ede665c541eda28941d4b09c1e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/9124157137da01b1f5a5a22d6486cb975f26db7e",
"reference": "9124157137da01b1f5a5a22d6486cb975f26db7e",
"url": "https://api.github.com/repos/nette/utils/zipball/cacdbf5a91a657ede665c541eda28941d4b09c1e",
"reference": "cacdbf5a91a657ede665c541eda28941d4b09c1e",
"shasum": ""
},
"require": {
"php": ">=8.0 <8.4"
"php": ">=8.0 <8.3"
},
"conflict": {
"nette/finder": "<3",
@ -850,7 +850,7 @@
},
"require-dev": {
"jetbrains/phpstorm-attributes": "dev-master",
"nette/tester": "^2.5",
"nette/tester": "^2.4",
"phpstan/phpstan": "^1.0",
"tracy/tracy": "^2.9"
},
@ -910,9 +910,9 @@
],
"support": {
"issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v4.0.1"
"source": "https://github.com/nette/utils/tree/v4.0.0"
},
"time": "2023-07-30T15:42:21+00:00"
"time": "2023-02-02T10:41:53+00:00"
},
{
"name": "nyholm/psr7",
@ -1518,16 +1518,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.28.0",
"version": "v1.27.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb"
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a",
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a",
"shasum": ""
},
"require": {
@ -1542,7 +1542,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.28-dev"
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -1580,7 +1580,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0"
},
"funding": [
{
@ -1596,20 +1596,20 @@
"type": "tidelift"
}
],
"time": "2023-01-26T09:26:14+00:00"
"time": "2022-11-03T14:55:06+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.28.0",
"version": "v1.27.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "42292d99c55abe617799667f454222c54c60e229"
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229",
"reference": "42292d99c55abe617799667f454222c54c60e229",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
"shasum": ""
},
"require": {
@ -1624,7 +1624,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.28-dev"
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -1663,7 +1663,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0"
},
"funding": [
{
@ -1679,20 +1679,20 @@
"type": "tidelift"
}
],
"time": "2023-07-28T09:04:16+00:00"
"time": "2022-11-03T14:55:06+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.28.0",
"version": "v1.27.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5"
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5",
"reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
"shasum": ""
},
"require": {
@ -1701,7 +1701,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.28-dev"
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -1746,7 +1746,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0"
},
"funding": [
{
@ -1762,7 +1762,7 @@
"type": "tidelift"
}
],
"time": "2023-01-26T09:26:14+00:00"
"time": "2022-11-03T14:55:06+00:00"
},
{
"name": "symfony/yaml",
@ -1840,16 +1840,16 @@
},
{
"name": "twig/twig",
"version": "v3.7.1",
"version": "v3.6.1",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "a0ce373a0ca3bf6c64b9e3e2124aca502ba39554"
"reference": "7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/a0ce373a0ca3bf6c64b9e3e2124aca502ba39554",
"reference": "a0ce373a0ca3bf6c64b9e3e2124aca502ba39554",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd",
"reference": "7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd",
"shasum": ""
},
"require": {
@ -1859,7 +1859,7 @@
},
"require-dev": {
"psr/container": "^1.0|^2.0",
"symfony/phpunit-bridge": "^5.4.9|^6.3"
"symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0"
},
"type": "library",
"autoload": {
@ -1895,7 +1895,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.7.1"
"source": "https://github.com/twigphp/Twig/tree/v3.6.1"
},
"funding": [
{
@ -1907,7 +1907,7 @@
"type": "tidelift"
}
],
"time": "2023-08-28T11:09:02+00:00"
"time": "2023-06-08T12:52:13+00:00"
}
],
"packages-dev": [

2329
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -2,20 +2,30 @@
"name": "antcms",
"description": "A simple CMS built with PHP and Markdown",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "npm-run-all compile-bs-css compile-tw-css min-bs-css min-tw-css",
"compile-bs-css": "sass --load-path=node_modules --no-source-map src/Themes/Bootstrap/Assets/styles.scss src/Themes/Bootstrap/Assets/Dist/Bootstrap.min.css",
"compile-tw-css": "npx tailwindcss -i ./src/Themes/Default/Assets/tailwind.css -o ./src/Themes/Default/Assets/Dist/tailwind.css",
"min-bs-css": "lightningcss --minify --browserslist ./src/Themes/Bootstrap/Assets/Dist/Bootstrap.min.css -o ./src/Themes/Bootstrap/Assets/Dist/Bootstrap.min.css",
"min-tw-css": "lightningcss --minify --browserslist ./src/Themes/Default/Assets/Dist/tailwind.css -o ./src/Themes/Default/Assets/Dist/tailwind.css"
},
"repository": {
"type": "git",
"url": "git+https://github.com/BelleNottelling/AntCMS.git"
"url": "git+https://github.com/AntCMS-org/AntCMS.git"
},
"author": "BelleNottelling",
"bugs": {
"url": "https://github.com/BelleNottelling/AntCMS/issues"
"url": "https://github.com/AntCMS-org/AntCMS/issues"
},
"homepage": "https://github.com/BelleNottelling/AntCMS#readme",
"homepage": "https://github.com/AntCMS-org/AntCMS#readme",
"devDependencies": {
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
"tailwindcss": "^3.3.5"
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.9",
"lightningcss-cli": "^1.21.5",
"npm-run-all": "^4.1.5",
"sass": "^1.63.2",
"tailwindcss": "^3.3.2"
},
"dependencies": {
"bootstrap": "^5.3.0"
}
}

View file

@ -81,8 +81,8 @@ class AntAuth
{
setcookie("auth", "valid");
$siteInfo = AntConfig::currentConfig('siteInfo');
header('WWW-Authenticate: Basic realm="' . $siteInfo['siteTitle'] . '"');
$title = AntConfig::currentConfig('siteInfo.siteTitle');
header('WWW-Authenticate: Basic realm="' . $title . '"');
http_response_code(401);
echo 'You must enter a valid username and password to access this page';
exit;

View file

@ -23,7 +23,7 @@ class AntCMS
*/
public function renderPage(string $page)
{
$start_time = hrtime(true);
$start_time = microtime(true);
$content = $this->getPage($page);
$themeConfig = Self::getThemeConfig();
@ -43,10 +43,12 @@ class AntCMS
];
$pageTemplate = $this->antTwig->renderWithTiwg($pageTemplate, $params);
$elapsed_time = (hrtime(true) - $start_time) / 1e+6;
$end_time = microtime(true);
$elapsed_time = round($end_time - $start_time, 4);
if (AntConfig::currentConfig('debug')) {
$pageTemplate = str_replace('<!--AntCMS-Debug-->', '<p>Took ' . $elapsed_time . ' milliseconds to render the page. </p>', $pageTemplate);
$pageTemplate = str_replace('<!--AntCMS-Debug-->', '<p>Took ' . $elapsed_time . ' seconds to render the page. </p>', $pageTemplate);
}
return $pageTemplate;
@ -124,27 +126,25 @@ class AntCMS
*/
public static function getThemeTemplate(string $layout = 'default', string $theme = null)
{
$theme ??= AntConfig::currentConfig('activeTheme');
$theme = $theme ?? AntConfig::currentConfig('activeTheme');
if (!is_dir(antThemePath . DIRECTORY_SEPARATOR . $theme)) {
if (!is_dir(antThemePath . '/' . $theme)) {
$theme = 'Default';
}
$basePath = AntTools::repairFilePath(antThemePath . DIRECTORY_SEPARATOR . $theme);
if (strpos($layout, '_') !== false) {
$layoutPrefix = explode('_', $layout)[0];
$templatePath = $basePath . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR . $layoutPrefix;
$templatePath = AntTools::repairFilePath(antThemePath . '/' . $theme . '/' . 'Templates' . '/' . $layoutPrefix);
$defaultTemplates = AntTools::repairFilePath(antThemePath . '/Default/Templates' . '/' . $layoutPrefix);
} else {
$templatePath = $basePath . DIRECTORY_SEPARATOR . 'Templates';
$templatePath = AntTools::repairFilePath(antThemePath . '/' . $theme . '/' . 'Templates');
$defaultTemplates = AntTools::repairFilePath(antThemePath . '/Default/Templates');
}
try {
$template = @file_get_contents($templatePath . DIRECTORY_SEPARATOR . $layout . '.html.twig');
$template = @file_get_contents(AntTools::repairFilePath($templatePath . '/' . $layout . '.html.twig'));
if (empty($template)) {
$template = file_get_contents($defaultTemplates . DIRECTORY_SEPARATOR . $layout . '.html.twig');
$template = file_get_contents(AntTools::repairFilePath($defaultTemplates . '/' . $layout . '.html.twig'));
}
} catch (\Exception) {
}

View file

@ -17,10 +17,10 @@ class AntCache
/**
* Creates a new cache object, sets the correct caching type. ('auto', 'filesystem', 'apcu', or 'none')
*/
public function __construct(null|string $mode = null)
public function __construct()
{
$mode = $mode ?? AntConfig::currentConfig('cacheMode') ?? 'auto';
$config = AntConfig::currentConfig();
$mode = $config['cacheMode'] ?? 'auto';
switch ($mode) {
case 'none':
$this->cacheType = self::noCache;
@ -86,9 +86,11 @@ class AntCache
return file_get_contents($cachePath);
case self::apcuCache:
$apcuKey = $this->cacheKeyApcu . $key;
$success = false;
$result = apcu_fetch($apcuKey, $success);
return $success ? $result : false;
if (apcu_exists($apcuKey)) {
return apcu_fetch($apcuKey);
} else {
return false;
}
default:
return false;
}
@ -127,20 +129,16 @@ class AntCache
*/
public function createCacheKey(string $content, string $salt = 'cache')
{
return hash(self::getHashAlgo(), $content . $salt);
}
/**
* Generates a unique cache key for a file and a salt value.
* The salt is used to ensure that each cache key is unique to each component, even if multiple components are using the same source content but caching different results.
*
* @param string $filePath The file path to create a cache key for.
* @param string $salt An optional salt value to use in the cache key generation. Default is 'cache'.
* @return string The generated cache key.
*/
public function createCacheKeyFile(string $filePath, string $salt = 'cache')
{
return hash_file(self::getHashAlgo(), $filePath) . $salt;
/**
* If the server is modern enough to have xxh128, use that. It is really fast and still produces long hashes
* If not, use MD4 since it's still quite fast.
* Source: https://php.watch/articles/php-hash-benchmark
*/
if (defined('HAS_XXH128')) {
return hash('xxh128', $content . $salt);
} else {
return hash('md4', $content . $salt);
}
}
public static function clearCache(): void
@ -164,14 +162,4 @@ class AntCache
}
}
}
public static function getHashAlgo(): string
{
/**
* If the server is modern enough to have xxh128, use that. It is really fast and still produces long hashes
* If not, use MD4 since it's still quite fast.
* Source: https://php.watch/articles/php-hash-benchmark
*/
return defined('HAS_XXH128') ? 'xxh128' : 'md4';
}
}

View file

@ -48,8 +48,7 @@ class AntConfig
*/
public static function currentConfig(?string $key = null)
{
// FS cache enabled to save ~10% of the time to deliver the file page.
$config = AntYaml::parseFile(antConfigFile, true);
$config = AntYaml::parseFile(antConfigFile);
if (is_null($key)) {
return $config;
} else {
@ -58,6 +57,7 @@ class AntConfig
}
}
/**
* @param array<mixed> $array
* @param array<mixed> $keys
@ -67,11 +67,13 @@ class AntConfig
{
foreach ($keys as $key) {
if (isset($array[$key])) {
return $array[$key];
$array = $array[$key];
} else {
return null;
}
}
return $array;
}
/**

View file

@ -52,18 +52,21 @@ class AntPages
AntYaml::saveFile(antPagesList, $pageList);
}
public static function getPages():array
/** @return array<mixed> */
public static function getPages()
{
return AntYaml::parseFile(antPagesList);
}
/**
* @param string $currentPage optional - What page is the active page. Used for highlighting the active page in the navbar
* @return string
*/
public static function generateNavigation(string $navTemplate = '', string $currentPage = ''): string
public static function generateNavigation(string $navTemplate = '', string $currentPage = '')
{
$pages = AntPages::getPages();
$antCache = new AntCache;
$antTwig = new AntTwig();
$theme = AntConfig::currentConfig('activeTheme');
$cacheKey = $antCache->createCacheKey(json_encode($pages), $theme . $currentPage);
@ -71,7 +74,7 @@ class AntPages
if ($antCache->isCached($cacheKey)) {
$cachedContent = $antCache->getCache($cacheKey);
if (!empty($cachedContent)) {
if ($cachedContent !== false && !empty($cachedContent)) {
return $cachedContent;
}
}
@ -88,7 +91,6 @@ class AntPages
}
}
$antTwig = new AntTwig();
$navHTML = $antTwig->renderWithTiwg($navTemplate, array('pages' => $pages));
$antCache->setCache($cacheKey, $navHTML);

View file

@ -51,7 +51,7 @@ class AntRouting
$isHttps = !empty($scheme) && (strcasecmp('on', $scheme) == 0 || strcasecmp('https', $scheme) == 0);
if (!$isHttps) {
$url = 'https://' . AntTools::repairURL($this->baseUrl . $this->requestUri);
$url = 'https://' . AntTools::repairURL($this->baseUrl . '/' . $this->requestUri);
header('Location: ' . $url);
exit;
}

View file

@ -14,7 +14,7 @@ class AntTwig
$twigCache = (AntConfig::currentConfig('enableCache') !== 'none') ? AntCachePath : false;
$this->theme = $theme ?? AntConfig::currentConfig('activeTheme');
if (!is_dir(antThemePath . DIRECTORY_SEPARATOR . $this->theme)) {
if (!is_dir(antThemePath . '/' . $this->theme)) {
$this->theme = 'Default';
}

View file

@ -7,25 +7,12 @@ use Symfony\Component\Yaml\Yaml;
class AntYaml
{
public static function parseFile(string $file, bool $fileCache = false): array
/**
* @return array<mixed>
*/
public static function parseFile(string $file)
{
if ($fileCache) {
$antCache = new AntCache('filesystem');
} else {
$antCache = new AntCache();
}
$cacheKey = $antCache->createCacheKeyFile($file);
if ($antCache->isCached($cacheKey)) {
$parsed = json_decode($antCache->getCache($cacheKey), true);
}
if (empty($parsed)) {
$parsed = Yaml::parseFile($file);
$antCache->setCache($cacheKey, json_encode($parsed));
}
return $parsed;
return Yaml::parseFile($file);
}
/**
@ -40,7 +27,7 @@ class AntYaml
/**
* @return array<mixed>|null
*/
public static function parseYaml(string $yaml): ?array
public static function parseYaml(string $yaml)
{
try {
return Yaml::parse($yaml);

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,33 @@
// scss-docs-start import-stack
// Configuration
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables";
@import "bootstrap/scss/variables-dark";
@import "bootstrap/scss/maps";
@import "bootstrap/scss/mixins";
@import "bootstrap/scss/utilities";
// Layout & components
@import "bootstrap/scss/root";
@import "bootstrap/scss/reboot";
@import "bootstrap/scss/type";
@import "bootstrap/scss/images";
@import "bootstrap/scss/containers";
@import "bootstrap/scss/grid";
@import "bootstrap/scss/tables";
@import "bootstrap/scss/forms";
@import "bootstrap/scss/buttons";
@import "bootstrap/scss/transitions";
@import "bootstrap/scss/dropdown";
@import "bootstrap/scss/button-group";
@import "bootstrap/scss/nav";
@import "bootstrap/scss/navbar";
@import "bootstrap/scss/list-group";
@import "bootstrap/scss/card";
// Helpers
//@import "bootstrap/scss/helpers";
// Utilities
@import "bootstrap/scss/utilities/api";
// scss-docs-end import-stack

View file

@ -8,12 +8,8 @@
<meta name="author" content="{{ AntCMSAuthor }}">
<meta name="keywords" content="{{ AntCMSKeywords }}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-aFq/bzH65dt+w6FI2ooMVUpc+21e0SRygnTpmBvdBgSdnuTN7QbdgL+OapgHtvPp" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-qKXV1j0HvMUeCBQ+QVp7JcfGl760yU08IQ+GpUo5hlbpg51QRiuqHAJz8+BrxE/N"
crossorigin="anonymous"></script>
<link href="{{ "Themes/Bootstrap/Assets/Dist/Bootstrap.min.css"|absUrl }}" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha2/dist/js/bootstrap.bundle.min.js" integrity="sha384-qKXV1j0HvMUeCBQ+QVp7JcfGl760yU08IQ+GpUo5hlbpg51QRiuqHAJz8+BrxE/N" crossorigin="anonymous"></script>
<script src="{{ "Themes/Default/Assets/Dist/TinyZoom.js"|absUrl }}" defer></script>
<style>

File diff suppressed because one or more lines are too long