feat: rilascio 1.1.0, piu' categorie insieme, periodo dal/al, parola nel titolo e scelta del carattere nel blocco e nello shortcode
All checks were successful
Release su wordpress.org / rilascio (push) Successful in 35s
All checks were successful
Release su wordpress.org / rilascio (push) Successful in 35s
This commit is contained in:
parent
1b1dda3281
commit
368682bd07
8 changed files with 112 additions and 11 deletions
|
|
@ -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'] );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue