Replace deprecated functions

This commit is contained in:
Brian Miyaji
2014-03-28 16:53:15 +11:00
parent 461b4f394c
commit 1add35a47f
58 changed files with 348 additions and 471 deletions

View File

@@ -5,7 +5,7 @@ else:
$args = array();
if ( isset( $team ) )
$args = array( 'key' => 'sp_team', 'value' => $team );
$post = sportspress_get_next_event( $args );
$post = sp_get_next_event( $args );
endif;
$output = '';

View File

@@ -15,7 +15,7 @@ $defaults = array(
extract( $defaults, EXTR_SKIP );
if ( isset( $id ) ):
$events = sportspress_get_calendar_data( $id );
$events = sp_get_calendar_data( $id );
$event_ids = array();
foreach ( $events as $event ):
$event_ids[] = $event->ID;

View File

@@ -1,6 +1,6 @@
<?php
global $sportspress_options;
$primary_result = sportspress_array_value( $sportspress_options, 'sportspress_primary_result', null );
$primary_result = sp_array_value( $sportspress_options, 'sportspress_primary_result', null );
$defaults = array(
'number' => -1,
@@ -14,7 +14,7 @@ extract( $defaults, EXTR_SKIP );
<thead>
<tr>
<?php
list( $data, $usecolumns ) = sportspress_get_calendar_data( $id, true );
list( $data, $usecolumns ) = sp_get_calendar_data( $id, true );
if ( isset( $columns ) )
$usecolumns = $columns;
@@ -67,10 +67,10 @@ extract( $defaults, EXTR_SKIP );
foreach ( $teams as $team ):
$name = get_the_title( $team );
if ( $name ):
$team_results = sportspress_array_value( $results, $team, null );
$team_results = sp_array_value( $results, $team, null );
if ( $primary_result ):
$team_result = sportspress_array_value( $team_results, $primary_result, null );
$team_result = sp_array_value( $team_results, $primary_result, null );
else:
if ( is_array( $team_results ) ):
end( $team_results );

View File

@@ -7,7 +7,7 @@ if ( ! isset( $id ) )
$teams = (array)get_post_meta( $id, 'sp_team', false );
$staff = (array)get_post_meta( $id, 'sp_staff', false );
$stats = (array)get_post_meta( $id, 'sp_players', true );
$performance_labels = sportspress_get_var_labels( 'sp_performance' );
$performance_labels = sp_get_var_labels( 'sp_performance' );
$link_posts = get_option( 'sportspress_event_link_players', 'yes' ) == 'yes' ? true : false;
$sortable = get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false;
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
@@ -20,11 +20,11 @@ foreach( $teams as $key => $team_id ):
$totals = array();
// Get results for players in the team
$players = sportspress_array_between( (array)get_post_meta( $id, 'sp_player', false ), 0, $key );
$players = sp_array_between( (array)get_post_meta( $id, 'sp_player', false ), 0, $key );
if ( sizeof( $players ) <= 1 ) continue;
$data = sportspress_array_combine( $players, sportspress_array_value( $stats, $team_id, array() ) );
$data = sp_array_combine( $players, sp_array_value( $stats, $team_id, array() ) );
$output .= '<h3>' . get_the_title( $team_id ) . '</h3>';
@@ -108,7 +108,7 @@ foreach( $teams as $key => $team_id ):
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
$value = $row[ $key ];
else:
$value = sportspress_array_value( $totals, $key, 0 );
$value = sp_array_value( $totals, $key, 0 );
endif;
$output .= '<td class="data-' . $key . '">' . $value . '</td>';
endforeach;

View File

@@ -3,8 +3,8 @@ if ( ! isset( $id ) )
$id = get_the_ID();
$teams = (array)get_post_meta( $id, 'sp_team', false );
$results = array_filter( sportspress_array_combine( $teams, (array)get_post_meta( $id, 'sp_results', true ) ), 'array_filter' );
$result_labels = sportspress_get_var_labels( 'sp_result' );
$results = array_filter( sp_array_combine( $teams, (array)get_post_meta( $id, 'sp_results', true ) ), 'array_filter' );
$result_labels = sp_get_var_labels( 'sp_result' );
$output = '';
@@ -17,7 +17,7 @@ if ( empty( $results ) )
return false;
foreach( $results as $team_id => $result ):
if ( sportspress_array_value( $result, 'outcome', '-1' ) != '-1' ):
if ( sp_array_value( $result, 'outcome', '-1' ) != '-1' ):
unset( $result['outcome'] );

View File

@@ -14,9 +14,9 @@ foreach( $venues as $venue ):
$t_id = $venue->term_id;
$term_meta = get_option( "taxonomy_$t_id" );
$address = sportspress_array_value( $term_meta, 'sp_address', '' );
$latitude = sportspress_array_value( $term_meta, 'sp_latitude', 0 );
$longitude = sportspress_array_value( $term_meta, 'sp_longitude', 0 );
$address = sp_array_value( $term_meta, 'sp_address', '' );
$latitude = sp_array_value( $term_meta, 'sp_latitude', 0 );
$longitude = sp_array_value( $term_meta, 'sp_longitude', 0 );
$output .= '<h3>' . SP()->text->string('Venue', 'event') . '</h3>';
$output .= '<p><a href="' . get_term_link( $t_id, 'sp_venue' ) . '">' . $venue->name . '</a><br><small>' . $address . '</small></p>';

View File

@@ -17,7 +17,7 @@ extract( $defaults, EXTR_SKIP );
$output = '<div class="sp-table-wrapper">' .
'<table class="sp-league-table sp-data-table' . ( $responsive ? ' sp-responsive-table' : '' ) . ( $sortable ? ' sp-sortable-table' : '' ) . '">' . '<thead>' . '<tr>';
$data = sportspress_get_league_table_data( $id );
$data = sp_get_league_table_data( $id );
// The first row should be column labels
$labels = $data[0];
@@ -49,7 +49,7 @@ foreach( $data as $team_id => $row ):
if ( isset( $limit ) && $i >= $limit ) continue;
$name = sportspress_array_value( $row, 'name', null );
$name = sp_array_value( $row, 'name', null );
if ( ! $name ) continue;
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
@@ -71,7 +71,7 @@ foreach( $data as $team_id => $row ):
if ( $key == 'name' )
continue;
if ( ! is_array( $columns ) || in_array( $key, $columns ) )
$output .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '&mdash;' ) . '</td>';
$output .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '&mdash;' ) . '</td>';
endforeach;
$output .= '</tr>';

