Plugin Directory

Changeset 3241492


Ignore:
Timestamp:
02/16/2025 07:08:53 PM (12 months ago)
Author:
MarkODonnell
Message:

Committing version 1.4

Location:
mstw-bracket-builder/trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • mstw-bracket-builder/trunk/includes/mstw-bb-admin.php

    r2810547 r3241492  
    273273   
    274274    //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" );
    276276    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 ) ) ) {
    277277       
  • mstw-bracket-builder/trunk/includes/mstw-bb-bracket-builder-class.php

    r2810547 r3241492  
    55 *
    66 *  MSTW Wordpress Plugins (http://shoalsummitsolutions.com)
    7  *  Copyright 2016-22 Mark O'Donnell ([email protected])
     7 *  Copyright 2016-25 Mark O'Donnell ([email protected])
    88 *
    99 *  This program is free software: you can redistribute it and/or modify
     
    9494           
    9595        $games = get_posts( $args );
    96        
    97         //mstw_bb_log_msg( "Games:" );
    98         //mstw_bb_log_msg( $games );
    9996       
    10097        ?>
     
    198195        $cols = 15;
    199196       
    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           
    226209        <tbody>
    227210          <?php
     
    229212         
    230213          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;
    243223          }
    244224          ?>
     
    281261          <?php
    282262          $game = ( count( $games ) > 0 ) ? $games[ $game_nbr - 1 ] : null ;
    283          
    284           //mstw_bb_log_msg( 'game:' );
    285           //mstw_bb_log_msg( $game );)
    286263         
    287264          $this -> build_date_cell( $game, $game_nbr  );
     
    540517        $value = ( null === $game ) ? 0 : get_post_meta( $game -> ID, "is_final", true );
    541518        $checked = checked( $value, 1, false );
    542         //mstw_bb_log_msg( "game: " . $game->ID . " is_final: $value, checked: $checked" );
    543519        ?>
    544520            <td class="is-final">
     
    574550                //mstw_bb_log_msg( 'Updating Games ...' );
    575551                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?? ' );
    577553                    mstw_bb_add_admin_notice( 'error',  __( 'No games updated. Did any data change?', 'mstw-bracket-builder' ) );
    578554                   
     
    618594                    }
    619595                   
    620                     // Don't believe we need this for free version
    621                     //$new_game_meta = $this -> update_game_meta( $tourney, $game_meta );
    622                    
    623                     //mstw_log_msg( "game_meta:" );
    624                     //mstw_log_msg( $game_meta );
    625                    
    626596                    if ( 0 == $nbr_games ) {
    627597                        // Games don't exist, create them before updating them
    628598                       
    629599                        // Find the round number
    630                         //mstw_log_msg( 'tourney slug: ' . $_POST[ 'bb-current-tourney' ] );
    631600                        $tourneyObj = get_page_by_path( $_POST[ 'bb-current-tourney' ], OBJECT, 'mstw_bb_tourney' );
    632                         //mstw_log_msg( "tourney object: " );
    633                         //mstw_log_msg( $tourneyObj );
    634601                        $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 game
    639                             $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;
    651602                   
    652603                        for ( $game_nbr = 1; $game_nbr <= sizeof( $game_meta ); $game_nbr++ ) {
    653604                            $round_nbr = $this -> get_round_by_game_nbr( $rounds, $game_nbr );
    654605                            $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                           
    656607                            if ( $game_id > 0 ) {
    657608                                $this -> update_game( $game_id, $game_meta[ $game_nbr ] );
     
    659610                               
    660611                            } 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" );   
    662613                            }
    663614                        }
     
    673624                               
    674625                            } else {
    675                                 mstw_log_msg( "Error: can't find game $game_slug" );
     626                                mstw_bb_log_msg( "Error: can't find game $game_slug" );
    676627                               
    677628                            }
     
    723674    // 
    724675    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" );
    726677       
    727678        // return value ... keeps things in order and handles checkboxes
     
    816767    //   
    817768    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:" );
    819770       
    820771        $gameKey = array_key_first( $gameData );
    821772       
    822773        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" );
    824775            return 0;
    825776        }
     
    850801    //   
    851802    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" );
    854805       
    855806        $retVal = -1;
     
    857808        $roundGames = pow( 2, $rounds ); // actually total games in tourney + 1
    858809        $cummGames = 0; // # of games for each round will be calculated in the loop
    859        
    860         //mstw_log_msg( "roundGames = $roundGames" );
    861810       
    862811        for ( $i = 1; $i <= $rounds; $i++ ) {
    863812            $roundGames = $roundGames/2;
    864813            $cummGames = $cummGames + $roundGames;
    865             //mstw_log_msg( "round $i: roundGames= $roundGames cummGames= $cummGames" );
     814            //mstw_bb_log_msg( "round $i: roundGames= $roundGames cummGames= $cummGames" );
    866815           
    867816            if ( $gameNbr <= $cummGames ) {
    868817                $retVal = $i;
    869                 //mstw_log_msg( "game $gameNbr is in round $retVal" );
    870818                break;
    871819            }
     
    887835    //   
    888836    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:" );
    890838       
    891839        $rgArray = explode( '_', $gameKey );
     
    925873        $game_title = get_the_title( $tourney_obj ) . ' Game ' . $game_nbr;
    926874       
    927         //mstw_bb_log_msg( "create game with title: $game_title and slug: $game_slug" );
    928        
    929875        if( has_action('save_post_mstw_bb_game') ) {
    930876            mstw_bb_log_msg( "create_game: Have a save_post_mstw_bb_game action. Hummm ..." );
     
    932878           
    933879        } else {
    934             //mstw_bb_log_msg( "No save_post_mstw_bb_game action ... shouldn't be." );
    935            
    936880            $game_args = array( 'post_title'  => $game_title,
    937881                                'post_type'   => 'mstw_bb_game',
     
    988932                    break;
    989933                   
    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                    
    1025934                // the rest are straightforward
    1026935                // time_is_tba, home, home_text, away, away_text, location, location_text, period
     
    1049958    function build_tourney_select( $current_tourney, $css_tag = '' ) {
    1050959        //mstw_bb_log_msg( 'build_tourney_select' );
     960       
    1051961        $tourney_list = $this -> build_tourney_list( );
    1052962        if ( $tourney_list ) {
    1053             //mstw_bb_log_msg( "tourney list:" );
    1054             //mstw_bb_log_msg( $tourney_list );
    1055963            ?>
    1056964            <select name='<?php echo $css_tag ?>' id='<?php echo $css_tag ?>' >
     
    11061014           
    11071015        } else {
    1108            
    11091016            mstw_bb_log_msg( 'build_tourney_list: no tourneys found' );
    11101017            return '';
  • mstw-bracket-builder/trunk/includes/mstw-bb-tourney-bracket-class.php

    r2810547 r3241492  
    66 *
    77 *  MSTW Wordpress Plugins (http://shoalsummitsolutions.com)
    8  *  Copyright 2016-22 Mark O'Donnell ([email protected])
     8 *  Copyright 2016-25 Mark O'Donnell ([email protected])
    99 *
    1010 *  This program is free software: you can redistribute it and/or modify
     
    3838    // Handles the shortcode inline arguments and merges them with options DB
    3939    //
    40     public function tourney_bracket_handler( $atts, $content = null, $shortcode ) {
     40    public function tourney_bracket_handler( $atts, $content, $shortcode, ) {
    4141        //mstw_bb_log_msg( "MSTW_TOURNEY_BRACKET:tourney_bracket_handler: shortcode= $shortcode " );
    4242        //mstw_bb_log_msg( 'shortcode: ' . $shortcode );
     
    4747       
    4848        //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            */
    4954       
    5055        // MUST have a tournament to proceed
     
    439444    //  HTML for a team's name, formatted based on the team_format attribute
    440445    //
    441     function build_team_name( $game, $team = 'home', $atts ) {
     446    function build_team_name( $game, $team, $atts ) {
    442447        //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            */
    443453       
    444454        $team_name = '';
  • mstw-bracket-builder/trunk/includes/mstw-bb-tourney-cpt-admin.php

    r2810547 r3241492  
    66 *
    77 *  MSTW Wordpress Plugins (http://shoalsummitsolutions.com)
    8  *  Copyright 2016-22 Mark O'Donnell ([email protected])
     8 *  Copyright 2016-25 Mark O'Donnell ([email protected])
    99 *
    1010 *  This program is free software: you can redistribute it and/or modify
     
    213213//  1 if select-option control was built successfully
    214214//
    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 ) {
     216function mstw_bb_build_teams_list_delete( $current_league, $current_team, $id ) {
    216217    //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        */
    217224   
    218225    //if( $league_slug ) build better metaquery
  • mstw-bracket-builder/trunk/includes/mstw-bb-tourney-table-class.php

    r2810547 r3241492  
    66 *
    77 *  MSTW Wordpress Plugins (http://shoalsummitsolutions.com)
    8  *  Copyright 2016-22 Mark O'Donnell ([email protected])
     8 *  Copyright 2016-25 Mark O'Donnell ([email protected])
    99 *
    1010 *  This program is free software: you can redistribute it and/or modify
     
    3838    // Handles the shortcode inline arguments and merges them with options DB
    3939    //
    40     public function tourney_table_handler( $atts, $content = null, $shortcode ) {
     40    public function tourney_table_handler( $atts, $content, $shortcode ) {
    4141        //mstw_bb_log_msg( "MSTW_TOURNEY_TABLE:tourney_table_handler: shortcode= $shortcode " );
    4242        //mstw_bb_log_msg( 'shortcode: ' . $shortcode );
     
    4747       
    4848        //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            */
    4954       
    5055        // MUST have a tournament to proceed
     
    124129        //
    125130        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 );
    127132            return $ret_html;
    128133        }
  • mstw-bracket-builder/trunk/includes/mstw-bb-utility-functions.php

    r2810547 r3241492  
    55 *
    66 *  MSTW Wordpress Plugins (http://shoalsummitsolutions.com)
    7  *  Copyright 2016-22 Mark O'Donnell ([email protected])
     7 *  Copyright 2016-25 Mark O'Donnell ([email protected])
    88 *
    99 *  This program is free software: you can redistribute it and/or modify
     
    150150//
    151151if ( !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 = '' ) {
    153153        //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            */
    154159       
    155160        $transient = 'mstw_bb_admin_notices';
  • mstw-bracket-builder/trunk/mstw-bracket-builder.php

    r2810547 r3241492  
    11<?php
    22/*
    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 */
    1116
    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 modify
    17  *  it under the terms of the GNU General Public License as published by
    18  *  the Free Software Foundation, either version 3 of the License, or
    19  *  (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 of
    23  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    24  *  GNU General Public License for details. <http://www.gnu.org/licenses/>
    25  *-------------------------------------------------------------------------*/
    2617
    2718//------------------------------------------------------------------------
     
    3122
    3223function mstw_bb_init( ) {
    33     //mstw_log_msg( "mstw_bb_init:" );
     24    //mstw_bb_log_msg( "mstw_bb_init:" );
    3425    //------------------------------------------------------------------------
    3526    // "Helper functions" used throughout MSTW Schedule Builder
  • mstw-bracket-builder/trunk/readme.txt

    r3050109 r3241492  
    22Contributors: MarkODonnell
    33Donate link: http://shoalsummitsolutions.com
    4 Tags: sports,tournament,bracket,knockout round  
     4Tags: sports,tournament,bracket,knockout round
    55Requires at least: 4.3
    6 Tested up to: 6.4.3
    7 Stable tag: 1.3
    8 Text Domain: mstw-bracket-builder
     6Tested up to: 6.7
     7Stable tag: 1.4
     8Requires PHP: 5.6
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5353== Changelog ==
    5454
     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
    5559= 1.3 =
    5660* 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.