Changeset 3241492
- Timestamp:
- 02/16/2025 07:08:53 PM (12 months ago)
- Location:
- mstw-bracket-builder/trunk
- Files:
-
- 2 added
- 8 edited
-
includes/mstw-bb-admin.php (modified) (1 diff)
-
includes/mstw-bb-bracket-builder-class.php (modified) (20 diffs)
-
includes/mstw-bb-tourney-bracket-class.php (modified) (4 diffs)
-
includes/mstw-bb-tourney-cpt-admin.php (modified) (2 diffs)
-
includes/mstw-bb-tourney-table-class.php (modified) (4 diffs)
-
includes/mstw-bb-utility-functions.php (modified) (2 diffs)
-
lang (added)
-
lang/mstw-bracket-builder.pot (added)
-
mstw-bracket-builder.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mstw-bracket-builder/trunk/includes/mstw-bb-admin.php
r2810547 r3241492 273 273 274 274 //if ( 'bracket-builder_page_mstw-bb-edit-tournament' == $hook_suffix ) { 275 //mstw_ log_msg( "typenow= $typenow, hook_suffix= $hook_suffix" );275 //mstw_bb_log_msg( "typenow= $typenow, hook_suffix= $hook_suffix" ); 276 276 if ( 'bracket-builder_page_mstw-bb-edit-tournament' == $hook_suffix || ( 'mstw_bb_tourney' == $typenow && ( 'edit.php' == $hook_suffix || 'post.php' == $hook_suffix || 'post-new.php' == $hook_suffix ) ) ) { 277 277 -
mstw-bracket-builder/trunk/includes/mstw-bb-bracket-builder-class.php
r2810547 r3241492 5 5 * 6 6 * MSTW Wordpress Plugins (http://shoalsummitsolutions.com) 7 * Copyright 2016-2 2Mark O'Donnell ([email protected])7 * Copyright 2016-25 Mark O'Donnell ([email protected]) 8 8 * 9 9 * This program is free software: you can redistribute it and/or modify … … 94 94 95 95 $games = get_posts( $args ); 96 97 //mstw_bb_log_msg( "Games:" );98 //mstw_bb_log_msg( $games );99 96 100 97 ?> … … 198 195 $cols = 15; 199 196 200 $rounds = get_post_meta( $tourney -> ID, 'rounds', true ); 201 //mstw_bb_log_msg( $rounds ); 202 203 204 // 205 // Get the tourney's teams, if there are any 206 // 207 /* 208 $tourney_league = get_post_meta( $tourney -> ID, 'league', true ); 209 //mstw_bb_log_msg( "tourney league = " . $tourney_league ); 210 211 $args = array( 'numberposts' => -1, 212 'post_type' => 'mstw_lm_team', 213 'mstw_lm_league' => $tourney_league, 214 'meta_key' => 'team_name', 215 'orderby' => 'meta_value', 216 'order' => 'ASC' 217 ); 218 219 $teams = get_posts( $args ); 220 221 $teams = null; 222 */ 223 //mstw_bb_log_msg( $teams ); 224 225 ?> 197 /** 198 * 20250207: fixed minor logic error that generated PHP warning 199 * when there's no tourney 200 */ 201 202 if ( is_null( $tourney ) ) { 203 $rounds = 0; 204 } else { 205 $rounds = get_post_meta( $tourney -> ID, 'rounds', true ); 206 } 207 ?> 208 226 209 <tbody> 227 210 <?php … … 229 212 230 213 for ( $i = 1; $i <= $rounds; $i++ ) { 231 $this -> build_round_header_row( $i ); 232 233 $round_nbr_games = pow( 2, $rounds ) / pow( 2, $i ); 234 //mstw_bb_log_msg( " Round: $i Nbr Games: $round_nbr_games" ); 235 236 for ( $j = 1; $j <= $round_nbr_games; $j++ ) { 237 //mstw_bb_log_msg( "game: $j" ); 238 $this -> build_table_row( $tourney, null, $games, $i, $j + $round_start_game ); 239 } 240 241 $round_start_game += $round_nbr_games; 242 214 $this -> build_round_header_row( $i ); 215 216 $round_nbr_games = pow( 2, $rounds ) / pow( 2, $i ); 217 218 for ( $j = 1; $j <= $round_nbr_games; $j++ ) { 219 $this -> build_table_row( $tourney, null, $games, $i, $j + $round_start_game ); 220 } 221 222 $round_start_game += $round_nbr_games; 243 223 } 244 224 ?> … … 281 261 <?php 282 262 $game = ( count( $games ) > 0 ) ? $games[ $game_nbr - 1 ] : null ; 283 284 //mstw_bb_log_msg( 'game:' );285 //mstw_bb_log_msg( $game );)286 263 287 264 $this -> build_date_cell( $game, $game_nbr ); … … 540 517 $value = ( null === $game ) ? 0 : get_post_meta( $game -> ID, "is_final", true ); 541 518 $checked = checked( $value, 1, false ); 542 //mstw_bb_log_msg( "game: " . $game->ID . " is_final: $value, checked: $checked" );543 519 ?> 544 520 <td class="is-final"> … … 574 550 //mstw_bb_log_msg( 'Updating Games ...' ); 575 551 if ( !array_key_exists( 'games', $_POST ) or !array_key_exists( 'bb-current-tourney', $_POST )) { 576 mstw_bb_log_msg( 'Oops! No games or tourney field?? ' );552 //mstw_bb_log_msg( 'Oops! No games or tourney field?? ' ); 577 553 mstw_bb_add_admin_notice( 'error', __( 'No games updated. Did any data change?', 'mstw-bracket-builder' ) ); 578 554 … … 618 594 } 619 595 620 // Don't believe we need this for free version621 //$new_game_meta = $this -> update_game_meta( $tourney, $game_meta );622 623 //mstw_log_msg( "game_meta:" );624 //mstw_log_msg( $game_meta );625 626 596 if ( 0 == $nbr_games ) { 627 597 // Games don't exist, create them before updating them 628 598 629 599 // Find the round number 630 //mstw_log_msg( 'tourney slug: ' . $_POST[ 'bb-current-tourney' ] );631 600 $tourneyObj = get_page_by_path( $_POST[ 'bb-current-tourney' ], OBJECT, 'mstw_bb_tourney' ); 632 //mstw_log_msg( "tourney object: " );633 //mstw_log_msg( $tourneyObj );634 601 $rounds = get_post_meta( $tourneyObj->ID, 'rounds', true ); 635 //mstw_log_msg( "rounds: $rounds" );636 637 /*638 //DEBUG STUFF for ( $i = 2; $i <= 3; $i++ ) { // $i is round, $j is game639 $rounds = 6;640 $totalGames = pow( 2, $rounds );641 mstw_log_msg( "$rounds rounds have $totalGames total games" );642 for ( $j = 1; $j <= $totalGames; $j++ ) {643 //mstw_log_msg( "j = $j" );644 $rndNbr = $this -> get_round_by_game_nbr( $rounds, $j );645 //mstw_log_msg( "game $j is in round $rndNbr" );646 647 }648 //}*/649 650 //return;651 602 652 603 for ( $game_nbr = 1; $game_nbr <= sizeof( $game_meta ); $game_nbr++ ) { 653 604 $round_nbr = $this -> get_round_by_game_nbr( $rounds, $game_nbr ); 654 605 $game_id = $this -> create_game( $_POST['bb-current-tourney'], $game_nbr, $round_nbr ); 655 mstw_log_msg( "game_id= $game_id, game_nbr= $game_nbr, round_nbr= $round_nbr" );606 656 607 if ( $game_id > 0 ) { 657 608 $this -> update_game( $game_id, $game_meta[ $game_nbr ] ); … … 659 610 660 611 } else { 661 mstw_ log_msg( $_POST['bb-current-tourney'] . ": error creating game $game_nbr" );612 mstw_bb_log_msg( $_POST['bb-current-tourney'] . ": error creating game $game_nbr" ); 662 613 } 663 614 } … … 673 624 674 625 } else { 675 mstw_ log_msg( "Error: can't find game $game_slug" );626 mstw_bb_log_msg( "Error: can't find game $game_slug" ); 676 627 677 628 } … … 723 674 // 724 675 function process_game_data( $gameNbr, $gameData ) { 725 //mstw_ log_msg( "process_game_data: game $gameNbr" );676 //mstw_bb_log_msg( "process_game_data: game $gameNbr" ); 726 677 727 678 // return value ... keeps things in order and handles checkboxes … … 816 767 // 817 768 function parse_game_nbr_key( $gameData ) { 818 //mstw_ log_msg( "MSTW_BB_BRACKET_BUILDER.parse_game_nbr_key:" );769 //mstw_bb_log_msg( "MSTW_BB_BRACKET_BUILDER.parse_game_nbr_key:" ); 819 770 820 771 $gameKey = array_key_first( $gameData ); 821 772 822 773 if ( false === strpos( $gameKey, "game-nbr" ) ) { 823 mstw_ log_msg( "$gameKey is not a legit game key" );774 mstw_bb_log_msg( "$gameKey is not a legit game key" ); 824 775 return 0; 825 776 } … … 850 801 // 851 802 function get_round_by_game_nbr( $rounds, $gameNbr ) { 852 //mstw_ log_msg( "MSTW_BB_BRACKET_BUILDER.get_round_by_game_nbr:" );853 //mstw_ log_msg( "rounds= $rounds game = $gameNbr" );803 //mstw_bb_log_msg( "MSTW_BB_BRACKET_BUILDER.get_round_by_game_nbr:" ); 804 //mstw_bb_log_msg( "rounds= $rounds game = $gameNbr" ); 854 805 855 806 $retVal = -1; … … 857 808 $roundGames = pow( 2, $rounds ); // actually total games in tourney + 1 858 809 $cummGames = 0; // # of games for each round will be calculated in the loop 859 860 //mstw_log_msg( "roundGames = $roundGames" );861 810 862 811 for ( $i = 1; $i <= $rounds; $i++ ) { 863 812 $roundGames = $roundGames/2; 864 813 $cummGames = $cummGames + $roundGames; 865 //mstw_ log_msg( "round $i: roundGames= $roundGames cummGames= $cummGames" );814 //mstw_bb_log_msg( "round $i: roundGames= $roundGames cummGames= $cummGames" ); 866 815 867 816 if ( $gameNbr <= $cummGames ) { 868 817 $retVal = $i; 869 //mstw_log_msg( "game $gameNbr is in round $retVal" );870 818 break; 871 819 } … … 887 835 // 888 836 function get_round_nbr_from_key( $gameKey ) { 889 //mstw_ log_msg( "MSTW_BB_BRACKET_BUILDER.get_round_nbr_from_key:" );837 //mstw_bb_log_msg( "MSTW_BB_BRACKET_BUILDER.get_round_nbr_from_key:" ); 890 838 891 839 $rgArray = explode( '_', $gameKey ); … … 925 873 $game_title = get_the_title( $tourney_obj ) . ' Game ' . $game_nbr; 926 874 927 //mstw_bb_log_msg( "create game with title: $game_title and slug: $game_slug" );928 929 875 if( has_action('save_post_mstw_bb_game') ) { 930 876 mstw_bb_log_msg( "create_game: Have a save_post_mstw_bb_game action. Hummm ..." ); … … 932 878 933 879 } else { 934 //mstw_bb_log_msg( "No save_post_mstw_bb_game action ... shouldn't be." );935 936 880 $game_args = array( 'post_title' => $game_title, 937 881 'post_type' => 'mstw_bb_game', … … 988 932 break; 989 933 990 //case 'home':991 /*992 $game_nbr = get_post_meta( $game_id, 'home', true );993 if ( 1 == $game_nbr ) {994 update_post_meta( $game_id, 'home', 'cal-bears' );995 update_post_meta( $game_id, 'away', 'oregon-ducks' );996 997 } else if ( 2 == $game_nbr ) {998 update_post_meta( $game_id, 'home', 'stanford-cardinal' );999 update_post_meta( $game_id, 'away', 'osu-beavers' );1000 1001 }1002 */1003 //break;1004 //case 'away':1005 //break;1006 1007 //case 'location':1008 //update_post_meta( $game_id, $key, $value );1009 //mstw_bb_log_msg( "$game_id $key $value" );1010 /*1011 $game_nbr = get_post_meta( $game_id, 'game_nbr', true );1012 if ( 1 == $game_nbr ) {1013 update_post_meta( $game_id, 'location', 'california-memorial-stadium' );1014 1015 } else if ( 2 == $game_nbr ) {1016 update_post_meta( $game_id, 'location', 'stanford-stadium' );1017 1018 } else if ( 5 == $game_nbr ) {1019 update_post_meta( $game_id, 'location', 'levis-stadium' );1020 1021 }1022 */1023 //break;1024 1025 934 // the rest are straightforward 1026 935 // time_is_tba, home, home_text, away, away_text, location, location_text, period … … 1049 958 function build_tourney_select( $current_tourney, $css_tag = '' ) { 1050 959 //mstw_bb_log_msg( 'build_tourney_select' ); 960 1051 961 $tourney_list = $this -> build_tourney_list( ); 1052 962 if ( $tourney_list ) { 1053 //mstw_bb_log_msg( "tourney list:" );1054 //mstw_bb_log_msg( $tourney_list );1055 963 ?> 1056 964 <select name='<?php echo $css_tag ?>' id='<?php echo $css_tag ?>' > … … 1106 1014 1107 1015 } else { 1108 1109 1016 mstw_bb_log_msg( 'build_tourney_list: no tourneys found' ); 1110 1017 return ''; -
mstw-bracket-builder/trunk/includes/mstw-bb-tourney-bracket-class.php
r2810547 r3241492 6 6 * 7 7 * MSTW Wordpress Plugins (http://shoalsummitsolutions.com) 8 * Copyright 2016-2 2Mark O'Donnell ([email protected])8 * Copyright 2016-25 Mark O'Donnell ([email protected]) 9 9 * 10 10 * This program is free software: you can redistribute it and/or modify … … 38 38 // Handles the shortcode inline arguments and merges them with options DB 39 39 // 40 public function tourney_bracket_handler( $atts, $content = null, $shortcode) {40 public function tourney_bracket_handler( $atts, $content, $shortcode, ) { 41 41 //mstw_bb_log_msg( "MSTW_TOURNEY_BRACKET:tourney_bracket_handler: shortcode= $shortcode " ); 42 42 //mstw_bb_log_msg( 'shortcode: ' . $shortcode ); … … 47 47 48 48 //mstw_bb_log_msg( 'last slash position: ' . $last_slash ); 49 50 /** 51 * 20250206: changed $content arg to required to stop annoying 52 * PHP warnings that started with PHP 8 53 */ 49 54 50 55 // MUST have a tournament to proceed … … 439 444 // HTML for a team's name, formatted based on the team_format attribute 440 445 // 441 function build_team_name( $game, $team = 'home', $atts ) {446 function build_team_name( $game, $team, $atts ) { 442 447 //mstw_bb_log_msg( "build_team_name:" ); 448 449 /** 450 * 20250206: changed $team arg to required to stop annoying 451 * PHP warnings that started with PHP 8 452 */ 443 453 444 454 $team_name = ''; -
mstw-bracket-builder/trunk/includes/mstw-bb-tourney-cpt-admin.php
r2810547 r3241492 6 6 * 7 7 * MSTW Wordpress Plugins (http://shoalsummitsolutions.com) 8 * Copyright 2016-2 2Mark O'Donnell ([email protected])8 * Copyright 2016-25 Mark O'Donnell ([email protected]) 9 9 * 10 10 * This program is free software: you can redistribute it and/or modify … … 213 213 // 1 if select-option control was built successfully 214 214 // 215 function mstw_bb_build_teams_list( $current_league = null, $current_team, $id ) { 215 //function mstw_bb_build_teams_list( $current_league = null, $current_team, $id ) { 216 function mstw_bb_build_teams_list_delete( $current_league, $current_team, $id ) { 216 217 //mstw_bb_log_msg( 'in mstw_bb_build_teams_list ...' ); 218 219 /** 220 * 20250207: changed optional arg $current_league to required 221 * PHP warnings that started with PHP 8 222 * THIS FUNCTION DOES NOT APPEAR TO BE USED 223 */ 217 224 218 225 //if( $league_slug ) build better metaquery -
mstw-bracket-builder/trunk/includes/mstw-bb-tourney-table-class.php
r2810547 r3241492 6 6 * 7 7 * MSTW Wordpress Plugins (http://shoalsummitsolutions.com) 8 * Copyright 2016-2 2Mark O'Donnell ([email protected])8 * Copyright 2016-25 Mark O'Donnell ([email protected]) 9 9 * 10 10 * This program is free software: you can redistribute it and/or modify … … 38 38 // Handles the shortcode inline arguments and merges them with options DB 39 39 // 40 public function tourney_table_handler( $atts, $content = null, $shortcode ) {40 public function tourney_table_handler( $atts, $content, $shortcode ) { 41 41 //mstw_bb_log_msg( "MSTW_TOURNEY_TABLE:tourney_table_handler: shortcode= $shortcode " ); 42 42 //mstw_bb_log_msg( 'shortcode: ' . $shortcode ); … … 47 47 48 48 //mstw_bb_log_msg( 'last slash position: ' . $last_slash ); 49 50 /** 51 * 20250206: changed $content arg to required to stop annoying 52 * PHP warnings that started with PHP 8 53 */ 49 54 50 55 // MUST have a tournament to proceed … … 124 129 // 125 130 if ( !$games ) { 126 $ret_html .= sprintf( __( 'No games found for tourney: %s', 'mstw-bracket-builder' ), $tourney_slug );131 $ret_html = sprintf( __( 'No games found for tourney: %s', 'mstw-bracket-builder' ), $tourney_slug ); 127 132 return $ret_html; 128 133 } -
mstw-bracket-builder/trunk/includes/mstw-bb-utility-functions.php
r2810547 r3241492 5 5 * 6 6 * MSTW Wordpress Plugins (http://shoalsummitsolutions.com) 7 * Copyright 2016-2 2Mark O'Donnell ([email protected])7 * Copyright 2016-25 Mark O'Donnell ([email protected]) 8 8 * 9 9 * This program is free software: you can redistribute it and/or modify … … 150 150 // 151 151 if ( !function_exists ( 'mstw_bb_add_admin_notice' ) ) { 152 function mstw_bb_add_admin_notice( $type = 'updated', $notice ) {152 function mstw_bb_add_admin_notice( $type = 'updated', $notice = '' ) { 153 153 //mstw_bb_log_msg( "mstw_bb_add_admin_notice:" ); 154 155 /** 156 * 20250206: changed required arg $notices to optional to stop annoying 157 * PHP warnings that started with PHP 8 158 */ 154 159 155 160 $transient = 'mstw_bb_admin_notices'; -
mstw-bracket-builder/trunk/mstw-bracket-builder.php
r2810547 r3241492 1 1 <?php 2 2 /* 3 Plugin Name: MSTW Bracket Builder 4 Plugin URI: https://wordpress.org/plugins/mstw-bracket-builder/ 5 Description: Builds brackets for 4 to 64 team tournaments. 6 Version: 1.3 7 Author: Mark O'Donnell 8 Author URI: http://shoalsummitsolutions.com 9 Text Domain: mstw-bracket-builder 10 */ 3 * Plugin Name: MSTW Bracket Builder 4 * Plugin URI: https://shoalsummitsolutions.com 5 * Description: Builds brackets for 4 to 64 team tournaments. 6 * Version: 1.4 7 * Requires at least: 3.4.2 8 * Requires PHP: 5.6 9 * Author: Mark O'Donnell 10 * Author URI: https://shoalsummitsolutions.com 11 * License: GPL v2 or later 12 * License URI: http://www.gnu.org/licenses/gpl-2.0.html 13 * Text Domain: mstw-bracket-builder 14 * Domain Path: /lang 15 */ 11 16 12 /*---------------------------------------------------------------------------13 * MSTW Wordpress Plugins (http://shoalsummitsolutions.com)14 * Copyright 2016-22 Mark O'Donnell ([email protected])15 *16 * This program is free software: you can redistribute it and/or modify17 * it under the terms of the GNU General Public License as published by18 * the Free Software Foundation, either version 3 of the License, or19 * (at your option) any later version.20 *21 * This program is distributed in the hope that it will be useful,22 * but WITHOUT ANY WARRANTY; without even the implied warranty of23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the24 * GNU General Public License for details. <http://www.gnu.org/licenses/>25 *-------------------------------------------------------------------------*/26 17 27 18 //------------------------------------------------------------------------ … … 31 22 32 23 function mstw_bb_init( ) { 33 //mstw_ log_msg( "mstw_bb_init:" );24 //mstw_bb_log_msg( "mstw_bb_init:" ); 34 25 //------------------------------------------------------------------------ 35 26 // "Helper functions" used throughout MSTW Schedule Builder -
mstw-bracket-builder/trunk/readme.txt
r3050109 r3241492 2 2 Contributors: MarkODonnell 3 3 Donate link: http://shoalsummitsolutions.com 4 Tags: sports,tournament,bracket,knockout round 4 Tags: sports,tournament,bracket,knockout round 5 5 Requires at least: 4.3 6 Tested up to: 6. 4.37 Stable tag: 1. 38 Text Domain: mstw-bracket-builder 6 Tested up to: 6.7 7 Stable tag: 1.4 8 Requires PHP: 5.6 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 53 53 == Changelog == 54 54 55 = 1.4 = 56 * Re-tested while cleaning up more annoying PHP 8 warnings. 57 * Added /lang/mstw-bracket-builder.pot file for translators. 58 55 59 = 1.3 = 56 60 * The major purpose of this release was to remove the each() construct because it has been removed from PHP 8.0.
Note: See TracChangeset
for help on using the changeset viewer.