Display metrics and statistics on player page
This commit is contained in:
14
admin/globals/continents.php
Normal file
14
admin/globals/continents.php
Normal 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
206
admin/globals/countries.php
Normal 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
23
admin/globals/sports.php
Normal 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' );
|
||||
@@ -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;
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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() ) );
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
global $sportspress_sports;
|
||||
|
||||
$sportspress_sports['baseball'] = array(
|
||||
'name' => 'Baseball',
|
||||
'name' => __( 'Baseball', 'sportspress' ),
|
||||
'posts' => array(
|
||||
// Columns
|
||||
'sp_column' => array(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
global $sportspress_sports;
|
||||
|
||||
$sportspress_sports['basketball'] = array(
|
||||
'name' => 'Basketball',
|
||||
'name' => __( 'Basketball', 'sportspress' ),
|
||||
'posts' => array(
|
||||
// Table Columns
|
||||
'sp_column' => array(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
global $sportspress_sports;
|
||||
|
||||
$sportspress_sports['cricket'] = array(
|
||||
'name' => 'Cricket',
|
||||
'name' => __( 'Cricket', 'sportspress' ),
|
||||
'posts' => array(
|
||||
// Table Columns
|
||||
'sp_column' => array(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
global $sportspress_sports;
|
||||
|
||||
$sportspress_sports['golf'] = array(
|
||||
'name' => 'Golf',
|
||||
'name' => __( 'Golf', 'sportspress' ),
|
||||
'posts' => array(
|
||||
// Table Columns
|
||||
'sp_column' => array(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
global $sportspress_sports;
|
||||
|
||||
$sportspress_sports['hockey'] = array(
|
||||
'name' => 'Hockey',
|
||||
'name' => __( 'Hockey', 'sportspress' ),
|
||||
'posts' => array(
|
||||
// Table Columns
|
||||
'sp_column' => array(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
global $sportspress_sports;
|
||||
|
||||
$sportspress_sports['racing'] = array(
|
||||
'name' => 'Racing',
|
||||
'name' => __( 'Racing', 'sportspress' ),
|
||||
'posts' => array(
|
||||
// Table Columns
|
||||
'sp_column' => array(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
global $sportspress_sports;
|
||||
|
||||
$sportspress_sports['rugby'] = array(
|
||||
'name' => 'Rugby',
|
||||
'name' => __( 'Rugby', 'sportspress' ),
|
||||
'posts' => array(
|
||||
// Table Columns
|
||||
'sp_column' => array(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user