-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
58 lines (52 loc) · 1.96 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
load([
'fundevogel\\gnupg' => 'src/GnuPG.php'
], __DIR__);
use Kirby\Cms\File;
use Fundevogel\GnuPG;
/**
* Kirby v3 utilities for GnuPG
*
* @package kirby3-gnupg
* @author Martin Folkers <[email protected]>
* @link https://fundevogel.de
* @copyright Kinder- und Jugendbuchhandlung Fundevogel
* @license https://opensource.org/licenses/MIT
*/
Kirby::plugin('fundevogel/gnupg', [
'blueprints' => [
'fields/pubkey' => __DIR__ . '/blueprints/field.yml',
'files/pubkey' => __DIR__ . '/blueprints/pubkey.yml',
'files/gnupg/key' => __DIR__ . '/blueprints/base/key.yml',
'files/gnupg/created' => __DIR__ . '/blueprints/base/created.yml',
'files/gnupg/expires' => __DIR__ . '/blueprints/base/expires.yml',
'files/gnupg/algo' => __DIR__ . '/blueprints/base/algo.yml',
'files/gnupg/crypto' => __DIR__ . '/blueprints/base/crypto.yml',
'files/gnupg/length' => __DIR__ . '/blueprints/base/length.yml',
'files/gnupg/type' => __DIR__ . '/blueprints/base/type.yml',
'sections/pubkeys' => __DIR__ . '/blueprints/pubkeys.yml',
],
'hooks' => [
/**
* Updates key information after upload
*
* @param \Kirby\Cms\File $file File object of uploaded file
*/
'file.create:after' => function (File $file) {
if ($file->extension() == 'asc') {
$file->update((new GnuPG($file->root()))->data);
}
},
/**
* Updates key information upon replacement
*
* @param \Kirby\Cms\File $newFile File object of replacement file
* @param \Kirby\Cms\File $oldFile File object of file to be replaced
*/
'file.replace:after' => function (File $newFile, File $oldFile) {
if ($newFile->extension() == 'asc') {
$newFile->update((new GnuPG($newFile->root()))->data);
}
},
],
]);