]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - application/api/controllers/Info.php
Apply PHP Code Beautifier on source code for linter automatic fixes
[github/shaarli/Shaarli.git] / application / api / controllers / Info.php
CommitLineData
18e67967
A
1<?php
2
3namespace Shaarli\Api\Controllers;
4
cf92b4dd 5use Shaarli\Bookmark\BookmarkFilter;
18e67967
A
6use Slim\Http\Request;
7use 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 */
17class 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),
53054b2b 32 'settings' => [
18e67967
A
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),
53054b2b 38 ],
18e67967
A
39 ];
40
41 return $response->withJson($info, 200, $this->jsonStyle);
42 }
43}