Cambio do deseño da paxina de Blogue e correccions varias.

This commit is contained in:
Laegnur 2024-10-22 19:45:48 +02:00
parent 72fc9d071e
commit b7b212d493
Signed by: laegnur
GPG key ID: F8FE83A0B2D932A3
66 changed files with 2528 additions and 320 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 750 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 714 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 780 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 703 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 792 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 608 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 635 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 724 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 701 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 801 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View file

Before

Width:  |  Height:  |  Size: 572 KiB

After

Width:  |  Height:  |  Size: 572 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View file

Before

Width:  |  Height:  |  Size: 508 KiB

After

Width:  |  Height:  |  Size: 508 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

14
site/finished.php Normal file
View file

@ -0,0 +1,14 @@
<?php namespace ProcessWire;
if(!defined("PROCESSWIRE")) die();
/** @var ProcessWire $wire */
/**
* ProcessWire Request Finished
* ============================
* This finished.php file is called after ProcessWire has finished serving the current
* request. This occurs after the current page has been rendered. This file receives a
* copy of all ProcessWire API variables.
*
*/

61
site/ready.php Normal file
View file

@ -0,0 +1,61 @@
<?php namespace ProcessWire;
if(!defined("PROCESSWIRE")) die();
/** @var ProcessWire $wire */
/**
* ProcessWire Bootstrap API Ready
* ===============================
* This ready.php file is called during ProcessWire bootstrap initialization process.
* This occurs after the current page has been determined and the API is fully ready
* to use, but before the current page has started rendering. This file receives a
* copy of all ProcessWire API variables.
*
*/
/*function str_lreplace($search, $replace, $subject)
{
return preg_replace('~(.*)' . preg_quote($search, '~') . '~', '$1' . $replace, $subject, 1);
}
function str_freplace($search, $replace, $subject)
{
$from = '/'.preg_quote($search, '/').'/';
return preg_replace($from, $replace, $subject, 1);
}
$captcha = wire('modules')->get("MarkupGoogleRecaptcha");
wire()->addHookProperty('Page::captcha', function($event) use ($captcha)
{
$event->return = $captcha;
});
wire()->addHookAfter('Page::render', function($event)
{
$template = $event->object->template;
$page = $event->object;
if($template == 'admin' && !wire('user')->isLoggedin())
{
$event->return = str_freplace('</form>', $page->captcha->render() . '</form>', $event->return);
$event->return = str_lreplace('</body>', $page->captcha->getScript() . '</body>', $event->return);
}
});
wire()->addHookAfter('Session::authenticate', function($event)
{
$page = wire('page');
$template = $page->template;
if($template == 'admin')
{
if($page->captcha->verifyResponse() == false)
{
wire('session')->logout();
wire('session')->redirect(wire('config')->urls->admin);
}
}
});*/

View file

@ -0,0 +1,67 @@
<?php namespace ProcessWire;
/** @var Page $page */
/** @var Pages $pages */
/** @var Config $config */
/** @var Sanitizer $sanitizer API variable */
/** @var WireInput $input API variable */
/** @var User $user API variable */
/** @var Languages $languages API variable */
/** @var SiteConfig $configuracion */
/** @var HomePage $inicio */
if($input->get->logout == true)
{
$session->logout();
$session->redirect('/');
}
$menu = '';
$saida = '';
$usuario = '';
$contrasinal = '';
$mensaxe_tipo = '';
$mensaxe = '';
$captcha = $modules->get('MarkupGoogleRecaptcha');
if ($captcha->verifyResponse() === true)
{
$usuario = $sanitizer->username($input->post->usuario);
$contrasinal = $input->post->contrasinal;
if($session->login($usuario, $contrasinal))
{
$session->redirect($inicio->url);
}
else
{
$mensaxe_tipo = "x-circle";
$mensaxe = _x('Wrong username or password', 'Wrong username or password');
}
}
?>
<main id="contido" class="completo">
<article id="<?=$page->name;?>">
<h1 class="visually-hidden"><?=ucfirst($page->title);?></h1>
<section id="accceso-formulario">
<h2><?=_x('Employee Access', 'employee access');?></h2>
<form method="post" action="<?=$page->url;?>">
<label for="usuario"><?=_x('Username', 'Username');?>:</label>
<input type="text" id="usuario">
<label for="contrasinal"><?=_x('Password', 'Password');?>:</label>
<input type="password" id="contrasinal">
<?php if($mensaxe != ''): ?>
<div id="notificacions" class="alerta <?=$mensaxe_tipo;?>" role="alert">
<span class="icono-<?=$mensaxe_tipo;?>"></span>
<p><?=$mensaxe;?></p>
<span class="icono-x pechar" onclick="this.parentElement.style.display='none';"></span>
</div>
<?php endif; ?>
<?=$captcha->render();?>
<input type="submit" id="enviar" name="enviar" class="boton activo" value="<?=_x('Log in', 'Log in');?>">
<a href="/" class="boton activo centrado"><?=_x('Return', 'return');?></a>
<?=$captcha->getScript();?>
</form>
</section>
</article">
</main>

