This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sports_bench_do_playoff_series_modal( $html, $series, $team_one, $team_one_name, $team_two, $team_two_name, $game_numbers ) { | |
$html .= '<div class="reveal sports-bench-playoff-modal" id="series-' . $series->series_id . '" data-reveal>'; | |
$html .= '<table class="series-modal-top">'; | |
$html .= '<tr>'; | |
$html .= '<td class="modal-logo">' . $team_one->get_team_photo( 'team-logo' ) . '</td>'; | |
$html .= '<td class="modal-team-name team-one-name">' . $team_one_name . '</td>'; | |
$html .= '<td class="modal-score">' . $series->get_series_score() . '</td>'; | |
$html .= '<td class="modal-team-name team-two-name">' . $team_two_name . '</td>'; | |
$html .= '<td class="modal-logo">' . $team_two->get_team_photo( 'team-logo' ) . '</td>'; | |
$html .= '</tr>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sports_bench_do_playoff_series( $html, $series, $team_one, $team_one_class, $team_one_name, $team_two, $team_two_class, $team_two_name, $game_numbers ) { | |
$html .= '<table>'; | |
$team_row_styles = apply_filters( 'sports_bench_playoff_team_row', '', $team_one ); | |
$html .= '<tr class="team-row" style="' . $team_row_styles . '">'; | |
$html .= '<td class="seed">' . $series->team_one_seed . '</td>'; | |
$html .= '<td class="logo">' . $team_one->get_team_photo( 'team-logo' ) . '</td>'; | |
$html .= '<td class="name ' . $team_one_class . '">' . $team_one_name . '</td>'; | |
$html .= '<td class="score">' . $series->get_team_score( 'team-one' ) . '</td>'; | |
$html .= '</tr>'; | |
$team_row_styles = apply_filters( 'sports_bench_playoff_team_row', '', $team_two ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sports_bench_theme_scoreboard_game( $html, $game, $count, $num_games ) { | |
$theme = wp_get_theme(); | |
$parent_theme = $theme->get( 'Template' ); | |
$game_id = $game->game_id; | |
$away_team = new Sports_Bench_Team( (int) $game->game_away_id ); | |
$home_team = new Sports_Bench_Team( (int) $game->game_home_id ); | |
$status = $game->game_status; | |
$date = date_create( $game->game_day ); | |
if ( sports_bench_is_game_time_set( $date ) === true ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sports_bench_do_game_modal( $html, $game, $away_team, $home_team, $status, $time, $period ) { | |
$theme = wp_get_theme(); | |
$parent_theme = $theme->parent(); | |
if ( $status == 'in_progress' && ( $theme->name != 'Sports Bench' || ( $parent_theme && $parent_theme->name != 'Sports Bench' ) ) ) { | |
if ( $game->game_current_period != null and $game->game_current_time != null ) { | |
$time_in_game = '<span class="time">' . $time . '</span><br /><span class="period">' . $period . '</span>'; | |
} else { | |
$time_in_game = '<span class="time">' . $time . '</span>'; | |
} | |
if ( $away_team->team_nickname != null ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import createClass from 'create-react-class'; | |
import PropTypes from 'prop-types'; | |
import Select from 'react-select'; | |
import fetch from 'isomorphic-fetch'; | |
const SelectTeam = createClass({ | |
displayName: 'SelectTeam', | |
getInitialState () { | |
return { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Block dependencies | |
*/ | |
import icon from './icon'; | |
import SelectTeam from '../select-team'; | |
//import './style.scss'; | |
import './editor.scss'; | |
/** | |
* Internal block libraries |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onSelectTeam( option ){ | |
console.log('change team'); | |
if( option === null ){ | |
console.log(null); | |
getTeams().then( function( options ) { | |
console.log(options); | |
setAttributes({ | |
team_id: "", | |
team_string: "", | |
getTeam: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sports_bench_render_team( $attributes ) { | |
$team_id = $attributes[ 'team_id' ]; | |
$html = ''; | |
if ( $team_id > 0 ) { | |
$team = new Sports_Bench_Team( (int)$team_id ); | |
$record = $team->get_record( '"' . get_option( 'sports-bench-season-year' ) . '"' ); | |
$html .= '<div id="sports-bench-team-' . $team->team_id . '" class="sports-bench-shortcode-team row">'; | |
$html .= apply_filters( 'sports_bench_before_team_shortcode', '', $team ); | |
$html .= '<div class="row sports-bench-row">'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp_localize_script( | |
'sportsbench-blocks-js', | |
'sportsbench_globals', | |
[ | |
'rest_url' => esc_url( rest_url() ), | |
'nonce' => wp_create_nonce( 'wp_rest' ), | |
'sport' => get_option( 'sports-bench-sport' ) | |
]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sports_bench_blocks_editor_scripts() { | |
// Make paths variables so we don't write em twice ;) | |
$blockPath = 'js/editor.blocks.js'; | |
$editorStylePath = '/css/blocks.editor.css'; | |
// Enqueue the bundled block JS file | |
wp_enqueue_script( | |
'sportsbench-blocks-js', | |
plugins_url( $blockPath, __FILE__ ), | |
[ 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api' ], | |
filemtime( plugin_dir_path(__FILE__) . 'js/editor.blocks.js' ) |