diff --git a/App.php b/App.php index 3c5beff..c14ee41 100644 --- a/App.php +++ b/App.php @@ -9,6 +9,7 @@ namespace SeaCMS; use Exception; use Pico; +use SeacmsAppPlugin; use Throwable; set_error_handler(function ( @@ -74,6 +75,7 @@ class App self::PLUGINS_PATH, // plugins dir self::THEMES_PATH // themes dir ); + $this->pico->loadPlugin(new SeacmsAppPlugin($this->pico)); } public function runPico(): string diff --git a/SeacmsAppPlugin.php b/SeacmsAppPlugin.php new file mode 100644 index 0000000..a3eb84e --- /dev/null +++ b/SeacmsAppPlugin.php @@ -0,0 +1,38 @@ + 'createPage', // TODO only define for POST + ]; + } + + /** + * method to create a page + * @return JsonResponse + */ + public function createPage(string $pageName): JsonResponse + { + return new JsonResponse(501,['code'=>501,'reason'=>"work in progress for '$pageName'"]); + } + +} \ No newline at end of file diff --git a/composer.json b/composer.json index e43a632..8476a2e 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,8 @@ "ext-pcre": "*", "composer": "^2.4", "picocms/composer-installer": "dev-pico-3.0", - "picocms/pico": "dev-fix-compatibility-php8 as v3.0.0-alpha.2" + "picocms/pico": "dev-fix-compatibility-php8 as v3.0.0-alpha.2", + "seacms/seacms-api": "dev-master" }, "config": { "optimize-autoloader": true, @@ -30,7 +31,7 @@ "picocms/pico-theme": "Default pico theme : revision ^3.0" }, "autoload": { - "classmap": ["App.php"] + "classmap": ["App.php","SeacmsAppPlugin.php"] }, "extra": { "pico-plugin-dir": "vendor/picocms/plugins/", @@ -51,6 +52,10 @@ { "type": "vcs", "url": "https://git.defis.info/SeaCMS/pico" + }, + { + "type": "vcs", + "url": "https://git.defis.info/SeaCMS/seacms-api" } ] } diff --git a/composer.lock b/composer.lock index 6177546..f537cd1 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": "c22d26de0ca3ffbcb24e1c63a66f1a18", + "content-hash": "535fa433099487b5d89809ec52ba3b4d", "packages": [ { "name": "erusev/parsedown", @@ -258,6 +258,52 @@ }, "time": "2023-01-24T10:20:23+00:00" }, + { + "name": "seacms/seacms-api", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://git.defis.info/SeaCMS/seacms-api", + "reference": "49ad30f7da79a42d19df66b1b535897e55cc9bae" + }, + "require": { + "php": "^8.0" + }, + "default-branch": true, + "type": "pico-plugin", + "autoload": { + "psr-4": { + "SeaCMS\\Api\\": "src" + }, + "classmap": [ + "SeacmsApi.php" + ] + }, + "license": [ + "EUPL-1.2" + ], + "authors": [ + { + "name": "Jérémy Dufraisse", + "homepage": "https://github.com/J9rem", + "role": "SeaCMS developer" + } + ], + "description": "API route for SeaCMS", + "homepage": "https://git.defis.info/SeaCMS/seacms-api", + "keywords": [ + "api", + "pico", + "picocms", + "picocms-plugin" + ], + "support": { + "docs": "https://git.defis.info/SeaCMS/seacms-api/src/branch/master/README.md", + "issues": "https://git.defis.info/SeaCMS/seacms-api/issues", + "source": "https://git.defis.info/SeaCMS/seacms-api" + }, + "time": "2023-02-26T00:32:51+00:00" + }, { "name": "symfony/polyfill-ctype", "version": "v1.27.0", @@ -663,7 +709,8 @@ "minimum-stability": "dev", "stability-flags": { "picocms/composer-installer": 20, - "picocms/pico": 20 + "picocms/pico": 20, + "seacms/seacms-api": 20 }, "prefer-stable": true, "prefer-lowest": false,