Merge globals into single file, load options, and add text settings page
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
function sportspress_define_continents_global() {
|
||||
global $sportspress_continents;
|
||||
|
||||
$sportspress_continents = array(
|
||||
__( 'Africa', 'sportspress' ) => 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', 'sportspress' ) => 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', 'sportspress' ) => array('AD','AL','AT','BA','BE','BG','BY','CH','CZ','DE','DK','EE','EN','ES','FI','FR','GB','GR','HR','HU','IE','IS','IT','LI','LT','LU','LV','MC','MD','ME','MK','MT','MW','NB','NL','NO','PL','PT','RO','RS','RU','SE','SF','SI','SK','SM','TR','UA','VA','WA'),
|
||||
__( 'North America', 'sportspress' ) => array('AG','BB','BS','BZ','CA','CR','CU','DM','DO','GD','GT','HN','HT','JM','KN','LC','MX','NI','PA','SV','US','VC'),
|
||||
__( 'Oceania', 'sportspress' ) => array('AU','TL','FJ','FM','ID','KI','MH','NR','NZ','PG','PW','SB','TO','TV','VU','WS'),
|
||||
__( 'South America', 'sportspress' ) => array('AR','BO','BR','CL','CO','EC','GY','PE','PY','SR','TT','UY','VE'),
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'sportspress_define_continents_global' );
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
function sportspress_define_formats_global() {
|
||||
global $sportspress_formats;
|
||||
|
||||
$sportspress_formats = array( 'event' => array(), 'list' => array() );
|
||||
|
||||
$sportspress_formats['event']['league'] = __( 'League', 'sportspress' );
|
||||
$sportspress_formats['event']['friendly'] = __( 'Friendly', 'sportspress' );
|
||||
|
||||
$sportspress_formats['calendar']['calendar'] = __( 'Calendar', 'sportspress' );
|
||||
$sportspress_formats['calendar']['list'] = __( 'List', 'sportspress' );
|
||||
|
||||
$sportspress_formats['list']['list'] = __( 'List', 'sportspress' );
|
||||
$sportspress_formats['list']['gallery'] = __( 'Gallery', 'sportspress' );
|
||||
}
|
||||
add_action( 'init', 'sportspress_define_formats_global', 10 );
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
function sportspress_define_sports_global() {
|
||||
global $sportspress_sports;
|
||||
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/soccer.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/football.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/footy.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/baseball.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/basketball.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/gaming.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/cricket.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/golf.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/handball.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/hockey.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/racing.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/rugby.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/swimming.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/tennis.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/volleyball.php';
|
||||
|
||||
uasort( $sportspress_sports, 'sportspress_sort_sports' );
|
||||
}
|
||||
add_action( 'init', 'sportspress_define_sports_global' );
|
||||
@@ -46,8 +46,8 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
|
||||
break;
|
||||
elseif ( $post_type == 'sp_event' ):
|
||||
$results = get_post_meta( $post_id, 'sp_results', true );
|
||||
$options = get_option( 'sportspress' );
|
||||
$main_result = sportspress_array_value( $options, 'main_result', null );
|
||||
global $sportspress_options;
|
||||
$main_result = sportspress_array_value( $sportspress_options, 'main_result', null );
|
||||
foreach( $teams as $team_id ):
|
||||
if ( ! $team_id ) continue;
|
||||
$team = get_post( $team_id );
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
<?php
|
||||
function sportspress_define_countries_global() {
|
||||
function sportspress_define_globals() {
|
||||
|
||||
// Options
|
||||
global $sportspress_options;
|
||||
|
||||
$sportspress_options = get_option( 'sportspress' );
|
||||
|
||||
// Continents
|
||||
global $sportspress_continents;
|
||||
|
||||
$sportspress_continents = array(
|
||||
__( 'Africa', 'sportspress' ) => 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', 'sportspress' ) => 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', 'sportspress' ) => array('AD','AL','AT','BA','BE','BG','BY','CH','CZ','DE','DK','EE','EN','ES','FI','FR','GB','GR','HR','HU','IE','IS','IT','LI','LT','LU','LV','MC','MD','ME','MK','MT','MW','NB','NL','NO','PL','PT','RO','RS','RU','SE','SF','SI','SK','SM','TR','UA','VA','WA'),
|
||||
__( 'North America', 'sportspress' ) => array('AG','BB','BS','BZ','CA','CR','CU','DM','DO','GD','GT','HN','HT','JM','KN','LC','MX','NI','PA','SV','US','VC'),
|
||||
__( 'Oceania', 'sportspress' ) => array('AU','TL','FJ','FM','ID','KI','MH','NR','NZ','PG','PW','SB','TO','TV','VU','WS'),
|
||||
__( 'South America', 'sportspress' ) => array('AR','BO','BR','CL','CO','EC','GY','PE','PY','SR','TT','UY','VE'),
|
||||
);
|
||||
|
||||
// Countries
|
||||
global $sportspress_countries;
|
||||
|
||||
$sportspress_countries = array(
|
||||
@@ -206,5 +225,40 @@ function sportspress_define_countries_global() {
|
||||
);
|
||||
|
||||
asort( $sportspress_countries );
|
||||
|
||||
// Formats
|
||||
global $sportspress_formats;
|
||||
|
||||
$sportspress_formats = array( 'event' => array(), 'list' => array() );
|
||||
|
||||
$sportspress_formats['event']['league'] = __( 'League', 'sportspress' );
|
||||
$sportspress_formats['event']['friendly'] = __( 'Friendly', 'sportspress' );
|
||||
|
||||
$sportspress_formats['calendar']['calendar'] = __( 'Calendar', 'sportspress' );
|
||||
$sportspress_formats['calendar']['list'] = __( 'List', 'sportspress' );
|
||||
|
||||
$sportspress_formats['list']['list'] = __( 'List', 'sportspress' );
|
||||
$sportspress_formats['list']['gallery'] = __( 'Gallery', 'sportspress' );
|
||||
|
||||
// Sports
|
||||
global $sportspress_sports;
|
||||
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/soccer.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/football.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/footy.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/baseball.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/basketball.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/gaming.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/cricket.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/golf.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/handball.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/hockey.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/racing.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/rugby.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/swimming.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/tennis.php';
|
||||
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/volleyball.php';
|
||||
|
||||
uasort( $sportspress_sports, 'sportspress_sort_sports' );
|
||||
}
|
||||
add_action( 'init', 'sportspress_define_countries_global' );
|
||||
add_action( 'init', 'sportspress_define_globals' );
|
||||
@@ -1,134 +1,136 @@
|
||||
<?php
|
||||
function sportspress_results_callback() {
|
||||
$options = get_option( 'sportspress' );
|
||||
class SportsPressEventSettingsPage {
|
||||
private $options;
|
||||
|
||||
$main_result = sportspress_array_value( $options, 'main_result', 0 );
|
||||
public function __construct() {
|
||||
global $sportspress_options;
|
||||
$this->options =& $sportspress_options;
|
||||
add_action( 'admin_init', array( $this, 'page_init' ), 1 );
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'sp_result',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
);
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<fieldset>
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Primary', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="radio"><input type="radio" id="sportspress_main_result_0" name="sportspress[main_result]" value="0" <?php checked( $main_result, 0 ); ?>></th>
|
||||
<th colspan="2"><label for="sportspress_main_result_0">
|
||||
<?php
|
||||
if ( sizeof( $data ) > 0 ):
|
||||
$default = end( $data );
|
||||
reset( $data );
|
||||
printf( __( 'Default (%s)', 'sportspress' ), $default->post_title );
|
||||
else:
|
||||
_e( 'Default', 'sportspress' );
|
||||
endif;
|
||||
?>
|
||||
</label></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="radio"><input type="radio" id="sportspress_main_result_<?php echo $row->post_name; ?>" name="sportspress[main_result]" value="<?php echo $row->post_name; ?>" <?php checked( $main_result, $row->post_name ); ?>></td>
|
||||
<td class="row-title"><label for="sportspress_main_result_<?php echo $row->post_name; ?>"><?php echo $row->post_title; ?></label></td>
|
||||
<td><?php echo $row->post_name; ?>for / <?php echo $row->post_name; ?>against</td>
|
||||
</tr>
|
||||
<?php $i++; endforeach; ?>
|
||||
</table>
|
||||
<div class="tablenav bottom">
|
||||
<div class="alignleft actions">
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_result' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_result' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
|
||||
function page_init() {
|
||||
register_setting(
|
||||
'sportspress_events',
|
||||
'sportspress',
|
||||
'sportspress_options_validate'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'event',
|
||||
__( 'Event Options', 'sportspress' ),
|
||||
'',
|
||||
'sportspress_events'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'results',
|
||||
__( 'Results', 'sportspress' ),
|
||||
array( $this, 'results_callback' ),
|
||||
'sportspress_events',
|
||||
'event'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'outcomes',
|
||||
__( 'Outcomes', 'sportspress' ),
|
||||
array( $this, 'outcomes_callback' ),
|
||||
'sportspress_events',
|
||||
'event'
|
||||
);
|
||||
}
|
||||
|
||||
function results_callback() {
|
||||
$main_result = sportspress_array_value( $this->options, 'main_result', 0 );
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'sp_result',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
);
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<fieldset>
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Primary', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="radio"><input type="radio" id="sportspress_main_result_0" name="sportspress[main_result]" value="0" <?php checked( $main_result, 0 ); ?>></th>
|
||||
<th colspan="2"><label for="sportspress_main_result_0">
|
||||
<?php
|
||||
if ( sizeof( $data ) > 0 ):
|
||||
$default = end( $data );
|
||||
reset( $data );
|
||||
printf( __( 'Default (%s)', 'sportspress' ), $default->post_title );
|
||||
else:
|
||||
_e( 'Default', 'sportspress' );
|
||||
endif;
|
||||
?>
|
||||
</label></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="radio"><input type="radio" id="sportspress_main_result_<?php echo $row->post_name; ?>" name="sportspress[main_result]" value="<?php echo $row->post_name; ?>" <?php checked( $main_result, $row->post_name ); ?>></td>
|
||||
<td class="row-title"><label for="sportspress_main_result_<?php echo $row->post_name; ?>"><?php echo $row->post_title; ?></label></td>
|
||||
<td><?php echo $row->post_name; ?>for / <?php echo $row->post_name; ?>against</td>
|
||||
</tr>
|
||||
<?php $i++; endforeach; ?>
|
||||
</table>
|
||||
<div class="tablenav bottom">
|
||||
<div class="alignleft actions">
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_result' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_result' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
|
||||
</div>
|
||||
<br class="clear">
|
||||
</div>
|
||||
<br class="clear">
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
||||
function sportspress_outcomes_callback() {
|
||||
$options = get_option( 'sportspress' );
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'sp_outcome',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
);
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<fieldset>
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||
<td><?php echo $row->post_name; ?></td>
|
||||
</tr>
|
||||
<?php $i++; endforeach; ?>
|
||||
</table>
|
||||
<div class="tablenav bottom">
|
||||
<div class="alignleft actions">
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_outcome' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_outcome' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
|
||||
function outcomes_callback() {
|
||||
$args = array(
|
||||
'post_type' => 'sp_outcome',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
);
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<fieldset>
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||
<td><?php echo $row->post_name; ?></td>
|
||||
</tr>
|
||||
<?php $i++; endforeach; ?>
|
||||
</table>
|
||||
<div class="tablenav bottom">
|
||||
<div class="alignleft actions">
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_outcome' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_outcome' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
|
||||
</div>
|
||||
<br class="clear">
|
||||
</div>
|
||||
<br class="clear">
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
function sportspress_event_settings_init() {
|
||||
register_setting(
|
||||
'sportspress_events',
|
||||
'sportspress',
|
||||
'sportspress_options_validate'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'events',
|
||||
'',
|
||||
'',
|
||||
'sportspress_events'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'results',
|
||||
__( 'Results', 'sportspress' ),
|
||||
'sportspress_results_callback',
|
||||
'sportspress_events',
|
||||
'events'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'outcomes',
|
||||
__( 'Outcomes', 'sportspress' ),
|
||||
'sportspress_outcomes_callback',
|
||||
'sportspress_events',
|
||||
'events'
|
||||
);
|
||||
}
|
||||
add_action( 'admin_init', 'sportspress_event_settings_init', 1 );
|
||||
if ( is_admin() )
|
||||
$sportspress_event_settings_page = new SportsPressEventSettingsPage();
|
||||
|
||||
@@ -1,44 +1,55 @@
|
||||
<?php
|
||||
function sportspress_sport_callback() {
|
||||
global $sportspress_sports;
|
||||
$options = get_option( 'sportspress' );
|
||||
class SportsPressGeneralSettingsPage {
|
||||
private $options;
|
||||
|
||||
$selected = sportspress_array_value( $options, 'sport', null );
|
||||
$custom_sport_name = sportspress_array_value( $options, 'custom_sport_name', null );
|
||||
?>
|
||||
<fieldset>
|
||||
<select id="sportspress_sport" name="sportspress[sport]">
|
||||
<option value><?php _e( '— Select —', 'sportspress' ); ?></option>
|
||||
<?php foreach( $sportspress_sports as $slug => $sport ): ?>
|
||||
<option value="<?php echo $slug; ?>" <?php selected( $selected, $slug ); ?>><?php echo $sport['name']; ?></option>
|
||||
<?php endforeach; ?>
|
||||
<option value="custom" <?php selected( $selected, 'custom' ); ?>><?php _e( 'Custom', 'sportspress' ); ?></option>
|
||||
</select>
|
||||
<input id="sportspress_custom_sport_name" name="sportspress[custom_sport_name]" type="text" placeholder="<?php _e( 'Sport', 'sportspress' ); ?>" value="<?php echo $custom_sport_name; ?>"<?php if ( $selected != 'custom' ): ?> class="hidden"<?php endif; ?>>
|
||||
</fieldset>
|
||||
<?php
|
||||
public function __construct() {
|
||||
global $sportspress_options;
|
||||
$this->options =& $sportspress_options;
|
||||
add_action( 'admin_init', array( $this, 'page_init' ), 1 );
|
||||
}
|
||||
|
||||
function page_init() {
|
||||
register_setting(
|
||||
'sportspress_general',
|
||||
'sportspress',
|
||||
'sportspress_options_validate'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'general',
|
||||
__( 'General Options', 'sportspress' ),
|
||||
'',
|
||||
'sportspress_general'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'sport',
|
||||
__( 'Sport', 'sportspress' ),
|
||||
array( $this, 'sport_callback' ),
|
||||
'sportspress_general',
|
||||
'general'
|
||||
);
|
||||
}
|
||||
|
||||
function sport_callback() {
|
||||
global $sportspress_options, $sportspress_sports;
|
||||
|
||||
$selected = sportspress_array_value( $sportspress_options, 'sport', null );
|
||||
$custom_sport_name = sportspress_array_value( $sportspress_options, 'custom_sport_name', null );
|
||||
?>
|
||||
<fieldset>
|
||||
<select id="sportspress_sport" name="sportspress[sport]">
|
||||
<option value><?php _e( '— Select —', 'sportspress' ); ?></option>
|
||||
<?php foreach( $sportspress_sports as $slug => $sport ): ?>
|
||||
<option value="<?php echo $slug; ?>" <?php selected( $selected, $slug ); ?>><?php echo $sport['name']; ?></option>
|
||||
<?php endforeach; ?>
|
||||
<option value="custom" <?php selected( $selected, 'custom' ); ?>><?php _e( 'Custom', 'sportspress' ); ?></option>
|
||||
</select>
|
||||
<input id="sportspress_custom_sport_name" name="sportspress[custom_sport_name]" type="text" placeholder="<?php _e( 'Sport', 'sportspress' ); ?>" value="<?php echo $custom_sport_name; ?>"<?php if ( $selected != 'custom' ): ?> class="hidden"<?php endif; ?>>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
function sportspress_general_settings_init() {
|
||||
register_setting(
|
||||
'sportspress_general',
|
||||
'sportspress',
|
||||
'sportspress_options_validate'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'general',
|
||||
'',
|
||||
'',
|
||||
'sportspress_general'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'sport',
|
||||
__( 'Sport', 'sportspress' ),
|
||||
'sportspress_sport_callback',
|
||||
'sportspress_general',
|
||||
'general'
|
||||
);
|
||||
}
|
||||
add_action( 'admin_init', 'sportspress_general_settings_init', 1 );
|
||||
if ( is_admin() )
|
||||
$sportspress_event_settings_page = new SportsPressGeneralSettingsPage();
|
||||
|
||||
@@ -1,145 +1,190 @@
|
||||
<?php
|
||||
function sportspress_player_settings_details_callback() {
|
||||
$options = get_option( 'sportspress' );
|
||||
class SportsPressPlayerSettingsPage {
|
||||
private $options;
|
||||
|
||||
$show_nationality_flag = sportspress_array_value( $options, 'player_show_nationality_flag', true );
|
||||
?>
|
||||
<fieldset>
|
||||
<label for="sportspress_player_show_nationality_flag">
|
||||
<input id="sportspress_player_show_nationality_flag_default" name="sportspress[player_show_nationality_flag]" type="hidden" value="0">
|
||||
<input id="sportspress_player_show_nationality_flag" name="sportspress[player_show_nationality_flag]" type="checkbox" value="1" <?php checked( $show_nationality_flag ); ?>>
|
||||
<?php _e( 'Display national flags', 'sportspress' ); ?>
|
||||
</label>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
public function __construct() {
|
||||
global $sportspress_options;
|
||||
$this->options =& $sportspress_options;
|
||||
add_action( 'admin_init', array( $this, 'page_init' ), 1 );
|
||||
}
|
||||
|
||||
function sportspress_player_settings_metrics_callback() {
|
||||
$args = array(
|
||||
'post_type' => 'sp_metric',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
function page_init() {
|
||||
register_setting(
|
||||
'sportspress_players',
|
||||
'sportspress',
|
||||
'sportspress_options_validate'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'player',
|
||||
__( 'Player Options', 'sportspress' ),
|
||||
'',
|
||||
'sportspress_players'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'list',
|
||||
__( 'Player List Options', 'sportspress' ),
|
||||
'',
|
||||
'sportspress_players'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'nationality',
|
||||
__( 'Nationality', 'sportspress' ),
|
||||
array( $this, 'nationality_callback' ),
|
||||
'sportspress_players',
|
||||
'player'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'list',
|
||||
__( 'List', 'sportspress' ),
|
||||
array( $this, 'list_callback' ),
|
||||
'sportspress_players',
|
||||
'list'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'gallery',
|
||||
__( 'Gallery', 'sportspress' ),
|
||||
array( $this, 'gallery_callback' ),
|
||||
'sportspress_players',
|
||||
'list'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'metrics',
|
||||
__( 'Metrics', 'sportspress' ),
|
||||
array( $this, 'metrics_callback' ),
|
||||
'sportspress_players',
|
||||
'list'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'statistics',
|
||||
__( 'Statistics', 'sportspress' ),
|
||||
array( $this, 'statistics_callback' ),
|
||||
'sportspress_players',
|
||||
'list'
|
||||
);
|
||||
}
|
||||
|
||||
function nationality_callback() {
|
||||
$show_nationality_flag = sportspress_array_value( $this->options, 'player_show_nationality_flag', true );
|
||||
?>
|
||||
<fieldset>
|
||||
<label for="sportspress_player_show_nationality_flag">
|
||||
<input id="sportspress_player_show_nationality_flag_default" name="sportspress[player_show_nationality_flag]" type="hidden" value="0">
|
||||
<input id="sportspress_player_show_nationality_flag" name="sportspress[player_show_nationality_flag]" type="checkbox" value="1" <?php checked( $show_nationality_flag ); ?>>
|
||||
<?php _e( 'Display national flags', 'sportspress' ); ?>
|
||||
</label>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
||||
function list_callback() {
|
||||
$link_posts = sportspress_array_value( $this->options, 'player_list_link_posts', true );
|
||||
?>
|
||||
<fieldset>
|
||||
<label for="sportspress_player_list_link_posts">
|
||||
<input id="sportspress_player_list_link_posts_default" name="sportspress[player_list_link_posts]" type="hidden" value="0">
|
||||
<input id="sportspress_player_list_link_posts" name="sportspress[player_list_link_posts]" type="checkbox" value="1" <?php checked( $link_posts ); ?>>
|
||||
<?php _e( 'Display players as links', 'sportspress' ); ?>
|
||||
</label>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
||||
function gallery_callback() {
|
||||
$show_names_on_hover = sportspress_array_value( $this->options, 'player_gallery_show_names_on_hover', true );
|
||||
?>
|
||||
<fieldset>
|
||||
<label for="sportspress_player_gallery_show_names_on_hover">
|
||||
<input id="sportspress_player_gallery_show_names_on_hover_default" name="sportspress[player_gallery_show_names_on_hover]" type="hidden" value="0">
|
||||
<input id="sportspress_player_gallery_show_names_on_hover" name="sportspress[player_gallery_show_names_on_hover]" type="checkbox" value="1" <?php checked( $show_names_on_hover ); ?>>
|
||||
<?php _e( 'Display player names on hover', 'sportspress' ); ?>
|
||||
</label>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
||||
function metrics_callback() {
|
||||
$args = array(
|
||||
'post_type' => 'sp_metric',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
);
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<fieldset>
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
|
||||
<th scope="col"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<?php $i++; endforeach; ?>
|
||||
</table>
|
||||
<div class="tablenav bottom">
|
||||
<div class="alignleft actions">
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_metric' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_metric' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
|
||||
</div>
|
||||
<br class="clear">
|
||||
</div>
|
||||
</fieldset>
|
||||
<?
|
||||
}
|
||||
|
||||
function statistics_callback() {
|
||||
$args = array(
|
||||
'post_type' => 'sp_statistic',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
);
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<fieldset>
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
|
||||
<th scope="col"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
|
||||
<th scope="col"> </th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<?php $i++; endforeach; ?>
|
||||
</table>
|
||||
<div class="tablenav bottom">
|
||||
<div class="alignleft actions">
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_metric' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_metric' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
|
||||
);
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<fieldset>
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Calculate', 'sportspress' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?></td>
|
||||
<td><?php echo sportspress_get_post_calculate( $row->ID ); ?></td>
|
||||
</tr>
|
||||
<?php $i++; endforeach; ?>
|
||||
</table>
|
||||
<div class="tablenav bottom">
|
||||
<div class="alignleft actions">
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_statistic' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_statistic' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
|
||||
</div>
|
||||
<br class="clear">
|
||||
</div>
|
||||
<br class="clear">
|
||||
</div>
|
||||
</fieldset>
|
||||
<?
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
function sportspress_player_settings_statistics_callback() {
|
||||
$args = array(
|
||||
'post_type' => 'sp_statistic',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
);
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<fieldset>
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Calculate', 'sportspress' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Calculate', 'sportspress' ); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?></td>
|
||||
<td><?php echo sportspress_get_post_calculate( $row->ID ); ?></td>
|
||||
</tr>
|
||||
<?php $i++; endforeach; ?>
|
||||
</table>
|
||||
<div class="tablenav bottom">
|
||||
<div class="alignleft actions">
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_statistic' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_statistic' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
|
||||
</div>
|
||||
<br class="clear">
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
||||
function sportspress_player_settings_init() {
|
||||
register_setting(
|
||||
'sportspress_players',
|
||||
'sportspress',
|
||||
'sportspress_options_validate'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'players',
|
||||
'',
|
||||
'',
|
||||
'sportspress_players'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'details',
|
||||
__( 'Details', 'sportspress' ),
|
||||
'sportspress_player_settings_details_callback',
|
||||
'sportspress_players',
|
||||
'players'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'metrics',
|
||||
__( 'Metrics', 'sportspress' ),
|
||||
'sportspress_player_settings_metrics_callback',
|
||||
'sportspress_players',
|
||||
'players'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'statistics',
|
||||
__( 'Statistics', 'sportspress' ),
|
||||
'sportspress_player_settings_statistics_callback',
|
||||
'sportspress_players',
|
||||
'players'
|
||||
);
|
||||
}
|
||||
add_action( 'admin_init', 'sportspress_player_settings_init', 1 );
|
||||
if ( is_admin() )
|
||||
$sportspress_event_settings_page = new SportsPressPlayerSettingsPage();
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
<?php
|
||||
function sportspress_table_settings_teams_callback() {
|
||||
$options = get_option( 'sportspress' );
|
||||
|
||||
$show_team_logo = sportspress_array_value( $options, 'league_table_show_team_logo', false );
|
||||
?>
|
||||
<fieldset>
|
||||
<label for="sportspress_league_table_show_team_logo">
|
||||
<input id="sportspress_league_table_show_team_logo_default" name="sportspress[league_table_show_team_logo]" type="hidden" value="0">
|
||||
<input id="sportspress_league_table_show_team_logo" name="sportspress[league_table_show_team_logo]" type="checkbox" value="1" <?php checked( $show_team_logo ); ?>>
|
||||
<?php _e( 'Display logos', 'sportspress' ); ?>
|
||||
</label>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
||||
function sportspress_table_settings_columns_callback() {
|
||||
$args = array(
|
||||
'post_type' => 'sp_column',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
);
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<fieldset>
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Rounding', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Sort Order', 'sportspress' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Rounding', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Sort Order', 'sportspress' ); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||
<td><?php echo $row->post_name; ?></td>
|
||||
<td><?php echo sportspress_get_post_equation( $row->ID, $row->post_name ); ?></td>
|
||||
<td><?php echo sportspress_get_post_precision( $row->ID ); ?></td>
|
||||
<td><?php echo sportspress_get_post_order( $row->ID ); ?></td>
|
||||
</tr>
|
||||
<?php $i++; endforeach; ?>
|
||||
</table>
|
||||
<div class="tablenav bottom">
|
||||
<div class="alignleft actions">
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_column' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_column' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
|
||||
</div>
|
||||
<br class="clear">
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
||||
function sportspress_table_settings_init() {
|
||||
register_setting(
|
||||
'sportspress_tables',
|
||||
'sportspress',
|
||||
'sportspress_options_validate'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'tables',
|
||||
'',
|
||||
'',
|
||||
'sportspress_tables'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'teams',
|
||||
__( 'Teams', 'sportspress' ),
|
||||
'sportspress_table_settings_teams_callback',
|
||||
'sportspress_tables',
|
||||
'tables'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'columns',
|
||||
__( 'Columns', 'sportspress' ),
|
||||
'sportspress_table_settings_columns_callback',
|
||||
'sportspress_tables',
|
||||
'tables'
|
||||
);
|
||||
}
|
||||
add_action( 'admin_init', 'sportspress_table_settings_init', 1 );
|
||||
114
admin/settings/options-team.php
Normal file
114
admin/settings/options-team.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
class SportsPressTeamSettingsPage {
|
||||
private $options;
|
||||
|
||||
public function __construct() {
|
||||
global $sportspress_options;
|
||||
$this->options =& $sportspress_options;
|
||||
add_action( 'admin_init', array( $this, 'page_init' ), 1 );
|
||||
}
|
||||
|
||||
function page_init() {
|
||||
register_setting(
|
||||
'sportspress_teams',
|
||||
'sportspress',
|
||||
'sportspress_options_validate'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'team',
|
||||
__( 'Team Options', 'sportspress' ),
|
||||
'',
|
||||
'sportspress_teams'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'table',
|
||||
__( 'League Table Options', 'sportspress' ),
|
||||
'',
|
||||
'sportspress_teams'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'table',
|
||||
__( 'Teams', 'sportspress' ),
|
||||
array( $this, 'tables_callback' ),
|
||||
'sportspress_teams',
|
||||
'table'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'columns',
|
||||
__( 'Columns', 'sportspress' ),
|
||||
array( $this, 'columns_callback' ),
|
||||
'sportspress_teams',
|
||||
'table'
|
||||
);
|
||||
}
|
||||
|
||||
function tables_callback() {
|
||||
$show_team_logo = sportspress_array_value( $this->options, 'league_table_show_team_logo', false );
|
||||
$link_posts = sportspress_array_value( $this->options, 'league_table_link_posts', false );
|
||||
?>
|
||||
<fieldset>
|
||||
<label for="sportspress_league_table_show_team_logo">
|
||||
<input id="sportspress_league_table_show_team_logo_default" name="sportspress[league_table_show_team_logo]" type="hidden" value="0">
|
||||
<input id="sportspress_league_table_show_team_logo" name="sportspress[league_table_show_team_logo]" type="checkbox" value="1" <?php checked( $show_team_logo ); ?>>
|
||||
<?php _e( 'Display logos', 'sportspress' ); ?>
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="sportspress_league_table_link_posts">
|
||||
<input id="sportspress_league_table_link_posts_default" name="sportspress[league_table_link_posts]" type="hidden" value="0">
|
||||
<input id="sportspress_league_table_link_posts" name="sportspress[league_table_link_posts]" type="checkbox" value="1" <?php checked( $link_posts ); ?>>
|
||||
<?php _e( 'Display teams as links', 'sportspress' ); ?>
|
||||
</label>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
||||
function columns_callback() {
|
||||
$args = array(
|
||||
'post_type' => 'sp_column',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC'
|
||||
);
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<fieldset>
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Rounding', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Sort Order', 'sportspress' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||
<td><?php echo $row->post_name; ?></td>
|
||||
<td><?php echo sportspress_get_post_equation( $row->ID, $row->post_name ); ?></td>
|
||||
<td><?php echo sportspress_get_post_precision( $row->ID ); ?></td>
|
||||
<td><?php echo sportspress_get_post_order( $row->ID ); ?></td>
|
||||
</tr>
|
||||
<?php $i++; endforeach; ?>
|
||||
</table>
|
||||
<div class="tablenav bottom">
|
||||
<div class="alignleft actions">
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_column' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_column' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
|
||||
</div>
|
||||
<br class="clear">
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_admin() )
|
||||
$sportspress_event_settings_page = new SportsPressTeamSettingsPage();
|
||||
55
admin/settings/options-text.php
Normal file
55
admin/settings/options-text.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
class SportsPressTextSettingsPage {
|
||||
public function __construct() {
|
||||
global $sportspress_options;
|
||||
$this->options =& $sportspress_options;
|
||||
$this->strings = array(
|
||||
array( 'league', __( 'League', 'sportspress' ) ),
|
||||
array( 'season', __( 'Season', 'sportspress' ) ),
|
||||
array( 'venue', __( 'Venue', 'sportspress' ) ),
|
||||
array( 'rank', __( 'Rank', 'sportspress' ) ),
|
||||
array( 'hash', '#' ),
|
||||
array( 'player', __( 'Player', 'sportspress' ) ),
|
||||
array( 'team', __( 'Team', 'sportspress' ) ),
|
||||
array( 'pos', __( 'Pos', 'sportspress' ) ),
|
||||
array( 'current_team', __( 'Current Team', 'sportspress' ) ),
|
||||
);
|
||||
add_action( 'admin_init', array( $this, 'page_init' ), 1 );
|
||||
}
|
||||
|
||||
function page_init() {
|
||||
register_setting(
|
||||
'sportspress_text',
|
||||
'sportspress',
|
||||
'sportspress_options_validate'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'string',
|
||||
__( 'Strings', 'sportspress' ),
|
||||
'',
|
||||
'sportspress_text'
|
||||
);
|
||||
|
||||
foreach ( $this->strings as $string ):
|
||||
add_settings_field(
|
||||
$string[0],
|
||||
$string[1],
|
||||
array( $this, 'string_callback' ),
|
||||
'sportspress_text',
|
||||
'string'
|
||||
);
|
||||
endforeach;
|
||||
}
|
||||
|
||||
public function string_callback( $test ) {
|
||||
$string = array_shift( $this->strings );
|
||||
$key = $string[0];
|
||||
$placeholder = $string[1];
|
||||
$text = sportspress_array_value( $this->options, $key . '_string', null );
|
||||
?><fieldset><input id="sportspress_<?php echo $key; ?>_string" name="sportspress[<?php echo $key; ?>_string]" type="text" value="<?php echo $text; ?>" placeholder="<?php echo $placeholder; ?>"></fieldset><?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_admin() )
|
||||
$sportspress_text_settings_page = new SportsPressTextSettingsPage();
|
||||
@@ -7,35 +7,37 @@ function sportspress_options() {
|
||||
<div class="wrap">
|
||||
|
||||
<h2 class="nav-tab-wrapper">
|
||||
<a href="<?php echo remove_query_arg( 'tab' ); ?>" class="nav-tab<?php echo $active_tab == 'general' ? ' nav-tab-active' : ''; ?>"><?php _e( 'General', 'sportspress' ); ?></a>
|
||||
<a href="<?php echo add_query_arg( 'tab', 'events' ); ?>" class="nav-tab<?php echo $active_tab == 'events' ? ' nav-tab-active' : ''; ?>"><?php _e( 'Events', 'sportspress' ); ?></a>
|
||||
<a href="<?php echo add_query_arg( 'tab', 'tables' ); ?>" class="nav-tab<?php echo $active_tab == 'tables' ? ' nav-tab-active' : ''; ?>"><?php _e( 'League Tables', 'sportspress' ); ?></a>
|
||||
<a href="<?php echo add_query_arg( 'tab', 'players' ); ?>" class="nav-tab<?php echo $active_tab == 'players' ? ' nav-tab-active' : ''; ?>"><?php _e( 'Players', 'sportspress' ); ?></a>
|
||||
<a href="<?php echo remove_query_arg( 'tab' ); ?>" class="nav-tab<?php echo $active_tab == 'general' ? ' nav-tab-active' : ''; ?>"><?php _e( 'SportsPress', 'sportspress' ); ?></a>
|
||||
<a href="<?php echo add_query_arg( 'tab', 'events' ); ?>" class="nav-tab<?php echo $active_tab == 'events' ? ' nav-tab-active' : ''; ?>"><?php _e( 'Schedule', 'sportspress' ); ?></a>
|
||||
<a href="<?php echo add_query_arg( 'tab', 'teams' ); ?>" class="nav-tab<?php echo $active_tab == 'teams' ? ' nav-tab-active' : ''; ?>"><?php _e( 'Teams', 'sportspress' ); ?></a>
|
||||
<a href="<?php echo add_query_arg( 'tab', 'players' ); ?>" class="nav-tab<?php echo $active_tab == 'players' ? ' nav-tab-active' : ''; ?>"><?php _e( 'Roster', 'sportspress' ); ?></a>
|
||||
<a href="<?php echo add_query_arg( 'tab', 'text' ); ?>" class="nav-tab<?php echo $active_tab == 'text' ? ' nav-tab-active' : ''; ?>"><?php _e( 'Text', 'sportspress' ); ?></a>
|
||||
</h2>
|
||||
|
||||
<form method="post" action="options.php">
|
||||
<?php
|
||||
switch ( $active_tab ):
|
||||
case 'events':
|
||||
?><h3 class="title"><?php _e( 'Event Options', 'sportspress' ); ?></h3><?php
|
||||
settings_fields( 'sportspress_events' );
|
||||
do_settings_sections( 'sportspress_events' );
|
||||
submit_button();
|
||||
break;
|
||||
case 'tables':
|
||||
?><h3 class="title"><?php _e( 'League Table Options', 'sportspress' ); ?></h3><?php
|
||||
settings_fields( 'sportspress_tables' );
|
||||
do_settings_sections( 'sportspress_tables' );
|
||||
case 'teams':
|
||||
settings_fields( 'sportspress_teams' );
|
||||
do_settings_sections( 'sportspress_teams' );
|
||||
submit_button();
|
||||
break;
|
||||
case 'players':
|
||||
?><h3 class="title"><?php _e( 'Player Options', 'sportspress' ); ?></h3><?php
|
||||
settings_fields( 'sportspress_players' );
|
||||
do_settings_sections( 'sportspress_players' );
|
||||
submit_button();
|
||||
break;
|
||||
case 'text':
|
||||
settings_fields( 'sportspress_text' );
|
||||
do_settings_sections( 'sportspress_text' );
|
||||
submit_button();
|
||||
break;
|
||||
default:
|
||||
?><h3 class="title"><?php _e( 'General Options', 'sportspress' ); ?></h3><?php
|
||||
settings_fields( 'sportspress_general' );
|
||||
do_settings_sections( 'sportspress_general' );
|
||||
submit_button();
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<?php
|
||||
if ( !function_exists( 'sportspress_countdown' ) ) {
|
||||
function sportspress_countdown( $args = array() ) {
|
||||
function sportspress_countdown( $id = null, $args = array() ) {
|
||||
|
||||
$id = sportspress_array_value( $args, 'event', null );
|
||||
$show_league = sportspress_array_value( $args, 'show_league', null );
|
||||
|
||||
if ( $id ):
|
||||
@@ -35,7 +34,7 @@ if ( !function_exists( 'sportspress_countdown' ) ) {
|
||||
$interval = date_diff( $now, $date );
|
||||
|
||||
$output .= '<p class="countdown sp-countdown"><time datetime="' . $post->post_date . '" data-countdown="' . str_replace( '-', '/', $post->post_date ) . '">' .
|
||||
'<span>' . sprintf( '%02s', ( $interval->invert ? 0 : $interval->d ) ) . ' <small>' . __( 'days', 'sportspress' ) . '</small></span> ' .
|
||||
'<span>' . sprintf( '%02s', ( $interval->invert ? 0 : $interval->days ) ) . ' <small>' . __( 'days', 'sportspress' ) . '</small></span> ' .
|
||||
'<span>' . sprintf( '%02s', ( $interval->invert ? 0 : $interval->h ) ) . ' <small>' . __( 'hrs', 'sportspress' ) . '</small></span> ' .
|
||||
'<span>' . sprintf( '%02s', ( $interval->invert ? 0 : $interval->i ) ) . ' <small>' . __( 'mins', 'sportspress' ) . '</small></span> ' .
|
||||
'<span>' . sprintf( '%02s', ( $interval->invert ? 0 : $interval->s ) ) . ' <small>' . __( 'secs', 'sportspress' ) . '</small></span>' .
|
||||
@@ -50,3 +49,17 @@ if ( !function_exists( 'sportspress_countdown' ) ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function sportspress_countdown_shortcode( $atts ) {
|
||||
if ( isset( $atts['id'] ) ):
|
||||
$id = $atts['id'];
|
||||
unset( $atts['id'] );
|
||||
elseif( isset( $atts[0] ) ):
|
||||
$id = $atts[0];
|
||||
unset( $atts[0] );
|
||||
else:
|
||||
$id = null;
|
||||
endif;
|
||||
return sportspress_countdown( $id, $atts );
|
||||
}
|
||||
add_shortcode('countdown', 'sportspress_countdown_shortcode');
|
||||
|
||||
@@ -203,3 +203,18 @@ if ( !function_exists( 'sportspress_events_calendar' ) ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function sportspress_events_calendar_shortcode( $atts ) {
|
||||
if ( isset( $atts['id'] ) ):
|
||||
$id = $atts['id'];
|
||||
unset( $atts['id'] );
|
||||
elseif( isset( $atts[0] ) ):
|
||||
$id = $atts[0];
|
||||
unset( $atts[0] );
|
||||
else:
|
||||
$id = null;
|
||||
endif;
|
||||
$initial = isset( $atts['initial'] ) ? $atts['initial'] : true;
|
||||
return sportspress_events_calendar( $id, $initial, $atts );
|
||||
}
|
||||
add_shortcode('events-calendar', 'sportspress_events_calendar_shortcode');
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
if ( !function_exists( 'sportspress_events_list' ) ) {
|
||||
function sportspress_events_list( $id = null, $args = '' ) {
|
||||
|
||||
$options = get_option( 'sportspress' );
|
||||
$main_result = sportspress_array_value( $options, 'main_result', null );
|
||||
global $sportspress_options;
|
||||
$main_result = sportspress_array_value( $sportspress_options, 'main_result', null );
|
||||
|
||||
$defaults = array(
|
||||
'show_all_events_link' => false,
|
||||
@@ -125,3 +125,17 @@ if ( !function_exists( 'sportspress_events_list' ) ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function sportspress_events_list_shortcode( $atts ) {
|
||||
if ( isset( $atts['id'] ) ):
|
||||
$id = $atts['id'];
|
||||
unset( $atts['id'] );
|
||||
elseif( isset( $atts[0] ) ):
|
||||
$id = $atts[0];
|
||||
unset( $atts[0] );
|
||||
else:
|
||||
$id = null;
|
||||
endif;
|
||||
return sportspress_events_list( $id, $atts );
|
||||
}
|
||||
add_shortcode('events-list', 'sportspress_events_list_shortcode');
|
||||
|
||||
@@ -2,16 +2,17 @@
|
||||
if ( !function_exists( 'sportspress_league_table' ) ) {
|
||||
function sportspress_league_table( $id = null, $args = '' ) {
|
||||
|
||||
if ( ! $id )
|
||||
if ( ! $id || ! is_numeric( $id ) )
|
||||
$id = get_the_ID();
|
||||
|
||||
$options = get_option( 'sportspress' );
|
||||
global $sportspress_options;
|
||||
|
||||
$defaults = array(
|
||||
'number' => -1,
|
||||
'columns' => null,
|
||||
'show_full_table_link' => false,
|
||||
'show_team_logo' => sportspress_array_value( $options, 'league_table_show_team_logo', 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 ),
|
||||
);
|
||||
|
||||
$r = wp_parse_args( $args, $defaults );
|
||||
@@ -29,6 +30,9 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
|
||||
|
||||
$columns = sportspress_array_value( $r, 'columns', null );
|
||||
|
||||
if ( ! is_array( $columns ) )
|
||||
$columns = explode( ',', $columns );
|
||||
|
||||
$output .= '<th class="data-number">' . __( 'Pos', 'sportspress' ) . '</th>';
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
@@ -58,6 +62,11 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
|
||||
if ( $r['show_team_logo'] )
|
||||
$name = get_the_post_thumbnail( $team_id, 'sportspress-fit-icon' ) . ' ' . $name;
|
||||
|
||||
if ( $r['link_posts'] ):
|
||||
$permalink = get_post_permalink( $team_id );
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
endif;
|
||||
|
||||
$output .= '<td class="data-name">' . $name . '</td>';
|
||||
|
||||
foreach( $labels as $key => $value ):
|
||||
@@ -84,3 +93,17 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function sportspress_league_table_shortcode( $atts ) {
|
||||
if ( isset( $atts['id'] ) ):
|
||||
$id = $atts['id'];
|
||||
unset( $atts['id'] );
|
||||
elseif( isset( $atts[0] ) ):
|
||||
$id = $atts[0];
|
||||
unset( $atts[0] );
|
||||
else:
|
||||
$id = null;
|
||||
endif;
|
||||
return sportspress_league_table( $id, $atts );
|
||||
}
|
||||
add_shortcode('league-table', 'sportspress_league_table_shortcode');
|
||||
|
||||
@@ -5,6 +5,8 @@ if ( !function_exists( 'sportspress_player_gallery' ) ) {
|
||||
if ( ! $id )
|
||||
$id = get_the_ID();
|
||||
|
||||
global $sportspress_options;
|
||||
|
||||
$defaults = array(
|
||||
'number' => -1,
|
||||
'orderby' => 'default',
|
||||
@@ -15,6 +17,7 @@ if ( !function_exists( 'sportspress_player_gallery' ) ) {
|
||||
'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 ),
|
||||
);
|
||||
|
||||
$r = wp_parse_args( $args, $defaults );
|
||||
@@ -93,7 +96,11 @@ if ( !function_exists( 'sportspress_player_gallery' ) ) {
|
||||
|
||||
foreach( $data as $player_id => $statistics ):
|
||||
|
||||
$caption = get_the_title( $player_id );
|
||||
if ( $r['show_names_on_hover'] ):
|
||||
$caption = get_the_title( $player_id );
|
||||
else:
|
||||
$caption = null;
|
||||
endif;
|
||||
|
||||
$thumbnail = get_the_post_thumbnail( $player_id, $size );
|
||||
|
||||
@@ -104,7 +111,7 @@ if ( !function_exists( 'sportspress_player_gallery' ) ) {
|
||||
<{$icontag} class='gallery-icon portrait'>"
|
||||
. '<a href="' . get_permalink( $player_id ) . '">' . $thumbnail . '</a>'
|
||||
. "</{$icontag}>";
|
||||
if ( $captiontag && trim($caption) ) {
|
||||
if ( $captiontag && trim( $caption ) ) {
|
||||
$output .= '<a href="' . get_permalink( $player_id ) . '">' . "
|
||||
<{$captiontag} class='wp-caption-text gallery-caption'>
|
||||
" . wptexturize($caption) . "
|
||||
@@ -128,3 +135,17 @@ if ( !function_exists( 'sportspress_player_gallery' ) ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function sportspress_player_gallery_shortcode( $atts ) {
|
||||
if ( isset( $atts['id'] ) ):
|
||||
$id = $atts['id'];
|
||||
unset( $atts['id'] );
|
||||
elseif( isset( $atts[0] ) ):
|
||||
$id = $atts[0];
|
||||
unset( $atts[0] );
|
||||
else:
|
||||
$id = null;
|
||||
endif;
|
||||
return sportspress_player_gallery( $id, $atts );
|
||||
}
|
||||
add_shortcode('player-gallery', 'sportspress_player_gallery_shortcode');
|
||||
|
||||
@@ -5,12 +5,15 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
||||
if ( ! $id )
|
||||
$id = get_the_ID();
|
||||
|
||||
global $sportspress_options;
|
||||
|
||||
$defaults = array(
|
||||
'number' => -1,
|
||||
'statistics' => null,
|
||||
'orderby' => 'default',
|
||||
'order' => 'ASC',
|
||||
'show_all_players_link' => false,
|
||||
'link_posts' => sportspress_array_value( $sportspress_options, 'player_list_link_posts', true ),
|
||||
);
|
||||
|
||||
$r = wp_parse_args( $args, $defaults );
|
||||
@@ -76,9 +79,12 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
||||
$output .= '<td class="data-number">' . ( $number ? $number : ' ' ) . '</td>';
|
||||
endif;
|
||||
|
||||
// Name as link
|
||||
$permalink = get_post_permalink( $player_id );
|
||||
$output .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>';
|
||||
if ( $r['link_posts'] ):
|
||||
$permalink = get_post_permalink( $player_id );
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
endif;
|
||||
|
||||
$output .= '<td class="data-name">' . $name . '</td>';
|
||||
|
||||
foreach( $labels as $key => $value ):
|
||||
if ( $key == 'name' )
|
||||
@@ -102,3 +108,17 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function sportspress_player_list_shortcode( $atts ) {
|
||||
if ( isset( $atts['id'] ) ):
|
||||
$id = $atts['id'];
|
||||
unset( $atts['id'] );
|
||||
elseif( isset( $atts[0] ) ):
|
||||
$id = $atts[0];
|
||||
unset( $atts[0] );
|
||||
else:
|
||||
$id = null;
|
||||
endif;
|
||||
return sportspress_player_list( $id, $atts );
|
||||
}
|
||||
add_shortcode('player-list', 'sportspress_player_list_shortcode');
|
||||
@@ -7,10 +7,10 @@ if ( !function_exists( 'sportspress_player_metrics' ) ) {
|
||||
|
||||
global $sportspress_countries;
|
||||
|
||||
$options = get_option( 'sportspress' );
|
||||
global $sportspress_options;
|
||||
|
||||
$defaults = array(
|
||||
'show_nationality_flag' => sportspress_array_value( $options, 'player_show_nationality_flag', true ),
|
||||
'show_nationality_flag' => sportspress_array_value( $sportspress_options, 'player_show_nationality_flag', true ),
|
||||
);
|
||||
|
||||
$r = wp_parse_args( $args, $defaults );
|
||||
|
||||
@@ -51,7 +51,7 @@ class SP_Admin_Dashboard {
|
||||
<?php if ( $next_event ): ?>
|
||||
<li class="countdown" data-countdown="<?php echo str_replace( '-', '/', $next_event->post_date ); ?>">
|
||||
<a href="<?php echo get_edit_post_link( $next_event->ID ); ?>">
|
||||
<?php printf( __( '<strong>%s</strong> until next event', 'sportspress' ), $interval->d . ' ' . __( 'days', 'sportspress' ) . ' ' . sprintf( '%02s:%02s:%02s', $interval->h, $interval->i, $interval->s ) ); ?>
|
||||
<?php printf( __( '<strong>%s</strong> until next event', 'sportspress' ), $interval->days . ' ' . __( 'days', 'sportspress' ) . ' ' . sprintf( '%02s:%02s:%02s', $interval->h, $interval->i, $interval->s ) ); ?>
|
||||
(<?php echo $next_event->post_title; ?>)
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -9,10 +9,12 @@ class SP_Widget_Countdown extends WP_Widget {
|
||||
function widget( $args, $instance ) {
|
||||
extract($args);
|
||||
$title = apply_filters('widget_title', empty($instance['title']) ? null : $instance['title'], $instance, $this->id_base);
|
||||
$id = empty($instance['id']) ? null : $instance['id'];
|
||||
$show_league = empty($instance['show_league']) ? false : $instance['show_league'];
|
||||
echo $before_widget;
|
||||
if ( $title )
|
||||
echo $before_title . $title . $after_title;
|
||||
echo sportspress_countdown( $instance );
|
||||
echo sportspress_countdown( $id, array( 'show_league' => $show_league ) );
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
@@ -26,7 +28,7 @@ class SP_Widget_Countdown extends WP_Widget {
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'event' => '', 'show_league' => 0 ) );
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'event' => '', 'show_league' => false ) );
|
||||
$title = strip_tags($instance['title']);
|
||||
$event = intval($instance['event']);
|
||||
$show_league = intval($instance['show_league']);
|
||||
|
||||
@@ -14,11 +14,12 @@ class SportsPress_Widget_Player_Gallery extends WP_Widget {
|
||||
$orderby = empty($instance['orderby']) ? 'default' : $instance['orderby'];
|
||||
$order = empty($instance['order']) ? 'ASC' : $instance['order'];
|
||||
$show_all_players_link = empty($instance['show_all_players_link']) ? false : $instance['show_all_players_link'];
|
||||
$show_names_on_hover = empty($instance['show_names_on_hover']) ? false : $instance['show_names_on_hover'];
|
||||
echo $before_widget;
|
||||
if ( $title )
|
||||
echo $before_title . $title . $after_title;
|
||||
echo '<div id="sp_player_list_wrap">';
|
||||
echo sportspress_player_gallery( $id, array( 'number' => $number, 'orderby' => $orderby , 'order' => $order, 'show_all_players_link' => $show_all_players_link ) );
|
||||
echo '<div id="sp_player_gallery_wrap">';
|
||||
echo sportspress_player_gallery( $id, array( 'number' => $number, 'orderby' => $orderby , 'order' => $order, 'show_all_players_link' => $show_all_players_link, 'show_names_on_hover' => $show_names_on_hover ) );
|
||||
echo '</div>';
|
||||
echo $after_widget;
|
||||
}
|
||||
@@ -31,18 +32,20 @@ class SportsPress_Widget_Player_Gallery extends WP_Widget {
|
||||
$instance['orderby'] = strip_tags($new_instance['orderby']);
|
||||
$instance['order'] = strip_tags($new_instance['order']);
|
||||
$instance['show_all_players_link'] = $new_instance['show_all_players_link'];
|
||||
$instance['show_names_on_hover'] = $new_instance['show_names_on_hover'];
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'number' => 5, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true ) );
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'number' => 5, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true, 'show_names_on_hover' => false ) );
|
||||
$title = strip_tags($instance['title']);
|
||||
$id = intval($instance['id']);
|
||||
$number = intval($instance['number']);
|
||||
$orderby = strip_tags($instance['orderby']);
|
||||
$order = strip_tags($instance['order']);
|
||||
$show_all_players_link = $instance['show_all_players_link'];
|
||||
$show_names_on_hover = $instance['show_names_on_hover'];
|
||||
?>
|
||||
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
|
||||
@@ -96,6 +99,9 @@ class SportsPress_Widget_Player_Gallery extends WP_Widget {
|
||||
|
||||
<p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_players_link'); ?>" name="<?php echo $this->get_field_name('show_all_players_link'); ?>" value="1" <?php checked( $show_all_players_link, 1 ); ?>>
|
||||
<label for="<?php echo $this->get_field_id('show_all_players_link'); ?>"><?php _e( 'Display link to view all players', 'sportspress' ); ?></label></p>
|
||||
|
||||
<p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_names_on_hover'); ?>" name="<?php echo $this->get_field_name('show_names_on_hover'); ?>" value="1" <?php checked( $show_names_on_hover, 1 ); ?>>
|
||||
<label for="<?php echo $this->get_field_id('show_names_on_hover'); ?>"><?php _e( 'Display player names on hover', 'sportspress' ); ?></label></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,6 +281,10 @@
|
||||
content: '\f185';
|
||||
}
|
||||
|
||||
table.widefat.sp-data-table img {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.widefat.sp-data-table th.column-outcome {
|
||||
width: 10em;
|
||||
}
|
||||
|
||||
@@ -800,8 +800,8 @@ if ( !function_exists( 'sportspress_edit_calendar_table' ) ) {
|
||||
<tbody>
|
||||
<?php
|
||||
if ( is_array( $data ) && sizeof( $data ) > 0 ):
|
||||
$options = get_option( 'sportspress' );
|
||||
$main_result = sportspress_array_value( $options, 'main_result', null );
|
||||
global $sportspress_options;
|
||||
$main_result = sportspress_array_value( $sportspress_options, 'main_result', null );
|
||||
$i = 0;
|
||||
foreach ( $data as $event ):
|
||||
$teams = get_post_meta( $event->ID, 'sp_team' );
|
||||
@@ -882,6 +882,8 @@ if ( !function_exists( 'sportspress_edit_league_table' ) ) {
|
||||
function sportspress_edit_league_table( $columns = array(), $usecolumns = null, $data = array(), $placeholders = array() ) {
|
||||
if ( is_array( $usecolumns ) )
|
||||
$usecolumns = array_filter( $usecolumns );
|
||||
global $sportspress_options;
|
||||
$show_team_logo = sportspress_array_value( $sportspress_options, 'league_table_show_team_logo', false );
|
||||
?>
|
||||
<div class="sp-data-table-container">
|
||||
<table class="widefat sp-data-table sp-league-table">
|
||||
@@ -911,6 +913,7 @@ if ( !function_exists( 'sportspress_edit_league_table' ) ) {
|
||||
?>
|
||||
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
||||
<td>
|
||||
<?php if ( $show_team_logo ) echo get_the_post_thumbnail( $team_id, 'sportspress-fit-icon' ); ?>
|
||||
<span class="sp-default-name">
|
||||
<span class="sp-default-name-input"><?php echo $default_name; ?></span>
|
||||
<a class="dashicons dashicons-edit sp-edit-name" title="<?php _e( 'Edit', 'sportspress' ); ?>"></a>
|
||||
|
||||
@@ -27,10 +27,7 @@ define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ );
|
||||
require_once dirname( __FILE__ ) . '/lib/eos/eos.class.php' ;
|
||||
|
||||
// Globals
|
||||
require_once dirname( __FILE__ ) . '/admin/globals/continents.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/globals/countries.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/globals/sports.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/globals/formats.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/includes/globals.php';
|
||||
|
||||
// Functions
|
||||
require_once dirname( __FILE__ ) . '/functions.php';
|
||||
@@ -58,8 +55,9 @@ require_once dirname( __FILE__ ) . '/admin/templates/team-columns.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/settings.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-general.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-event.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-table.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-team.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-player.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-text.php';
|
||||
|
||||
// Custom post types
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/separator.php';
|
||||
|
||||
Reference in New Issue
Block a user