View file

@ -1,43 +1,56 @@
<?php namespace ProcessWire;
/** @var Page $page API variable */
/** @var Page $page */
/** @var Pages $pages */
/** @var Config $config */
/** @var Sanitizer $sanitizer API variable */
/** @var WireInput $input API variable */
/** @var User $user API variable */
/** @var Languages $languages API variable */
/** @var SiteConfig $configuracion */
/** @var HomePage $inicio */
$menu = '';
$contido = '';
if($configuracion['mantemento']['activo'] && !$user->isLoggedin())
{
$menu = renderMenu($pages->get('/noticias')->and($pages->get('/contacto')));
$menu = renderMenu($inicio->and($pages->get('/noticias')->and($pages->get('/contacto'))));
}
else
{
$menu = renderMenu($inicio->children);
$menu = renderMenu($inicio->and($inicio->children));
}
$categorias = pages()->get('/noticias/categorias/')->children();
$etiquetas = pages()->get('/noticias/etiquetas/')->children();
$contido .= renderMigasPan($page) . "\n";
$contido .= '<article id="' . $page->name .'" class="container">' . "\n";
$contido .= '<h2 class="visually-hidden">' . ucfirst($page->title) . '</h2>' . "\n";
$contido .= '<section class="row row-cols-1 row-cols-md-2 mb-3">' . "\n";
$contido .= renderCategoriasEtiquetas($categorias);
$contido .= renderCategoriasEtiquetas($etiquetas);
$contido .= '</section>' . "\n";
$contido .= '<section id="publicacions" class="row row-cols-1 row-cols-lg-2 mb-3">' . "\n";
?>
<main id="contido" class="completo">
<nav id="migas" aria-label="<?=_x("Breadcrumb", "Breadcrumb");?>">
<?=renderMigasPan($page);?>
</nav>
<section id="<?=$page->name;?>" class="destacado">
<h1 class="visually-hidden"><?=ucfirst($page->title);?></h1>
<aside>
<?=renderCategoriasEtiquetas($categorias, true);?>
<?=renderCategoriasEtiquetas($etiquetas);?>
</aside>
<div>
<?php
if($page->numChildren)
{
$publicacions = pages()->get('/noticias/publicacions/')->children("template='publicacion',sort=-fecha_publicacion,limit=10");
$contido .= renderPaxinacion($publicacions, 'superior');
echo renderPaxinacion($publicacions, 'superior');
foreach($publicacions as $publicacion)
{
$contido .= renderArtigos($publicacion, $languages->getLocale());
echo renderArtigos($publicacion, $languages->getLocale());
}
$contido .= renderPaxinacion($publicacions, 'inferior');
echo renderPaxinacion($publicacions, 'inferior');
}
$contido .= '</section>' . "\n";
$contido .= '</article>' . "\n";
?>
</div>
</section>
</main>
<?php

View file

@ -19,6 +19,7 @@ if($configuracion['mantemento']['activo'] && !$user->isLoggedin())
else
{
$menu = renderMenu($inicio->and($inicio->children));
}
$saida = '';
$captcha = $modules->get('MarkupGoogleRecaptcha');
@ -36,27 +37,27 @@ else
if($enviado)
{
$saida .= '<p>' . _x('Correo enviado', 'mail sent');
$saida .= '<p>' . _x('Mail sent', 'mail sent');
}
else
{
$saida .= '<p>' . _x('Erro ao enviar o correo', 'error sending mail');
$saida .= '<p>' . _x('Error sending email', 'error sending mail');
}
$saida .= '<br><a class="boton activo centrado" href="' . $page->url . '" >' . _x('Volver ao formulario', 'go back to form') .'</a></p>';
$saida .= '<br><a class="boton activo centrado" href="' . $page->url . '" >' . _x('Go back to form', 'go back to form') .'</a></p>';
}
else
{
$saida .= '<form method="post" action="' . $page->url . '">';
$saida .= '<label for="nome">' . _x('Nome', 'name') . '</label>';
$saida .= '<label for="nome">' . _x('Name', 'name') . '</label>';
$saida .= '<input type="text" name="nome" id="nome" required>';
$saida .= '<label for="correo">' . _x('Correo electrónico', 'email') . '</label>';
$saida .= '<label for="correo">' . _x('Email', 'email') . '</label>';
$saida .= '<input type="email" name="correo" id="correo" required>';
$saida .= '<label for="asunto">' . _x('Asunto', 'subject') . '</label>';
$saida .= '<label for="asunto">' . _x('Subject', 'subject') . '</label>';
$saida .= '<input type="text" name="asunto" id="asunto" required>';
$saida .= '<label for="mensaxe">' . _x('Mensaxe', 'message') . '</label>';
$saida .= '<label for="mensaxe">' . _x('Message', 'message') . '</label>';
$saida .= '<textarea name="mensaxe" id="mensaxe" cols="30" rows="6" required></textarea>';
$saida .= $captcha->render();
$saida .= '<input type="submit" id="enviar" name="enviar" class="boton activo" value="' . _x('Enviar mensaxe', 'send message') . '">';
$saida .= '<input type="submit" id="enviar" name="enviar" class="boton activo" value="' . _x('Send message', 'send message') . '">';
$saida .= '</form>' . "\n";
$saida .= $captcha->getScript();
}
@ -91,5 +92,4 @@ else
</section>
</article>
</main>
<?php
}
<?php

