Add Events widget

This commit is contained in:
Brian Miyaji
2014-02-03 05:51:09 +11:00
parent eca5c08d16
commit 39d7bbac7f
18 changed files with 323 additions and 30 deletions

View File

@@ -1,5 +1,9 @@
<?php <?php
function sportspress_admin_enqueue_scripts() { function sportspress_admin_enqueue_scripts() {
// Add ThemeBoy icon font, used in the admin stylesheet.
wp_enqueue_style( 'themeboy', SPORTSPRESS_PLUGIN_URL . 'assets/css/themeboy.css', array(), null );
// Load our admin stylesheet.
wp_enqueue_style( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL . 'assets/css/admin.css', array(), time() ); wp_enqueue_style( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL . 'assets/css/admin.css', array(), time() );
wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery' );

View File

@@ -60,7 +60,7 @@ function sportspress_event_details_meta( $post ) {
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_league',
'name' => 'sp_league', 'name' => 'sp_league',
'selected' => $league_id, 'selected' => $league_id,
'value' => 'term_id', 'values' => 'term_id',
'show_option_none' => __( '-- Not set --', 'sportspress' ), 'show_option_none' => __( '-- Not set --', 'sportspress' ),
); );
sportspress_dropdown_taxonomies( $args ); sportspress_dropdown_taxonomies( $args );
@@ -73,7 +73,7 @@ function sportspress_event_details_meta( $post ) {
'taxonomy' => 'sp_season', 'taxonomy' => 'sp_season',
'name' => 'sp_season', 'name' => 'sp_season',
'selected' => $season_id, 'selected' => $season_id,
'value' => 'term_id', 'values' => 'term_id',
'show_option_none' => __( '-- Not set --', 'sportspress' ), 'show_option_none' => __( '-- Not set --', 'sportspress' ),
); );
sportspress_dropdown_taxonomies( $args ); sportspress_dropdown_taxonomies( $args );
@@ -86,7 +86,7 @@ function sportspress_event_details_meta( $post ) {
'taxonomy' => 'sp_venue', 'taxonomy' => 'sp_venue',
'name' => 'sp_venue', 'name' => 'sp_venue',
'selected' => $venue_id, 'selected' => $venue_id,
'value' => 'term_id', 'values' => 'term_id',
'show_option_none' => __( '-- Not set --', 'sportspress' ), 'show_option_none' => __( '-- Not set --', 'sportspress' ),
); );
sportspress_dropdown_taxonomies( $args ); sportspress_dropdown_taxonomies( $args );

View File

@@ -60,7 +60,7 @@ function sportspress_list_player_meta( $post ) {
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_league',
'name' => 'sp_league', 'name' => 'sp_league',
'selected' => $league_id, 'selected' => $league_id,
'value' => 'term_id' 'values' => 'term_id'
); );
sportspress_dropdown_taxonomies( $args ); sportspress_dropdown_taxonomies( $args );
?> ?>
@@ -72,7 +72,7 @@ function sportspress_list_player_meta( $post ) {
'taxonomy' => 'sp_season', 'taxonomy' => 'sp_season',
'name' => 'sp_season', 'name' => 'sp_season',
'selected' => $season_id, 'selected' => $season_id,
'value' => 'term_id' 'values' => 'term_id'
); );
sportspress_dropdown_taxonomies( $args ); sportspress_dropdown_taxonomies( $args );
?> ?>

View File

@@ -38,6 +38,7 @@ function sportspress_table_meta_init( $post ) {
$teams = (array)get_post_meta( $post->ID, 'sp_team', false ); $teams = (array)get_post_meta( $post->ID, 'sp_team', false );
remove_meta_box( 'sp_seasondiv', 'sp_table', 'side' ); remove_meta_box( 'sp_seasondiv', 'sp_table', 'side' );
remove_meta_box( 'sp_leaguediv', 'sp_table', 'side' );
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_table_team_meta', 'sp_table', 'side', 'high' ); add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_table_team_meta', 'sp_table', 'side', 'high' );
if ( $teams && $teams != array(0) ): if ( $teams && $teams != array(0) ):
@@ -57,7 +58,7 @@ function sportspress_table_team_meta( $post, $test ) {
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_league',
'name' => 'sp_league', 'name' => 'sp_league',
'selected' => $league_id, 'selected' => $league_id,
'value' => 'term_id' 'values' => 'term_id'
); );
sportspress_dropdown_taxonomies( $args ); sportspress_dropdown_taxonomies( $args );
?> ?>
@@ -69,7 +70,7 @@ function sportspress_table_team_meta( $post, $test ) {
'taxonomy' => 'sp_season', 'taxonomy' => 'sp_season',
'name' => 'sp_season', 'name' => 'sp_season',
'selected' => $season_id, 'selected' => $season_id,
'value' => 'term_id' 'values' => 'term_id'
); );
sportspress_dropdown_taxonomies( $args ); sportspress_dropdown_taxonomies( $args );
?> ?>

View File

@@ -80,7 +80,7 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) {
<tr>'; <tr>';
if ( $previous ) { if ( $previous ) {
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . add_query_arg( array( 'sp_year' => $previous->year, 'sp_month' => $previous->month ) ) . '" title="' . esc_attr( sprintf(__('%1$s %2$s', 'calendar caption', 'sportspress'), $wp_locale->get_month($previous->month), date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)))) . '">&laquo; ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>'; $calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a data-tooltip data-options="disable_for_touch:true" class="has-tooltip tip-right" href="' . add_query_arg( array( 'sp_year' => $previous->year, 'sp_month' => $previous->month ) ) . '" title="' . esc_attr( sprintf(__('%1$s %2$s', 'calendar caption', 'sportspress'), $wp_locale->get_month($previous->month), date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)))) . '">&laquo; ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
} else { } else {
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>'; $calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
} }
@@ -88,7 +88,7 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) {
$calendar_output .= "\n\t\t".'<td class="pad">&nbsp;</td>'; $calendar_output .= "\n\t\t".'<td class="pad">&nbsp;</td>';
if ( $next ) { if ( $next ) {
$calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="' . add_query_arg( array( 'sp_year' => $next->year, 'sp_month' => $next->month ) ) . '" title="' . esc_attr( sprintf(__('%1$s %2$s', 'calendar caption', 'sportspress'), $wp_locale->get_month($next->month), date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year))) ) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' &raquo;</a></td>'; $calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a data-tooltip data-options="disable_for_touch:true" class="has-tooltip tip-left" href="' . add_query_arg( array( 'sp_year' => $next->year, 'sp_month' => $next->month ) ) . '" title="' . esc_attr( sprintf(__('%1$s %2$s', 'calendar caption', 'sportspress'), $wp_locale->get_month($next->month), date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year))) ) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' &raquo;</a></td>';
} else { } else {
$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>'; $calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>';
} }
@@ -157,7 +157,7 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) {
$calendar_output .= '<td>'; $calendar_output .= '<td>';
if ( array_key_exists($day, $daywithpost) ) // any posts today? if ( array_key_exists($day, $daywithpost) ) // any posts today?
$calendar_output .= '<a href="' . ( sizeof( $daywithpost[ $day ] ) > 1 ? add_query_arg( array( 'post_type' => 'sp_event' ), get_day_link( $thisyear, $thismonth, $day ) ) : get_permalink( $daywithpost[ $day ][0] ) ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) . "\">$day</a>"; $calendar_output .= '<a data-tooltip data-options="disable_for_touch:true" class="has-tip" href="' . ( sizeof( $daywithpost[ $day ] ) > 1 ? add_query_arg( array( 'post_type' => 'sp_event' ), get_day_link( $thisyear, $thismonth, $day ) ) . '" title="' . sprintf( '%s Events', ( sizeof( $daywithpost[ $day ] ) ) ) : get_permalink( $daywithpost[ $day ][0] ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) ) . "\">$day</a>";
else else
$calendar_output .= $day; $calendar_output .= $day;
$calendar_output .= '</td>'; $calendar_output .= '</td>';

View File

@@ -0,0 +1,65 @@
<?php
if ( !function_exists( 'sportspress_events' ) ) {
function sportspress_events( $args = array() ) {
$options = array(
'post_type' => 'sp_event',
'posts_per_page' => 1,
'post_status' => 'publish',
'tax_query' => array(),
);
if ( isset( $args['number'] ) ):
$options['posts_per_page'] = $args['number'];
endif;
if ( isset( $args['status'] ) && $args['status'] == 'any' || $args['status'] == 'scheduled' ):
$options['post_status'] = array( 'publish', 'future' );
endif;
if ( isset( $args['league'] ) ):
$options['tax_query'][] = array(
'taxonomy' => 'sp_league',
'field' => 'id',
'terms' => $league
);
endif;
if ( isset( $args['season'] ) ):
$options['tax_query'][] = array(
'taxonomy' => 'sp_season',
'field' => 'id',
'terms' => $season
);
endif;
if ( isset( $args['venue'] ) ):
$options['tax_query'][] = array(
'taxonomy' => 'sp_venue',
'field' => 'id',
'terms' => $venue
);
endif;
$query = new WP_Query( $options );
if ( $query->have_posts() ):
$output = '<ul class="sp-events-list">';
while ( $query->have_posts() ):
$query->the_post();
$output .=
'<li>' .
'<span class="post-date">' . get_the_date() . '</span>' .
'<a href="' . get_permalink() . '">' . get_the_title() . '</a>' .
'</li>';
endwhile;
$output .= '</ul>';
wp_reset_postdata();
endif;
return apply_filters( 'sportspress_events', $output );
}
}

View File

@@ -17,19 +17,23 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
$seasons = get_the_terms( $id, 'sp_season' ); $seasons = get_the_terms( $id, 'sp_season' );
$terms = array(); $terms = array();
if ( sizeof( $leagues ) ): if ( $leagues ):
$league = reset( $leagues ); $league = reset( $leagues );
$terms[] = $league->name; $terms[] = $league->name;
endif; endif;
if ( sizeof( $seasons ) ): if ( $seasons ):
$season = reset( $seasons ); $season = reset( $seasons );
$terms[] = $season->name; $terms[] = $season->name;
endif; endif;
$title = sizeof( $terms ) ? implode( ' &mdash; ', $terms ) : get_the_title( $id ); $title = sizeof( $terms ) ? implode( ' &mdash; ', $terms ) : get_the_title( $id );
$output = '<h4 class="sp-table-caption">' . $title . '</h4>' . if ( ! is_singular( 'sp_table' ) )
'<div class="sp-table-wrapper">' . $output = '<h4 class="sp-table-caption"><a href="' . get_permalink( $id ) . '">' . $title . '</a></h4>';
else
$output = '<h4 class="sp-table-caption">' . $title . '</h4>';
$output .= '<div class="sp-table-wrapper">' .
'<table class="sp-league-table sp-data-table sp-responsive-table">' . '<thead>' . '<tr>'; '<table class="sp-league-table sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
$data = sportspress_get_league_table_data( $id ); $data = sportspress_get_league_table_data( $id );

145
admin/widgets/events.php Normal file
View File

@@ -0,0 +1,145 @@
<?php
class SportsPress_Widget_Events extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_recent_entries widget_sp_events', 'description' => __( 'SportsPress widget.', 'sportspress' ) );
parent::__construct('sp_events', __( 'Events', 'sportspress' ), $widget_ops);
}
function widget( $args, $instance ) {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$status = empty($instance['status']) ? null : $instance['status'];
$league = empty($instance['league']) ? null : $instance['league'];
$season = empty($instance['season']) ? null : $instance['season'];
$venue = empty($instance['venue']) ? null : $instance['venue'];
$team = empty($instance['team']) ? null : $instance['team'];
$number = empty($instance['number']) ? get_option( 'posts_per_page' ) : $instance['number'];
$args = array(
'status' => $status,
'league' => $league,
'season' => $season,
'venue' => $venue,
'team' => $team,
'number' => $number,
);
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
echo '<div id="sp_events_wrap">';
echo sportspress_events( $args );
echo '</div>';
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['status'] = strip_tags($new_instance['status']);
$instance['league'] = intval($new_instance['league']);
$instance['season'] = intval($new_instance['season']);
$instance['venue'] = intval($new_instance['venue']);
$instance['team'] = intval($new_instance['team']);
$instance['number'] = intval($new_instance['number']);
return $instance;
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'status' => '', 'league' => '', 'season' => '', 'venue' => '', 'team' => '', 'number' => 3 ) );
$title = strip_tags($instance['title']);
$status = strip_tags($instance['status']);
$league = intval($instance['league']);
$season = intval($instance['season']);
$venue = intval($instance['venue']);
$team = intval($instance['team']);
$number = intval($instance['number']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('status'); ?>"><?php _e( 'Status:', 'sportspress' ); ?></label>
<?php
$options = array(
'any' => __( 'Any', 'sportspress' ),
'played' => __( 'Played', 'sportspress' ),
'scheduled' => __( 'Scheduled', 'sportspress' ),
);
?>
<select id="<?php echo $this->get_field_id('status'); ?>" name="<?php echo $this->get_field_name('status'); ?>" class="widefat">
<?php foreach( $options as $key => $name ): ?>
<option value="<?php echo $key; ?>" <?php selected ( $key, $status ); ?>><?php echo $name; ?></option>
<?php endforeach; ?>
</select>
<p><label for="<?php echo $this->get_field_id('league'); ?>"><?php _e( 'League:', 'sportspress' ); ?></label>
<?php
$args = array(
'taxonomy' => 'sp_league',
'name' => $this->get_field_name('league'),
'id' => $this->get_field_id('league'),
'selected' => $league,
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
'hide_empty' => 0,
'values' => 'term_id',
'class' => 'widefat',
);
wp_dropdown_categories( $args );
?>
</p>
<p><label for="<?php echo $this->get_field_id('season'); ?>"><?php _e( 'Season:', 'sportspress' ); ?></label>
<?php
$args = array(
'taxonomy' => 'sp_season',
'name' => $this->get_field_name('season'),
'id' => $this->get_field_id('season'),
'selected' => $season,
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
'hide_empty' => 0,
'values' => 'term_id',
'class' => 'widefat',
);
wp_dropdown_categories( $args );
?>
</p>
<p><label for="<?php echo $this->get_field_id('venue'); ?>"><?php _e( 'Venue:', 'sportspress' ); ?></label>
<?php
$args = array(
'taxonomy' => 'sp_venue',
'name' => $this->get_field_name('venue'),
'id' => $this->get_field_id('venue'),
'selected' => $venue,
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Venues', 'sportspress' ) ),
'hide_empty' => 0,
'values' => 'term_id',
'class' => 'widefat',
);
wp_dropdown_categories( $args );
?>
</p>
<p><label for="<?php echo $this->get_field_id('team'); ?>"><?php _e( 'Team:', 'sportspress' ); ?></label>
<?php
$args = array(
'post_type' => 'sp_team',
'name' => $this->get_field_name('team'),
'id' => $this->get_field_id('team'),
'selected' => $team,
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Teams', 'sportspress' ) ),
'values' => 'ID',
'class' => 'widefat',
);
if ( ! sportspress_dropdown_pages( $args ) ):
sportspress_post_adder( 'sp_table' );
endif;
?>
</p>
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php printf( __( 'Number of %s to show:', 'sportspress' ), __( 'events', 'sportspress' ) ); ?></label>
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3"></p>
<?php
}
}
add_action( 'widgets_init', create_function( '', 'return register_widget( "SportsPress_Widget_Events" );' ) );

