From 30348d8a723bc32564977edcd5ddfb2a14edcd2b Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Thu, 13 Feb 2014 20:29:30 +1100 Subject: [PATCH] Countdown widget options --- admin/templates/countdown.php | 21 ++++++++++++--------- admin/widgets/countdown.php | 22 +++++++++++++--------- admin/widgets/league-table.php | 2 +- admin/widgets/player-list.php | 2 +- readme.txt | 11 ++++++++++- sportspress.php | 4 ++-- 6 files changed, 39 insertions(+), 23 deletions(-) diff --git a/admin/templates/countdown.php b/admin/templates/countdown.php index 2d443926..b8c6422e 100644 --- a/admin/templates/countdown.php +++ b/admin/templates/countdown.php @@ -2,7 +2,8 @@ if ( !function_exists( 'sportspress_countdown' ) ) { function sportspress_countdown( $args = array() ) { - $id = sportspress_array_value( $args, 'id', null ); + $id = sportspress_array_value( $args, 'event', null ); + $show_league = sportspress_array_value( $args, 'show_league', null ); if ( $id ): $post = get_post( $id ); @@ -27,24 +28,26 @@ if ( !function_exists( 'sportspress_countdown' ) ) { $output .= '
'; $output .= '

' . $post->post_title . '

'; - $leagues = get_the_terms( $post->ID, 'sp_league' ); - if ( $leagues ): - foreach( $leagues as $league ): - $term = get_term( $league->term_id, 'sp_league' ); - $output .= '
' . $term->name . '
'; - endforeach; + if ( $show_league ): + $leagues = get_the_terms( $post->ID, 'sp_league' ); + if ( $leagues ): + foreach( $leagues as $league ): + $term = get_term( $league->term_id, 'sp_league' ); + $output .= '
' . $term->name . '
'; + endforeach; + endif; endif; $now = new DateTime( current_time( 'mysql', 0 ) ); $date = new DateTime( $post->post_date ); $interval = date_diff( $now, $date ); - $output .= '

'; + '

'; $output .= '
'; else: diff --git a/admin/widgets/countdown.php b/admin/widgets/countdown.php index 5faba94f..732e5f1d 100644 --- a/admin/widgets/countdown.php +++ b/admin/widgets/countdown.php @@ -8,9 +8,8 @@ class SP_Widget_Countdown extends WP_Widget { function widget( $args, $instance ) { extract($args); - $title = apply_filters('widget_title', empty($instance['title']) ? __( 'Countdown', 'sportspress' ) : $instance['title'], $instance, $this->id_base); + $title = apply_filters('widget_title', empty($instance['title']) ? null : $instance['title'], $instance, $this->id_base); echo $before_widget; - $id = empty($instance['id']) ? null : $instance['id']; if ( $title ) echo $before_title . $title . $after_title; echo sportspress_countdown( $instance ); @@ -20,26 +19,28 @@ class SP_Widget_Countdown extends WP_Widget { function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); - $instance['id'] = intval($new_instance['id']); + $instance['event'] = intval($new_instance['event']); + $instance['show_league'] = intval($new_instance['show_league']); return $instance; } function form( $instance ) { - $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '' ) ); + $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'event' => '', 'show_league' => 0 ) ); $title = strip_tags($instance['title']); - $id = intval($instance['id']); + $event = intval($instance['event']); + $show_league = intval($instance['show_league']); ?>

-

+

'sp_event', - 'name' => $this->get_field_name('id'), - 'id' => $this->get_field_id('id'), - 'selected' => $id, + 'name' => $this->get_field_name('event'), + 'id' => $this->get_field_id('event'), + 'selected' => $event, 'show_option_all' => __( '(Auto)', 'sportspress' ), 'values' => 'ID', 'class' => 'widefat', @@ -51,6 +52,9 @@ class SP_Widget_Countdown extends WP_Widget { endif; ?>

+ +

> +

-

+

'sp_table', diff --git a/admin/widgets/player-list.php b/admin/widgets/player-list.php index 246c4c11..15ae752c 100644 --- a/admin/widgets/player-list.php +++ b/admin/widgets/player-list.php @@ -44,7 +44,7 @@ class SportsPress_Widget_Player_list extends WP_Widget {

-

+

'sp_list', diff --git a/readme.txt b/readme.txt index ac6aadb7..f2a439a8 100644 --- a/readme.txt +++ b/readme.txt @@ -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 Requires at least: 3.8 Tested up to: 3.8.1 -Stable tag: 0.2.9 +Stable tag: 0.2.10 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -88,9 +88,18 @@ SportsPress is currently in beta and is undergoing testing. We are still activel 3. Players admin. 4. SportsPress Settings panel. 5. League Table widget. +6. Player List widget. +7. Events Calendar widget. +8. Countdown widget. == Changelog == += 0.2.10 = +* Fix - Team filtering in events, tables, players, and lists. +* Tweak - Display statistics for all league/season events played in player profiles and player lists. +* Tweak - Count events as played when in starting lineup or made substitution. +* Tweak - Display player metrics only when value is set. + = 0.2.9 = * Feature - Ability to select players from all teams in player list. * Fix - Decimal sorting in league tables and player lists. diff --git a/sportspress.php b/sportspress.php index 188c2d99..ee05b5ce 100644 --- a/sportspress.php +++ b/sportspress.php @@ -6,7 +6,7 @@ Plugin Name: SportsPress Plugin URI: http://themeboy.com/sportspress Description: Manage your club and its players, staff, events, league tables, and player lists. -Version: 0.2.9 +Version: 0.2.10 Author: ThemeBoy Author URI: http://themeboy.com/ License: GPLv3 @@ -18,7 +18,7 @@ if ( !function_exists( 'add_action' ) ) { exit; } -define( 'SPORTSPRESS_VERSION', '0.2.9' ); +define( 'SPORTSPRESS_VERSION', '0.2.10' ); define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ );