/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/src
/App
/Service
/ContentService.php
use Psr\Http\Server\RequestHandlerInterface;
use \Vertex;
/**
* Serviço de Conteudo
*/
class ContentService
{
private static $languageSufix = [pt_BR => '', en_US => '-en'];
public static function getContent($path, $routes = null, $cache = 3600)
{
global $hg;
// if ($cachedContent = DataCacheService::getCachableContent($path, $cache)) {
// return $cachedContent;
// }
if (self::$languageSufix[LANGUAGE]) {
$path = str_replace(".html", self::$languageSufix[LANGUAGE] . ".html", $path);
}
$content = file_get_contents($path);
$urlPt = str_replace('/en/', '/', $routes->getOriginalPath());
$urlEn = '/en' . $urlPt;
$replaces = [
'url-pt' => $urlPt,
'url-en' => $urlEn
];
$content = self::fillData($replaces, $content);
//Carrega o menu
$siteMenus = $hg->getLinkedVertices(
[SITE, LANGUAGE],
[
'fromSCHEMATail' => '*',
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/src
/App
/Service
/ContentService.php
use Psr\Http\Server\RequestHandlerInterface;
use \Vertex;
/**
* Serviço de Conteudo
*/
class ContentService
{
private static $languageSufix = [pt_BR => '', en_US => '-en'];
public static function getContent($path, $routes = null, $cache = 3600)
{
global $hg;
// if ($cachedContent = DataCacheService::getCachableContent($path, $cache)) {
// return $cachedContent;
// }
if (self::$languageSufix[LANGUAGE]) {
$path = str_replace(".html", self::$languageSufix[LANGUAGE] . ".html", $path);
}
$content = file_get_contents($path);
$urlPt = str_replace('/en/', '/', $routes->getOriginalPath());
$urlEn = '/en' . $urlPt;
$replaces = [
'url-pt' => $urlPt,
'url-en' => $urlEn
];
$content = self::fillData($replaces, $content);
//Carrega o menu
$siteMenus = $hg->getLinkedVertices(
[SITE, LANGUAGE],
[
'fromSCHEMATail' => '*',
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/src
/Routes
/Routes.php
preg_match_all($regex, $path, $matches, PREG_SET_ORDER, 0);
if ($matches) {
$this->path = $key;
$handler = new $this->routes[$this->method][$key];
$language = $this->variables[$this->method][$key]["language"];
setlocale(LC_TIME, $language . '.utf-8');
define('LANGUAGE', constant($language));
$handler->handle($this, $matches[0][2]);
return;
}
}
$this->show404();
}
private function show404()
{
http_response_code(404);
echo ContentService::getContent('template/404.html');
die();
}
}
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/src
/Routes
/Routes.php
setlocale(LC_TIME, $language . '.utf-8');
define('LANGUAGE', constant($language));
$handler->handle($this);
return;
}
foreach ($this->regex[$this->method] as $key => $regex) {
preg_match_all($regex, $path, $matches, PREG_SET_ORDER, 0);
if ($matches) {
$this->path = $key;
$handler = new $this->routes[$this->method][$key];
$language = $this->variables[$this->method][$key]["language"];
setlocale(LC_TIME, $language . '.utf-8');
define('LANGUAGE', constant($language));
$handler->handle($this, $matches[0][2]);
return;
}
}
$this->show404();
}
private function show404()
{
http_response_code(404);
echo ContentService::getContent('template/404.html');
die();
}
}
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/config
/config.routes.php
$routes->addRoute('/en/agenda', 'App\Handler\ScheduleHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/agenda/[name]', 'App\Handler\EventHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/artistas', 'App\Handler\ArtistsHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/artistas/[name]', 'App\Handler\ArtistHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/enunciados', 'App\Handler\EnunciadosHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/enunciados/[name]', 'App\Handler\EnunciadoHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/exposicoes', 'App\Handler\ExhibitionHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/exposicoes/[name]', 'App\Handler\EventHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/multimidia', 'App\Handler\MultimediaHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/planeje-sua-visita', 'App\Handler\VisitHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/post/[name]', 'App\Handler\PostHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/educacao', 'App\Handler\EducationProjectHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/publicacoes', 'App\Handler\PublicationsHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/relacoes', 'App\Handler\LabelsHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/relacoes/[name]', 'App\Handler\LabelHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/en/sobrea34', 'App\Handler\AboutHandler', 'GET', ['language' => 'en_US']);
$routes->addRoute('/search', 'App\Handler\SearchHandler', 'POST', ['language' => 'pt_BR']);
$routes->run();
/var
/www
/html
/fbsp.org.br
/mercuriohg
/modules
/34bienal
/index.php
<?php
ob_start('ob_gzhandler');
// Set Cache-Control header
header("Cache-Control: private, max-age=186400");
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/config/config.development.php';
require __DIR__ . '/config/config.php';
require __DIR__ . '/config/config.mercurio.php';
require __DIR__ . '/config/config.routes.php';
ob_end_flush();