diff --git a/actions.php b/actions.php index d4cb7e39..06f31190 100644 --- a/actions.php +++ b/actions.php @@ -29,8 +29,8 @@ function sp_manage_posts_custom_column( $column, $post_id ) { case 'sp_event': echo get_post_meta ( $post_id, 'sp_event' ) ? sizeof( get_post_meta ( $post_id, 'sp_event' ) ) : '—'; break; - case 'sp_league': - echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—'; + case 'sp_division': + echo get_the_terms ( $post_id, 'sp_division' ) ? the_terms( $post_id, 'sp_division' ) : '—'; break; case 'sp_sponsor': echo get_the_terms ( $post_id, 'sp_sponsor' ) ? the_terms( $post_id, 'sp_sponsor' ) : '—'; @@ -69,21 +69,11 @@ function sp_restrict_manage_posts() { sp_dropdown_taxonomies( $args ); endif; if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_list' ) ) ): - $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; + $selected = isset( $_REQUEST['sp_division'] ) ? $_REQUEST['sp_division'] : null; $args = array( - 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), - 'taxonomy' => 'sp_league', - 'name' => 'sp_league', - 'selected' => $selected - ); - sp_dropdown_taxonomies( $args ); - endif; - if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player' ) ) ): - $selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null; - $args = array( - 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ), - 'taxonomy' => 'sp_sponsor', - 'name' => 'sp_sponsor', + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Divisions', 'sportspress' ) ), + 'taxonomy' => 'sp_division', + 'name' => 'sp_division', 'selected' => $selected ); sp_dropdown_taxonomies( $args ); @@ -141,13 +131,13 @@ function sp_save_post( $post_id ) { break; case ( 'sp_table' ): update_post_meta( $post_id, 'sp_stats', sp_array_value( $_POST, 'sp_stats', array() ) ); - wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_league', 0 ), 'sp_league' ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_division', 0 ), 'sp_division' ); sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) ); break; case ( 'sp_list' ): update_post_meta( $post_id, 'sp_stats', sp_array_value( $_POST, 'sp_stats', array() ) ); update_post_meta( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) ); - wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_league', 0 ), 'sp_league' ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_division', 0 ), 'sp_division' ); sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) ); break; endswitch; diff --git a/division.php b/division.php new file mode 100644 index 00000000..12ead5f5 --- /dev/null +++ b/division.php @@ -0,0 +1,18 @@ + $name, + 'labels' => $labels, + 'public' => true, + 'hierarchical' => true, + 'rewrite' => array( 'slug' => 'division' ), + ); + register_taxonomy( 'sp_division', $object_type, $args ); +} +add_action( 'init', 'sp_division_tax_init' ); +?> \ No newline at end of file diff --git a/event.php b/event.php index 47e6db32..e82a9810 100644 --- a/event.php +++ b/event.php @@ -131,8 +131,7 @@ function sp_event_edit_columns() { 'cb' => '', 'title' => __( 'Event', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_league' => __( 'Leagues', 'sportspress' ), - 'sp_sponsor' => __( 'Sponsors', 'sportspress' ), + 'sp_division' => __( 'Divisions', 'sportspress' ), 'sp_kickoff' => __( 'Kick-off', 'sportspress' ) ); return $columns; diff --git a/helpers.php b/helpers.php index eee92fed..4e550796 100644 --- a/helpers.php +++ b/helpers.php @@ -210,7 +210,7 @@ if ( !function_exists( 'sp_post_checklist' ) ) { $parents = get_post_ancestors( $post ); if ( $filter ): $filter_values = (array)get_post_meta( $post->ID, $filter, false ); - $terms = (array)get_the_terms( $post->ID, 'sp_league' ); + $terms = (array)get_the_terms( $post->ID, 'sp_division' ); foreach ( $terms as $term ): if ( is_object( $term ) && property_exists( $term, 'term_id' ) ) $filter_values[] = $term->term_id; diff --git a/languages/sportspress-ja.mo b/languages/sportspress-ja.mo index 2fc0a1cd..897cd948 100644 Binary files a/languages/sportspress-ja.mo and b/languages/sportspress-ja.mo differ diff --git a/languages/sportspress-ja.po b/languages/sportspress-ja.po index d2645420..7b4e5bc6 100644 --- a/languages/sportspress-ja.po +++ b/languages/sportspress-ja.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: SportsPress 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-08-23 19:38+1000\n" -"PO-Revision-Date: 2013-08-23 19:38+1000\n" +"POT-Creation-Date: 2013-08-25 13:40+1000\n" +"PO-Revision-Date: 2013-08-25 13:41+1000\n" "Last-Translator: ThemeBoy \n" "Language-Team: ThemeBoy \n" "Language: ja\n" @@ -28,9 +28,8 @@ msgstr "試合終了" msgid "M j, Y @ G:i" msgstr "Y年n月j日 @ G:i" -#: ../actions.php:54 ../actions.php:64 ../actions.php:74 ../actions.php:84 -#: ../helpers.php:73 ../helpers.php:93 ../list.php:46 ../list.php:57 -#: ../table.php:44 +#: ../actions.php:54 ../actions.php:64 ../actions.php:74 ../helpers.php:73 +#: ../helpers.php:93 ../list.php:46 ../list.php:57 ../table.php:44 #, php-format msgid "All %s" msgstr "すべての%s" @@ -46,16 +45,19 @@ msgstr "チーム" msgid "Positions" msgstr "ポジション" -#: ../actions.php:74 ../event.php:134 ../league.php:3 ../list.php:27 +#: ../actions.php:74 ../division.php:3 ../event.php:134 ../list.php:27 #: ../list.php:46 ../player.php:141 ../staff.php:44 ../table.php:26 #: ../table.php:44 ../team.php:33 -msgid "Leagues" -msgstr "リーグ" +msgid "Divisions" +msgstr "リーグレベル" -#: ../actions.php:84 ../event.php:135 ../player.php:142 ../sponsor.php:3 -#: ../team.php:34 -msgid "Sponsors" -msgstr "スポンサー" +#: ../division.php:4 ../player.php:46 ../team.php:80 +msgid "Division" +msgstr "リーグレベル" + +#: ../division.php:5 +msgid "divisions" +msgstr "リーグレベル" #: ../event.php:3 ../settings.php:86 msgid "Events" @@ -104,7 +106,7 @@ msgstr "チーム" msgid "Player" msgstr "選手" -#: ../event.php:136 ../globals.php:12 ../globals.php:13 ../globals.php:14 +#: ../event.php:135 ../globals.php:12 ../globals.php:13 ../globals.php:14 msgid "Kick-off" msgstr "キックオフ" @@ -200,14 +202,6 @@ msgstr "(タイトルなし)" msgid "Total" msgstr "合計" -#: ../league.php:4 ../player.php:46 ../team.php:81 -msgid "League" -msgstr "リーグ" - -#: ../league.php:5 -msgid "leagues" -msgstr "リーグ" - #: ../list.php:3 msgid "Player Lists" msgstr "選手名鑑" @@ -312,6 +306,10 @@ msgstr "警告" msgid "Red Cards" msgstr "退場" +#: ../sponsor.php:3 +msgid "Sponsors" +msgstr "スポンサー" + #: ../sponsor.php:4 msgid "Sponsor" msgstr "スポンサー" @@ -339,3 +337,12 @@ msgstr "順位表" #: ../team.php:5 msgid "teams" msgstr "チーム" + +#~ msgid "Leagues" +#~ msgstr "リーグ" + +#~ msgid "League" +#~ msgstr "リーグ" + +#~ msgid "leagues" +#~ msgstr "リーグ" diff --git a/league.php b/league.php deleted file mode 100644 index 4f3f6881..00000000 --- a/league.php +++ /dev/null @@ -1,18 +0,0 @@ - $name, - 'labels' => $labels, - 'public' => true, - 'hierarchical' => true, - 'rewrite' => array( 'slug' => 'league' ), - ); - register_taxonomy( 'sp_league', $object_type, $args ); -} -add_action( 'init', 'sp_league_tax_init' ); -?> \ No newline at end of file diff --git a/list.php b/list.php index b44320fc..893f4030 100644 --- a/list.php +++ b/list.php @@ -24,7 +24,7 @@ function sp_list_edit_columns() { 'title' => __( 'Title' ), 'sp_player' => __( 'Players', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_league' => __( 'Leagues', 'sportspress' ) + 'sp_division' => __( 'Divisions', 'sportspress' ) ); return $columns; } @@ -36,17 +36,17 @@ function sp_list_meta_init() { } function sp_list_player_meta( $post ) { - $league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); + $division_id = sp_get_the_term_id( $post->ID, 'sp_division', 0 ); $team_id = get_post_meta( $post->ID, 'sp_team', true ); ?>

sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), - 'taxonomy' => 'sp_league', - 'name' => 'sp_league', - 'selected' => $league_id + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Divisions', 'sportspress' ) ), + 'taxonomy' => 'sp_division', + 'name' => 'sp_division', + 'selected' => $division_id ); sp_dropdown_taxonomies( $args ); ?> @@ -75,9 +75,9 @@ function sp_list_player_meta( $post ) { function sp_list_stats_meta( $post ) { $players = (array)get_post_meta( $post->ID, 'sp_player', false ); $stats = (array)get_post_meta( $post->ID, 'sp_stats', true ); - $league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); + $division_id = sp_get_the_term_id( $post->ID, 'sp_division', 0 ); $team_id = get_post_meta( $post->ID, 'sp_team', true ); - $data = sp_array_combine( $players, sp_array_value( $stats, $league_id, array() ) ); + $data = sp_array_combine( $players, sp_array_value( $stats, $division_id, array() ) ); // Generate array of placeholder values for each player $placeholders = array(); @@ -92,9 +92,9 @@ function sp_list_stats_meta( $post ) { ), 'tax_query' => array( array( - 'taxonomy' => 'sp_league', + 'taxonomy' => 'sp_division', 'field' => 'id', - 'terms' => $league_id + 'terms' => $division_id ) ) ); @@ -108,6 +108,6 @@ function sp_list_stats_meta( $post ) { // Add first column label array_unshift( $columns, __( 'Player', 'sportspress' ) ); - sp_stats_table( $data, $placeholders, $league_id, $columns, false ); + sp_stats_table( $data, $placeholders, $division_id, $columns, false ); } ?> \ No newline at end of file diff --git a/player.php b/player.php index 5fe9f714..7702176c 100644 --- a/player.php +++ b/player.php @@ -35,7 +35,7 @@ function sp_player_team_meta( $post ) { function sp_player_stats_meta( $post ) { $teams = (array)get_post_meta( $post->ID, 'sp_team', false ); - $leagues = (array)get_the_terms( $post->ID, 'sp_league' ); + $divisions = (array)get_the_terms( $post->ID, 'sp_division' ); $stats = (array)get_post_meta( $post->ID, 'sp_stats', true ); // Get column names from settings @@ -43,21 +43,21 @@ function sp_player_stats_meta( $post ) { $columns = sp_get_eos_keys( $stats_settings['player'] ); // Add first column label - array_unshift( $columns, __( 'League', 'sportspress' ) ); + array_unshift( $columns, __( 'Division', 'sportspress' ) ); - // Generate array of all league ids - $league_ids = array( 0 ); - foreach ( $leagues as $key => $value ): + // Generate array of all division ids + $division_ids = array( 0 ); + foreach ( $divisions as $key => $value ): if ( is_object( $value ) && property_exists( $value, 'term_id' ) ) - $league_ids[] = $value->term_id; + $division_ids[] = $value->term_id; endforeach; // Get all teams populated with overall stats where availabled - $data = sp_array_combine( $league_ids, sp_array_value( $stats, 0, array() ) ); + $data = sp_array_combine( $division_ids, sp_array_value( $stats, 0, array() ) ); - // Generate array of placeholder values for each league + // Generate array of placeholder values for each division $placeholders = array(); - foreach ( $league_ids as $league_id ): + foreach ( $division_ids as $division_id ): $args = array( 'post_type' => 'sp_event', 'meta_query' => array( @@ -67,33 +67,33 @@ function sp_player_stats_meta( $post ) { ) ) ); - if ( $league_id ): + if ( $division_id ): $args['tax_query'] = array( array( - 'taxonomy' => 'sp_league', + 'taxonomy' => 'sp_division', 'field' => 'id', - 'terms' => $league_id + 'terms' => $division_id ) ); endif; - $placeholders[ $league_id ] = sp_get_stats_row( 'sp_player', $args ); + $placeholders[ $division_id ] = sp_get_stats_row( 'sp_player', $args ); endforeach; ?>

'sp_event', 'meta_query' => array( @@ -108,19 +108,19 @@ function sp_player_stats_meta( $post ) { ), 'tax_query' => array( array( - 'taxonomy' => 'sp_league', + 'taxonomy' => 'sp_division', 'field' => 'id', - 'terms' => $league_id + 'terms' => $division_id ) ) ); - $placeholders[ $league_id ] = sp_get_stats_row( 'sp_player', $args ); + $placeholders[ $division_id ] = sp_get_stats_row( 'sp_player', $args ); endforeach; ?>

__( 'Name', 'sportspress' ), 'sp_position' => __( 'Positions', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_league' => __( 'Leagues', 'sportspress' ), - 'sp_sponsor' => __( 'Sponsors', 'sportspress' ) + 'sp_division' => __( 'Divisions', 'sportspress' ) ); return $columns; } diff --git a/readme.txt b/readme.txt index 6f40b672..95dc8e01 100644 --- a/readme.txt +++ b/readme.txt @@ -1,6 +1,6 @@ === SportsPress - flexible sports management === Contributors: themeboy -Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league table, leagues, reporting, themeboy, wordpress sports, configurable, variable, widgets +Tags: sports, sports journalism, teams, team management, fixtures, results, standings, league tables, divisions, reporting, themeboy, wordpress sports, configurable, variable, widgets Requires at least: 3.5 Tested up to: 3.6 Stable tag: 1.0 diff --git a/sponsor.php b/sponsor.php deleted file mode 100644 index e68dfee9..00000000 --- a/sponsor.php +++ /dev/null @@ -1,18 +0,0 @@ - $name, - 'labels' => $labels, - 'public' => true, - 'hierarchical' => true, - 'rewrite' => array( 'slug' => 'sponsor' ), - ); - register_taxonomy( 'sp_sponsor', $object_type, $args ); -} -add_action( 'init', 'sp_sponsor_tax_init' ); -?> \ No newline at end of file diff --git a/sportspress.php b/sportspress.php index 601ae844..0b4367f8 100644 --- a/sportspress.php +++ b/sportspress.php @@ -42,9 +42,8 @@ require_once dirname( __FILE__ ) . '/table.php'; require_once dirname( __FILE__ ) . '/list.php'; // Taxonomies -require_once dirname( __FILE__ ) . '/league.php'; +require_once dirname( __FILE__ ) . '/division.php'; require_once dirname( __FILE__ ) . '/position.php'; -require_once dirname( __FILE__ ) . '/sponsor.php'; // Styles include_once dirname( __FILE__ ) . '/styles.php' ; diff --git a/staff.php b/staff.php index 32e06f3d..b9955a60 100644 --- a/staff.php +++ b/staff.php @@ -41,7 +41,7 @@ function sp_staff_edit_columns() { 'title' => __( 'Name', 'sportspress' ), 'sp_position' => __( 'Positions', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_league' => __( 'Leagues', 'sportspress' ), + 'sp_division' => __( 'Divisions', 'sportspress' ), ); return $columns; } diff --git a/table.php b/table.php index 24f2103b..cfd10676 100644 --- a/table.php +++ b/table.php @@ -23,7 +23,7 @@ function sp_table_edit_columns() { 'cb' => '', 'title' => __( 'Title' ), 'sp_team' => __( 'Teams', 'sportspress' ), - 'sp_league' => __( 'Leagues', 'sportspress' ), + 'sp_division' => __( 'Divisions', 'sportspress' ), ); return $columns; } @@ -35,22 +35,22 @@ function sp_table_meta_init() { } function sp_table_team_meta( $post ) { - $league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); + $division_id = sp_get_the_term_id( $post->ID, 'sp_division', 0 ); ?>

sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ), - 'taxonomy' => 'sp_league', - 'name' => 'sp_league', - 'selected' => $league_id + 'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Divisions', 'sportspress' ) ), + 'taxonomy' => 'sp_division', + 'name' => 'sp_division', + 'selected' => $division_id ); sp_dropdown_taxonomies( $args ); ?>

ID, 'sp_team', 'block', 'sp_league' ); + sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_division' ); sp_post_adder( 'sp_team' ); ?>
@@ -61,8 +61,8 @@ function sp_table_team_meta( $post ) { function sp_table_stats_meta( $post ) { $teams = (array)get_post_meta( $post->ID, 'sp_team', false ); $stats = (array)get_post_meta( $post->ID, 'sp_stats', true ); - $league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); - $data = sp_array_combine( $teams, sp_array_value( $stats, $league_id, array() ) ); + $division_id = sp_get_the_term_id( $post->ID, 'sp_division', 0 ); + $data = sp_array_combine( $teams, sp_array_value( $stats, $division_id, array() ) ); // Generate array of placeholder values for each team $placeholders = array(); @@ -77,9 +77,9 @@ function sp_table_stats_meta( $post ) { ), 'tax_query' => array( array( - 'taxonomy' => 'sp_league', + 'taxonomy' => 'sp_division', 'field' => 'id', - 'terms' => $league_id + 'terms' => $division_id ) ) ); @@ -93,6 +93,6 @@ function sp_table_stats_meta( $post ) { // Add first column label array_unshift( $columns, __( 'Team', 'sportspress' ) ); - sp_stats_table( $data, $placeholders, $league_id, $columns, false ); + sp_stats_table( $data, $placeholders, $division_id, $columns, false ); } ?> \ No newline at end of file diff --git a/team.php b/team.php index 95a4da2d..109afabc 100644 --- a/team.php +++ b/team.php @@ -30,30 +30,29 @@ function sp_team_edit_columns() { 'cb' => '', 'sp_icon' => ' ', 'title' => __( 'Team', 'sportspress' ), - 'sp_league' => __( 'Leagues', 'sportspress' ), - 'sp_sponsor' => __( 'Sponsors', 'sportspress' ) + 'sp_division' => __( 'Divisions', 'sportspress' ) ); return $columns; } add_filter( 'manage_edit-sp_team_columns', 'sp_team_edit_columns' ); function sp_team_stats_meta( $post ) { - $leagues = (array)get_the_terms( $post->ID, 'sp_league' ); + $divisions = (array)get_the_terms( $post->ID, 'sp_division' ); $stats = (array)get_post_meta( $post->ID, 'sp_stats', true ); - // Generate array of all league ids - $league_ids = array( 0 ); - foreach ( $leagues as $key => $value ): + // Generate array of all division ids + $division_ids = array( 0 ); + foreach ( $divisions as $key => $value ): if ( is_object( $value ) && property_exists( $value, 'term_id' ) ) - $league_ids[] = $value->term_id; + $division_ids[] = $value->term_id; endforeach; - // Get all leagues populated with stats where available - $data = sp_array_combine( $league_ids, sp_array_value( $stats, 0, array() ) ); + // Get all divisions populated with stats where available + $data = sp_array_combine( $division_ids, sp_array_value( $stats, 0, array() ) ); - // Generate array of placeholder values for each league + // Generate array of placeholder values for each division $placeholders = array(); - foreach ( $league_ids as $league_id ): + foreach ( $division_ids as $division_id ): $args = array( 'post_type' => 'sp_event', 'meta_query' => array( @@ -64,13 +63,13 @@ function sp_team_stats_meta( $post ) { ), 'tax_query' => array( array( - 'taxonomy' => 'sp_league', + 'taxonomy' => 'sp_division', 'field' => 'id', - 'terms' => $league_id + 'terms' => $division_id ) ) ); - $placeholders[ $league_id ] = sp_get_stats_row( 'sp_team', $args ); + $placeholders[ $division_id ] = sp_get_stats_row( 'sp_team', $args ); endforeach; // Get column names from settings @@ -78,9 +77,9 @@ function sp_team_stats_meta( $post ) { $columns = sp_get_eos_keys( $stats_settings['team'] ); // Add first column label - array_unshift( $columns, __( 'League', 'sportspress' ) ); + array_unshift( $columns, __( 'Division', 'sportspress' ) ); - sp_stats_table( $data, $placeholders, 0, $columns, false, 'sp_league' ); + sp_stats_table( $data, $placeholders, 0, $columns, false, 'sp_division' ); sp_nonce(); } ?> \ No newline at end of file