]>
Commit | Line | Data |
---|---|---|
6fc14d53 A |
1 | <?php |
2 | ||
bcba6bd3 A |
3 | use Shaarli\Bookmark\Bookmark; |
4 | ||
6fc14d53 A |
5 | /** |
6 | * Hook for test. | |
7 | * | |
8 | * @param array $data - data passed to plugin. | |
9 | * | |
10 | * @return mixed altered data. | |
11 | */ | |
12 | function hook_test_random($data) | |
13 | { | |
14 | if (isset($data['_PAGE_']) && $data['_PAGE_'] == 'test') { | |
15 | $data[1] = 'page test'; | |
d2d4f993 | 16 | } elseif (isset($data['_LOGGEDIN_']) && $data['_LOGGEDIN_'] === true) { |
6fc14d53 | 17 | $data[1] = 'loggedin'; |
4ff703e3 A |
18 | } elseif (array_key_exists('_LOGGEDIN_', $data)) { |
19 | $data[1] = 'loggedin'; | |
20 | $data[2] = $data['_LOGGEDIN_']; | |
6fc14d53 A |
21 | } else { |
22 | $data[1] = $data[0]; | |
23 | } | |
24 | ||
25 | return $data; | |
26 | } | |
7e3dc0ba A |
27 | |
28 | function hook_test_error() | |
29 | { | |
30 | new Unknown(); | |
31 | } | |
a6e9c084 A |
32 | |
33 | function test_register_routes(): array | |
34 | { | |
35 | return [ | |
36 | [ | |
37 | 'method' => 'GET', | |
38 | 'route' => '/test', | |
39 | 'callable' => 'getFunction', | |
40 | ], | |
41 | [ | |
42 | 'method' => 'POST', | |
43 | 'route' => '/custom', | |
44 | 'callable' => 'postFunction', | |
45 | ], | |
46 | ]; | |
47 | } | |
bcba6bd3 A |
48 | |
49 | function hook_test_filter_search_entry(Bookmark $bookmark, array $context): bool | |
50 | { | |
51 | return $context['_result']; | |
52 | } |