From ecf94d36da5ee242e7daf4626c139aa7252a2cdf Mon Sep 17 00:00:00 2001 From: Belle Aerni Date: Thu, 19 Jan 2023 18:01:03 -0800 Subject: [PATCH] Removed the keyword generator It didn't really work, added a bunch to the overall file size, and computer-generated keywords just won't compare to human created ones, unless you're to use AI or a particularly advanced algorithm, which I feel is outside the scope of the project. I've left the class in place, so if needed, it'll be really easy to add it back --- composer.json | 1 - composer.lock | 125 ++++++++++--------------------------- phpstan.neon | 2 + readme.md | 1 - src/AntCMS/AntCMS.php | 5 +- src/AntCMS/AntConfig.php | 2 - src/AntCMS/AntPages.php | 4 +- src/Content/index.md | 1 - tests/ConfigTest.php | 1 - tests/Includes/config.yaml | 1 - 10 files changed, 40 insertions(+), 103 deletions(-) diff --git a/composer.json b/composer.json index ac39c00..27d1ee5 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,6 @@ "elgigi/commonmark-emoji": "^2.0", "twig/twig": "^3.5", "shapecode/twig-string-loader": "^1.1", - "donatello-za/rake-php-plus": "^1.0", "embed/embed": "^4.4", "nyholm/psr7": "^1.5" }, diff --git a/composer.lock b/composer.lock index 0a03b75..bb8c750 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2b32ca6ab5978e9e11f071023d5dd4c5", + "content-hash": "c5ca069c1cb40f460516e523125a2eca", "packages": [ { "name": "composer/ca-bundle", @@ -157,66 +157,6 @@ }, "time": "2022-10-27T11:44:00+00:00" }, - { - "name": "donatello-za/rake-php-plus", - "version": "v1.0.18", - "source": { - "type": "git", - "url": "https://github.com/Donatello-za/rake-php-plus.git", - "reference": "e9e9c0862b3dc953d288e8f42c76e4ceaeca0619" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Donatello-za/rake-php-plus/zipball/e9e9c0862b3dc953d288e8f42c76e4ceaeca0619", - "reference": "e9e9c0862b3dc953d288e8f42c76e4ceaeca0619", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-mbstring": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "php": ">=5.5.0", - "phpunit/phpunit": "~4.0|~5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.13-dev" - } - }, - "autoload": { - "psr-4": { - "DonatelloZa\\RakePlus\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Don Schoeman", - "email": "ta.maximus@gmail.com" - } - ], - "description": "Yet another PHP implementation of the Rapid Automatic Keyword Extraction algorithm (RAKE).", - "homepage": "https://github.com/Donatello-za/rake-php-plus", - "keywords": [ - "Algorithm", - "automatic", - "extraction", - "keyword", - "rake", - "rapid" - ], - "support": { - "issues": "https://github.com/Donatello-za/rake-php-plus/issues", - "source": "https://github.com/Donatello-za/rake-php-plus" - }, - "time": "2022-02-23T18:42:03+00:00" - }, { "name": "elgigi/commonmark-emoji", "version": "2.0.0", @@ -700,16 +640,16 @@ }, { "name": "nette/utils", - "version": "v3.2.8", + "version": "v3.2.9", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368" + "reference": "c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/02a54c4c872b99e4ec05c4aec54b5a06eb0f6368", - "reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368", + "url": "https://api.github.com/repos/nette/utils/zipball/c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c", + "reference": "c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c", "shasum": "" }, "require": { @@ -719,6 +659,7 @@ "nette/di": "<3.0.6" }, "require-dev": { + "jetbrains/phpstorm-attributes": "dev-master", "nette/tester": "~2.0", "phpstan/phpstan": "^1.0", "tracy/tracy": "^2.3" @@ -779,9 +720,9 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v3.2.8" + "source": "https://github.com/nette/utils/tree/v3.2.9" }, - "time": "2022-09-12T23:36:20+00:00" + "time": "2023-01-18T03:26:20+00:00" }, { "name": "nyholm/psr7", @@ -1857,16 +1798,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.2", + "version": "v4.15.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", "shasum": "" }, "require": { @@ -1907,9 +1848,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" }, - "time": "2022-11-12T15:38:23+00:00" + "time": "2023-01-16T22:05:37+00:00" }, { "name": "phar-io/manifest", @@ -2024,16 +1965,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.11", + "version": "1.9.14", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "60f3d68481eef216199eae7a2603cd5fe124d464" + "reference": "e5fcc96289cf737304286a9b505fbed091f02e58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/60f3d68481eef216199eae7a2603cd5fe124d464", - "reference": "60f3d68481eef216199eae7a2603cd5fe124d464", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5fcc96289cf737304286a9b505fbed091f02e58", + "reference": "e5fcc96289cf737304286a9b505fbed091f02e58", "shasum": "" }, "require": { @@ -2063,7 +2004,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.11" + "source": "https://github.com/phpstan/phpstan/tree/1.9.14" }, "funding": [ { @@ -2079,7 +2020,7 @@ "type": "tidelift" } ], - "time": "2023-01-12T14:04:13+00:00" + "time": "2023-01-19T10:47:09+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2401,20 +2342,20 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.27", + "version": "9.5.28", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e", + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -2483,7 +2424,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28" }, "funding": [ { @@ -2499,20 +2440,20 @@ "type": "tidelift" } ], - "time": "2022-12-09T07:31:23+00:00" + "time": "2023-01-14T12:32:24+00:00" }, { "name": "rector/rector", - "version": "0.15.5", + "version": "0.15.7", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "b27945f63527b540dba09a4f4612bc738da9c285" + "reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/b27945f63527b540dba09a4f4612bc738da9c285", - "reference": "b27945f63527b540dba09a4f4612bc738da9c285", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/a43370e1f4c47aaa96c0f85bf9db73db1be7552f", + "reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f", "shasum": "" }, "require": { @@ -2547,7 +2488,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.5" + "source": "https://github.com/rectorphp/rector/tree/0.15.7" }, "funding": [ { @@ -2555,7 +2496,7 @@ "type": "github" } ], - "time": "2023-01-12T19:13:08+00:00" + "time": "2023-01-13T21:14:19+00:00" }, { "name": "sebastian/cli-parser", diff --git a/phpstan.neon b/phpstan.neon index b9d8473..763dfad 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,3 +6,5 @@ parameters: analyse: - src/Vendor - src/Cache + - src/AntCMS/AntKeywords.php + diff --git a/readme.md b/readme.md index 487c959..56fe40e 100644 --- a/readme.md +++ b/readme.md @@ -45,7 +45,6 @@ AntCMS stores its configuration in the human-readable "yaml" file format. The ma - `siteTitle: AntCMS` - This configuration sets the title of your AntCMS website. - `forceHTTPS: true` - Set to 'true' by default, enables HTTPs redirection. - `activeTheme: Default` - Sets what theme AntCMS should use. should match the folder name of the theme you want to use. -- `generateKeywords: false` - AntCMS can automatically generate keywords for content if they aren't provided. Due to the limitations of this feature, it's currently disabled while we evaluate it's value in the project, but you can manually enable it if you want. - `enableCache: true` - Enables or disables file caching in AntCMS. - `admin:` - `username: 'Admin'` - The username used to access any parts of AntCMS that may require authentication. diff --git a/src/AntCMS/AntCMS.php b/src/AntCMS/AntCMS.php index f00314b..b79a528 100644 --- a/src/AntCMS/AntCMS.php +++ b/src/AntCMS/AntCMS.php @@ -178,7 +178,7 @@ class AntCMS 'title' => 'AntCMS', 'author' => 'AntCMS', 'description' => 'AntCMS', - 'keywords' => trim($AntKeywords->generateKeywords($pageContent)), + 'keywords' => '', ]; // First get the AntCMS header and store it in the matches varible @@ -199,8 +199,7 @@ class AntCMS $pageHeaders['description'] = trim($matches[1] ?? 'AntCMS'); preg_match('/Keywords: (.*)/', $header, $matches); - $keywods = $matches[1] ?? $AntKeywords->generateKeywords($pageContent); - $pageHeaders['keywords'] = trim($keywods); + $pageHeaders['keywords'] = trim($matches[1] ?? ''); } return $pageHeaders; diff --git a/src/AntCMS/AntConfig.php b/src/AntCMS/AntConfig.php index 840b9b7..ffe93e7 100644 --- a/src/AntCMS/AntConfig.php +++ b/src/AntCMS/AntConfig.php @@ -11,7 +11,6 @@ class AntConfig 'siteInfo', 'forceHTTPS', 'activeTheme', - 'generateKeywords', 'enableCache', 'admin', 'debug', @@ -30,7 +29,6 @@ class AntConfig ], 'forceHTTPS' => true, 'activeTheme' => 'Default', - 'generateKeywords' => false, 'enableCache' => true, 'admin' => array( 'username' => 'Admin', diff --git a/src/AntCMS/AntPages.php b/src/AntCMS/AntPages.php index 9ab9724..82de787 100644 --- a/src/AntCMS/AntPages.php +++ b/src/AntCMS/AntPages.php @@ -23,7 +23,7 @@ class AntPages $pageHeader = AntCMS::getPageHeaders($pageContent); // Because we are only getting a list of files with the 'md' extension, we can blindly strip off the extension from each path. - // Doing this creates more profesional URLs as AntCMS will automatically add the 'md' extenstion during the page rendering process. + // Doing this creates more profesional looking URLs as AntCMS can automatically add the 'md' extenstion during the page rendering process. $pageFunctionalPath = substr(str_replace(antContentPath, "", $page), 0, -3); if ($pageFunctionalPath == '/index') { @@ -40,6 +40,8 @@ class AntPages 'functionalPagePath' => $pageFunctionalPath, 'showInNav' => true, ); + + // Move the index page to the first item in the page list, so it appears as the first item in the navbar. if ($pageFunctionalPath === '/') { array_unshift($pageList, $currentPage); } else { diff --git a/src/Content/index.md b/src/Content/index.md index ab69cb6..2341743 100644 --- a/src/Content/index.md +++ b/src/Content/index.md @@ -48,7 +48,6 @@ AntCMS stores its configuration in the human-readable yaml file format. The main - `siteTitle: AntCMS` - This configuration sets the title of your AntCMS website. - `forceHTTPS: true` - Set to 'true' by default, enables HTTPs redirection. - `activeTheme: Default` - Sets what theme AntCMS should use. should match the folder name of the theme you want to use. -- `generateKeywords: true` - AntCMS will automatically attempt to generate keywords for each page if they don't have keywords defined. Set this to `false` to disable this. Note: this feature is very limited, we highly suggest manually creating keywords for your content. - `enableCache: true` - Enables or disables file caching in AntCMS. - `admin:` - `username: 'Admin'` - The username used to access any parts of AntCMS that may require authentication. diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index 6d82b0d..a44fee2 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -15,7 +15,6 @@ class ConfigTest extends TestCase 'siteInfo', 'forceHTTPS', 'activeTheme', - 'generateKeywords', 'enableCache', 'admin', 'debug', diff --git a/tests/Includes/config.yaml b/tests/Includes/config.yaml index 7a2bcc3..c8d3de2 100644 --- a/tests/Includes/config.yaml +++ b/tests/Includes/config.yaml @@ -2,7 +2,6 @@ siteInfo: siteTitle: 'AntCMS' forceHTTPS: true activeTheme: Default -generateKeywords: false enableCache: true admin: username: Admin