2018-11-16 05:59:00 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Friendica\Directory\Routes\Web;
|
|
|
|
|
|
|
|
use Friendica\Directory\Controllers\Web\BaseController;
|
|
|
|
|
|
|
|
/**
|
2020-06-13 19:15:53 +02:00
|
|
|
* @author Hypolite Petovan <hypolite@mrpetovan.com>
|
2018-11-16 05:59:00 +01:00
|
|
|
*/
|
|
|
|
abstract class BaseRoute
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var \Slim\Container
|
|
|
|
*/
|
|
|
|
protected $container;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var BaseController
|
|
|
|
*/
|
|
|
|
protected $controller;
|
|
|
|
|
|
|
|
public function __construct(\Slim\Container $container)
|
|
|
|
{
|
|
|
|
$this->container = $container;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function __invoke(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args): \Slim\Http\Response
|
|
|
|
{
|
|
|
|
$defaults = [
|
2018-11-20 04:12:09 +01:00
|
|
|
'pages' => glob(__DIR__ . '/../../../../config/pages/*.html'),
|
2018-11-19 14:32:58 +01:00
|
|
|
'version' => file_get_contents(__DIR__ . '/../../../../VERSION'),
|
2018-11-16 05:59:00 +01:00
|
|
|
'languages' => $this->container->settings['i18n']['locales'],
|
|
|
|
'lang' => $request->getAttribute('locale'),
|
|
|
|
'baseUrl' => $request->getUri()->getBaseUrl(),
|
|
|
|
'content' => '',
|
|
|
|
'noNavSearch' => false
|
|
|
|
];
|
|
|
|
|
|
|
|
$values = $this->controller->render($request, $response, $args);
|
|
|
|
|
|
|
|
$values = $values + $defaults;
|
|
|
|
|
|
|
|
// Render index view
|
|
|
|
return $this->container->renderer->render($response, 'layout.phtml', $values);
|
|
|
|
}
|
|
|
|
}
|