Complete refactoring and add style settings

This commit is contained in:
Brian Miyaji
2014-03-28 01:48:52 +11:00
parent d3b27c8c73
commit 7e6b4adb9b
83 changed files with 2063 additions and 7028 deletions

View File

@@ -195,6 +195,6 @@ if ( $pad != 0 && $pad != 7 )
$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>\n\t</div>";
if ( $id && $show_all_events_link )
$calendar_output .= '<a class="sp-calendar-link" href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a>';
$calendar_output .= '<a class="sp-calendar-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events', 'event') . '</a>';
echo apply_filters( 'sportspress_event_calendar', $calendar_output );

View File

@@ -7,19 +7,19 @@ $time = get_the_time( get_option('time_format'), $id );
$leagues = get_the_terms( $id, 'sp_league' );
$seasons = get_the_terms( $id, 'sp_season' );
$data = array( __( 'Date', 'sportspress' ) => $date, __( 'Time', 'sportspress' ) => $time );
$data = array( SP()->text->string('Date', 'event') => $date, SP()->text->string('Time', 'event') => $time );
if ( $leagues ):
$league = array_pop( $leagues );
$data[ __( 'League', 'sportspress' ) ] = $league->name;
$data[ SP()->text->string('League') ] = $league->name;
endif;
if ( $seasons ):
$season = array_pop( $seasons );
$data[ __( 'Season', 'sportspress' ) ] = $season->name;
$data[ SP()->text->string('Season') ] = $season->name;
endif;
$output = '<h3>' . __( 'Details', 'sportspress' ) . '</h3>';
$output = '<h3>' . SP()->text->string('Details', 'event') . '</h3>';
$output .= '<div class="sp-table-wrapper">' .
'<table class="sp-event-details sp-data-table"><tbody>';

View File

@@ -16,19 +16,19 @@ list( $data, $usecolumns ) = sportspress_get_calendar_data( $id, true );
if ( isset( $columns ) )
$usecolumns = $columns;
$output .= '<th class="column-date">' . __( 'Date', 'sportspress' ). '</th>';
$output .= '<th class="data-date">' . SP()->text->string('Date', 'event') . '</th>';
if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
$output .= '<th class="column-event">' . __( 'Event', 'sportspress' ). '</th>';
$output .= '<th class="data-event">' . SP()->text->string('Event', 'event') . '</th>';
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) )
$output .= '<th class="column-teams">' . __( 'Teams', 'sportspress' ). '</th>';
$output .= '<th class="data-teams">' . SP()->text->string('Teams', 'event') . '</th>';
if ( $usecolumns == null || in_array( 'time', $usecolumns ) )
$output .= '<th class="column-time">' . __( 'Time', 'sportspress' ). '</th>';
$output .= '<th class="data-time">' . SP()->text->string('Time', 'event') . '</th>';
if ( $usecolumns == null || in_array( 'article', $usecolumns ) )
$output .= '<th class="column-article">' . __( 'Article', 'sportspress' ). '</th>';
$output .= '<th class="data-article">' . SP()->text->string('Article', 'event') . '</th>';
$output .= '</tr>' . '</thead>' . '<tbody>';
@@ -40,13 +40,13 @@ foreach ( $data as $event ):
$output .= '<tr class="sp-row sp-post' . ( $i % 2 == 0 ? ' alternate' : '' ) . '">';
$output .= '<td class="column-date">' . get_post_time( get_option( 'date_format' ), false, $event ) . '</td>';
$output .= '<td class="data-date">' . get_post_time( get_option( 'date_format' ), false, $event ) . '</td>';
if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
$output .= '<td class="column-event">' . $event->post_title . '</td>';
$output .= '<td class="data-event">' . $event->post_title . '</td>';
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) ):
$output .= '<td class="column-teams">';
$output .= '<td class="data-teams">';
$teams = get_post_meta( $event->ID, 'sp_team', false );
if ( $teams ):
@@ -83,11 +83,11 @@ foreach ( $data as $event ):
endif;
if ( $usecolumns == null || in_array( 'time', $usecolumns ) )
$output .= '<td class="column-time">' . get_post_time( get_option( 'time_format' ), false, $event ) . '</td>';
$output .= '<td class="data-time">' . get_post_time( get_option( 'time_format' ), false, $event ) . '</td>';
if ( $usecolumns == null || in_array( 'article', $usecolumns ) ):
$output .= '<td class="column-article">
<a href="' . get_permalink( $event->ID ) . '#sp_articlediv">';
$output .= '<td class="data-article">
<a href="' . get_permalink( $event->ID ) . '">';
if ( $video ):
$output .= '<div class="dashicons dashicons-video-alt"></div>';
@@ -96,9 +96,9 @@ foreach ( $data as $event ):
endif;
if ( $event->post_content !== null ):
if ( $event->post_status == 'publish' ):
$output .= __( 'Recap', 'sportspress' );
$output .= SP()->text->string('Recap', 'event');
else:
$output .= __( 'Preview', 'sportspress' );
$output .= SP()->text->string('Preview', 'event');
endif;
endif;
@@ -114,7 +114,7 @@ endforeach;
$output .= '</tbody>' . '</table>';
if ( $id && $show_all_events_link )
$output .= '<a class="sp-calendar-link" href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a>';
$output .= '<a class="sp-calendar-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events', 'event') . '</a>';
$output .= '</div>';