View File

@@ -34,7 +34,7 @@ $float = is_rtl() ? 'right' : 'left';
$selector = 'sp-player-gallery-' . $id;
$data = sportspress_get_player_list_data( $id );
$data = sp_get_player_list_data( $id );
// The first row should be column labels
$labels = $data[0];
@@ -53,7 +53,7 @@ else:
'order' => $order,
),
);
uasort( $data, 'sportspress_sort_list_players' );
uasort( $data, 'sp_sort_list_players' );
endif;
$gallery_style = $gallery_div = '';

View File

@@ -7,7 +7,7 @@ if ( ! isset( $id ) )
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
$data = sportspress_get_player_performance_data( $id, $league->term_id );
$data = sp_get_player_performance_data( $id, $league->term_id );
// The first row should be column labels
$labels = $data[0];
@@ -36,7 +36,7 @@ foreach( $data as $season_id => $row ):
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
foreach( $labels as $key => $value ):
$output .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '&mdash;' ) . '</td>';
$output .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '&mdash;' ) . '</td>';
endforeach;
$output .= '</tr>';

View File

@@ -18,7 +18,7 @@ extract( $defaults, EXTR_SKIP );
$output = '<div class="sp-table-wrapper">' .
'<table class="sp-player-list sp-data-table' . ( $responsive ? ' sp-responsive-table' : '' ) . ( $sortable ? ' sp-sortable-table' : '' ) . '">' . '<thead>' . '<tr>';
$data = sportspress_get_player_list_data( $id );
$data = sp_get_player_list_data( $id );
// The first row should be column labels
$labels = $data[0];
@@ -37,7 +37,7 @@ else:
'order' => $order,
),
);
uasort( $data, 'sportspress_sort_list_players' );
uasort( $data, 'sp_sort_list_players' );
endif;
if ( in_array( $orderby, array( 'number', 'name' ) ) ):
@@ -61,7 +61,7 @@ if ( is_int( $number ) && $number > 0 )
foreach( $data as $player_id => $row ):
if ( isset( $limit ) && $i >= $limit ) continue;
$name = sportspress_array_value( $row, 'name', null );
$name = sp_array_value( $row, 'name', null );
if ( ! $name ) continue;
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
@@ -85,7 +85,7 @@ foreach( $data as $player_id => $row ):
if ( $key == 'name' )
continue;
if ( ! is_array( $performance ) || in_array( $key, $performance ) )
$output .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '&mdash;' ) . '</td>';
$output .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '&mdash;' ) . '</td>';
endforeach;
$output .= '</tr>';

