Migrated templates to plates

This commit is contained in:
Alejandro Celaya 2017-10-12 10:03:14 +02:00
parent 453ca1728e
commit e53ffc8d43
9 changed files with 61 additions and 50 deletions

View File

@ -4,6 +4,9 @@ return [
'templates' => [ 'templates' => [
'extension' => 'phtml', 'extension' => 'phtml',
],
'plates' => [
'extensions' => [ 'extensions' => [
// extension service names or instances // extension service names or instances
], ],

View File

@ -5,7 +5,7 @@ use Shlinkio\Shlink\Common\Template\Extension\TranslatorExtension;
return [ return [
'templates' => [ 'plates' => [
'extensions' => [ 'extensions' => [
TranslatorExtension::class, TranslatorExtension::class,
], ],

View File

@ -1,17 +0,0 @@
{% extends 'core/layout/default.html.twig' %}
{% block title %}{{ translate('URL Not Found') }}{% endblock %}
{% block stylesheets %}
<style>
p {margin-bottom: 20px;}
body {text-align: center;}
</style>
{% endblock %}
{% block content %}
<h1>{{ translate('Oops!') }}</h1>
<hr>
<p>{{ translate('This short URL doesn\'t seem to be valid.') }}</p>
<p>{{ translate('Make sure you included all the characters, with no extra punctuation.') }}</p>
{% endblock %}

View File

@ -0,0 +1,19 @@
<?php $this->layout('ShlinkCore::layout/default') ?>
<?php $this->start('title') ?>
<?= $this->translate('URL Not Found') ?>
<?php $this->end() ?>
<?php $this->start('stylesheets') ?>
<style>
p {margin-bottom: 20px;}
body {text-align: center;}
</style>
<?php $this->end() ?>
<?php $this->start('main') ?>
<h1><?= $this->translate('Oops!') ?></h1>
<hr>
<p><?= $this->translate('This short URL doesn\'t seem to be valid.') ?></p>
<p><?= $this->translate('Make sure you included all the characters, with no extra punctuation.') ?></p>
<?php $this->end() ?>

View File

@ -1,21 +0,0 @@
{% extends 'core/layout/default.html.twig' %}
{% block title %}{{ status }} {{ reason }}{% endblock %}
{% block stylesheets %}
<style>
p {margin-bottom: 20px;}
body {text-align: center;}
</style>
{% endblock %}
{% block content %}
<h1>{{ translate('Oops!') }}</h1>
<hr>
{% if status != 404 %}
<p>{{ translate('We encountered a %s %s error.') | format(status, reason) }}</p>
{% else %}
<p>{{ translate('This short URL doesn\'t seem to be valid.') }}</p>
<p>{{ translate('Make sure you included all the characters, with no extra punctuation.') }}</p>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,25 @@
<?php $this->layout('ShlinkCore::layout/default') ?>
<?php $this->start('title') ?>
<?= $this->e($status . ' ' . $reason) ?>
<?php $this->end() ?>
<?php $this->start('stylesheets') ?>
<style>
p {margin-bottom: 20px;}
body {text-align: center;}
</style>
<?php $this->end() ?>
<?php $this->start('main') ?>
<h1><?= $this->translate('Oops!') ?></h1>
<hr>
<?php if ($status !== 404): ?>
<p><?= sprintf($this->translate('We encountered a %s %s error.'), $status, $reason) ?></p>
<?php else: ?>
<p><?= $this->translate('This short URL doesn\'t seem to be valid.') ?></p>
<p><?= $this->translate('Make sure you included all the characters, with no extra punctuation.') ?></p>
<?php endif; ?>
<?php $this->end() ?>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>{% block title %}{% endblock %} | URL shortener</title> <title><?= $this->section('title', '') ?> | URL shortener</title>
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" />
@ -13,28 +13,30 @@
.app-content {flex: 1;} .app-content {flex: 1;}
.app-footer p {margin-bottom: 20px;} .app-footer p {margin-bottom: 20px;}
</style> </style>
{% block stylesheets %}{% endblock %} <?= $this->section('stylesheets', '') ?>
</head> </head>
<body class="app"> <body class="app">
<div class="app-content"> <div class="app-content">
<main class="container"> <main class="container">
{% block content %}{% endblock %} <?= $this->section('main', '') ?>
</main> </main>
</div> </div>
<footer class="app-footer"> <footer class="app-footer">
<div class="container"> <div class="container">
<hr /> <hr />
{% block footer %} <?php if ($this->section('footer')): ?>
<?= $this->section('footer') ?>
<?php else: ?>
<p> <p>
&copy; {{ "now" | date("Y") }} <a href="https://shlink.io">Shlink</a> &copy; <?= date('Y') ?> <a href="https://shlink.io">Shlink</a>
</p> </p>
{% endblock %} <?php endif; ?>
</div> </div>
</footer> </footer>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
{% block javascript %}{% endblock %} <?= $this->section('javascript', '') ?>
</body> </body>
</html> </html>

View File

@ -37,7 +37,7 @@ class PathVersionMiddleware implements MiddlewareInterface
$uri = $request->getUri(); $uri = $request->getUri();
$path = $uri->getPath(); $path = $uri->getPath();
// If the path does not begin with the version number, prepend v1 by default for retrocompatibility purposes // If the path does not begin with the version number, prepend v1 by default for BC compatibility purposes
if (strpos($path, '/v') !== 0) { if (strpos($path, '/v') !== 0) {
$parts = explode('/', $path); $parts = explode('/', $path);
// Remove the first empty part and the // Remove the first empty part and the

View File

@ -1,9 +1,9 @@
<?php <?php
declare(strict_types=1);
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;
use Zend\Expressive\Application; use Zend\Expressive\Application;
/** @var ContainerInterface $container */ /** @var ContainerInterface $container */
$container = include __DIR__ . '/../config/container.php'; $container = include __DIR__ . '/../config/container.php';
/** @var Application $app */ $app = $container->get(Application::class)->run();
$app = $container->get(Application::class);
$app->run();