Consistently use event prefix for calendar and list templates

Retain backwards compatibility
This commit is contained in:
Brian Miyaji
2014-03-22 17:21:56 +11:00
parent d433a58eb0
commit c30b7eb664
11 changed files with 45 additions and 110 deletions

View File

@@ -1,9 +1,9 @@
<?php
class SportsPress_Widget_Events_Calendar extends WP_Widget {
class SportsPress_Widget_Event_Calendar extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_calendar widget_sp_events_calendar', 'description' => __( 'A calendar of events.', 'sportspress' ) );
parent::__construct('sp_events_calendar', __( 'SportsPress Events Calendar', 'sportspress' ), $widget_ops);
$widget_ops = array('classname' => 'widget_calendar widget_sp_event_calendar', 'description' => __( 'A calendar of events.', 'sportspress' ) );
parent::__construct('sp_event_calendar', __( 'SportsPress Events Calendar', 'sportspress' ), $widget_ops);
}
function widget( $args, $instance ) {
@@ -15,7 +15,7 @@ class SportsPress_Widget_Events_Calendar extends WP_Widget {
if ( $title )
echo $before_title . $title . $after_title;
echo '<div id="calendar_wrap">';
echo sportspress_events_calendar( $id, true, array( 'caption_tag' => 'caption', 'show_all_events_link' => $show_all_events_link ) );
echo sportspress_event_calendar( $id, true, array( 'caption_tag' => 'caption', 'show_all_events_link' => $show_all_events_link ) );
echo '</div>';
echo $after_widget;
}
@@ -47,7 +47,7 @@ class SportsPress_Widget_Events_Calendar extends WP_Widget {
'id' => $this->get_field_id('id'),
'selected' => $id,
'values' => 'ID',
'class' => 'sp-events-calendar-select widefat',
'class' => 'sp-event-calendar-select widefat',
);
if ( ! sportspress_dropdown_pages( $args ) ):
sportspress_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) );
@@ -55,9 +55,9 @@ class SportsPress_Widget_Events_Calendar extends WP_Widget {
?>
</p>
<p class="sp-events-calendar-show-all-toggle<?php if ( ! $id ): ?> hidden<?php endif; ?>"><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_events_link'); ?>" name="<?php echo $this->get_field_name('show_all_events_link'); ?>" value="1" <?php checked( $show_all_events_link, 1 ); ?>>
<p class="sp-event-calendar-show-all-toggle<?php if ( ! $id ): ?> hidden<?php endif; ?>"><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_events_link'); ?>" name="<?php echo $this->get_field_name('show_all_events_link'); ?>" value="1" <?php checked( $show_all_events_link, 1 ); ?>>
<label for="<?php echo $this->get_field_id('show_all_events_link'); ?>"><?php _e( 'Display link to view all events', 'sportspress' ); ?></label></p>
<?php
}
}
add_action( 'widgets_init', create_function( '', 'return register_widget( "SportsPress_Widget_Events_Calendar" );' ) );
add_action( 'widgets_init', create_function( '', 'return register_widget( "SportsPress_Widget_Event_Calendar" );' ) );

View File

@@ -1,9 +1,9 @@
<?php
class SportsPress_Widget_Events_List extends WP_Widget {
class SportsPress_Widget_Event_List extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_sp_events_list', 'description' => __( 'A list of events.', 'sportspress' ) );
parent::__construct('sp_events_list', __( 'SportsPress Events List', 'sportspress' ), $widget_ops);
$widget_ops = array('classname' => 'widget_sp_event_list', 'description' => __( 'A list of events.', 'sportspress' ) );
parent::__construct('sp_event_list', __( 'SportsPress Events List', 'sportspress' ), $widget_ops);
}
function widget( $args, $instance ) {
@@ -15,7 +15,7 @@ class SportsPress_Widget_Events_List extends WP_Widget {
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
echo sportspress_events_list( $id, array( 'columns' => $columns, 'show_all_events_link' => $show_all_events_link ) );
echo sportspress_event_list( $id, array( 'columns' => $columns, 'show_all_events_link' => $show_all_events_link ) );
echo $after_widget;
}
@@ -48,7 +48,7 @@ class SportsPress_Widget_Events_List extends WP_Widget {
'id' => $this->get_field_id('id'),
'selected' => $id,
'values' => 'ID',
'class' => 'sp-events-calendar-select widefat',
'class' => 'sp-event-calendar-select widefat',
);
if ( ! sportspress_dropdown_pages( $args ) ):
sportspress_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) );
@@ -73,9 +73,9 @@ class SportsPress_Widget_Events_List extends WP_Widget {
<?php endforeach; ?>
</p>
<p class="sp-events-calendar-show-all-toggle<?php if ( ! $id ): ?> hidden<?php endif; ?>"><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_events_link'); ?>" name="<?php echo $this->get_field_name('show_all_events_link'); ?>" value="1" <?php checked( $show_all_events_link, 1 ); ?>>
<p class="sp-event-calendar-show-all-toggle<?php if ( ! $id ): ?> hidden<?php endif; ?>"><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_events_link'); ?>" name="<?php echo $this->get_field_name('show_all_events_link'); ?>" value="1" <?php checked( $show_all_events_link, 1 ); ?>>
<label for="<?php echo $this->get_field_id('show_all_events_link'); ?>"><?php _e( 'Display link to view all events', 'sportspress' ); ?></label></p>
<?php
}
}
add_action( 'widgets_init', create_function( '', 'return register_widget( "SportsPress_Widget_Events_List" );' ) );
add_action( 'widgets_init', create_function( '', 'return register_widget( "SportsPress_Widget_Event_List" );' ) );