]> git.immae.eu Git - github/shaarli/Shaarli.git/blob - controllers/Info.php
Merge pull request #1698 from ArthurHoaro/feature/plugins-search-filter
[github/shaarli/Shaarli.git] / controllers / Info.php
1 <?php
2
3 namespace Shaarli\Api\Controllers;
4
5 use Shaarli\Bookmark\BookmarkFilter;
6 use Slim\Http\Request;
7 use Slim\Http\Response;
8
9 /**
10 * Class Info
11 *
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.
21 *
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 = [
30 'global_counter' => $this->bookmarkService->count(),
31 'private_counter' => $this->bookmarkService->count(BookmarkFilter::$PRIVATE),
32 'settings' => [
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 }