View File

@@ -8,9 +8,9 @@ $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' );
$link_posts = sportspress_array_value( $sportspress_options, 'event_performance_link_posts', true );
$sortable = sportspress_array_value( $sportspress_options, 'event_performance_sortable', true );
$responsive = sportspress_array_value( $sportspress_options, 'event_performance_responsive', true );
$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;
$output = '';
@@ -29,7 +29,7 @@ foreach( $teams as $key => $team_id ):
'<table class="sp-event-performance sp-data-table' . ( $responsive ? ' sp-responsive-table' : '' ) . ( $sortable ? ' sp-sortable-table' : '' ) . '">' . '<thead>' . '<tr>';
$output .= '<th class="data-number">#</th>';
$output .= '<th class="data-number">' . __( 'Player', 'sportspress' ) . '</th>';
$output .= '<th class="data-name">' . SP()->text->string('Player', 'event') . '</th>';
foreach( $performance_labels as $key => $label ):
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
@@ -94,7 +94,7 @@ foreach( $teams as $key => $team_id ):
// Player number
$output .= '<td class="data-number">&nbsp;</td>';
$output .= '<td class="data-name">' . __( 'Total', 'sportspress' ) . '</td>';
$output .= '<td class="data-name">' . SP()->text->string('Total', 'event') . '</td>';
$row = $data[0];

View File

@@ -49,11 +49,11 @@ if ( empty( $table_rows ) ):
else:
$output .= '<h3>' . __( 'Results', 'sportspress' ) . '</h3>';
$output .= '<h3>' . SP()->text->string('Results', 'event') . '</h3>';
$output .= '<div class="sp-table-wrapper">' .
'<table class="sp-event-results sp-data-table sp-responsive-table"><thead>' .
'<th class="data-name">' . __( 'Team', 'sportspress' ) . '</th>';
'<th class="data-name">' . SP()->text->string('Team', 'event') . '</th>';
foreach( $result_labels as $key => $label ):
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
endforeach;

View File

@@ -18,7 +18,7 @@ foreach( $venues as $venue ):
$latitude = sportspress_array_value( $term_meta, 'sp_latitude', 0 );
$longitude = sportspress_array_value( $term_meta, 'sp_longitude', 0 );
$output .= '<h3>' . __( 'Venue', 'sportspress' ) . '</h3>';
$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>';
if ( $latitude != null && $longitude != null )
$output .= '<div class="sp-google-map" data-address="' . $address . '" data-latitude="' . $latitude . '" data-longitude="' . $longitude . '"></div>';

View File

@@ -6,10 +6,10 @@ $defaults = array(
'number' => -1,
'columns' => null,
'show_full_table_link' => false,
'show_team_logo' => sportspress_array_value( $sportspress_options, 'league_table_show_team_logo', false ),
'link_posts' => sportspress_array_value( $sportspress_options, 'league_table_link_posts', false ),
'sortable' => sportspress_array_value( $sportspress_options, 'league_table_sortable', true ),
'responsive' => sportspress_array_value( $sportspress_options, 'league_table_responsive', true ),
'show_team_logo' => get_option( 'sportspress_table_show_logos', 'yes' ) == 'yes' ? true : false,
'link_posts' => get_option( 'sportspress_table_link_teams', 'no' ) == '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,
);
extract( $defaults, EXTR_SKIP );
@@ -31,7 +31,7 @@ if ( ! $columns )
if ( ! is_array( $columns ) )
$columns = explode( ',', $columns );
$output .= '<th class="data-rank">' . __( 'Pos', 'sportspress' ) . '</th>';
$output .= '<th class="data-rank">' . SP()->text->string('Pos', 'team') . '</th>';
foreach( $labels as $key => $label ):
if ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) )
@@ -83,7 +83,7 @@ endforeach;
$output .= '</tbody>' . '</table>';
if ( $show_full_table_link )
$output .= '<a class="sp-league-table-link" href="' . get_permalink( $id ) . '">' . __( 'View full table', 'sportspress' ) . '</a>';
$output .= '<a class="sp-league-table-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View full table', 'team') . '</a>';
$output .= '</div>';

View File