View File

@@ -15,11 +15,11 @@ $countries = SP()->countries->countries;
$nationality = get_post_meta( $id, 'sp_nationality', true );
$current_team = get_post_meta( $id, 'sp_current_team', true );
$past_teams = get_post_meta( $id, 'sp_past_team', false );
$metrics = sportspress_get_player_metrics_data( $id );
$metrics = sp_get_player_metrics_data( $id );
$common = array();
if ( $nationality ):
$country_name = sportspress_array_value( $countries, $nationality, null );
$country_name = sp_array_value( $countries, $nationality, null );
$common[ SP()->text->string('Nationality', 'player') ] = $country_name ? ( $show_nationality_flag ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '&mdash;';
endif;

View File

@@ -12,7 +12,7 @@ $r = wp_parse_args( $args, $defaults );
$output = '';
$data = sportspress_get_player_roster_data( $id );
$data = sp_get_player_roster_data( $id );
// The first row should be column labels
$labels = $data[0];
@@ -20,7 +20,7 @@ $labels = $data[0];
// Remove the first row to leave us with the actual data
unset( $data[0] );
$performance = sportspress_array_value( $r, 'performance', null );
$performance = sp_array_value( $r, 'performance', null );
if ( $r['orderby'] == 'default' ):
$r['orderby'] = get_post_meta( $id, 'sp_orderby', true );
@@ -33,7 +33,7 @@ else:
'order' => $r['order'],
),
);
uasort( $data, 'sportspress_sort_list_players' );
uasort( $data, 'sp_sort_list_players' );
endif;
$positions = get_terms ( 'sp_position' );
@@ -59,14 +59,14 @@ foreach ( $positions as $position ):
// Name as link
$permalink = get_post_permalink( $player_id );
$name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', '&nbsp;' ) );
$name = sp_array_value( $row, 'name', sp_array_value( $row, 'name', '&nbsp;' ) );
$rows .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>';
foreach( $labels as $key => $value ):
if ( $key == 'name' )
continue;
if ( ! is_array( $performance ) || in_array( $key, $performance ) )
$rows .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '&mdash;' ) . '</td>';
$rows .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '&mdash;' ) . '</td>';
endforeach;
$rows .= '</tr>';

View File

@@ -12,7 +12,7 @@ $output = '';
// Loop through data for each league
foreach ( $leagues as $league ):
$data = sportspress_get_team_columns_data( $id, $league->term_id );
$data = sp_get_team_columns_data( $id, $league->term_id );
if ( sizeof( $data ) <= 1 )
continue;
@@ -40,7 +40,7 @@ foreach ( $leagues as $league ):
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
foreach( $labels as $key => $value ):
$output .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '&mdash;' ) . '</td>';
$output .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '&mdash;' ) . '</td>';
endforeach;
$output .= '</tr>';