Display metrics and statistics on player page

This commit is contained in:
Brian Miyaji
2014-01-14 04:16:11 +11:00
parent bd919ad121
commit 6e099d0424
218 changed files with 537 additions and 157 deletions

View File

@@ -726,7 +726,7 @@ if ( !function_exists( 'sportspress_edit_event_results_table' ) ) {
}
if ( !function_exists( 'sportspress_event_player_status_selector' ) ) {
function sportspress_event_player_status_selector( $team_id, $player_id, $value ) {
function sportspress_event_player_status_selector( $team_id, $player_id, $value = null ) {
if ( ! $team_id || ! $player_id )
return '—';
@@ -832,6 +832,27 @@ if ( !function_exists( 'sportspress_event_players_table' ) ) {
}
}
if ( !function_exists( 'sportspress_player_nationality_selector' ) ) {
function sportspress_player_nationality_selector( $value = null ) {
$options = array(
'lineup' => __( 'Starting Lineup', 'sportspress' ),
'sub' => __( 'Substitute', 'sportspress' ),
);
$output = '<select name="sp_players[' . $team_id . '][' . $player_id . '][status]">';
foreach( $options as $key => $name ):
$output .= '<option value="' . $key . '"' . ( $key == $value ? ' selected' : '' ) . '>' . $name . '</option>';
endforeach;
$output .= '</select>';
return $output;
}
}
if ( !function_exists( 'sportspress_post_adder' ) ) {
function sportspress_post_adder( $meta = 'post' ) {
$obj = get_post_type_object( $meta );
@@ -1439,6 +1460,27 @@ if ( !function_exists( 'sportspress_get_player_list_data' ) ) {
}
}
if ( !function_exists( 'sportspress_get_player_metrics_data' ) ) {
function sportspress_get_player_metrics_data( $post_id ) {
$metrics = (array)get_post_meta( $post_id, 'sp_metrics', true );
// Get labels from metric variables
$metric_labels = (array)sportspress_get_var_labels( 'sp_metric' );
$data = array();
foreach( $metric_labels as $key => $value ):
$data[ $value ] = sportspress_array_value( $metrics, $key, '&nbsp;' );
endforeach;
return $data;
}
}
if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) {
function sportspress_get_player_statistics_data( $post_id, $team_id, $breakdown = false ) {

View File

@@ -0,0 +1,14 @@
<?php
function sportspress_define_continents_global() {
global $sportspress_continents;
$sportspress_continents = array(
__( 'Africa', 'countries' ) => array('AO','BF','BI','BJ','BW','CD','CF','CG','CI','CM','CV','DJ','DZ','EG','EH','ER','ET','GA','GH','GM','GN','GQ','GW','KE','KM','LR','LS','LY','MA','MG','ML','MR','MU','MZ','NA','NE','NG','RW','SC','SD','SL','SN','SO','ST','SZ','TD','TG','TN','TZ','UG','ZA','ZM','ZW'),
__( 'Asia', 'countries' ) => array('AE','AF','AM','AZ','BD','BH','BN','BT','CN','CY','GE','HK','IL','IN','IQ','IR','JO','JP','KG','KH','KP','KR','KW','KZ','LA','LB','LK','MM','MN','MO','MV','MY','NP','OM','PH','PK','QA','SA','SG','TH','TJ','TM','TW','UZ','VN','YE'),
__( 'Europe', 'countries' ) => array('AD','AL','AT','BA','BE','BG','BY','CH','CZ','DE','DK','EE','ES','FI','FR','GB','GR','HR','HU','IE','IS','IT','LI','LT','LU','LV','MC','MD','ME','MK','MT','MW','NL','NO','PL','PT','RO','RS','RU','SE','SI','SK','SM','TR','UA','VA'),
__( 'North America', 'countries' ) => array('AG','BB','BS','BZ','CA','CR','CU','DM','DO','GD','GT','HN','HT','JM','KN','LC','MX','NI','PA','SV','US','VC'),
__( 'Oceania', 'countries' ) => array('AU','TL','FJ','FM','ID','KI','MH','NR','NZ','PG','PW','SB','TO','TV','VU','WS'),
__( 'South America', 'countries' ) => array('AR','BO','BR','CL','CO','EC','GY','PE','PY','SR','TT','UY','VE'),
);
}
add_action( 'init', 'sportspress_define_continents_global' );

206
admin/globals/countries.php Normal file
View File

@@ -0,0 +1,206 @@
<?php
function sportspress_define_countries_global() {
global $sportspress_countries;
$sportspress_countries = array(
'AD' => __( "Andorra", 'sportspress' ),
'AE' => __( "United Arab Emirates", 'sportspress' ),
'AF' => __( "Afghanistan", 'sportspress' ),
'AG' => __( "Antigua and Barbuda", 'sportspress' ),
'AL' => __( "Albania", 'sportspress' ),
'AM' => __( "Armenia", 'sportspress' ),
'AO' => __( "Angola", 'sportspress' ),
'AR' => __( "Argentina", 'sportspress' ),
'AT' => __( "Austria", 'sportspress' ),
'AU' => __( "Australia", 'sportspress' ),
'AZ' => __( "Azerbaijan", 'sportspress' ),
'BA' => __( "Bosnia and Herzegovina", 'sportspress' ),
'BB' => __( "Barbados", 'sportspress' ),
'BD' => __( "Bangladesh", 'sportspress' ),
'BE' => __( "Belgium", 'sportspress' ),
'BF' => __( "Burkina Faso", 'sportspress' ),
'BG' => __( "Bulgaria", 'sportspress' ),
'BH' => __( "Bahrain", 'sportspress' ),
'BI' => __( "Burundi", 'sportspress' ),
'BJ' => __( "Benin", 'sportspress' ),
'BN' => __( "Brunei", 'sportspress' ),
'BO' => __( "Bolivia", 'sportspress' ),
'BR' => __( "Brazil", 'sportspress' ),
'BS' => __( "Bahamas", 'sportspress' ),
'BT' => __( "Bhutan", 'sportspress' ),
'BW' => __( "Botswana", 'sportspress' ),
'BY' => __( "Belarus", 'sportspress' ),
'BZ' => __( "Belize", 'sportspress' ),
'CA' => __( "Canada", 'sportspress' ),
'CD' => __( "Democratic Republic of the Congo", 'sportspress' ),
'CF' => __( "Central African Republic", 'sportspress' ),
'CG' => __( "Republic of the Congo", 'sportspress' ),
'CH' => __( "Switzerland", 'sportspress' ),
'CI' => __( "Cote d'Ivoire", 'sportspress' ),
'CL' => __( "Chile", 'sportspress' ),
'CM' => __( "Cameroon", 'sportspress' ),
'CN' => __( "China", 'sportspress' ),
'CO' => __( "Colombia", 'sportspress' ),
'CR' => __( "Costa Rica", 'sportspress' ),
'CU' => __( "Cuba", 'sportspress' ),
'CV' => __( "Cape Verde", 'sportspress' ),
'CY' => __( "Cyprus", 'sportspress' ),
'CZ' => __( "Czech Republic", 'sportspress' ),
'DE' => __( "Germany", 'sportspress' ),
'DJ' => __( "Djibouti", 'sportspress' ),
'DK' => __( "Denmark", 'sportspress' ),
'DM' => __( "Dominica", 'sportspress' ),
'DO' => __( "Dominican Republic", 'sportspress' ),
'DZ' => __( "Algeria", 'sportspress' ),
'EC' => __( "Ecuador", 'sportspress' ),
'EE' => __( "Estonia", 'sportspress' ),
'EG' => __( "Egypt", 'sportspress' ),
'EH' => __( "Western Sahara", 'sportspress' ),
'ER' => __( "Eritrea", 'sportspress' ),
'ES' => __( "Spain", 'sportspress' ),
'ET' => __( "Ethiopia", 'sportspress' ),
'FI' => __( "Finland", 'sportspress' ),
'FJ' => __( "Fiji", 'sportspress' ),
'FM' => __( "Micronesia", 'sportspress' ),
'FR' => __( "France", 'sportspress' ),
'GA' => __( "Gabon", 'sportspress' ),
'GB' => __( "United Kingdom", 'sportspress' ),
'GD' => __( "Grenada", 'sportspress' ),
'GE' => __( "Georgia", 'sportspress' ),
'GH' => __( "Ghana", 'sportspress' ),
'GM' => __( "Gambia", 'sportspress' ),
'GN' => __( "Guinea", 'sportspress' ),
'GQ' => __( "Equatorial Guinea", 'sportspress' ),
'GR' => __( "Greece", 'sportspress' ),
'GT' => __( "Guatemala", 'sportspress' ),
'GW' => __( "Guinea-Bissau", 'sportspress' ),
'GY' => __( "Guyana", 'sportspress' ),
'HK' => __( "Hong Kong", 'sportspress' ),
'HN' => __( "Honduras", 'sportspress' ),
'HR' => __( "Croatia", 'sportspress' ),
'HT' => __( "Haiti", 'sportspress' ),
'HU' => __( "Hungary", 'sportspress' ),
'ID' => __( "Indonesia", 'sportspress' ),
'IE' => __( "Ireland", 'sportspress' ),
'IL' => __( "Israel", 'sportspress' ),
'IN' => __( "India", 'sportspress' ),
'IQ' => __( "Iraq", 'sportspress' ),
'IR' => __( "Iran", 'sportspress' ),
'IS' => __( "Iceland", 'sportspress' ),
'IT' => __( "Italy", 'sportspress' ),
'JM' => __( "Jamaica", 'sportspress' ),
'JO' => __( "Jordan", 'sportspress' ),
'JP' => __( "Japan", 'sportspress' ),
'KE' => __( "Kenya", 'sportspress' ),
'KG' => __( "Kyrgyzstan", 'sportspress' ),
'KH' => __( "Cambodia", 'sportspress' ),
'KI' => __( "Kiribati", 'sportspress' ),
'KM' => __( "Comoros", 'sportspress' ),
'KN' => __( "Saint Kitts and Nevis", 'sportspress' ),
'KP' => __( "North Korea", 'sportspress' ),
'KR' => __( "South Korea", 'sportspress' ),
'KW' => __( "Kuwait", 'sportspress' ),
'KZ' => __( "Kazakhstan", 'sportspress' ),
'LA' => __( "Laos", 'sportspress' ),
'LB' => __( "Lebanon", 'sportspress' ),
'LC' => __( "Saint Lucia", 'sportspress' ),
'LI' => __( "Liechtenstein", 'sportspress' ),
'LK' => __( "Sri Lanka", 'sportspress' ),
'LR' => __( "Liberia", 'sportspress' ),
'LS' => __( "Lesotho", 'sportspress' ),
'LT' => __( "Lithuania", 'sportspress' ),
'LU' => __( "Luxembourg", 'sportspress' ),
'LV' => __( "Latvia", 'sportspress' ),
'LY' => __( "Libya", 'sportspress' ),
'MA' => __( "Morocco", 'sportspress' ),
'MC' => __( "Monaco", 'sportspress' ),
'MD' => __( "Moldova", 'sportspress' ),
'ME' => __( "Montenegro", 'sportspress' ),
'MG' => __( "Madagascar", 'sportspress' ),
'MH' => __( "Marshall Islands", 'sportspress' ),
'MK' => __( "Macedonia", 'sportspress' ),
'ML' => __( "Mali", 'sportspress' ),
'MM' => __( "Myanmar", 'sportspress' ),
'MN' => __( "Mongolia", 'sportspress' ),
'MO' => __( "Macau", 'sportspress' ),
'MR' => __( "Mauritania", 'sportspress' ),
'MT' => __( "Malta", 'sportspress' ),
'MU' => __( "Mauritius", 'sportspress' ),
'MV' => __( "Maldives", 'sportspress' ),
'MW' => __( "Malawi", 'sportspress' ),
'MX' => __( "Mexico", 'sportspress' ),
'MY' => __( "Malaysia", 'sportspress' ),
'MZ' => __( "Mozambique", 'sportspress' ),
'NA' => __( "Namibia", 'sportspress' ),
'NE' => __( "Niger", 'sportspress' ),
'NG' => __( "Nigeria", 'sportspress' ),
'NI' => __( "Nicaragua", 'sportspress' ),
'NL' => __( "Netherlands", 'sportspress' ),
'NO' => __( "Norway", 'sportspress' ),
'NP' => __( "Nepal", 'sportspress' ),
'NR' => __( "Nauru", 'sportspress' ),
'NZ' => __( "New Zealand", 'sportspress' ),
'OM' => __( "Oman", 'sportspress' ),
'PA' => __( "Panama", 'sportspress' ),
'PE' => __( "Peru", 'sportspress' ),
'PG' => __( "Papua New Guinea", 'sportspress' ),
'PH' => __( "Philippines", 'sportspress' ),
'PK' => __( "Pakistan", 'sportspress' ),
'PL' => __( "Poland", 'sportspress' ),
'PT' => __( "Portugal", 'sportspress' ),
'PW' => __( "Palau", 'sportspress' ),
'PY' => __( "Paraguay", 'sportspress' ),
'QA' => __( "Qatar", 'sportspress' ),
'RO' => __( "Romania", 'sportspress' ),
'RS' => __( "Serbia", 'sportspress' ),
'RU' => __( "Russia", 'sportspress' ),
'RW' => __( "Rwanda", 'sportspress' ),
'SA' => __( "Saudi Arabia", 'sportspress' ),
'SB' => __( "Solomon Islands", 'sportspress' ),
'SC' => __( "Seychelles", 'sportspress' ),
'SD' => __( "Sudan", 'sportspress' ),
'SE' => __( "Sweden", 'sportspress' ),
'SG' => __( "Singapore", 'sportspress' ),
'SI' => __( "Slovenia", 'sportspress' ),
'SK' => __( "Slovakia", 'sportspress' ),
'SL' => __( "Sierra Leone", 'sportspress' ),
'SM' => __( "San Marino", 'sportspress' ),
'SN' => __( "Senegal", 'sportspress' ),
'SO' => __( "Somalia", 'sportspress' ),
'SR' => __( "Suriname", 'sportspress' ),
'ST' => __( "Sao Tome and Principe", 'sportspress' ),
'SV' => __( "El Salvador", 'sportspress' ),
'SZ' => __( "Swaziland", 'sportspress' ),
'TD' => __( "Chad", 'sportspress' ),
'TG' => __( "Togo", 'sportspress' ),
'TH' => __( "Thailand", 'sportspress' ),
'TJ' => __( "Tajikistan", 'sportspress' ),
'TL' => __( "East Timor", 'sportspress' ),
'TM' => __( "Turkmenistan", 'sportspress' ),
'TN' => __( "Tunisia", 'sportspress' ),
'TO' => __( "Tonga", 'sportspress' ),
'TR' => __( "Turkey", 'sportspress' ),
'TT' => __( "Trinidad and Tobago", 'sportspress' ),
'TV' => __( "Tuvalu", 'sportspress' ),
'TW' => __( "Taiwan", 'sportspress' ),
'TZ' => __( "Tanzania", 'sportspress' ),
'UA' => __( "Ukraine", 'sportspress' ),
'UG' => __( "Uganda", 'sportspress' ),
'US' => __( "United States", 'sportspress' ),
'UY' => __( "Uruguay", 'sportspress' ),
'UZ' => __( "Uzbekistan", 'sportspress' ),
'VA' => __( "Vatican City", 'sportspress' ),
'VC' => __( "Saint Vincent and the Grenadines", 'sportspress' ),
'VE' => __( "Venezuela", 'sportspress' ),
'VN' => __( "Vietnam", 'sportspress' ),
'VU' => __( "Vanuatu", 'sportspress' ),
'WS' => __( "Samoa", 'sportspress' ),
'YE' => __( "Yemen", 'sportspress' ),
'ZA' => __( "South Africa", 'sportspress' ),
'ZM' => __( "Zambia", 'sportspress' ),
'ZW' => __( "Zimbabwe", 'sportspress' ),
);
asort( $sportspress_countries );
}
add_action( 'init', 'sportspress_define_countries_global' );

23
admin/globals/sports.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
function sportspress_define_sports_global() {
global $sportspress_sports;
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/soccer.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/football.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/footy.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/baseball.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/basketball.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/gaming.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/cricket.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/golf.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/handball.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/hockey.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/racing.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/rugby.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/swimming.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/tennis.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/presets/volleyball.php';
asort( $sportspress_sports );
}
add_action( 'init', 'sportspress_define_sports_global' );

View File

@@ -2,23 +2,23 @@
function sportspress_admin_post_thumbnail_html( $translated_text, $post_id ) {
$texts = array(
'sp_team' => array(
'Set featured image' => 'Select Logo',
'Remove featured image' => 'Remove Logo',
'Set featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Logo', 'sportspress' ) ),
'Remove featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Logo', 'sportspress' ) ),
),
'sp_player' => array(
'Set featured image' => 'Select Photo',
'Remove featured image' => 'Remove Photo',
'Set featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ),
'Remove featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ),
),
'sp_staff' => array(
'Set featured image' => 'Select Photo',
'Remove featured image' => 'Remove Photo',
'Set featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ),
'Remove featured image' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ),
),
);
$typenow = get_post_type( $post_id );
if ( is_admin() && array_key_exists( $typenow, $texts ) ):
foreach ( $texts[ $typenow ] as $key => $value ):
$translated_text = str_replace( __( $key ), __( $value, 'sportspress' ), $translated_text );
$translated_text = str_replace( __( $key ), $value, $translated_text );
endforeach;
endif;
return $translated_text;