@@ -12,7 +12,6 @@ $defaults = array(
'columns' => 3,
'size' => 'thumbnail',
'show_all_players_link' => false,
'show_names_on_hover' => sportspress_array_value( $sportspress_options, 'player_gallery_show_names_on_hover', true ),
);
extract( $defaults, EXTR_SKIP );
@@ -89,14 +88,10 @@ if ( is_int( $number ) && $number > 0 )
foreach( $data as $player_id => $performance ):
if ( $show_names_on_hover ):
$caption = get_the_title( $player_id );
$player_number = get_post_meta( $player_id, 'sp_number', true );
if ( $player_number ):
$caption = '<strong>' . $player_number . '</strong> ' . $caption;
endif;
else:
$caption = null;
$caption = get_the_title( $player_id );
$player_number = get_post_meta( $player_id, 'sp_number', true );
if ( $player_number ):
$caption = '<strong>' . $player_number . '</strong> ' . $caption;
endif;
if ( isset( $limit ) && $i >= $limit )
@@ -128,6 +123,6 @@ $output .= "
</div>\n";
if ( $show_all_players_link )
$output .= '<a class="sp-player-list-link" href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a>';
$output .= '<a class="sp-player-list-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all players', 'player') . '</a>';
echo apply_filters( 'sportspress_player_gallery', $output );

View File

@@ -5,6 +5,8 @@ if ( ! isset( $league ) )
if ( ! isset( $id ) )
$id = get_the_ID();
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
$data = sportspress_get_player_performance_data( $id, $league->term_id );
// The first row should be column labels
@@ -19,7 +21,7 @@ if ( empty( $data ) )
$output = '<h4 class="sp-table-caption">' . $league->name . '</h4>' .
'<div class="sp-table-wrapper">' .
'<table class="sp-player-performance sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
'<table class="sp-player-performance sp-data-table' . ( $responsive ? ' sp-responsive-table' : '' ) . '">' . '<thead>' . '<tr>';
foreach( $labels as $key => $label ):
$output .= '<th class="data-' . $key . '">' . $label . '</th>';

View File

@@ -8,9 +8,9 @@ $defaults = array(
'orderby' => 'default',
'order' => 'ASC',
'show_all_players_link' => false,
'link_posts' => sportspress_array_value( $sportspress_options, 'player_list_link_posts', true ),
'sortable' => sportspress_array_value( $sportspress_options, 'player_list_sortable', true ),
'responsive' => sportspress_array_value( $sportspress_options, 'player_list_responsive', true ),
'link_posts' => get_option( 'sportspress_list_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,
);
extract( $defaults, EXTR_SKIP );
@@ -43,7 +43,7 @@ endif;
if ( in_array( $orderby, array( 'number', 'name' ) ) ):
$output .= '<th class="data-number">#</th>';
else:
$output .= '<th class="data-rank">' . __( 'Rank', 'sportspress' ) . '</th>';
$output .= '<th class="data-rank">' . SP()->text->string('Rank', 'player') . '</th>';
endif;
foreach( $labels as $key => $label ):
@@ -97,6 +97,6 @@ endforeach;
$output .= '</tbody>' . '</table>' . '</div>';
if ( $show_all_players_link )
$output .= '<a class="sp-player-list-link" href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a>';
$output .= '<a class="sp-player-list-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all players', 'player') . '</a>';
echo apply_filters( 'sportspress_player_list', $output );

View File

@@ -5,7 +5,7 @@ if ( ! isset( $id ) )
global $sportspress_options;
$defaults = array(
'show_nationality_flag' => sportspress_array_value( $sportspress_options, 'player_show_nationality_flag', true ),
'show_nationality_flag' => get_option( 'sportspress_player_show_flag', 'yes' ) == 'yes' ? true : false,
);
extract( $defaults, EXTR_SKIP );
@@ -20,20 +20,20 @@ $metrics = sportspress_get_player_metrics_data( $id );
$common = array();
if ( $nationality ):
$country_name = sportspress_array_value( $countries, $nationality, null );
$common[ __( 'Nationality', 'sportspress' ) ] = $country_name ? ( $show_nationality_flag ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '&mdash;';
$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;
$data = array_merge( $common, $metrics );
if ( $current_team )
$data[ __( 'Current Team', 'sportspress' ) ] = '<a href="' . get_post_permalink( $current_team ) . '">' . get_the_title( $current_team ) . '</a>';
$data[ SP()->text->string('Current Team', 'player') ] = '<a href="' . get_post_permalink( $current_team ) . '">' . get_the_title( $current_team ) . '</a>';
if ( $past_teams ):
$teams = array();
foreach ( $past_teams as $team ):
$teams[] = '<a href="' . get_post_permalink( $team ) . '">' . get_the_title( $team ) . '</a>';
endforeach;
$data[ __( 'Past Teams', 'sportspress' ) ] = implode( ', ', $teams );
$data[ SP()->text->string('Past Teams', 'player') ] = implode( ', ', $teams );
endif;
$output = '<div class="sp-list-wrapper">' .

View File

@@ -82,7 +82,7 @@ foreach ( $positions as $position ):
if ( in_array( $r['orderby'], array( 'number', 'name' ) ) ):
$output .= '<th class="data-number">#</th>';
else:
$output .= '<th class="data-rank">' . __( 'Rank', 'sportspress' ) . '</th>';
$output .= '<th class="data-rank">' . SP()->text->string('Rank', 'player') . '</th>';
endif;
foreach( $labels as $key => $label ):