]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | ||
3 | use Shaarli\Bookmark\Bookmark; | |
4 | ||
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'; | |
16 | } elseif (isset($data['_LOGGEDIN_']) && $data['_LOGGEDIN_'] === true) { | |
17 | $data[1] = 'loggedin'; | |
18 | } elseif (array_key_exists('_LOGGEDIN_', $data)) { | |
19 | $data[1] = 'loggedin'; | |
20 | $data[2] = $data['_LOGGEDIN_']; | |
21 | } else { | |
22 | $data[1] = $data[0]; | |
23 | } | |
24 | ||
25 | return $data; | |
26 | } | |
27 | ||
28 | function hook_test_error() | |
29 | { | |
30 | new Unknown(); | |
31 | } | |
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 | } | |
48 | ||
49 | function hook_test_filter_search_entry(Bookmark $bookmark, array $context): bool | |
50 | { | |
51 | return $context['_result']; | |
52 | } |