View File

@@ -2,42 +2,89 @@
function sportspress_gettext( $translated_text, $untranslated_text, $domain ) {
global $typenow;
$texts = array(
'sp_team' => array(
'Enter title here' => 'Team',
'Set featured image' => 'Select Logo',
'Set Featured Image' => 'Select Logo',
'Remove featured image' => 'Remove Logo',
),
'sp_event' => array(
'Enter title here' => '(no title)',
'Scheduled for: <b>%1$s</b>' => 'Date/Time: <b>%1$s</b>',
'Published on: <b>%1$s</b>' => 'Date/Time: <b>%1$s</b>',
'Publish <b>immediately</b>' => 'Date/Time: <b>%1$s</b>',
),
'sp_player' => array(
'Enter title here' => 'Name',
'Set featured image' => 'Select Photo',
'Set Featured Image' => 'Select Photo',
'Remove featured image' => 'Remove Photo',
'Scheduled for: <b>%1$s</b>' => 'Joined: <b>%1$s</b>',
'Published on: <b>%1$s</b>' => 'Joined: <b>%1$s</b>',
'Publish <b>immediately</b>' => 'Joined: <b>%1$s</b>',
),
'sp_staff' => array(
'Enter title here' => 'Name',
'Set featured image' => 'Select Photo',
'Set Featured Image' => 'Select Photo',
'Remove featured image' => 'Remove Photo',
'Scheduled for: <b>%1$s</b>' => 'Joined: <b>%1$s</b>',
'Published on: <b>%1$s</b>' => 'Joined: <b>%1$s</b>',
'Publish <b>immediately</b>' => 'Joined: <b>%1$s</b>',
),
);
if ( is_admin() ):
if ( is_admin() && array_key_exists( $typenow, $texts ) && array_key_exists( $untranslated_text, $texts[ $typenow ] ) )
return __( $texts[ $typenow ][ $untranslated_text ], 'sportspress' );
else
return $translated_text;
switch ( $typenow ):
case 'sp_team':
switch ( $untranslated_text ):
case 'Enter title here':
$translated_text = __( 'Team', 'sportspress' );
break;
case 'Set featured image':
$translated_text = sprintf( __( 'Select %s', 'sportspress' ), __( 'Logo', 'sportspress' ) );
break;
case 'Set Featured Image':
$translated_text = sprintf( __( 'Select %s', 'sportspress' ), __( 'Logo', 'sportspress' ) );
break;
case 'Remove featured image':
$translated_text = sprintf( __( 'Remove %s', 'sportspress' ), __( 'Logo', 'sportspress' ) );
break;
endswitch;
case 'sp_event':
switch ( $untranslated_text ):
case 'Enter title here':
$translated_text = __( '(no title)', 'sportspress' );
break;
case 'Scheduled for: <b>%1$s</b>':
$translated_text = __( 'Date/Time: <b>%1$s</b>', 'sportspress' );
break;
case 'Published on: <b>%1$s</b>':
$translated_text = __( 'Date/Time: <b>%1$s</b>', 'sportspress' );
break;
case 'Publish <b>immediately</b>':
$translated_text = __( 'Date/Time: <b>%1$s</b>', 'sportspress' );
break;
endswitch;
case 'sp_player':
switch ( $untranslated_text ):
case 'Enter title here':
$translated_text = __( 'Name', 'sportspress' );
break;
case 'Set featured image':
$translated_text = sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) );
break;
case 'Set Featured Image':
$translated_text = sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) );
break;
case 'Remove featured image':
$translated_text = sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) );
break;
case 'Scheduled for: <b>%1$s</b>':
$translated_text = __( 'Joined: <b>%1$s</b>', 'sportspress' );
break;
case 'Published on: <b>%1$s</b>':
$translated_text = __( 'Joined: <b>%1$s</b>', 'sportspress' );
break;
case 'Publish <b>immediately</b>':
$translated_text = __( 'Joined: <b>%1$s</b>', 'sportspress' );
break;
endswitch;
case 'sp_staff':
switch ( $untranslated_text ):
case 'Enter title here':
$translated_text = __( 'Name', 'sportspress' );
break;
case 'Set featured image':
$translated_text = sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) );
break;
case 'Set Featured Image':
$translated_text = sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) );
break;
case 'Remove featured image':
$translated_text = sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) );
break;
case 'Scheduled for: <b>%1$s</b>':
$translated_text = __( 'Joined: <b>%1$s</b>', 'sportspress' );
break;
case 'Published on: <b>%1$s</b>':
$translated_text = __( 'Joined: <b>%1$s</b>', 'sportspress' );
break;
case 'Publish <b>immediately</b>':
$translated_text = __( 'Joined: <b>%1$s</b>', 'sportspress' );
break;
endswitch;
endswitch;
endif;
return $translated_text;
}
add_filter( 'gettext', 'sportspress_gettext', 20, 3 );

