diff --git a/.github/screenshot.png b/.github/screenshot.png index 7330ed0..bc885fe 100644 Binary files a/.github/screenshot.png and b/.github/screenshot.png differ diff --git a/CHANGELOG.md b/CHANGELOG.md index eeea9a1..8588e9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ + +# [5.2.0](https://github.com/thathoff/kirby-git-content/compare/v5.1.0...v5.2.0) (2023-12-09) + +### Features +- Add support for Kirby 4 +- Configurable panel menu item + # [5.1.0](https://github.com/thathoff/kirby-git-content/compare/v5.0.2...v5.1.0) (2023-10-16) diff --git a/README.md b/README.md index 0fc3a77..ad18411 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Kirby Git Content -This is a plugin for [Kirby 3](http://getkirby.com/) that commits and pushes content changes made via the Panel to your git repository. +This is a plugin for [Kirby](http://getkirby.com/) that commits and pushes content changes made via the Panel to your git repository. ![Screnshot of Panel Area](/.github/screenshot.png?raw=true) ## Requirements -This plugin supports **Kirby from version 3.6** and requires **git version > 2.24** +This plugin supports **Kirby from version 3.6 (including Kirby 4)** and requires **git version > 2.24** ## Usage @@ -85,6 +85,8 @@ return [ - `disable` (Boolean): If set to `true`, the plugin won't initialize. (default: `false`) - `disableBranchManagement` (Boolean): If set to `true`, the options to create and switch branches are hidden. (default: `false`) - `helpText` (String): Supply a custom help text shown in the panel UI. (default: `null`) +- `menuIcon` (String): Supply a custom icon for the panel menu item. (default: `sitemap`) +- `menuLabel` (String): Supply a custom label for the panel menu item. (default: `Git Content`) ### Custom Commit Message diff --git a/composer.json b/composer.json index 8ae4e14..cb50f7b 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Plugin to track changes to content in a git repository.", "type": "kirby-plugin", "license": "MIT", - "version": "5.1.0", + "version": "5.2.0", "authors": [ { "name": "Markus Denhoff", @@ -23,7 +23,7 @@ "getkirby/composer-installer": "^1.1" }, "require-dev": { - "getkirby/cms": "^3.6.0" + "getkirby/cms": "^3.6.0|^4.0.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 7b2f1b9..fd090e7 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": "8fd5b0dc2db7adb891ec8ca781bc99d3", + "content-hash": "d4ee0cd8e95f163238f679b940786621", "packages": [ { "name": "czproject/git-php", @@ -107,6 +107,65 @@ } ], "packages-dev": [ + { + "name": "christian-riesen/base32", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/ChristianRiesen/base32.git", + "reference": "2e82dab3baa008e24a505649b0d583c31d31e894" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ChristianRiesen/base32/zipball/2e82dab3baa008e24a505649b0d583c31d31e894", + "reference": "2e82dab3baa008e24a505649b0d583c31d31e894", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.17", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^8.5.13 || ^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Base32\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Riesen", + "email": "chris.riesen@gmail.com", + "homepage": "http://christianriesen.com", + "role": "Developer" + } + ], + "description": "Base32 encoder/decoder according to RFC 4648", + "homepage": "https://github.com/ChristianRiesen/base32", + "keywords": [ + "base32", + "decode", + "encode", + "rfc4648" + ], + "support": { + "issues": "https://github.com/ChristianRiesen/base32/issues", + "source": "https://github.com/ChristianRiesen/base32/tree/1.6.0" + }, + "time": "2021-02-26T10:19:33+00:00" + }, { "name": "claviska/simpleimage", "version": "4.0.6", @@ -243,16 +302,16 @@ }, { "name": "filp/whoops", - "version": "2.15.3", + "version": "2.15.4", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "c83e88a30524f9360b11f585f71e6b17313b7187" + "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/c83e88a30524f9360b11f585f71e6b17313b7187", - "reference": "c83e88a30524f9360b11f585f71e6b17313b7187", + "url": "https://api.github.com/repos/filp/whoops/zipball/a139776fa3f5985a50b509f2a02ff0f709d2a546", + "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546", "shasum": "" }, "require": { @@ -302,7 +361,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.15.3" + "source": "https://github.com/filp/whoops/tree/2.15.4" }, "funding": [ { @@ -310,23 +369,24 @@ "type": "github" } ], - "time": "2023-07-13T12:00:00+00:00" + "time": "2023-11-03T12:00:00+00:00" }, { "name": "getkirby/cms", - "version": "3.9.7", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/getkirby/kirby.git", - "reference": "8bb22df36cd6ef9728153a9081c63b875fce1ffc" + "reference": "40eae8e8a4e1705412c64de63984376eeaa8b259" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getkirby/kirby/zipball/8bb22df36cd6ef9728153a9081c63b875fce1ffc", - "reference": "8bb22df36cd6ef9728153a9081c63b875fce1ffc", + "url": "https://api.github.com/repos/getkirby/kirby/zipball/40eae8e8a4e1705412c64de63984376eeaa8b259", + "reference": "40eae8e8a4e1705412c64de63984376eeaa8b259", "shasum": "" }, "require": { + "christian-riesen/base32": "1.6.0", "claviska/simpleimage": "4.0.6", "composer/semver": "3.4.0", "ext-ctype": "*", @@ -340,15 +400,15 @@ "ext-mbstring": "*", "ext-openssl": "*", "ext-simplexml": "*", - "filp/whoops": "2.15.3", + "filp/whoops": "2.15.4", "getkirby/composer-installer": "^1.2.1", - "laminas/laminas-escaper": "2.12.0", + "laminas/laminas-escaper": "2.13.0", "michelf/php-smartypants": "1.8.1", - "php": ">=8.0.0 <8.3.0", - "phpmailer/phpmailer": "6.8.1", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "phpmailer/phpmailer": "6.9.1", "symfony/polyfill-intl-idn": "1.28.0", "symfony/polyfill-mbstring": "1.28.0", - "symfony/yaml": "5.4.23" + "symfony/yaml": "6.3.8" }, "replace": { "symfony/polyfill-php72": "*" @@ -360,6 +420,7 @@ "ext-fileinfo": "Improved mime type detection for files", "ext-intl": "Improved i18n number formatting", "ext-memcached": "Support for the Memcached cache driver", + "ext-sodium": "Support for the crypto class and more robust session handling", "ext-zip": "Support for ZIP archive file functions", "ext-zlib": "Sanitization and validation for svgz files" }, @@ -392,7 +453,7 @@ "homepage": "https://getkirby.com" } ], - "description": "The Kirby 3 core", + "description": "The Kirby core", "homepage": "https://getkirby.com", "keywords": [ "cms", @@ -411,37 +472,37 @@ "type": "custom" } ], - "time": "2023-10-06T10:40:05+00:00" + "time": "2023-11-28T09:04:45+00:00" }, { "name": "laminas/laminas-escaper", - "version": "2.12.0", + "version": "2.13.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-escaper.git", - "reference": "ee7a4c37bf3d0e8c03635d5bddb5bb3184ead490" + "reference": "af459883f4018d0f8a0c69c7a209daef3bf973ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/ee7a4c37bf3d0e8c03635d5bddb5bb3184ead490", - "reference": "ee7a4c37bf3d0e8c03635d5bddb5bb3184ead490", + "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/af459883f4018d0f8a0c69c7a209daef3bf973ba", + "reference": "af459883f4018d0f8a0c69c7a209daef3bf973ba", "shasum": "" }, "require": { "ext-ctype": "*", "ext-mbstring": "*", - "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0" + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" }, "conflict": { "zendframework/zend-escaper": "*" }, "require-dev": { - "infection/infection": "^0.26.6", - "laminas/laminas-coding-standard": "~2.4.0", + "infection/infection": "^0.27.0", + "laminas/laminas-coding-standard": "~2.5.0", "maglnet/composer-require-checker": "^3.8.0", - "phpunit/phpunit": "^9.5.18", - "psalm/plugin-phpunit": "^0.17.0", - "vimeo/psalm": "^4.22.0" + "phpunit/phpunit": "^9.6.7", + "psalm/plugin-phpunit": "^0.18.4", + "vimeo/psalm": "^5.9" }, "type": "library", "autoload": { @@ -473,7 +534,7 @@ "type": "community_bridge" } ], - "time": "2022-10-10T10:11:09+00:00" + "time": "2023-10-10T08:35:13+00:00" }, { "name": "league/color-extractor", @@ -592,16 +653,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.8.1", + "version": "v6.9.1", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "e88da8d679acc3824ff231fdc553565b802ac016" + "reference": "039de174cd9c17a8389754d3b877a2ed22743e18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e88da8d679acc3824ff231fdc553565b802ac016", - "reference": "e88da8d679acc3824ff231fdc553565b802ac016", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/039de174cd9c17a8389754d3b877a2ed22743e18", + "reference": "039de174cd9c17a8389754d3b877a2ed22743e18", "shasum": "" }, "require": { @@ -621,6 +682,7 @@ "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { + "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication", "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", "ext-openssl": "Needed for secure SMTP sending and DKIM signing", "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", @@ -660,7 +722,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.1" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.9.1" }, "funding": [ { @@ -668,7 +730,7 @@ "type": "github" } ], - "time": "2023-08-29T08:26:30+00:00" + "time": "2023-11-25T22:23:28+00:00" }, { "name": "psr/log", @@ -722,7 +784,7 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.3.0", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", @@ -769,7 +831,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" }, "funding": [ { @@ -1125,31 +1187,28 @@ }, { "name": "symfony/yaml", - "version": "v5.4.23", + "version": "v6.3.8", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b" + "reference": "3493af8a8dad7fa91c77fa473ba23ecd95334a92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4cd2e3ea301aadd76a4172756296fe552fb45b0b", - "reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b", + "url": "https://api.github.com/repos/symfony/yaml/zipball/3493af8a8dad7fa91c77fa473ba23ecd95334a92", + "reference": "3493af8a8dad7fa91c77fa473ba23ecd95334a92", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<5.3" + "symfony/console": "<5.4" }, "require-dev": { - "symfony/console": "^5.3|^6.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "symfony/console": "^5.4|^6.0" }, "bin": [ "Resources/bin/yaml-lint" @@ -1180,7 +1239,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.23" + "source": "https://github.com/symfony/yaml/tree/v6.3.8" }, "funding": [ { @@ -1196,7 +1255,7 @@ "type": "tidelift" } ], - "time": "2023-04-23T19:33:36+00:00" + "time": "2023-11-06T10:58:05+00:00" } ], "aliases": [], diff --git a/src/KirbyGit.php b/src/KirbyGit.php index 3052859..cd65122 100644 --- a/src/KirbyGit.php +++ b/src/KirbyGit.php @@ -130,59 +130,59 @@ public function getHooks() * Site */ 'site.update:after' => function ($newSite) use ($gitHelper) { - $gitHelper->kirbyChange('update', 'site', [$newSite->contentFileDirectory()], $newSite); + $gitHelper->kirbyChange('update', 'site', [$newSite->root()], $newSite); }, /* * Pages */ 'page.create:after' => function ($page) use ($gitHelper) { - $gitHelper->kirbyChange('create', 'page', [$page->contentFileDirectory()], $page->id()); + $gitHelper->kirbyChange('create', 'page', [$page->root()], $page->id()); }, 'page.update:after' => function ($newPage) use ($gitHelper) { - $gitHelper->kirbyChange('update', 'page', [$newPage->contentFileDirectory()], $newPage->id()); + $gitHelper->kirbyChange('update', 'page', [$newPage->root()], $newPage->id()); }, 'page.delete:after' => function ($status, $page) use ($gitHelper) { - $gitHelper->kirbyChange('delete', 'page', [$page->contentFileDirectory()], $page->id()); + $gitHelper->kirbyChange('delete', 'page', [$page->root()], $page->id()); }, 'page.changeNum:after' => function ($newPage) use ($gitHelper) { $parent = $newPage->parent() ?: kirby()->site(); - $gitHelper->kirbyChange('sort', 'page', [$parent->contentFileDirectory()], $newPage->id()); + $gitHelper->kirbyChange('sort', 'page', [$parent->root()], $newPage->id()); }, 'page.changeSlug:after' => function ($newPage, $oldPage) use ($gitHelper) { - $gitHelper->kirbyChange('update', 'page', [$newPage->contentFileDirectory(), $oldPage->contentFileDirectory()], $newPage->id()); + $gitHelper->kirbyChange('update', 'page', [$newPage->root(), $oldPage->root()], $newPage->id()); }, 'page.changeStatus:after' => function ($newPage, $oldPage) use ($gitHelper) { $parent = $newPage->parent() ?: kirby()->site(); - $gitHelper->kirbyChange('update', 'page', [$parent->contentFileDirectory(), $oldPage->contentFileDirectory()], $newPage->id()); + $gitHelper->kirbyChange('update', 'page', [$parent->root(), $oldPage->root()], $newPage->id()); }, 'page.changeTemplate:after' => function ($newPage) use ($gitHelper) { - $gitHelper->kirbyChange('update', 'page', [$newPage->contentFileDirectory()], $newPage->id()); + $gitHelper->kirbyChange('update', 'page', [$newPage->root()], $newPage->id()); }, 'page.changeTitle:after' => function ($newPage) use ($gitHelper) { - $gitHelper->kirbyChange('update', 'page', [$newPage->contentFileDirectory()], $newPage->id()); + $gitHelper->kirbyChange('update', 'page', [$newPage->root()], $newPage->id()); }, /* * File */ 'file.create:after' => function ($file) use ($gitHelper) { - $gitHelper->kirbyChange('create', 'file', [$file->contentFileDirectory()], $file->id()); + $gitHelper->kirbyChange('create', 'file', [dirname($file->root())], $file->id()); }, 'file.replace:after' => function ($newFile) use ($gitHelper) { - $gitHelper->kirbyChange('replace', 'file', [$newFile->contentFileDirectory()], $newFile->id()); + $gitHelper->kirbyChange('replace', 'file', [dirname($newFile->root())], $newFile->id()); }, 'file.changeName:after' => function ($newFile) use ($gitHelper) { - $gitHelper->kirbyChange('rename', 'file', [$newFile->contentFileDirectory()], $newFile->id()); + $gitHelper->kirbyChange('rename', 'file', [dirname($newFile->root())], $newFile->id()); }, 'file.update:after' => function ($newFile) use ($gitHelper) { - $gitHelper->kirbyChange('update', 'file', [$newFile->contentFileDirectory()], $newFile->id()); + $gitHelper->kirbyChange('update', 'file', [dirname($newFile->root())], $newFile->id()); }, 'file.changeSort:after' => function ($newFile) use ($gitHelper) { - $gitHelper->kirbyChange('sort', 'file', [$newFile->contentFileDirectory()], $newFile->id()); + $gitHelper->kirbyChange('sort', 'file', [dirname($newFile->root())], $newFile->id()); }, 'file.delete:after' => function ($status, $file) use ($gitHelper) { - $gitHelper->kirbyChange('delete', 'file', [$file->contentFileDirectory()], $file->id()); + $gitHelper->kirbyChange('delete', 'file', [dirname($file->root())], $file->id()); }, ]; } diff --git a/src/areas/git-content.php b/src/areas/git-content.php index ed10493..4eaba1b 100644 --- a/src/areas/git-content.php +++ b/src/areas/git-content.php @@ -3,8 +3,8 @@ use Thathoff\GitContent\KirbyGitHelper; return [ - 'label' => 'Git Content', - 'icon' => 'sitemap', + 'label' => option('thathoff.git-content.menuLabel', 'Git Content'), + 'icon' => option('thathoff.git-content.menuIcon', 'sitemap'), 'menu' => true, 'link' => 'git-content', 'dialogs' => [