diff --git a/admin-functions.php b/admin-functions.php index 78f06b02..4b2cee4b 100644 --- a/admin-functions.php +++ b/admin-functions.php @@ -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 = ''; + + 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, ' ' ); + + endforeach; + + return $data; + + } +} + if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) { function sportspress_get_player_statistics_data( $post_id, $team_id, $breakdown = false ) { diff --git a/admin/globals/continents.php b/admin/globals/continents.php new file mode 100644 index 00000000..caea6fcc --- /dev/null +++ b/admin/globals/continents.php @@ -0,0 +1,14 @@ + 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' ); diff --git a/admin/globals/countries.php b/admin/globals/countries.php new file mode 100644 index 00000000..b0145a42 --- /dev/null +++ b/admin/globals/countries.php @@ -0,0 +1,206 @@ + __( "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' ); diff --git a/admin/globals/sports.php b/admin/globals/sports.php new file mode 100644 index 00000000..be0d1baa --- /dev/null +++ b/admin/globals/sports.php @@ -0,0 +1,23 @@ + 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; diff --git a/admin/hooks/gettext.php b/admin/hooks/gettext.php index f7521a92..7d68fc25 100644 --- a/admin/hooks/gettext.php +++ b/admin/hooks/gettext.php @@ -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: %1$s' => 'Date/Time: %1$s', - 'Published on: %1$s' => 'Date/Time: %1$s', - 'Publish immediately' => 'Date/Time: %1$s', - ), - 'sp_player' => array( - 'Enter title here' => 'Name', - 'Set featured image' => 'Select Photo', - 'Set Featured Image' => 'Select Photo', - 'Remove featured image' => 'Remove Photo', - 'Scheduled for: %1$s' => 'Joined: %1$s', - 'Published on: %1$s' => 'Joined: %1$s', - 'Publish immediately' => 'Joined: %1$s', - ), - 'sp_staff' => array( - 'Enter title here' => 'Name', - 'Set featured image' => 'Select Photo', - 'Set Featured Image' => 'Select Photo', - 'Remove featured image' => 'Remove Photo', - 'Scheduled for: %1$s' => 'Joined: %1$s', - 'Published on: %1$s' => 'Joined: %1$s', - 'Publish immediately' => 'Joined: %1$s', - ), - ); + 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: %1$s': + $translated_text = __( 'Date/Time: %1$s', 'sportspress' ); + break; + case 'Published on: %1$s': + $translated_text = __( 'Date/Time: %1$s', 'sportspress' ); + break; + case 'Publish immediately': + $translated_text = __( 'Date/Time: %1$s', '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: %1$s': + $translated_text = __( 'Joined: %1$s', 'sportspress' ); + break; + case 'Published on: %1$s': + $translated_text = __( 'Joined: %1$s', 'sportspress' ); + break; + case 'Publish immediately': + $translated_text = __( 'Joined: %1$s', '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: %1$s': + $translated_text = __( 'Joined: %1$s', 'sportspress' ); + break; + case 'Published on: %1$s': + $translated_text = __( 'Joined: %1$s', 'sportspress' ); + break; + case 'Publish immediately': + $translated_text = __( 'Joined: %1$s', 'sportspress' ); + break; + endswitch; + endswitch; + endif; + return $translated_text; } add_filter( 'gettext', 'sportspress_gettext', 20, 3 ); diff --git a/admin/hooks/save-post.php b/admin/hooks/save-post.php index c0bdbab5..65dd59c8 100644 --- a/admin/hooks/save-post.php +++ b/admin/hooks/save-post.php @@ -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() ) ); diff --git a/admin/hooks/the-content.php b/admin/hooks/the-content.php index 9128ad03..b4c3945c 100644 --- a/admin/hooks/the-content.php +++ b/admin/hooks/the-content.php @@ -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; diff --git a/admin/post-types/player.php b/admin/post-types/player.php index e1b89f03..5ae2ad19 100644 --- a/admin/post-types/player.php +++ b/admin/post-types/player.php @@ -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 ); + ?> +
+ +
++ +
++ +
++ +
+ ID, 'sp_metrics', true ); + + ?> +| + | + |
|---|---|
| + post_title; ?> + | + post_name, '' ); + ?> ++ |
-
- -
- 'sp_metric', - 'numberposts' => -1, - 'posts_per_page' => -1, - 'orderby' => 'menu_order', - 'order' => 'ASC', - ); - - $vars = get_posts( $args ); - - $custom = array(); - foreach ( $vars as $var ): - ?> -post_title; ?>
-- -
- 'Baseball', + 'name' => __( 'Baseball', 'sportspress' ), 'posts' => array( // Columns 'sp_column' => array( diff --git a/admin/presets/basketball.php b/admin/presets/basketball.php index 9536a32c..297d45cd 100644 --- a/admin/presets/basketball.php +++ b/admin/presets/basketball.php @@ -2,7 +2,7 @@ global $sportspress_sports; $sportspress_sports['basketball'] = array( - 'name' => 'Basketball', + 'name' => __( 'Basketball', 'sportspress' ), 'posts' => array( // Table Columns 'sp_column' => array( diff --git a/admin/presets/cricket.php b/admin/presets/cricket.php index a3bdf120..c60dc6e4 100644 --- a/admin/presets/cricket.php +++ b/admin/presets/cricket.php @@ -2,7 +2,7 @@ global $sportspress_sports; $sportspress_sports['cricket'] = array( - 'name' => 'Cricket', + 'name' => __( 'Cricket', 'sportspress' ), 'posts' => array( // Table Columns 'sp_column' => array( diff --git a/admin/presets/football.php b/admin/presets/football.php index e95012e0..e87376be 100644 --- a/admin/presets/football.php +++ b/admin/presets/football.php @@ -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( diff --git a/admin/presets/footy.php b/admin/presets/footy.php index 35bbc403..5404469c 100644 --- a/admin/presets/footy.php +++ b/admin/presets/footy.php @@ -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( diff --git a/admin/presets/gaming.php b/admin/presets/gaming.php index 7e387f1e..0cb91539 100644 --- a/admin/presets/gaming.php +++ b/admin/presets/gaming.php @@ -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( diff --git a/admin/presets/golf.php b/admin/presets/golf.php index 79080163..c036a59f 100644 --- a/admin/presets/golf.php +++ b/admin/presets/golf.php @@ -2,7 +2,7 @@ global $sportspress_sports; $sportspress_sports['golf'] = array( - 'name' => 'Golf', + 'name' => __( 'Golf', 'sportspress' ), 'posts' => array( // Table Columns 'sp_column' => array( diff --git a/admin/presets/hockey.php b/admin/presets/hockey.php index fb8772e6..57c85e69 100644 --- a/admin/presets/hockey.php +++ b/admin/presets/hockey.php @@ -2,7 +2,7 @@ global $sportspress_sports; $sportspress_sports['hockey'] = array( - 'name' => 'Hockey', + 'name' => __( 'Hockey', 'sportspress' ), 'posts' => array( // Table Columns 'sp_column' => array( diff --git a/admin/presets/racing.php b/admin/presets/racing.php index bb6c3706..ef9438d9 100644 --- a/admin/presets/racing.php +++ b/admin/presets/racing.php @@ -2,7 +2,7 @@ global $sportspress_sports; $sportspress_sports['racing'] = array( - 'name' => 'Racing', + 'name' => __( 'Racing', 'sportspress' ), 'posts' => array( // Table Columns 'sp_column' => array( diff --git a/admin/presets/rugby.php b/admin/presets/rugby.php index 2aa6779c..95f6ee29 100644 --- a/admin/presets/rugby.php +++ b/admin/presets/rugby.php @@ -2,7 +2,7 @@ global $sportspress_sports; $sportspress_sports['rugby'] = array( - 'name' => 'Rugby', + 'name' => __( 'Rugby', 'sportspress' ), 'posts' => array( // Table Columns 'sp_column' => array( diff --git a/admin/presets/soccer.php b/admin/presets/soccer.php index 9ed167b3..21c76be8 100644 --- a/admin/presets/soccer.php +++ b/admin/presets/soccer.php @@ -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( diff --git a/admin/settings/settings.php b/admin/settings/settings.php index cf35bbe7..fbb8331c 100644 --- a/admin/settings/settings.php +++ b/admin/settings/settings.php @@ -38,7 +38,7 @@ function sportspress_sport_callback() { ?> ' . '' . ''; - $i = 1; + $i = 0; foreach( $data as $team_id => $row ): - $output .= '
';
+
+ $common = array(
+ __( 'Number', 'sportspress' ) => $number,
+ __( 'Nationality', 'sportspress' ) => $flag_image . ' ' . sportspress_array_value( $sportspress_countries, $nationality, '—' ),
+ );
+
+ $data = array_merge( $common, $metrics );
+
+ $output = '| ' . $label . ' | ' . $value . ' |
|---|
| ' . $label . ' | '; @@ -132,11 +177,11 @@ if ( !function_exists( 'sportspress_player_statistics' ) ) { $output .= '
|---|
| ' . sportspress_array_value( $row, $key, '—' ) . ' | '; @@ -144,6 +189,8 @@ if ( !function_exists( 'sportspress_player_statistics' ) ) { $output .= '