View File

@@ -93,6 +93,9 @@ function sportspress_save_post( $post_id ) {
// Update player number
update_post_meta( $post_id, 'sp_number', sportspress_array_value( $_POST, 'sp_number', '' ) );
// Update nationality
update_post_meta( $post_id, 'sp_nationality', sportspress_array_value( $_POST, 'sp_nationality', '' ) );
// Update player metrics array
update_post_meta( $post_id, 'sp_metrics', sportspress_array_value( $_POST, 'sp_metrics', array() ) );

View File

@@ -22,7 +22,7 @@ function sportspress_the_content( $content ) {
global $post;
// Display player list
$content = sportspress_player_statistics( $post->ID ) . $content;
$content = sportspress_player_metrics( $post->ID ) . sportspress_player_statistics( $post->ID ) . $content;
endif;

View File

@@ -42,6 +42,7 @@ function sportspress_player_meta_init( $post ) {
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_player', 'side', 'high' );
remove_meta_box( 'postimagediv', 'sp_player', 'side' );
add_meta_box( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_player', 'side', 'high' );
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_player_details_meta', 'sp_player', 'side', 'high' );
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_player_team_meta', 'sp_player', 'side', 'high' );
if ( $teams && ! empty( $teams ) && $seasons && is_array( $seasons ) && is_object( $seasons[0] ) ):
@@ -50,7 +51,45 @@ function sportspress_player_meta_init( $post ) {
add_meta_box( 'sp_metricsdiv', __( 'Player Metrics', 'sportspress' ), 'sportspress_player_metrics_meta', 'sp_player', 'normal', 'high' );
add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sportspress_player_profile_meta', 'sp_player', 'normal', 'high' );
}
function sportspress_player_details_meta( $post ) {
global $sportspress_continents, $sportspress_countries;
$continents = array();
foreach( $sportspress_continents as $continent => $codes ):
$countries = array_intersect_key( $sportspress_countries, array_flip( $codes ) );
asort( $countries );
$continents[ $continent ] = $countries;
endforeach;
$number = get_post_meta( $post->ID, 'sp_number', true );
$nationality = get_post_meta( $post->ID, 'sp_nationality', true );
?>
<p>
<strong><?php _e( 'Number', 'sportspress' ); ?></strong>
</p>
<p>
<input type="text" size="4" id="sp_number" name="sp_number" value="<?php echo $number; ?>">
</p>
<p>
<strong><?php _e( 'Nationality', 'sportspress' ); ?></strong>
</p>
<p>
<select id="sp_nationality" name="sp_nationality">
<?php foreach ( $continents as $continent => $countries ): ?>
<optgroup label="<?php echo $continent; ?>">
<?php foreach ( $countries as $code => $country ): ?>
<option value="<?php echo $code; ?>" <?php selected ( $nationality, $code ); ?>>
<?php echo $country; ?>
</option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
</p>
<?php
}
function sportspress_player_team_meta( $post ) {
@@ -85,40 +124,54 @@ function sportspress_player_stats_meta( $post ) {
endforeach;
}
function sportspress_player_metrics_meta( $post ) {
$metrics = get_post_meta( $post->ID, 'sp_metrics', true );
?>
<div class="sp-data-table-container">
<table class="widefat sp-data-table">
<thead>
<tr>
<th><?php _e( 'Metric', 'sportspress' ); ?></th>
<th><?php _e( 'Value', 'sportspress' ); ?></th>
</tr>
</thead>
<tbody>
<?php
$args = array(
'post_type' => 'sp_metric',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
);
$vars = get_posts( $args );
$i = 0;
foreach ( $vars as $var ):
?>
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
<td>
<?php echo $var->post_title; ?>
</td>
<?php
$value = sportspress_array_value( $metrics, $var->post_name, '' );
?>
<td><input type="text" name="sp_metrics[<?php echo $var->post_name; ?>]" value="<?php echo $value; ?>" /></td>
</tr>
<?php
$i++;
endforeach;
?>
</tbody>
</table>
</div>
<?php
sportspress_nonce();
}
function sportspress_player_profile_meta( $post ) {
wp_editor( $post->post_content, 'content' );
}
function sportspress_player_metrics_meta( $post ) {
$number = get_post_meta( $post->ID, 'sp_number', true );
$details = get_post_meta( $post->ID, 'sp_metrics', true );
?>
<p><strong><?php _e( 'Player Number', 'sportspress' ); ?></strong></p>
<p>
<input name="sp_number" type="text" size="4" id="sp_number" value="<?php echo $number; ?>">
</p>
<?php
$args = array(
'post_type' => 'sp_metric',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
);
$vars = get_posts( $args );
$custom = array();
foreach ( $vars as $var ):
?>
<p><strong><?php echo $var->post_title; ?></strong></p>
<p>
<input name="sp_metrics[<?php echo $var->post_name; ?>]" type="text" value="<?php echo sportspress_array_value( $details, $var->post_name, ''); ?>">
</p>
<?php
endforeach;
sportspress_nonce();
}

View File

@@ -2,7 +2,7 @@
global $sportspress_sports;
$sportspress_sports['baseball'] = array(
'name' => 'Baseball',
'name' => __( 'Baseball', 'sportspress' ),
'posts' => array(
// Columns
'sp_column' => array(

View File

@@ -2,7 +2,7 @@
global $sportspress_sports;
$sportspress_sports['basketball'] = array(
'name' => 'Basketball',
'name' => __( 'Basketball', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(

View File

@@ -2,7 +2,7 @@
global $sportspress_sports;
$sportspress_sports['cricket'] = array(
'name' => 'Cricket',
'name' => __( 'Cricket', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(

View File

@@ -2,7 +2,7 @@
global $sportspress_sports;
$sportspress_sports['football'] = array(
'name' => 'American Football',
'name' => __( 'American Football', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(

View File

@@ -2,7 +2,7 @@
global $sportspress_sports;
$sportspress_sports['footy'] = array(
'name' => 'Australian Rules Football',
'name' => __( 'Australian Rules Football', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(

View File

@@ -2,7 +2,7 @@
global $sportspress_sports;
$sportspress_sports['gaming'] = array(
'name' => 'Competitive Gaming',
'name' => __( 'Competitive Gaming', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(

View File

@@ -2,7 +2,7 @@
global $sportspress_sports;
$sportspress_sports['golf'] = array(
'name' => 'Golf',
'name' => __( 'Golf', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(

View File

@@ -2,7 +2,7 @@
global $sportspress_sports;
$sportspress_sports['hockey'] = array(
'name' => 'Hockey',
'name' => __( 'Hockey', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(

View File

@@ -2,7 +2,7 @@
global $sportspress_sports;
$sportspress_sports['racing'] = array(
'name' => 'Racing',
'name' => __( 'Racing', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(

View File

@@ -2,7 +2,7 @@
global $sportspress_sports;
$sportspress_sports['rugby'] = array(
'name' => 'Rugby',
'name' => __( 'Rugby', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(

View File

@@ -2,7 +2,7 @@
global $sportspress_sports;
$sportspress_sports['soccer'] = array(
'name' => 'Association Football (Soccer)',
'name' => __( 'Association Football (Soccer)', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(

View File

@@ -38,7 +38,7 @@ function sportspress_sport_callback() {
?>
<select id="sportspress_sport" name="sportspress[sport]">
<?php foreach( $sportspress_sports as $slug => $sport ): ?>
<option value="<?php echo $slug; ?>" <?php selected( $options['sport'], $slug ); ?>><?php _e( $sport['name'], 'sportspress' ); ?></option>
<option value="<?php echo $slug; ?>" <?php selected( $options['sport'], $slug ); ?>><?php echo $sport['name']; ?></option>
<?php endforeach; ?>
</select>
<?php

BIN
assets/images/flags/ad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

BIN
assets/images/flags/ae.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

BIN
assets/images/flags/af.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

BIN
assets/images/flags/ag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

BIN
assets/images/flags/al.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

BIN
assets/images/flags/am.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

BIN
assets/images/flags/ao.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

BIN
assets/images/flags/ar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

BIN
assets/images/flags/at.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

BIN
assets/images/flags/au.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

BIN
assets/images/flags/az.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

BIN
assets/images/flags/ba.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

BIN
assets/images/flags/bb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

BIN
assets/images/flags/bd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

BIN
assets/images/flags/be.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

BIN
assets/images/flags/bf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

BIN
assets/images/flags/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

BIN
assets/images/flags/bh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

BIN
assets/images/flags/bi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

BIN
assets/images/flags/bj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

BIN
assets/images/flags/bn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
assets/images/flags/bo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

BIN
assets/images/flags/br.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

BIN
assets/images/flags/bs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

BIN
assets/images/flags/bt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

BIN
assets/images/flags/bw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

BIN
assets/images/flags/by.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

BIN
assets/images/flags/bz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
assets/images/flags/ca.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

BIN
assets/images/flags/cd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

BIN
assets/images/flags/cf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 B

BIN
assets/images/flags/cg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

BIN
assets/images/flags/ch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

BIN
assets/images/flags/ci.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

BIN
assets/images/flags/cl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

BIN
assets/images/flags/cm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

BIN
assets/images/flags/cn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

BIN
assets/images/flags/co.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

BIN
assets/images/flags/cr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

BIN
assets/images/flags/cu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

BIN
assets/images/flags/cv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

BIN
assets/images/flags/cy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

BIN
assets/images/flags/cz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

BIN
assets/images/flags/de.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

BIN
assets/images/flags/dj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

BIN
assets/images/flags/dk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

BIN
assets/images/flags/dm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

BIN
assets/images/flags/do.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

BIN
assets/images/flags/dz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

BIN
assets/images/flags/ec.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

BIN
assets/images/flags/ee.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

BIN
assets/images/flags/eg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

BIN
assets/images/flags/eh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

BIN
assets/images/flags/er.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

BIN
assets/images/flags/es.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

BIN
assets/images/flags/et.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

BIN
assets/images/flags/fi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

BIN
assets/images/flags/fj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
assets/images/flags/fm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

BIN
assets/images/flags/fr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

BIN
assets/images/flags/ga.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

BIN
assets/images/flags/gb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
assets/images/flags/gd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

BIN
assets/images/flags/ge.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

BIN
assets/images/flags/gh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

BIN
assets/images/flags/gm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

BIN
assets/images/flags/gn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

BIN
assets/images/flags/gq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

BIN
assets/images/flags/gr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

BIN
assets/images/flags/gt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

BIN
assets/images/flags/gw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

BIN
assets/images/flags/gy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

BIN
assets/images/flags/hn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

BIN
assets/images/flags/hr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

BIN
assets/images/flags/ht.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

BIN
assets/images/flags/hu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

BIN
assets/images/flags/id.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

BIN
assets/images/flags/ie.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

BIN
assets/images/flags/il.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Some files were not shown because too many files have changed in this diff Show More