View file

@ -1,3 +1,9 @@
:root
{
--titulos: ui-rounded, 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, Manjari, 'Arial Rounded MT', 'Arial Rounded MT Bold', Calibri, source-sans-pro, sans-serif;
--corpo: Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro, sans-serif;
}
*, *::before, *::after
{
box-sizing: border-box;
@ -53,7 +59,7 @@ body
grid-template-rows: auto 1fr auto;
color: rgb(var(--cor_10));
font-family: Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro, sans-serif;
font-family: var(--corpo);
font-size: 1rem;
font-weight: normal;
@ -70,11 +76,52 @@ a
h1, h2, h3, h4, h5, h6
{
color: rgb(var(--cor_30));
font-family: ui-rounded, 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, Manjari, 'Arial Rounded MT', 'Arial Rounded MT Bold', Calibri, source-sans-pro, sans-serif;
font-family: var(--titulos);
font-weight: bold;
text-wrap: balance;
}
a.boton
{
text-decoration: none;
}
dl
{
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 10%;
max-width: 18.75rem;
margin: 0;
font-family: var(--titulos);
font-size: 0.875rem;
}
dt
{
width: 10%;
color: rgb(var(--cor_30));
}
dt::after
{
content: ": ";
}
dd
{
width: 80%;
margin: 0;
padding: 0;
}
figure
{
margin: 0;
@ -94,7 +141,7 @@ figure figcaption
padding: 10px 40px 20px;
color: rgb(var(--cor_30));
font-family: ui-rounded, 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, Manjari, 'Arial Rounded MT', 'Arial Rounded MT Bold', Calibri, source-sans-pro, sans-serif;
font-family: var(--titulos);
font-weight: normal;
font-size: 1rem;
text-align: center;
@ -108,6 +155,66 @@ figcaption
margin-inline: auto;
}
time
{
display: block;
position: relative;
height: 5rem;
overflow: hidden;
width: 5rem;
border-radius: 0.6em;
box-shadow: 0 1px 0 #bdbdbd, 0 2px 0 #fff, 0 3px 0 #bdbdbd, 0 4px 0 #fff, 0 5px 0 #bdbdbd, 0 0 0 1px #bdbdbd;
font-size: 0.75rem;
background-color: #fff;
}
time *
{
display: block;
width: 100%;
font-size: 0.8rem;
font-style: normal;
font-weight: bold;
text-align: center;
}
time em
{
position: absolute;
bottom: 0;
color: rgb(var(--cor_30));
}
time strong
{
position: absolute;
top: 0;
padding: 0.3rem 0;
box-shadow: 0 2px 0 rgb(var(--cor_30));
color: white;
background-color: rgb(var(--cor_30));
}
time span
{
padding-top: 1.6rem;
color: black;
font-size: 2rem;
letter-spacing: -0.05rem;
}
ul,
ol
{
@ -152,7 +259,7 @@ div#cabeceira-superior
nav#menu-usuario
{
display: grid;
grid-template-columns: auto auto;
grid-template-columns: repeat(2, auto);
justify-content: space-between;
}
@ -469,6 +576,14 @@ article#habitacions figure:hover h3
transform: scale(0.9);
}
article#noticias
{
display: grid;
grid-template-columns: 1fr;
grid-template-rows: repeat(2, auto) 1fr;
gap: var(--separacion);
}
section#mantemento img
{
margin-bottom: 1.5rem;
@ -779,7 +894,8 @@ section#contacto-info p
margin-bottom: var(--separacion);
}
section#contacto-formulario
section#contacto-formulario,
section#accceso-formulario
{
display: grid;
grid-template-columns: 1fr;
@ -793,7 +909,15 @@ section#contacto-formulario
background-color: #eeeeee;
}
section#contacto-formulario form
section#accceso-formulario
{
width: min(100%, 22rem);
margin: 0 auto;
}
section#contacto-formulario form,
section#accceso-formulario form
{
display: grid;
grid-template-columns: 1fr;
@ -827,6 +951,122 @@ section#contacto-info div.elemento
width: 100%;
}
section#categorias,
section#etiquetas
{
margin-bottom: var(--separacion);
}
section#categorias h2,
section#etiquetas h2
{
margin: 0;
}
section.acordeon > input[type="radio"]
{
position: absolute;
left: -100vw;
}
section.acordeon ul
{
overflow-y: hidden;
height: 0;
transition: height 0.3s ease;
}
section.acordeon label
{
display: block;
padding: var(--separacion);
border: 1px solid rgba(var(--cor_10), 0.5);
border-radius: 0.5rem 0.5rem 0 0;
background-color: #eeeeee;
}
section.acordeon > input[type="radio"]:checked ~ ul
{
height: auto;
overflow: visible;
padding: 15px;
border: 1px solid rgba(var(--cor_10), 0.5);
border-top: 0;
}
section#noticias
{
display: grid;
grid-template-columns: 1fr;
gap: var(--separacion);
}
section#noticias aside
{
grid-column: 1;
grid-row: 1;
}
section#noticias > div
{
grid-column: 1;
grid-row: 2;
}
nav.paxinacion ul
{
justify-content: center;
gap: var(--separacion);
margin-block: var(--separacion);
}
section#noticias article.artigo header
{
display: grid;
grid-template-columns: auto 1fr;
grid-template-rows: auto;
gap: var(--separacion);
margin-bottom: var(--separacion);
}
section#noticias time
{
grid-column: 1;
grid-row: 1 / 3;
}
section#noticias h3
{
grid-column: 2;
grid-row: 1;
margin: 0;
}
section#noticias dl
{
grid-column: 2 / 3;
grid-row: 2;
}
section#noticias dt span
{
display: none;
}
section#noticias img
{
width: 100%;
}
footer#pe
{
padding-block: 1.5rem;
@ -989,7 +1229,7 @@ footer#pe p#desenrolo
section[id^="reixa-"],
div[id^="reixa-"]
{
grid-template-columns: 1fr 1fr;
grid-template-columns: repeat(2, 1fr);
}
section#contacto-info
@ -1048,7 +1288,7 @@ footer#pe p#desenrolo
section[id^="imaxe-"],
div[id^="imaxe-"]
{
grid-template-columns: 1fr 1fr;
grid-template-columns: repeat(2, 1fr);
}
section[id^="imaxe-"].superior,
@ -1094,7 +1334,7 @@ footer#pe p#desenrolo
section[id^="reixa-"],
div[id^="reixa-"]
{
grid-template-columns: 1fr 1fr 1fr;
grid-template-columns: repeat(3, 1fr);
}
section[id^="destacados-"],
@ -1102,10 +1342,45 @@ footer#pe p#desenrolo
{
grid-template-columns: repeat(2, 1fr);
}
section#noticias
{
display: grid;
grid-template-columns: 2fr 1fr;
gap: var(--separacion);
}
section#noticias aside
{
grid-column: 2;
grid-row: 1;
}
section#noticias > div
{
grid-column: 1;
grid-row: 1;
}
}
@media (min-width: 1024px)
{
dl
{
gap: 0;
}
dt
{
width: 60%;
}
dd
{
width: 40%;
}
nav#menu-usuario button.boton,
nav#menu-principal div#menu-despregable button.boton
{
@ -1148,6 +1423,12 @@ footer#pe p#desenrolo
width: calc(50% - (var(--separacion) * 2));
}
article#noticias
{
grid-template-columns: repeat(2, 1fr);
grid-template-rows: auto 1fr;
}
section[id^="destacados-"],
div[id^="destacados-"]
{
@ -1175,6 +1456,11 @@ footer#pe p#desenrolo
{
width: calc(33% - (var(--separacion) / 2));
}
section#noticias dt span
{
display: inline;
}
}
@keyframes zoom

View file

@ -15,6 +15,14 @@ $menu = '';
if($configuracion['mantemento']['activo'] && !$user->isLoggedin())
{
$menu = renderMenu($inicio->and($pages->get('/noticias')->and($pages->get('/contacto'))));
?>
<main id="contido" class="completo">
<article id="inicio" class="completo">
<h1 class="visually-hidden"><?=ucfirst($inicio->title);?></h1>
<?=renderTextoMantemento($configuracion['mantemento']['titular'], $configuracion['mantemento']['artigo'], $configuracion['mantemento']['imaxe']);?>
</article>
</main>
<?php
}
else
{

View file

@ -1,7 +1,6 @@
function abrirMenu()
{
document.getElementById("menu-despregable").classList.add("despregado");
}
function pecharMenu()

View file

@ -257,6 +257,32 @@ function renderMigasPan($paxina, $separador = '<i class="icon-chevrons-right"></
return $saida;
}
/**
* @param array|PageArray $artigos
* @param int $posicion
* @return string
*/
function renderPaxinacion($artigos, $posicion)
{
$paxinacion = $artigos->renderPager(
array(
'listMarkup' => '<nav id="paxinacion-' . $posicion . '" class="paxinacion"><ul>{out}</ul></nav>',
'itemMarkup' => '<li class="{class}">{out}</li>',
'linkMarkup' => '<a href="{url}"><span>{out}</span></a>',
'nextItemLabel' => '<i class="icon-skip-forward"></i>',
'previousItemLabel' => '<i class="icon-skip-back"></i>',
'separatorItemClass' => 'separador',
'nextItemClass' => 'seguinte',
'previousItemClass' => 'anterior',
'lastItemClass' => 'derradeiro',
'currentItemClass' => 'actual'
)
);
return $paxinacion;
}
/**
* @param string $titulo
* @param string $texto
@ -271,7 +297,10 @@ function renderTextoMantemento($titulo, $texto, $imaxe)
$saida .= '<section id="mantemento" class="centrado">';
$saida .= '<h2>' . $titulo . '</h2>';
$saida .= $texto;
$saida .= '<figure>';
$saida .= '<img src="' . $imaxe->url . '" alt="' . $imaxe->description . '" loading="lazy">';
$saida .= '<figcaption>' . $imaxe->description . '</figcaption>';
$saida .= '</figure>';
$saida .= '</section>';
return $saida;
@ -429,14 +458,14 @@ function renderLigazonImaxe($seccion)
{
$saida = '';
$saida .= '<figure>' . "\n";
$saida .= '<figure>';
$saida .= '<img src="' . $seccion->imaxe->url . '" alt="' . $seccion->imaxe->description . '" loading="lazy">';
$saida .= '<figcaption>' . "\n";
$saida .= '<h2>' . $seccion->titular . '</h2>' . "\n";
$saida .= '<p>' . _x('See details', 'see details') . '</p>' . "\n";
$saida .= '<a href=' . $seccion->ligazon_interna->url . '></a>' . "\n";
$saida .= '</figcaption>' . "\n";
$saida .= '</figure>' . "\n";
$saida .= '<figcaption>';
$saida .= '<h2>' . $seccion->titular . '</h2>';
$saida .= '<p>' . _x('See details', 'see details') . '</p>';
$saida .= '<a href=' . $seccion->ligazon_interna->url . '></a>';
$saida .= '</figcaption>';
$saida .= '</figure>';
return $saida;
}
@ -498,15 +527,150 @@ function renderLigazonImaxe($seccion)
$saida .= $seccion->artigo;
if($seccion->botons && $seccion->botons->isEmpty())
{
$saida .= '<div>' . "\n";
$saida .= getSeccions($seccion->botons) . "\n";
$saida .= '</div>' . "\n";
$saida .= '<div>';
$saida .= getSeccions($seccion->botons);
$saida .= '</div>';
}
$saida .= '</div>' . "\n";
$saida .= '</div>' ;
return $saida;
}
/**
* @param array|PageArray $seccion
* @return string
*/
function renderCategoriasEtiquetas($seccion, $activo = false)
{
$saida = '';
switch ($seccion->first()->template->name)
{
case 'categoria':
$icono = 'folder';
$nome = 'categorias';
break;
case 'etiqueta':
$icono = 'tag';
$nome = 'etiquetas';
break;
}
$saida .= '<section id="' . $nome . '" class="acordeon">';
$saida .= '<input type="radio" name="plegable" id="plegable-' . $nome . '" ' . ($activo ? 'checked':'') . '>';
$saida .= '<h2>';
$saida .= '<label for="plegable-' . $nome . '">' . pages()->get('/noticias/' . $nome)->title . '</label>';
$saida .= '</h2>';
$saida .= '<ul>';
foreach($seccion as $item)
{
$saida .= '<li>';
$saida .= '<a href="' . $item->url . '"><i class="icon-' . $icono . '"></i> ' . $item->title . '</a>';
$saida .= '</li>';
}
$saida .= '</ul>';
$saida .= '</section>';
return $saida;
}
/**
* @param array|PageArray $publicacion
* @param string $locale
* @param boolean $resumen
* @return string
*/
function renderArtigos($publicacion, $locale, $resumen = true)
{
$saida = '';
$data = strtotime($publicacion->fecha_publicacion);
$dateFormatter = \IntlDateFormatter::create(
$locale,
\IntlDateFormatter::NONE,
\IntlDateFormatter::NONE,
\date_default_timezone_get(),
\IntlDateFormatter::GREGORIAN
);
$saida .= '<article id="' . $publicacion->name .'" class="artigo">';
$saida .= '<header>';
$saida .= '<time datetime="' . $publicacion->fecha_publicacion . '">' ."\n";
$dateFormatter->setPattern('EEEE');
$saida .= '<em>' . ucfirst(datefmt_format($dateFormatter, $data)) . '</em>';
$dateFormatter->setPattern('MMMM');
$saida .= '<strong>' . ucfirst(datefmt_format($dateFormatter, $data)) . '</strong>';
$dateFormatter->setPattern('dd');
$saida .= '<span>' . datefmt_format($dateFormatter, $data) . '</span>';
$saida .= '</time>';
$saida .= '<h3>';
$saida .= '<a href="' . $publicacion->url . '"><i class="icon-' . (($resumen) ? 'book' : 'book-open') . '"></i> ' . $publicacion->title . '</a>';
$saida .= '</h3>';
$saida .= '<dl>';
$saida .= '<dt title="' . pages()->get('/noticias/categorias/')->title . '"><i class="icon-folder"></i><span> ' . pages()->get('/noticias/categorias/')->title . '</span></dt>';
$saida .= '<dd><a href="' . $publicacion->categorias->url . '">' . $publicacion->categorias->title . '</a></dd>';
$saida .= '<dt title="' . pages()->get('/noticias/etiquetas/')->title . '"><i class="icon-tag"></i><span> ' . pages()->get('/noticias/etiquetas/')->title . '</span></dt>';
$saida .= '<dd>' . $publicacion->etiquetas->each("<a href='{url}'>{title}</a>") . '</dd>';
$saida .= '</dl>';
$saida .= '</header>';
if($resumen)
{
if($publicacion->imaxe)
{
$thumb = $publicacion->imaxe->size(0, 260);
$saida .= '<img src="' . $thumb->url . '" alt="' . $publicacion->imaxe->description . '">';
}
$saida .= '<div class="resumo mb-5">';
$saida .= '<p>' . renderResumen(getTextoLimpo(getSeccions($publicacion->seccions))) . '</p>';
$saida .= '<p><a href="' . $publicacion->url . '"><i class="icon-arrow-right"></i>' . _x("Read more", "Read more") . '</a></p>' ."\n";
$saida .= '</div>';
}
else
{
if($publicacion->imaxe)
{
$thumb = $publicacion->imaxe->size(0, 260);
$saida .= '<a href="' . $publicacion->imaxe->url . '"><img class="mw-100" src="' . $thumb->url . '" alt="' . $publicacion->imaxe->description . '"></a>';
}
$saida .= '<div class="secciones mb-5">';
$saida .= getSeccions($publicacion->seccions);
$saida .= '</div>';
}
$saida .= '</article>';
return $saida;
}
/**
* @param string $texto
* @param int $limite
* @param string $fin
* @return string
*/
function renderResumen($texto = '', $limite = 120, $fin = '...')
{
$saida = '';
if($texto == '') return '';
if(strlen($texto) <= $limite) return $texto;
$saida = substr($texto, 0, $limite);
$pos = strrpos($saida, " ");
if($pos>0)
{
$saida = substr($saida, 0, $pos);
}
$saida .= $fin;
return $saida;
}
@ -587,174 +751,7 @@ function renderBoton($seccion)
/**
* @param array|PageArray $seccion
* @return string
*/
function renderCategoriasEtiquetas($seccion)
{
$saida = '';
switch ($seccion->first()->template->name)
{
case 'categoria':
$icono = 'folder';
$nome = 'categorias';
break;
case 'etiqueta':
$icono = 'tag';
$nome = 'etiquetas';
break;
default:
$icono = 'sn';
$nome = 'sin';
break;
}
$saida .= '<div id="' . $nome . '" class="col p-3">' . "\n";
$saida .= '<a class="collapse-head" data-bs-toggle="collapse" href="#collapse-' . $nome . '" role="button" aria-expanded="false" aria-controls="collapse-' . $nome . '">' . "\n";
$saida .= '<h3>' . pages()->get('/noticias/' . $nome)->title . '</h3>' . "\n";
$saida .= '</a>' . "\n";
$saida .= '<div class="collapse" id="collapse-' . $nome . '">' . "\n";
$saida .= '<ul class="list-group">' . "\n";
foreach($seccion as $item)
{
$numPosts = pages()->count('template=publicacion, ' . $nome . '=' . $item->name);
$saida .= '<li class="list-group-item d-flex justify-content-between align-items-start">' . "\n";
$saida .= '<a class="ms-2 me-auto" href="' . $item->url . '"><i class="icon-' . $icono . '"></i> ' . $item->title . '</a>' . "\n";
$saida .= '<span class="badge bg-primary rounded-pill">(' . sprintf(_n('%d post', '%d posts', $numPosts), $numPosts) . ')</span>' . "\n";
$saida .= '</li>' . "\n";
}
$saida .= '</ul>' . "\n";
$saida .= '</div>' . "\n";
$saida .= '</div>' . "\n";
return $saida;
}
/**
* @param array|PageArray $artigos
* @param int $posicion
* @return string
*/
function renderPaxinacion($artigos, $posicion)
{
$paxinacion = $artigos->renderPager(
array(
'listMarkup' => '<nav id="paxinacion-' . $posicion . '" class="paxinacion"><ul>{out}</ul></nav>',
'itemMarkup' => '<li class="{class}">{out}</li>',
'linkMarkup' => '<a href="{url}"><span>{out}</span></a>',
'nextItemLabel' => '<i class="icon-skip-forward"></i>',
'previousItemLabel' => '<i class="icon-skip-back"></i>',
'separatorItemClass' => 'separador',
'nextItemClass' => 'seguinte',
'previousItemClass' => 'anterior',
'lastItemClass' => 'derradeiro',
'currentItemClass' => 'actual'
)
);
return $paxinacion;
}
/**
* @param array|PageArray $publicacion
* @param string $locale
* @param boolean $resumen
* @return string
*/
function renderArtigos($publicacion, $locale, $resumen = true)
{
$saida = '';
$data = strtotime($publicacion->fecha_publicacion);
$dateFormatter = \IntlDateFormatter::create(
$locale,
\IntlDateFormatter::NONE,
\IntlDateFormatter::NONE,
\date_default_timezone_get(),
\IntlDateFormatter::GREGORIAN
);
$saida .= '<article id="' . $publicacion->name .'" class="container">' . "\n";
$saida .= '<header class="d-flex gap-3 mb-3">' . "\n";
$saida .= '<time datetime="' . $publicacion->fecha_publicacion . '">' ."\n";
$dateFormatter->setPattern('EEEE');
$saida .= '<em>' . ucfirst(datefmt_format($dateFormatter, $data)) . '</em>' . "\n";
$dateFormatter->setPattern('MMMM');
$saida .= '<strong>' . ucfirst(datefmt_format($dateFormatter, $data)) . '</strong>' . "\n";
$dateFormatter->setPattern('dd');
$saida .= '<span>' . datefmt_format($dateFormatter, $data) . '</span>' . "\n";
$saida .= '</time>' . "\n";
$saida .= '<div>' . "\n";
$saida .= '<h3 class="publicacion-titulo">' . "\n";
$saida .= '<a href="' . $publicacion->url . '"><i class="icon-' . (($resumen) ? 'book' : 'book-open') . '"></i> ' . $publicacion->title . '</a>' . "\n";
$saida .= '</h3>' . "\n";
$saida .= '<dl>' . "\n";
$saida .= '<dt title="' . pages()->get('/noticias/categorias/')->title . '"><i class="icon-folder"></i><span class="d-none d-lg-inline"> ' . pages()->get('/noticias/categorias/')->title . '</span></dt>' . "\n";
$saida .= '<dd><a href="' . $publicacion->categorias->url . '">' . $publicacion->categorias->title . '</a></dd>' . "\n";
$saida .= '<dt title="' . pages()->get('/noticias/etiquetas/')->title . '"><i class="icon-tag"></i><span class="d-none d-lg-inline"> ' . pages()->get('/noticias/etiquetas/')->title . '</span></dt>' . "\n";
$saida .= '<dd>' . $publicacion->etiquetas->each("<a href='{url}'>{title}</a>") . '</dd>' . "\n";
$saida .= '</dl>' . "\n";
$saida .= '</div>' . "\n";
$saida .= '</header>' . "\n";
if($resumen)
{
if($publicacion->imaxe)
{
$thumb = $publicacion->imaxe->size(466, 260);
$saida .= '<img class="mw-100" src="' . $thumb->url . '" alt="' . $publicacion->imaxe->description . '">' . "\n";
}
$saida .= '<div class="resumo mb-5">' . "\n";
$saida .= '<p>' . renderResumen(getTextoLimpo(getSeccions($publicacion->seccions))) . '</p>' . "\n";
$saida .= '<p><a href="' . $publicacion->url . '"><i class="icon-arrow-right"></i>' . _x("Read more", "Read more") . '</a></p>' ."\n";
$saida .= '</div>' . "\n";
}
else
{
if($publicacion->imaxe)
{
$thumb = $publicacion->imaxe->size(466, 260);
$saida .= '<a href="' . $publicacion->imaxe->url . '"><img class="mw-100" src="' . $thumb->url . '" alt="' . $publicacion->imaxe->description . '"></a>' . "\n";
}
$saida .= '<div class="secciones mb-5">' . "\n";
$saida .= getSeccions($publicacion->seccions) . "\n";
$saida .= '</div>' . "\n";
}
$saida .= '</article>' . "\n";
return $saida;
}
/**
* @param string $texto
* @param int $limite
* @param string $fin
* @return string
*/
function renderResumen($texto = '', $limite = 120, $fin = '...')
{
$saida = '';
if($texto == '') return '';
if(strlen($texto) <= $limite) return $texto;
$saida = substr($texto, 0, $limite);
$pos = strrpos($saida, " ");
if($pos>0)
{
$saida = substr($saida, 0, $pos);
}
$saida .= $fin;
return $saida;
}

View file

@ -1,103 +0,0 @@
<?php namespace ProcessWire;
define("RECAPTCHA_V3_SECRET_KEY", '6LexXqYiAAAAAOoFqs4kfWd7zW6stVRK0aViyiQo');
if($input->post->usuario && $input->post->contrasinal)
{
$user = $sanitizer->username($input->post->usuario);
$pass = $input->post->contrasinal;
}
$token = $input->post->token;
$action = $input->post->action;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.google.com/recaptcha/api/siteverify");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('secret' => RECAPTCHA_V3_SECRET_KEY, 'response' => $token)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$arrResponse = json_decode($response, true);
if($arrResponse["success"] == '1' && $arrResponse["action"] == $action && $arrResponse["score"] >= 0.5)
{
if($session->login($user, $pass))
{
$session->redirect($page->parent->httpUrl);
}
else
{
$mensaxe_tipo = "erro";
$mensaxe = _x('Wrong username or password', 'Wrong username or password');
}
}
else
{
$mensaxe_tipo = "alerta";
$mensaxe = _x('Wrong reCaptcha', 'Wrong reCaptcha');
}
?><!DOCTYPE html>
<html lang="<?php echo _x('en', 'HTML language code'); ?>">
<head>
<title><?php echo $titulo; ?></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo $config->urls->templates; ?>images/favicon-32x32.png">
<link rel="shortcut icon" href="<?php echo $config->urls->templates; ?>images/favicon.ico">
<link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates; ?>css/reset.css">
<link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates; ?>css/fonts.css">
<link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates; ?>vendors/Bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates; ?>vendors/Swiperjs/css/swiper-bundle.min.css">
<link title="Praia de Seselle" rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>css/style.css">
<style>
:root
{
font-size: 16px;
--cor_60: <?php echo $configuracion['cor_fondo'] ?>;
--cor_30: <?php echo $configuracion['cor_principal'] ?>;
--cor_10: <?php echo $configuracion['cor_secundario'] ?>;
--imaxe_destacada: <?php echo $page->imaxe ? 'url("'. $page->imaxe->url . '")' : 'none'; ?>;
}
</style>
</head>
<body class="signin text-center">
<main class="form-signin w-100 m-auto">
<form id="inicio-sesion" onSubmit="getLogin(event)" action="/es/gestion/acceder/" method='post'>
<picture class="mb-4">
<source srcset="<?php echo $config->urls->templates?>images/logo-praia-seselle-150x116.jpg" media="(max-width: 767px)">
<source srcset="<?php echo $config->urls->templates?>images/logo-praia-seselle-230x179.jpg" media="(min-width: 768px)">
<img src="<?php echo $config->urls->templates?>images/logo-praia-seselle.svg" alt="<?php echo _x('Logo of Praia de Seselle Tourist Apartments', 'Site logo'); ?>">
</picture>
<h1 class="visually-hidden"><?php echo $configuracion['sitio_nome']; ?> <?php echo $configuracion['sitio_descripcion']; ?></h1>
<h2 class="h3 mb-3 fw-normal"><?php echo _x('Log in', 'Log in'); ?></h2>
<div class="form-floating">
<input type="text" class="form-control" id="usuario" placeholder="<?php echo _x('Username', 'Username') ?>">
<label for="usuario"><?php echo _x('Username', 'Username') ?>:</label>
</div>
<div class="form-floating">
<input type="password" class="form-control" id="contrasinal" placeholder="<?php echo _x('Password', 'Password') ?>">
<label for="contrasinal"><?php echo _x('Password', 'Password') ?>:</label>
</div>
<?php if($input->post->usuario): ?>
<div id="notificacions" class="<?php echo $mensaxe_tipo; ?>">
<h3><i class="icon-x-circle"></i> <?php echo $mensaxe ?></h2>
</div>
<?php endif; ?>
<div class="checkbox mb-3">
<label>
<input type="checkbox" value="remember-me"> Remember me
</label>
</div>
<input class="w-100 btn btn-lg btn-primary" type="submit" id="enviar" name="enviar" value="<?php echo _x('Log in', 'Log in'); ?>">
<p>&copy;2022 <?php echo $configuracion['sitio_nome']
. ' ' . $configuracion['sitio_descripcion']; ?>.</p>
</form>
</main>
<script src="https://www.google.com/recaptcha/api.js?render=6LexXqYiAAAAACwDpMGIg1OMnAXVJU0VmbEMQUD8"></script>
<script src="<?php echo $config->urls->templates?>vendors/Swiperjs/js/swiper-bundle.min.js"></script>
<script src="<?php echo $config->urls->templates?>js/main.js"></script>
</body>
</html>