✨ feature: Update version to 1.2.6, add registration link field, and enhance event templates
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
notes/
|
notes/
|
||||||
|
docs/
|
||||||
phpcs-results.txt
|
phpcs-results.txt
|
||||||
tests/
|
tests/
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: AA Events
|
* Plugin Name: AA Events
|
||||||
* Plugin URI: https://github.com/automattic/aa-events
|
* Plugin URI: https://github.com/automattic/aa-events
|
||||||
* Description: An Events management plugin for WordPress, with accessible calendar (WCAG 2.2AA) and card grid views.
|
* Description: An Events management plugin for WordPress, with accessible calendar (WCAG 2.2AA) and card grid views.
|
||||||
* Version: 1.2.5
|
* Version: 1.2.6
|
||||||
* Author: Keith Solomon
|
* Author: Keith Solomon
|
||||||
* Author URI: https://vincentdesign.ca
|
* Author URI: https://vincentdesign.ca
|
||||||
* License: GPL-2.0+
|
* License: GPL-2.0+
|
||||||
@@ -49,7 +49,7 @@ register_deactivation_hook( __FILE__, 'deactivate_aa_events' );
|
|||||||
* Define Constants
|
* Define Constants
|
||||||
*/
|
*/
|
||||||
define( 'AA_EVENTS_PLUGIN_FILE', __FILE__ );
|
define( 'AA_EVENTS_PLUGIN_FILE', __FILE__ );
|
||||||
define( 'AA_EVENTS_VERSION', '1.2.1' );
|
define( 'AA_EVENTS_VERSION', '1.2.6' );
|
||||||
define( 'AA_EVENTS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
define( 'AA_EVENTS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||||
define( 'AA_EVENTS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
define( 'AA_EVENTS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||||
|
|
||||||
|
|||||||
@@ -309,6 +309,21 @@ function events_register_acf_fields() {
|
|||||||
'default_value' => '',
|
'default_value' => '',
|
||||||
'placeholder' => '',
|
'placeholder' => '',
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'key' => 'field_aa_events_registration_link',
|
||||||
|
'label' => 'Registration Link',
|
||||||
|
'name' => 'registration_link',
|
||||||
|
'type' => 'link',
|
||||||
|
'instructions' => '',
|
||||||
|
'required' => 0,
|
||||||
|
'conditional_logic' => 0,
|
||||||
|
'wrapper' => array(
|
||||||
|
'width' => '',
|
||||||
|
'class' => '',
|
||||||
|
'id' => '',
|
||||||
|
),
|
||||||
|
'return_format' => 'array',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'location' => array(
|
'location' => array(
|
||||||
array(
|
array(
|
||||||
|
|||||||
@@ -26,6 +26,46 @@ function aa_events_contact_email_markup( $value ) {
|
|||||||
return '<a href="' . esc_attr( 'mailto:' . $protected ) . '">' . wp_kses_post( $protected ) . '</a>';
|
return '<a href="' . esc_attr( 'mailto:' . $protected ) . '">' . wp_kses_post( $protected ) . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build safe registration-link markup for event templates.
|
||||||
|
*
|
||||||
|
* @param mixed $value Raw registration link value.
|
||||||
|
* @return string Escaped registration link, or an empty string for invalid input.
|
||||||
|
*/
|
||||||
|
function aa_events_registration_link_markup( $value ) {
|
||||||
|
if ( is_array( $value ) ) {
|
||||||
|
if ( ! isset( $value['url'] ) || ! is_string( $value['url'] ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = trim( $value['url'] );
|
||||||
|
$target = isset( $value['target'] ) && is_string( $value['target'] ) ? $value['target'] : '';
|
||||||
|
} elseif ( is_string( $value ) ) {
|
||||||
|
$url = trim( $value );
|
||||||
|
$target = '';
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( '' === $url || false === filter_var( $url, FILTER_VALIDATE_URL ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$url_parts = wp_parse_url( $url );
|
||||||
|
if (
|
||||||
|
! is_array( $url_parts ) ||
|
||||||
|
empty( $url_parts['host'] ) ||
|
||||||
|
empty( $url_parts['scheme'] ) ||
|
||||||
|
! in_array( strtolower( $url_parts['scheme'] ), array( 'http', 'https' ), true )
|
||||||
|
) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$target_attributes = '_blank' === $target ? ' target="_blank" rel="noopener noreferrer"' : '';
|
||||||
|
|
||||||
|
return '<a class="aa-event-registration-link button" href="' . esc_url( $url ) . '"' . $target_attributes . '>' . esc_html( __( 'Register', 'aa-events' ) ) . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a template.
|
* Load a template.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -285,6 +285,30 @@
|
|||||||
div { margin-bottom: 0.625rem; }
|
div { margin-bottom: 0.625rem; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aa-event-registration-link {
|
||||||
|
background: #005f73;
|
||||||
|
border: 2px solid #005f73;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
color: #fff;
|
||||||
|
display: inline-block;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-top: 1.25rem;
|
||||||
|
padding: 0.625rem 1.25rem;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aa-event-registration-link:hover {
|
||||||
|
background: #003f4d;
|
||||||
|
border-color: #003f4d;
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aa-event-registration-link:focus-visible {
|
||||||
|
outline: 3px solid #111;
|
||||||
|
outline-offset: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Events archive layout */
|
/* Events archive layout */
|
||||||
.aa-events-wrap .aa-events-grid {
|
.aa-events-wrap .aa-events-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
@@ -112,41 +112,6 @@ $events = new WP_Query(
|
|||||||
'no_found_rows' => true,
|
'no_found_rows' => true,
|
||||||
'update_post_meta_cache' => true,
|
'update_post_meta_cache' => true,
|
||||||
'update_post_term_cache' => false,
|
'update_post_term_cache' => false,
|
||||||
'meta_query' => array(
|
|
||||||
'relation' => 'OR',
|
|
||||||
array(
|
|
||||||
'relation' => 'AND',
|
|
||||||
array(
|
|
||||||
'key' => '_aa_events_occurrence_index_version',
|
|
||||||
'value' => AA_EVENTS_VERSION,
|
|
||||||
'compare' => '=',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'key' => '_aa_events_sort_start',
|
|
||||||
'value' => $month['month_end']->format( 'Y-m-d 23:59:59' ),
|
|
||||||
'compare' => '<=',
|
|
||||||
'type' => 'DATETIME',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'key' => '_aa_events_sort_end',
|
|
||||||
'value' => $month['month_start']->format( 'Y-m-d 00:00:00' ),
|
|
||||||
'compare' => '>=',
|
|
||||||
'type' => 'DATETIME',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'relation' => 'OR',
|
|
||||||
array(
|
|
||||||
'key' => '_aa_events_occurrence_index_version',
|
|
||||||
'compare' => 'NOT EXISTS',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'key' => '_aa_events_occurrence_index_version',
|
|
||||||
'value' => AA_EVENTS_VERSION,
|
|
||||||
'compare' => '!=',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
foreach ( $events->posts as $event_id ) {
|
foreach ( $events->posts as $event_id ) {
|
||||||
|
|||||||
@@ -93,6 +93,13 @@ get_header(); ?>
|
|||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php $registration_link_markup = aa_events_registration_link_markup( get_field( 'registration_link' ) ); ?>
|
||||||
|
<?php if ( $registration_link_markup ) : ?>
|
||||||
|
<div class="aa-event-registration">
|
||||||
|
<?php echo wp_kses_post( $registration_link_markup ); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</footer><!-- .entry-footer -->
|
</footer><!-- .entry-footer -->
|
||||||
</article><!-- #post-<?php the_ID(); ?> -->
|
</article><!-- #post-<?php the_ID(); ?> -->
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user