View File

@@ -3,7 +3,7 @@ class SportsPress_Widget_League_Table extends WP_Widget {
function __construct() { function __construct() {
$widget_ops = array('classname' => 'widget_league_table widget_sp_league_table', 'description' => __( 'SportsPress widget.', 'sportspress' ) ); $widget_ops = array('classname' => 'widget_league_table widget_sp_league_table', 'description' => __( 'SportsPress widget.', 'sportspress' ) );
parent::__construct('sp_table', __( 'League Table', 'sportspress', 'sportspress' ), $widget_ops); parent::__construct('sp_table', __( 'League Table', 'sportspress' ), $widget_ops);
} }
function widget( $args, $instance ) { function widget( $args, $instance ) {
@@ -35,17 +35,19 @@ class SportsPress_Widget_League_Table extends WP_Widget {
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<p> <p><label for="<?php echo $this->get_field_id('id'); ?>"><?php _e( 'League Table:', 'sportspress' ); ?></label>
<?php <?php
$args = array( $args = array(
'post_type' => 'sp_table', 'post_type' => 'sp_table',
'name' => $this->get_field_name('id'), 'name' => $this->get_field_name('id'),
'id' => $this->get_field_id('id'), 'id' => $this->get_field_id('id'),
'show_option_none' => __( '-- Select --', 'sportspress' ),
'selected' => $id, 'selected' => $id,
'values' => 'ID', 'values' => 'ID',
'class' => 'widefat',
); );
sportspress_dropdown_pages( $args ); if ( ! sportspress_dropdown_pages( $args ) ):
sportspress_post_adder( 'sp_table' );
endif;
?> ?>
</p> </p>
<?php <?php

View File

@@ -1,5 +1,21 @@
/* SportsPress admin styles */ /* SportsPress admin styles */
.widget[id*="sp_events-"] .widget-title h4:before,
.widget[id*="sp_calendar-"] .widget-title h4:before,
.widget[id*="sp_table-"] .widget-title h4:before {
font-family: 'themeboy';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
content: "\e600";
margin-right: 0.5em;
}
.postbox .inside .sp-data-table-container { .postbox .inside .sp-data-table-container {
overflow: auto; overflow: auto;
} }

31
assets/css/themeboy.css Executable file
View File

@@ -0,0 +1,31 @@
@font-face {
font-family: 'themeboy';
src:url('../fonts/themeboy.eot');
src:url('../fonts/themeboy.eot?#iefix') format('embedded-opentype'),
url('../fonts/themeboy.woff') format('woff'),
url('../fonts/themeboy.ttf') format('truetype'),
url('../fonts/themeboy.svg#themeboy') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"], [class*=" icon-"] {
font-family: 'themeboy';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-themeboy:before {
content: "\e600";
}
.icon-themeboy-alt:before {
content: "\e601";
}

BIN
assets/fonts/themeboy.eot Executable file

Binary file not shown.

12
assets/fonts/themeboy.svg Executable file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="themeboy" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" d="" horiz-adv-x="512" />
<glyph unicode="&#xe600;" d="M970.3 532l-22.1 12.8h23.1v-12.8h-1zM903.9 570.3h67.4v-12.8h-45.3l-22.1 12.8zM859.7 595.8h111.6v-12.8h-89.5l-22.1 12.8zM815.4 621.4h155.9v-12.8h-133.7l-22.2 12.8zM771.2 646.9h200.1c0-0.5 0.1-0.9 0.1-1.4v-11.4h-178l-22.2 12.8zM726.6 672.6h240.6c1.2-4.3 2.2-8.5 2.9-12.8h-221.4l-22.1 12.8zM682.3 698.2h274.3c2.2-4.2 4.2-8.4 6-12.8h-258.2l-22.1 12.8zM638.1 723.7h301.2c3.5-4 6.7-8.3 9.8-12.8h-288.9l-22.1 12.8zM593.8 749.2h313.6l6-3.4c4.5-2.6 8.8-5.8 13.1-9.3h-310.6l-22.1 12.7zM549.6 774.8h313.6l22.1-12.8h-313.6l-22.1 12.8zM510.5 797.3l-16.9-9.8h-313.6l22.1 12.8h616.8l22.1-12.8h-313.5l-17 9.8zM246.4 825.8h528.2l22.1-12.8h-572.4l22.1 12.8zM290.7 851.3h439.7l22.1-12.8h-484l22.2 12.8zM334.9 876.9h351.2l22.1-12.8h-395.4l22.1 12.8zM379.2 902.4h262.7l22.1-12.8h-307l22.2 12.8zM423.4 927.9h174.2l22.1-12.8h-218.4l22.1 12.8zM452.6 944.8c6.3 3.6 13.4 6.5 21 8.7h73.9c7.6-2.2 14.7-5.1 21-8.7l7-4.1h-129.9l7 4.1zM449.3 762h-313.6l22.1 12.8h313.6l-22.1-12.8zM405.1 736.5h-310.5c4.2 3.6 8.6 6.7 13.1 9.3l6 3.4h313.6l-22.2-12.7zM360.8 710.9h-288.8c3 4.5 6.3 8.8 9.7 12.8h301.2l-22.1-12.8zM358.5 709.6l152-87.7-155.7-89.9h-305v12.8h308.8v12.8h-308.9v12.8h308.8v12.8h-308.8v12.8h308.8v12.8h-308.8v12.8h308.8v12.8h-308.8v11.4c0 0.4 0.1 0.9 0.1 1.4h308.7v13h-307.6c0.7 4.2 1.7 8.5 2.9 12.8h304.6v12.8h-300c1.8 4.3 3.8 8.6 6 12.8h294.2v11zM310.5 506.5h-260.8v12.8h282.9l-22.1-12.8zM266.3 480.9h-216.6v12.8h238.7l-22.1-12.8zM222 455.4h-172.3v12.8h194.4l-22.1-12.8zM177.8 429.9h-128.1v12.8h150.2l-22.1-12.8zM133.5 404.3h-83.8v12.8h106l-22.2-12.8zM89.3 378.8h-39.6v12.8h61.7l-22.1-12.8zM49.7 356v10h17.5l-17.5-10zM662.5 534.2l156.7-90.4 152 87.7v-178.2h-4.7l-22.1-12.8h26.9v-12.8h-49l-22.2-12.7h71.2v-12.8h-93.3l-22.5-13h115.8v-12.8h-138l-14.1-8.1-14.1 8.1h-285.2l-22.1-12.8h473.5v-12.8h-495.6l-22.1-12.8h517.2c-0.5-4.2-1.2-8.5-2.2-12.8h-537.2l-22.1-12.8h555.4c-1.6-4.3-3.4-8.6-5.4-12.8h-572.1l-22.2-12.5h587.2c-2.7-4.4-5.7-8.7-8.8-12.8h-600.5l-22.1-12.8h611.3c-5.1-4.9-10.5-9.2-16.1-12.8h-617.3l-22.2-12.7h617.6l-22.1-12.7h-617.6l-22.1-12.8h617.6l-22.1-12.8h-617.6l-8.4-4.9-94.1 54.3c-31.9 18.4-57.9 63.5-57.9 100.2v108.7l152-87.7 460.7 265.9zM672 353.3h-19l-22.1-12.8h63.3l-22.2 12.8zM716.3 327.7h-107.5l-22.2-12.7h151.7l-22 12.7zM783 289.2l-22.5 13h-196l-22.5-13h241zM783.5 72.2h-546l-22.1 12.8h590.2l-22.1-12.8zM739.2 46.7h-457.4l-22.1 12.8h501.7l-22.2-12.8zM695 21.1h-368.9l-22.1 12.8h413.1l-22.1-12.8zM650.7-4.4h-280.4l-22.1 12.8h324.6l-22.1-12.8zM606.4-29.9h-191.8l-22.1 12.8h236.1l-22.2-12.8zM568.4-51.8c-2.3-1.3-4.7-2.5-7.1-3.6h-101.6c-2.5 1.1-4.8 2.3-7.1 3.6l-15.9 9.2h147.6l-15.9-9.2z" />
<glyph unicode="&#xe601;" d="M971.3 544.8v-12.8h-1l0.9-0.5-152-87.7-156.7 90.4-460.8-266-152 87.8v10h17.5l22.1 12.8h-39.6v12.8h61.7l22.1 12.8h-83.8v12.8h106l22.1 12.8h-128.1v12.8h150.2l22.1 12.8h-172.3v12.8h194.4l22.1 12.8h-216.5v12.8h238.7l22.1 12.8h-260.8v12.8h282.9l22.1 12.8h-305v12.8h308.8v-10.6l152 87.7-152 87.7 2.3 1.3h-288.8c3 4.5 6.3 8.8 9.7 12.8h301.2l22.1 12.8h-310.4c4.2 3.6 8.6 6.7 13.1 9.3l6 3.4h313.6l22.1 12.8h-313.7l22.1 12.8h313.6l22.1 12.8h-313.5l22.1 12.8h616.8l22.1-12.8h-313.5l22.1-12.8h313.6l22.1-12.8h-313.6l22.1-12.8h313.6l6-3.4c4.5-2.6 8.8-5.8 13.1-9.3h-310.6l22.1-12.8h301.2c3.5-4 6.7-8.3 9.8-12.8h-288.8l22.1-12.8h274.3c2.2-4.2 4.2-8.4 6-12.8h-258.2l22.1-12.8h240.6c1.2-4.3 2.2-8.5 2.9-12.8h-221.3l22.5-13h200.1c0-0.5 0.1-0.9 0.1-1.4v-11.4h-178l22.1-12.8h155.9v-12.8h-133.8l22.1-12.8h111.6v-12.8h-89.5l22.1-12.8h67.4v-12.8h-45.3l22.1-12.8h23.2zM246.4 825.8h528.2l22.1-12.8h-572.4l22.1 12.8zM290.7 851.3h439.7l22.1-12.8h-484l22.2 12.8zM334.9 876.9h351.2l22.1-12.8h-395.4l22.1 12.8zM379.2 902.4h262.7l22.1-12.8h-307l22.2 12.8zM423.4 927.9h174.2l22.1-12.8h-218.4l22.1 12.8zM452.6 944.8c6.3 3.6 13.4 6.5 21 8.7h73.9c7.6-2.2 14.7-5.1 21-8.7l7-4.1h-129.9l7 4.1zM358.5 685.4h-300.1c1.8 4.3 3.8 8.6 6 12.8h294.2v-12.8zM358.5 659.9h-307.6c0.7 4.2 1.7 8.5 2.9 12.8h304.6v-12.8zM358.5 634.1h-308.8v11.4c0 0.4 0.1 0.9 0.1 1.4h308.7v-12.8zM358.5 608.6h-308.8v12.8h308.8v-12.8zM358.5 583.1h-308.8v12.8h308.8v-12.8zM358.5 557.5h-308.8v12.8h308.8v-12.8zM849.9 110.5l-22.1-12.8h-617.6l22.1 12.8h617.6zM783.5 72.2h-546l-22.1 12.8h590.2l-22.1-12.8zM739.2 46.7h-457.4l-22.1 12.8h501.7l-22.2-12.8zM695 21.1h-368.9l-22.1 12.8h413.1l-22.1-12.8zM650.7-4.4h-280.4l-22.1 12.8h324.6l-22.1-12.8zM606.4-29.9h-191.8l-22.1 12.8h236.1l-22.2-12.8zM568.4-51.8c-2.3-1.3-4.7-2.5-7.1-3.6h-101.6c-2.5 1.1-4.8 2.3-7.1 3.6l-15.9 9.2h147.6l-15.9-9.2zM276.5 136h617.6l-22.1-12.7h-617.6l22.1 12.7zM320.8 161.6h611.3c-5.1-4.9-10.5-9.2-16.1-12.8h-617.3l22.1 12.8zM365 187.1h587.2c-2.7-4.4-5.7-8.7-8.8-12.8h-600.5l22.1 12.8zM409.3 212.6h555.4c-1.6-4.3-3.4-8.6-5.4-12.8h-572.1l22.1 12.8zM453.5 238.2h517.2c-0.5-4.2-1.2-8.5-2.2-12.8h-537.1l22.1 12.8zM805.1 276.5h-285.2l22.1 12.8h241l22.1-12.8zM760.5 302.2h-196l22.1 12.8h151.7l22.2-12.8zM672 353.3h-19l9.5 5.5 9.5-5.5zM716.3 327.7h-107.5l22.1 12.8h63.3l22.1-12.8zM971.3 250.9h-495.6l22.1 12.8h473.5v-12.8zM971.3 276.5h-138l22.1 12.8h115.8l0.1-12.8zM971.3 302.2h-93.3l22.1 12.8h71.2v-12.8zM971.2 353.3h-4.7l4.7 2.7v-2.7zM971.3 327.7h-49l22.1 12.8h26.9v-12.8z" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
assets/fonts/themeboy.ttf Executable file

Binary file not shown.

BIN
assets/fonts/themeboy.woff Executable file

Binary file not shown.

View File

@@ -230,13 +230,16 @@ if ( !function_exists( 'sportspress_dropdown_taxonomies' ) ) {
'name' => null, 'name' => null,
'selected' => null, 'selected' => null,
'hide_empty' => false, 'hide_empty' => false,
'value' => 'slug', 'values' => 'slug',
'class' => null,
); );
$args = array_merge( $defaults, $args ); $args = array_merge( $defaults, $args );
$terms = get_terms( $args['taxonomy'], $args ); $terms = get_terms( $args['taxonomy'], $args );
$name = ( $args['name'] ) ? $args['name'] : $args['taxonomy']; $name = ( $args['name'] ) ? $args['name'] : $args['taxonomy'];
$class = $args['class'];
unset( $args['class'] );
if ( $terms ) { if ( $terms ) {
printf( '<select name="%s" class="postform">', $name ); printf( '<select name="%1$s" class="postform %2$s">', $name, $class );
if ( $args['show_option_all'] ) { if ( $args['show_option_all'] ) {
printf( '<option value="0">%s</option>', $args['show_option_all'] ); printf( '<option value="0">%s</option>', $args['show_option_all'] );
} }
@@ -244,7 +247,7 @@ if ( !function_exists( 'sportspress_dropdown_taxonomies' ) ) {
printf( '<option value="-1">%s</option>', $args['show_option_none'] ); printf( '<option value="-1">%s</option>', $args['show_option_none'] );
} }
foreach ( $terms as $term ) { foreach ( $terms as $term ) {
if ( $args['value'] == 'term_id' ) if ( $args['values'] == 'term_id' )
printf( '<option value="%s" %s>%s</option>', $term->term_id, selected( true, $args['selected'] == $term->term_id, false ), $term->name ); printf( '<option value="%s" %s>%s</option>', $term->term_id, selected( true, $args['selected'] == $term->term_id, false ), $term->name );
else else
printf( '<option value="%s" %s>%s</option>', $term->slug, selected( true, $args['selected'] == $term->slug, false ), $term->name ); printf( '<option value="%s" %s>%s</option>', $term->slug, selected( true, $args['selected'] == $term->slug, false ), $term->name );
@@ -259,6 +262,8 @@ if ( !function_exists( 'sportspress_dropdown_pages' ) ) {
$defaults = array( $defaults = array(
'show_option_all' => false, 'show_option_all' => false,
'show_option_none' => false, 'show_option_none' => false,
'option_all_value' => 0,
'option_none_value' => -1,
'name' => 'page_id', 'name' => 'page_id',
'selected' => null, 'selected' => null,
'numberposts' => -1, 'numberposts' => -1,
@@ -275,20 +280,23 @@ if ( !function_exists( 'sportspress_dropdown_pages' ) ) {
'exclude_tree' => null, 'exclude_tree' => null,
'post_type' => 'page', 'post_type' => 'page',
'values' => 'post_name', 'values' => 'post_name',
'class' => null,
); );
$args = array_merge( $defaults, $args ); $args = array_merge( $defaults, $args );
$name = $args['name']; $name = $args['name'];
unset( $args['name'] ); unset( $args['name'] );
$values = $args['values']; $values = $args['values'];
unset( $args['values'] ); unset( $args['values'] );
$class = $args['class'];
unset( $args['class'] );
$posts = get_posts( $args ); $posts = get_posts( $args );
if ( $posts ) { if ( $posts ):
printf( '<select name="%s" class="postform">', $name ); printf( '<select name="%1$s" class="postform %2$s">', $name, $class );
if ( $args['show_option_all'] ) { if ( $args['show_option_all'] ) {
printf( '<option value="0">%s</option>', $args['show_option_all'] ); printf( '<option value="%1$s">%2$s</option>', $args['option_all_value'], $args['show_option_all'] );
} }
if ( $args['show_option_none'] ) { if ( $args['show_option_none'] ) {
printf( '<option value="-1">%s</option>', $args['show_option_none'] ); printf( '<option value="%1$s">%2$s</option>', $args['option_none_value'], $args['show_option_none'] );
} }
foreach ( $posts as $post ) { foreach ( $posts as $post ) {
if ( $values == 'ID' ): if ( $values == 'ID' ):
@@ -298,7 +306,10 @@ if ( !function_exists( 'sportspress_dropdown_pages' ) ) {
endif; endif;
} }
print( '</select>' ); print( '</select>' );
} return true;
else:
return false;
endif;
} }
} }
@@ -882,7 +893,7 @@ if ( !function_exists( 'sportspress_edit_event_results_table' ) ) {
'post_type' => 'sp_outcome', 'post_type' => 'sp_outcome',
'name' => 'sp_results[' . $team_id . '][outcome]', 'name' => 'sp_results[' . $team_id . '][outcome]',
'show_option_none' => __( '-- Not set --', 'sportspress' ), 'show_option_none' => __( '-- Not set --', 'sportspress' ),
'option_none_value' => 0, 'option_none_value' => '',
'sort_order' => 'ASC', 'sort_order' => 'ASC',
'sort_column' => 'menu_order', 'sort_column' => 'menu_order',
'selected' => $value 'selected' => $value

View File

@@ -4,7 +4,7 @@ Tags: sports, sports journalism, teams, team management, fixtures, results, stan
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@themeboy.com&item_name=Donation+for+SportsPress Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@themeboy.com&item_name=Donation+for+SportsPress
Requires at least: 3.5 Requires at least: 3.5
Tested up to: 3.8 Tested up to: 3.8
Stable tag: 0.2.1 Stable tag: 0.2.2
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html

View File

@@ -6,7 +6,7 @@
Plugin Name: SportsPress Plugin Name: SportsPress
Plugin URI: http://themeboy.com/sportspress Plugin URI: http://themeboy.com/sportspress
Description: Manage your club and its players, staff, events, league tables, and player lists. Description: Manage your club and its players, staff, events, league tables, and player lists.
Version: 0.2.1 Version: 0.2.2
Author: ThemeBoy Author: ThemeBoy
Author URI: http://themeboy.com/ Author URI: http://themeboy.com/
License: GPLv3 License: GPLv3
@@ -18,7 +18,7 @@ if ( !function_exists( 'add_action' ) ) {
exit; exit;
} }
define( 'SPORTSPRESS_VERSION', '0.2' ); define( 'SPORTSPRESS_VERSION', '0.2.2' );
define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ ); define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ );
@@ -40,6 +40,7 @@ require_once dirname( __FILE__ ) . '/admin/templates/event-players.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-results.php'; require_once dirname( __FILE__ ) . '/admin/templates/event-results.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-staff.php'; require_once dirname( __FILE__ ) . '/admin/templates/event-staff.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-venue.php'; require_once dirname( __FILE__ ) . '/admin/templates/event-venue.php';
require_once dirname( __FILE__ ) . '/admin/templates/events.php';
require_once dirname( __FILE__ ) . '/admin/templates/events-calendar.php'; require_once dirname( __FILE__ ) . '/admin/templates/events-calendar.php';
require_once dirname( __FILE__ ) . '/admin/templates/league-table.php'; require_once dirname( __FILE__ ) . '/admin/templates/league-table.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-league-statistics.php'; require_once dirname( __FILE__ ) . '/admin/templates/player-league-statistics.php';
@@ -72,6 +73,7 @@ require_once dirname( __FILE__ ) . '/admin/terms/venue.php';
require_once dirname( __FILE__ ) . '/admin/terms/position.php'; require_once dirname( __FILE__ ) . '/admin/terms/position.php';
// Widgets // Widgets
require_once dirname( __FILE__ ) . '/admin/widgets/events.php';
require_once dirname( __FILE__ ) . '/admin/widgets/calendar.php'; require_once dirname( __FILE__ ) . '/admin/widgets/calendar.php';
require_once dirname( __FILE__ ) . '/admin/widgets/table.php'; require_once dirname( __FILE__ ) . '/admin/widgets/table.php';