Compare commits

...

2 commits

8 changed files with 234 additions and 172 deletions

View file

@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "piazza-in-festa/eventi",
"version": "1.0.1",
"version": "1.1.0",
"title": "Piazza in Festa",
"category": "widgets",
"icon": "calendar-alt",
@ -22,7 +22,11 @@
"tema": { "type": "string", "default": "chiaro" },
"colore": { "type": "string", "default": "" },
"titolo": { "type": "string", "default": "" },
"altezza": { "type": "string", "default": "320" }
"altezza": { "type": "string", "default": "320" },
"dal": { "type": "string", "default": "" },
"al": { "type": "string", "default": "" },
"cerca": { "type": "string", "default": "" },
"font": { "type": "string", "default": "" }
},
"editorScript": "file:./index.js"
}

View file

@ -99,6 +99,17 @@
set({ categoria: v });
}
}),
campo(
'cerca',
__('Word in the title', 'piazza-in-festa'),
__('Optional, at least 3 letters, for instance: natale.', 'piazza-in-festa')
),
campo(
'dal',
__('Starting from', 'piazza-in-festa'),
__('Optional. Only events that start in the period, format YYYY-MM-DD.', 'piazza-in-festa')
),
campo('al', __('Until', 'piazza-in-festa'), __('Optional, format YYYY-MM-DD.', 'piazza-in-festa')),
campo('limite', __('How many events', 'piazza-in-festa'), __('From 1 to 20.', 'piazza-in-festa')),
el(SelectControl, {
label: __('Layout', 'piazza-in-festa'),
@ -132,6 +143,20 @@
}
}),
campo('colore', __('Accent colour', 'piazza-in-festa'), __('Hex code, for instance #b4315a.', 'piazza-in-festa')),
el(SelectControl, {
label: __('Font', 'piazza-in-festa'),
value: a.font,
options: [
{ label: __('Visitor device font', 'piazza-in-festa'), value: '' },
{ label: 'Helvetica / Arial', value: 'helvetica' },
{ label: 'Georgia', value: 'serif' }
],
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
onChange: function (v) {
set({ font: v });
}
}),
campo('titolo', __('Heading', 'piazza-in-festa'), __('Leave it empty for no heading.', 'piazza-in-festa')),
campo('altezza', __('Starting height (px)', 'piazza-in-festa'), __('It adapts by itself once loaded.', 'piazza-in-festa'))
)

View file

