]>
Commit | Line | Data |
---|---|---|
18e67967 A |
1 | <?php |
2 | ||
3 | namespace Shaarli\Api\Controllers; | |
4 | ||
cf92b4dd | 5 | use Shaarli\Bookmark\BookmarkFilter; |
18e67967 A |
6 | use Slim\Http\Request; |
7 | use Slim\Http\Response; | |
8 | ||
9 | /** | |
10 | * Class Info | |
f211e417 | 11 | * |
18e67967 A |
12 | * REST API Controller: /info |
13 | * | |
14 | * @package Api\Controllers | |
15 | * @see http://shaarli.github.io/api-documentation/#links-instance-information-get | |
16 | */ | |
17 | class Info extends ApiController | |
18 | { | |
19 | /** | |
20 | * Service providing various information about Shaarli instance. | |
f211e417 | 21 | * |
18e67967 A |
22 | * @param Request $request Slim request. |
23 | * @param Response $response Slim response. | |
24 | * | |
25 | * @return Response response. | |
26 | */ | |
27 | public function getInfo($request, $response) | |
28 | { | |
29 | $info = [ | |
cf92b4dd A |
30 | 'global_counter' => $this->bookmarkService->count(), |
31 | 'private_counter' => $this->bookmarkService->count(BookmarkFilter::$PRIVATE), | |
18e67967 A |
32 | 'settings' => array( |
33 | 'title' => $this->conf->get('general.title', 'Shaarli'), | |
34 | 'header_link' => $this->conf->get('general.header_link', '?'), | |
35 | 'timezone' => $this->conf->get('general.timezone', 'UTC'), | |
36 | 'enabled_plugins' => $this->conf->get('general.enabled_plugins', []), | |
37 | 'default_private_links' => $this->conf->get('privacy.default_private_links', false), | |
38 | ), | |
39 | ]; | |
40 | ||
41 | return $response->withJson($info, 200, $this->jsonStyle); | |
42 | } | |
43 | } |