@ -25,6 +25,10 @@ function pinfesta_defaults() {
'colore' => '',
'titolo' => '',
'altezza' => '320',
'dal' => '',
'al' => '',
'cerca' => '',
'font' => '',
);
}
@ -97,8 +101,44 @@ function pinfesta_build_url( $args ) {
$query['regione'] = sanitize_text_field( $args['regione'] );
}
if ( in_array( $args['categoria'], pinfesta_categorie(), true ) ) {
$query['categoria'] = $args['categoria'];
// One category or several, comma separated. Unknown ones are dropped, so a
// typo widens the widget instead of emptying it.
$categorie = array();
foreach ( explode( ',', (string) $args['categoria'] ) as $item ) {
$item = trim( $item );
if ( in_array( $item, pinfesta_categorie(), true ) ) {
$categorie[] = $item;
}
}
if ( $categorie ) {
$query['categoria'] = implode( ',', array_unique( $categorie ) );
}
// Period: only events that start between these two dates (YYYY-MM-DD), for
// a page about Christmas or the summer. Anything that is not a date is
// ignored.
foreach ( array( 'dal', 'al' ) as $chiave_data ) {
$data = trim( (string) $args[ $chiave_data ] );
if ( preg_match( '/^\d{4}-\d{2}-\d{2}$/', $data ) ) {
$query[ $chiave_data ] = $data;
}
}
// A word in the title, for instance "natale" inside the markets.
$cerca = sanitize_text_field( $args['cerca'] );
if ( mb_strlen( $cerca ) >= 3 ) {
$query['cerca'] = mb_substr( $cerca, 0, 40 );
}
// The widget lives in an iframe and cannot inherit the site's font: the
// service offers a few safe stacks to pick from.
if ( in_array( $args['font'], array( 'helvetica', 'serif' ), true ) ) {
$query['font'] = $args['font'];
}
$limite = absint( $args['limite'] );

View file

@ -7,7 +7,8 @@
* read there is what you write here.
*
* [piazza-in-festa comuni="alba,barolo,la-morra" limite="5"]
* [piazza-in-festa regione="Piemonte" categoria="sagra_enogastronomica"]
* [piazza-in-festa regione="Piemonte" categoria="sagra_enogastronomica,mercatini"]
* [piazza-in-festa regione="Veneto" categoria="mercatini" cerca="natale" dal="2026-11-01" al="2027-01-06"]
*
* @package PiazzaInFesta
*/

View file

@ -1,191 +1,176 @@
# Traduzione italiana di Piazza in Festa.
# This file is distributed under the GPL-2.0-or-later.
msgid ""
msgstr ""
"PO-Revision-Date: 2026-09-09 12:00+0000\n"
"Project-Id-Version: Piazza in Festa 1.0.1\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"Language: it\n"
"Project-Id-Version: Plugins - Piazza in Festa\n"
"PO-Revision-Date: 2026-09-21 12:00+0200\n"
"Last-Translator: thisloke\n"
"Language-Team: Italiano\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: blocks/eventi/block.json
msgctxt "block keyword"
msgid "agenda"
msgstr "agenda"
#. Plugin Name of the plugin
#. Author of the plugin
msgid "Piazza in Festa"
msgstr "Piazza in Festa"
#: blocks/eventi/block.json
msgctxt "block keyword"
msgid "calendar"
msgstr "calendario"
#. Plugin URI of the plugin
msgid "https://piazzainfesta.it/widget"
msgstr "https://piazzainfesta.it/widget"
#: blocks/eventi/block.json
msgctxt "block keyword"
msgid "sagre"
msgstr "sagre"
#. Description of the plugin
msgid "Show the upcoming local events of the Italian towns you follow: village feasts, concerts, fairs, exhibitions. Shortcode and block, updated daily."
msgstr "Mostra i prossimi eventi dei comuni italiani che segui: sagre, concerti, fiere, mostre. Shortcode e blocco, aggiornati ogni giorno."
#: blocks/eventi/block.json
msgctxt "block keyword"
msgid "events"
msgstr "eventi"
#. Author URI of the plugin
msgid "https://piazzainfesta.it"
msgstr "https://piazzainfesta.it"
#: blocks/eventi/block.json
msgctxt "block keyword"
msgid "eventi"
msgstr "eventi"
msgid "Piazza in Festa: set at least one town or a region."
msgstr "Piazza in Festa: indica almeno un comune o una regione."
#: blocks/eventi/block.json
msgctxt "block description"
msgid "Upcoming local events of the towns you follow."
msgstr "I prossimi eventi in zona dei comuni che segui."
msgid "Upcoming local events"
msgstr "Prossimi eventi in zona"
msgid "Service key"
msgstr "Chiave del servizio"
msgid "Optional. Leave it empty and the widget works anyway, with a small credit line at the bottom."
msgstr "Facoltativa. Se la lasci vuota il widget funziona lo stesso, con una piccola firma in fondo."
msgid "Add the events with the block called Piazza in Festa, or with this shortcode:"
msgstr "Aggiungi gli eventi con il blocco Piazza in Festa, oppure con questo shortcode:"
#, php-format
msgid "Not sure about the identifiers of your towns? Build the widget here and copy the values: %s"
msgstr "Non sei sicuro degli identificativi dei tuoi comuni? Costruisci il widget qui e copia i valori: %s"
msgid "Settings"
msgstr "Impostazioni"
msgid "All categories"
msgstr "Tutte le categorie"
msgid "No region"
msgstr "Nessuna regione"
msgid "Events to show"
msgstr "Eventi da mostrare"
msgid "Towns"
msgstr "Comuni"
msgid "Comma separated identifiers, for instance: alba, barolo, la-morra"
msgstr "Identificativi separati da virgola, per esempio: alba, barolo, la-morra"
msgid "Or a whole region"
msgstr "Oppure una regione intera"
msgid "Category"
msgstr "Categoria"
msgid "How many events"
msgstr "Quanti eventi"
msgid "From 1 to 20."
msgstr "Da 1 a 20."
msgid "Layout"
msgstr "Layout"
msgid "List"
msgstr "Elenco"
msgid "Cards"
msgstr "Schede"
msgid "Carousel"
msgstr "Carosello"
msgid "Look"
msgstr "Aspetto"
msgid "Theme"
msgstr "Tema"
msgid "Light"
msgstr "Chiaro"
msgid "Dark"
msgstr "Scuro"
msgid "Accent colour"
msgstr "Colore di accento"
msgid "Hex code, for instance #b4315a."
msgstr "Codice esadecimale, per esempio #b4315a."
msgid "Heading"
msgstr "Titolo"
msgid "Leave it empty for no heading."
msgstr "Lascialo vuoto per non avere titolo."
msgid "Starting height (px)"
msgstr "Altezza iniziale (px)"
msgid "It adapts by itself once loaded."
msgstr "Si adatta da sola dopo il caricamento."
msgid "Piazza in Festa: set at least one town or a region in the block settings."
msgstr "Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco."
#: blocks/eventi/block.json
msgctxt "block title"
msgid "Piazza in Festa"
msgstr "Piazza in Festa"
#: blocks/eventi/index.js:145
msgid "Piazza in Festa: set at least one town or a region in the block settings."
msgstr "Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco."
msgctxt "block description"
msgid "Upcoming local events of the towns you follow."
msgstr "I prossimi eventi dei comuni che segui."
#: blocks/eventi/index.js:136
msgid "It adapts by itself once loaded."
msgstr "Si adatta da sola appena carica."
msgctxt "block keyword"
msgid "eventi"
msgstr "eventi"
#: blocks/eventi/index.js:136
msgid "Starting height (px)"
msgstr "Altezza iniziale (px)"
msgctxt "block keyword"
msgid "events"
msgstr "eventi"
#: blocks/eventi/index.js:135
msgid "Leave it empty for no heading."
msgstr "Lascialo vuoto per non avere titolo."
msgctxt "block keyword"
msgid "sagre"
msgstr "sagre"
#: blocks/eventi/index.js:135
msgid "Heading"
msgstr "Titolo"
msgctxt "block keyword"
msgid "calendar"
msgstr "calendario"
#: blocks/eventi/index.js:134
msgid "Hex code, for instance #b4315a."
msgstr "Codice esadecimale, per esempio #b4315a."
msgctxt "block keyword"
msgid "agenda"
msgstr "agenda"
#: blocks/eventi/index.js:134
msgid "Accent colour"
msgstr "Colore d'accento"
msgid "Word in the title"
msgstr "Parola nel titolo"
#: blocks/eventi/index.js:126
msgid "Dark"
msgstr "Scuro"
msgid "Optional, at least 3 letters, for instance: natale."
msgstr "Facoltativa, almeno 3 lettere, per esempio: natale."
#: blocks/eventi/index.js:125
msgid "Light"
msgstr "Chiaro"
msgid "Starting from"
msgstr "Dal"
#: blocks/eventi/index.js:122
msgid "Theme"
msgstr "Tema"
msgid "Optional. Only events that start in the period, format YYYY-MM-DD."
msgstr "Facoltativo. Solo gli eventi che iniziano nel periodo, formato AAAA-MM-GG."
#: blocks/eventi/index.js:120
msgid "Look"
msgstr "Aspetto"
msgid "Until"
msgstr "Al"
#: blocks/eventi/index.js:109
msgid "Carousel"
msgstr "Carosello"
msgid "Optional, format YYYY-MM-DD."
msgstr "Facoltativo, formato AAAA-MM-GG."
#: blocks/eventi/index.js:108
msgid "Cards"
msgstr "Schede"
msgid "Font"
msgstr "Carattere"
#: blocks/eventi/index.js:107
msgid "List"
msgstr "Elenco"
#: blocks/eventi/index.js:104
msgid "Layout"
msgstr "Formato"
#: blocks/eventi/index.js:102
msgid "From 1 to 20."
msgstr "Da 1 a 20."
#: blocks/eventi/index.js:102
msgid "How many events"
msgstr "Quanti eventi"
#: blocks/eventi/index.js:93
msgid "Category"
msgstr "Categoria"
#: blocks/eventi/index.js:82
msgid "Or a whole region"
msgstr "Oppure una regione intera"
#: blocks/eventi/index.js:79
msgid "Comma separated identifiers, for instance: alba, barolo, la-morra"
msgstr "Identificativi separati da virgola, per esempio: alba, barolo, la-morra"
#: blocks/eventi/index.js:78
msgid "Towns"
msgstr "Comuni"
#: blocks/eventi/index.js:75
msgid "Events to show"
msgstr "Quali eventi mostrare"
#: blocks/eventi/index.js:47
msgid "No region"
msgstr "Nessuna regione"
#: blocks/eventi/index.js:22
msgid "All categories"
msgstr "Tutte le categorie"
#: piazza-in-festa.php:97
msgid "Settings"
msgstr "Impostazioni"
#. translators: %s: link to the online configurator.
#: includes/settings.php:133
msgid "Not sure about the identifiers of your towns? Build the widget here and copy the values: %s"
msgstr "Non sai come si scrivono i tuoi comuni? Costruisci il widget qui e copia i valori: %s"
#: includes/settings.php:126
msgid "Add the events with the block called Piazza in Festa, or with this shortcode:"
msgstr "Metti gli eventi con il blocco Piazza in Festa, oppure con questo shortcode:"
#: includes/settings.php:93
msgid "Optional. Leave it empty and the widget works anyway, with a small credit line at the bottom."
msgstr "Facoltativa. Lasciala vuota e il widget funziona lo stesso, con una riga piccola in fondo che dice da dove arrivano gli eventi."
#: includes/settings.php:55
msgid "Service key"
msgstr "Chiave del servizio"
#: includes/render.php:179
msgid "Upcoming local events"
msgstr "Eventi in arrivo in zona"
#: includes/render.php:167
msgid "Piazza in Festa: set at least one town or a region."
msgstr "Piazza in Festa: indica almeno un comune o una regione."
#. Author URI of the plugin
#: piazza-in-festa.php
msgid "https://piazzainfesta.it"
msgstr "https://piazzainfesta.it"
#. Description of the plugin
#: piazza-in-festa.php
msgid "Show the upcoming local events of the Italian towns you follow: village feasts, concerts, fairs, exhibitions. Shortcode and block, updated daily."
msgstr "Mostra i prossimi eventi dei comuni italiani che segui: sagre, concerti, fiere, mostre. Shortcode e blocco, aggiornati ogni giorno."
#. Plugin URI of the plugin
#: piazza-in-festa.php
msgid "https://piazzainfesta.it/widget"
msgstr "https://piazzainfesta.it/widget"
#. Plugin Name of the plugin
#. Author of the plugin
#: piazza-in-festa.php includes/settings.php:103 includes/settings.php:104
#: includes/settings.php:123
msgid "Piazza in Festa"
msgstr "Piazza in Festa"
msgid "Visitor device font"
msgstr "Carattere del dispositivo del visitatore"

View file

@ -95,8 +95,8 @@ msgid "As with any embedded content, that request reaches the service with the v
msgstr "Come per qualsiasi contenuto incorporato, quella richiesta arriva al servizio con l'indirizzo IP del visitatore e lo user agent del browser. Il plugin non manda niente dal tuo server, non conserva niente sui tuoi visitatori e non usa cookie propri."
#. Found in description paragraph.
msgid "When a visitor opens a page that contains the block or the shortcode, their browser loads a page from <code>https://piazzainfesta.it/embed</code> with the parameters you configured: the towns or the region, the category, how many events to show, and the appearance options (theme, colour, heading). If you saved a service key in the settings, the key is part of that address as well."
msgstr "Quando un visitatore apre una pagina che contiene il blocco o lo shortcode, il suo browser carica una pagina da <code>https://piazzainfesta.it/embed</code> con i parametri che hai configurato: i comuni o la regione, la categoria, quanti eventi mostrare e le opzioni di aspetto (tema, colore, titolo). Se hai salvato una chiave del servizio nelle impostazioni, anche la chiave fa parte di quell'indirizzo."
msgid "When a visitor opens a page that contains the block or the shortcode, their browser loads a page from <code>https://piazzainfesta.it/embed</code> with the parameters you configured: the towns or the region, the categories, the optional period and word in the title, how many events to show, and the appearance options (theme, colour, font, heading). If you saved a service key in the settings, the key is part of that address as well."
msgstr "Quando un visitatore apre una pagina che contiene il blocco o lo shortcode, il suo browser carica una pagina da <code>https://piazzainfesta.it/embed</code> con i parametri che hai configurato: i comuni o la regione, le categorie, l'eventuale periodo e la parola nel titolo, quanti eventi mostrare e le opzioni di aspetto (tema, colore, carattere, titolo). Se hai salvato una chiave del servizio nelle impostazioni, anche la chiave fa parte di quell'indirizzo."
#. Found in description paragraph.
msgid "This plugin displays events served by <strong>Piazza in Festa</strong>, an external service run by the plugin author."

View file

@ -3,7 +3,7 @@
* Plugin Name: Piazza in Festa
* Plugin URI: https://piazzainfesta.it/widget
* Description: Show the upcoming local events of the Italian towns you follow: village feasts, concerts, fairs, exhibitions. Shortcode and block, updated daily.
* Version: 1.0.1
* Version: 1.1.0
* Requires at least: 6.5
* Requires PHP: 7.4
* Author: Piazza in Festa
@ -17,7 +17,7 @@
defined( 'ABSPATH' ) || exit;
define( 'PINFESTA_VERSION', '1.0.1' );
define( 'PINFESTA_VERSION', '1.1.0' );
define( 'PINFESTA_FILE', __FILE__ );
define( 'PINFESTA_DIR', plugin_dir_path( __FILE__ ) );
define( 'PINFESTA_URL', plugin_dir_url( __FILE__ ) );

View file

@ -4,7 +4,7 @@ Tags: eventi, sagre, comuni, pro loco, turismo
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.1
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@ -36,7 +36,7 @@ The plugin is free and complete: every option described here works, with or with
This plugin displays events served by **Piazza in Festa**, an external service run by the plugin author.
When a visitor opens a page that contains the block or the shortcode, their browser loads a page from `https://piazzainfesta.it/embed` with the parameters you configured: the towns or the region, the category, how many events to show, and the appearance options (theme, colour, heading). If you saved a service key in the settings, the key is part of that address as well.
When a visitor opens a page that contains the block or the shortcode, their browser loads a page from `https://piazzainfesta.it/embed` with the parameters you configured: the towns or the region, the categories, the optional period and word in the title, how many events to show, and the appearance options (theme, colour, font, heading). If you saved a service key in the settings, the key is part of that address as well.
As with any embedded content, that request reaches the service with the visitor's IP address and browser user agent. The plugin sends nothing from your server, stores nothing about your visitors, and sets no cookies of its own.
@ -90,6 +90,13 @@ You can set the theme (light or dark), the accent colour and the heading. The re
== Changelog ==
= 1.1.0 =
* Several categories at once, comma separated in the shortcode.
* Period filter (`dal`, `al`): only events that start between two dates, for a page about Christmas or the summer.
* Word in the title (`cerca`), for instance "natale" inside the Christmas markets.
* Font choice for the widget: the visitor's device font, Helvetica or Georgia.
* The service now picks events by quality: posters and verified details first, no council notices, no months-long containers.
= 1.0.1 =
* Directory tags in Italian (eventi, sagre, comuni, pro loco, turismo), so that towns and Pro Loco can find the plugin. No code changes.