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;
|
break;
|
||||||
elseif ( $post_type == 'sp_event' ):
|
elseif ( $post_type == 'sp_event' ):
|
||||||
$results = get_post_meta( $post_id, 'sp_results', true );
|
$results = get_post_meta( $post_id, 'sp_results', true );
|
||||||
$options = get_option( 'sportspress' );
|
global $sportspress_options;
|
||||||
$main_result = sportspress_array_value( $options, 'main_result', null );
|
$main_result = sportspress_array_value( $sportspress_options, 'main_result', null );
|
||||||
foreach( $teams as $team_id ):
|
foreach( $teams as $team_id ):
|
||||||
if ( ! $team_id ) continue;
|
if ( ! $team_id ) continue;
|
||||||
$team = get_post( $team_id );
|
$team = get_post( $team_id );
|
||||||
|
|||||||
@@ -1,5 +1,24 @@
|
|||||||
<?php
|
<?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;
|
global $sportspress_countries;
|
||||||
|
|
||||||
$sportspress_countries = array(
|
$sportspress_countries = array(
|
||||||
@@ -206,5 +225,40 @@ function sportspress_define_countries_global() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
asort( $sportspress_countries );
|
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,8 +1,46 @@
|
|||||||
<?php
|
<?php
|
||||||
function sportspress_results_callback() {
|
class SportsPressEventSettingsPage {
|
||||||
$options = get_option( 'sportspress' );
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
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(
|
$args = array(
|
||||||
'post_type' => 'sp_result',
|
'post_type' => 'sp_result',
|
||||||
@@ -57,9 +95,7 @@ function sportspress_results_callback() {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
function sportspress_outcomes_callback() {
|
function outcomes_callback() {
|
||||||
$options = get_option( 'sportspress' );
|
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_type' => 'sp_outcome',
|
'post_type' => 'sp_outcome',
|
||||||
'numberposts' => -1,
|
'numberposts' => -1,
|
||||||
@@ -77,12 +113,6 @@ function sportspress_outcomes_callback() {
|
|||||||
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</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 ): ?>
|
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
@@ -100,35 +130,7 @@ function sportspress_outcomes_callback() {
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<?php
|
<?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,10 +1,41 @@
|
|||||||
<?php
|
<?php
|
||||||
function sportspress_sport_callback() {
|
class SportsPressGeneralSettingsPage {
|
||||||
global $sportspress_sports;
|
private $options;
|
||||||
$options = get_option( 'sportspress' );
|
|
||||||
|
|
||||||
$selected = sportspress_array_value( $options, 'sport', null );
|
public function __construct() {
|
||||||
$custom_sport_name = sportspress_array_value( $options, 'custom_sport_name', null );
|
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>
|
<fieldset>
|
||||||
<select id="sportspress_sport" name="sportspress[sport]">
|
<select id="sportspress_sport" name="sportspress[sport]">
|
||||||
@@ -18,27 +49,7 @@ function sportspress_sport_callback() {
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<?php
|
<?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,8 +1,77 @@
|
|||||||
<?php
|
<?php
|
||||||
function sportspress_player_settings_details_callback() {
|
class SportsPressPlayerSettingsPage {
|
||||||
$options = get_option( 'sportspress' );
|
private $options;
|
||||||
|
|
||||||
$show_nationality_flag = sportspress_array_value( $options, 'player_show_nationality_flag', true );
|
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_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>
|
<fieldset>
|
||||||
<label for="sportspress_player_show_nationality_flag">
|
<label for="sportspress_player_show_nationality_flag">
|
||||||
@@ -14,7 +83,33 @@ function sportspress_player_settings_details_callback() {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
function sportspress_player_settings_metrics_callback() {
|
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(
|
$args = array(
|
||||||
'post_type' => 'sp_metric',
|
'post_type' => 'sp_metric',
|
||||||
'numberposts' => -1,
|
'numberposts' => -1,
|
||||||
@@ -33,13 +128,6 @@ function sportspress_player_settings_metrics_callback() {
|
|||||||
<th scope="col"> </th>
|
<th scope="col"> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</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 ): ?>
|
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
@@ -59,7 +147,7 @@ function sportspress_player_settings_metrics_callback() {
|
|||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
|
|
||||||
function sportspress_player_settings_statistics_callback() {
|
function statistics_callback() {
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_type' => 'sp_statistic',
|
'post_type' => 'sp_statistic',
|
||||||
'numberposts' => -1,
|
'numberposts' => -1,
|
||||||
@@ -78,13 +166,6 @@ function sportspress_player_settings_statistics_callback() {
|
|||||||
<th scope="col"><?php _e( 'Calculate', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Calculate', 'sportspress' ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</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 ): ?>
|
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
@@ -103,43 +184,7 @@ function sportspress_player_settings_statistics_callback() {
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<?php
|
<?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">
|
<div class="wrap">
|
||||||
|
|
||||||
<h2 class="nav-tab-wrapper">
|
<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 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( 'Events', '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', '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', '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( 'Players', '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>
|
</h2>
|
||||||
|
|
||||||
<form method="post" action="options.php">
|
<form method="post" action="options.php">
|
||||||
<?php
|
<?php
|
||||||
switch ( $active_tab ):
|
switch ( $active_tab ):
|
||||||
case 'events':
|
case 'events':
|
||||||
?><h3 class="title"><?php _e( 'Event Options', 'sportspress' ); ?></h3><?php
|
|
||||||
settings_fields( 'sportspress_events' );
|
settings_fields( 'sportspress_events' );
|
||||||
do_settings_sections( 'sportspress_events' );
|
do_settings_sections( 'sportspress_events' );
|
||||||
submit_button();
|
submit_button();
|
||||||
break;
|
break;
|
||||||
case 'tables':
|
case 'teams':
|
||||||
?><h3 class="title"><?php _e( 'League Table Options', 'sportspress' ); ?></h3><?php
|
settings_fields( 'sportspress_teams' );
|
||||||
settings_fields( 'sportspress_tables' );
|
do_settings_sections( 'sportspress_teams' );
|
||||||
do_settings_sections( 'sportspress_tables' );
|
|
||||||
submit_button();
|
submit_button();
|
||||||
break;
|
break;
|
||||||
case 'players':
|
case 'players':
|
||||||
?><h3 class="title"><?php _e( 'Player Options', 'sportspress' ); ?></h3><?php
|
|
||||||
settings_fields( 'sportspress_players' );
|
settings_fields( 'sportspress_players' );
|
||||||
do_settings_sections( 'sportspress_players' );
|
do_settings_sections( 'sportspress_players' );
|
||||||
submit_button();
|
submit_button();
|
||||||
break;
|
break;
|
||||||
|
case 'text':
|
||||||
|
settings_fields( 'sportspress_text' );
|
||||||
|
do_settings_sections( 'sportspress_text' );
|
||||||
|
submit_button();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
?><h3 class="title"><?php _e( 'General Options', 'sportspress' ); ?></h3><?php
|
|
||||||
settings_fields( 'sportspress_general' );
|
settings_fields( 'sportspress_general' );
|
||||||
do_settings_sections( 'sportspress_general' );
|
do_settings_sections( 'sportspress_general' );
|
||||||
submit_button();
|
submit_button();
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
if ( !function_exists( 'sportspress_countdown' ) ) {
|
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 );
|
$show_league = sportspress_array_value( $args, 'show_league', null );
|
||||||
|
|
||||||
if ( $id ):
|
if ( $id ):
|
||||||
@@ -35,7 +34,7 @@ if ( !function_exists( 'sportspress_countdown' ) ) {
|
|||||||
$interval = date_diff( $now, $date );
|
$interval = date_diff( $now, $date );
|
||||||
|
|
||||||
$output .= '<p class="countdown sp-countdown"><time datetime="' . $post->post_date . '" data-countdown="' . str_replace( '-', '/', $post->post_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->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->i ) ) . ' <small>' . __( 'mins', 'sportspress' ) . '</small></span> ' .
|
||||||
'<span>' . sprintf( '%02s', ( $interval->invert ? 0 : $interval->s ) ) . ' <small>' . __( 'secs', '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' ) ) {
|
if ( !function_exists( 'sportspress_events_list' ) ) {
|
||||||
function sportspress_events_list( $id = null, $args = '' ) {
|
function sportspress_events_list( $id = null, $args = '' ) {
|
||||||
|
|
||||||
$options = get_option( 'sportspress' );
|
global $sportspress_options;
|
||||||
$main_result = sportspress_array_value( $options, 'main_result', null );
|
$main_result = sportspress_array_value( $sportspress_options, 'main_result', null );
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'show_all_events_link' => false,
|
'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' ) ) {
|
if ( !function_exists( 'sportspress_league_table' ) ) {
|
||||||
function sportspress_league_table( $id = null, $args = '' ) {
|
function sportspress_league_table( $id = null, $args = '' ) {
|
||||||
|
|
||||||
if ( ! $id )
|
if ( ! $id || ! is_numeric( $id ) )
|
||||||
$id = get_the_ID();
|
$id = get_the_ID();
|
||||||
|
|
||||||
$options = get_option( 'sportspress' );
|
global $sportspress_options;
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'number' => -1,
|
'number' => -1,
|
||||||
'columns' => null,
|
'columns' => null,
|
||||||
'show_full_table_link' => false,
|
'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 );
|
$r = wp_parse_args( $args, $defaults );
|
||||||
@@ -29,6 +30,9 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
|
|||||||
|
|
||||||
$columns = sportspress_array_value( $r, 'columns', null );
|
$columns = sportspress_array_value( $r, 'columns', null );
|
||||||
|
|
||||||
|
if ( ! is_array( $columns ) )
|
||||||
|
$columns = explode( ',', $columns );
|
||||||
|
|
||||||
$output .= '<th class="data-number">' . __( 'Pos', 'sportspress' ) . '</th>';
|
$output .= '<th class="data-number">' . __( 'Pos', 'sportspress' ) . '</th>';
|
||||||
|
|
||||||
foreach( $labels as $key => $label ):
|
foreach( $labels as $key => $label ):
|
||||||
@@ -58,6 +62,11 @@ if ( !function_exists( 'sportspress_league_table' ) ) {
|
|||||||
if ( $r['show_team_logo'] )
|
if ( $r['show_team_logo'] )
|
||||||
$name = get_the_post_thumbnail( $team_id, 'sportspress-fit-icon' ) . ' ' . $name;
|
$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>';
|
$output .= '<td class="data-name">' . $name . '</td>';
|
||||||
|
|
||||||
foreach( $labels as $key => $value ):
|
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 )
|
if ( ! $id )
|
||||||
$id = get_the_ID();
|
$id = get_the_ID();
|
||||||
|
|
||||||
|
global $sportspress_options;
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'number' => -1,
|
'number' => -1,
|
||||||
'orderby' => 'default',
|
'orderby' => 'default',
|
||||||
@@ -15,6 +17,7 @@ if ( !function_exists( 'sportspress_player_gallery' ) ) {
|
|||||||
'columns' => 3,
|
'columns' => 3,
|
||||||
'size' => 'thumbnail',
|
'size' => 'thumbnail',
|
||||||
'show_all_players_link' => false,
|
'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 );
|
$r = wp_parse_args( $args, $defaults );
|
||||||
@@ -93,7 +96,11 @@ if ( !function_exists( 'sportspress_player_gallery' ) ) {
|
|||||||
|
|
||||||
foreach( $data as $player_id => $statistics ):
|
foreach( $data as $player_id => $statistics ):
|
||||||
|
|
||||||
|
if ( $r['show_names_on_hover'] ):
|
||||||
$caption = get_the_title( $player_id );
|
$caption = get_the_title( $player_id );
|
||||||
|
else:
|
||||||
|
$caption = null;
|
||||||
|
endif;
|
||||||
|
|
||||||
$thumbnail = get_the_post_thumbnail( $player_id, $size );
|
$thumbnail = get_the_post_thumbnail( $player_id, $size );
|
||||||
|
|
||||||
@@ -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 )
|
if ( ! $id )
|
||||||
$id = get_the_ID();
|
$id = get_the_ID();
|
||||||
|
|
||||||
|
global $sportspress_options;
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'number' => -1,
|
'number' => -1,
|
||||||
'statistics' => null,
|
'statistics' => null,
|
||||||
'orderby' => 'default',
|
'orderby' => 'default',
|
||||||
'order' => 'ASC',
|
'order' => 'ASC',
|
||||||
'show_all_players_link' => false,
|
'show_all_players_link' => false,
|
||||||
|
'link_posts' => sportspress_array_value( $sportspress_options, 'player_list_link_posts', true ),
|
||||||
);
|
);
|
||||||
|
|
||||||
$r = wp_parse_args( $args, $defaults );
|
$r = wp_parse_args( $args, $defaults );
|
||||||
@@ -76,9 +79,12 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
|||||||
$output .= '<td class="data-number">' . ( $number ? $number : ' ' ) . '</td>';
|
$output .= '<td class="data-number">' . ( $number ? $number : ' ' ) . '</td>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Name as link
|
if ( $r['link_posts'] ):
|
||||||
$permalink = get_post_permalink( $player_id );
|
$permalink = get_post_permalink( $player_id );
|
||||||
$output .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>';
|
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$output .= '<td class="data-name">' . $name . '</td>';
|
||||||
|
|
||||||
foreach( $labels as $key => $value ):
|
foreach( $labels as $key => $value ):
|
||||||
if ( $key == 'name' )
|
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;
|
global $sportspress_countries;
|
||||||
|
|
||||||
$options = get_option( 'sportspress' );
|
global $sportspress_options;
|
||||||
|
|
||||||
$defaults = array(
|
$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 );
|
$r = wp_parse_args( $args, $defaults );
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class SP_Admin_Dashboard {
|
|||||||
<?php if ( $next_event ): ?>
|
<?php if ( $next_event ): ?>
|
||||||
<li class="countdown" data-countdown="<?php echo str_replace( '-', '/', $next_event->post_date ); ?>">
|
<li class="countdown" data-countdown="<?php echo str_replace( '-', '/', $next_event->post_date ); ?>">
|
||||||
<a href="<?php echo get_edit_post_link( $next_event->ID ); ?>">
|
<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; ?>)
|
(<?php echo $next_event->post_title; ?>)
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ class SP_Widget_Countdown extends WP_Widget {
|
|||||||
function widget( $args, $instance ) {
|
function widget( $args, $instance ) {
|
||||||
extract($args);
|
extract($args);
|
||||||
$title = apply_filters('widget_title', empty($instance['title']) ? null : $instance['title'], $instance, $this->id_base);
|
$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;
|
echo $before_widget;
|
||||||
if ( $title )
|
if ( $title )
|
||||||
echo $before_title . $title . $after_title;
|
echo $before_title . $title . $after_title;
|
||||||
echo sportspress_countdown( $instance );
|
echo sportspress_countdown( $id, array( 'show_league' => $show_league ) );
|
||||||
echo $after_widget;
|
echo $after_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +28,7 @@ class SP_Widget_Countdown extends WP_Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function form( $instance ) {
|
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']);
|
$title = strip_tags($instance['title']);
|
||||||
$event = intval($instance['event']);
|
$event = intval($instance['event']);
|
||||||
$show_league = intval($instance['show_league']);
|
$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'];
|
$orderby = empty($instance['orderby']) ? 'default' : $instance['orderby'];
|
||||||
$order = empty($instance['order']) ? 'ASC' : $instance['order'];
|
$order = empty($instance['order']) ? 'ASC' : $instance['order'];
|
||||||
$show_all_players_link = empty($instance['show_all_players_link']) ? false : $instance['show_all_players_link'];
|
$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;
|
echo $before_widget;
|
||||||
if ( $title )
|
if ( $title )
|
||||||
echo $before_title . $title . $after_title;
|
echo $before_title . $title . $after_title;
|
||||||
echo '<div id="sp_player_list_wrap">';
|
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 ) );
|
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 '</div>';
|
||||||
echo $after_widget;
|
echo $after_widget;
|
||||||
}
|
}
|
||||||
@@ -31,18 +32,20 @@ class SportsPress_Widget_Player_Gallery extends WP_Widget {
|
|||||||
$instance['orderby'] = strip_tags($new_instance['orderby']);
|
$instance['orderby'] = strip_tags($new_instance['orderby']);
|
||||||
$instance['order'] = strip_tags($new_instance['order']);
|
$instance['order'] = strip_tags($new_instance['order']);
|
||||||
$instance['show_all_players_link'] = $new_instance['show_all_players_link'];
|
$instance['show_all_players_link'] = $new_instance['show_all_players_link'];
|
||||||
|
$instance['show_names_on_hover'] = $new_instance['show_names_on_hover'];
|
||||||
|
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
function form( $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']);
|
$title = strip_tags($instance['title']);
|
||||||
$id = intval($instance['id']);
|
$id = intval($instance['id']);
|
||||||
$number = intval($instance['number']);
|
$number = intval($instance['number']);
|
||||||
$orderby = strip_tags($instance['orderby']);
|
$orderby = strip_tags($instance['orderby']);
|
||||||
$order = strip_tags($instance['order']);
|
$order = strip_tags($instance['order']);
|
||||||
$show_all_players_link = $instance['show_all_players_link'];
|
$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>
|
<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>
|
<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 ); ?>>
|
<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>
|
<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
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,6 +281,10 @@
|
|||||||
content: '\f185';
|
content: '\f185';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.widefat.sp-data-table img {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
table.widefat.sp-data-table th.column-outcome {
|
table.widefat.sp-data-table th.column-outcome {
|
||||||
width: 10em;
|
width: 10em;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -800,8 +800,8 @@ if ( !function_exists( 'sportspress_edit_calendar_table' ) ) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
if ( is_array( $data ) && sizeof( $data ) > 0 ):
|
if ( is_array( $data ) && sizeof( $data ) > 0 ):
|
||||||
$options = get_option( 'sportspress' );
|
global $sportspress_options;
|
||||||
$main_result = sportspress_array_value( $options, 'main_result', null );
|
$main_result = sportspress_array_value( $sportspress_options, 'main_result', null );
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ( $data as $event ):
|
foreach ( $data as $event ):
|
||||||
$teams = get_post_meta( $event->ID, 'sp_team' );
|
$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() ) {
|
function sportspress_edit_league_table( $columns = array(), $usecolumns = null, $data = array(), $placeholders = array() ) {
|
||||||
if ( is_array( $usecolumns ) )
|
if ( is_array( $usecolumns ) )
|
||||||
$usecolumns = array_filter( $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">
|
<div class="sp-data-table-container">
|
||||||
<table class="widefat sp-data-table sp-league-table">
|
<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'; ?>">
|
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
||||||
<td>
|
<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">
|
||||||
<span class="sp-default-name-input"><?php echo $default_name; ?></span>
|
<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>
|
<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' ;
|
require_once dirname( __FILE__ ) . '/lib/eos/eos.class.php' ;
|
||||||
|
|
||||||
// Globals
|
// Globals
|
||||||
require_once dirname( __FILE__ ) . '/admin/globals/continents.php';
|
require_once dirname( __FILE__ ) . '/admin/includes/globals.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';
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
require_once dirname( __FILE__ ) . '/functions.php';
|
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/settings.php';
|
||||||
require_once dirname( __FILE__ ) . '/admin/settings/options-general.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-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-player.php';
|
||||||
|
require_once dirname( __FILE__ ) . '/admin/settings/options-text.php';
|
||||||
|
|
||||||
// Custom post types
|
// Custom post types
|
||||||
require_once dirname( __FILE__ ) . '/admin/post-types/separator.php';
|
require_once dirname( __FILE__ ) . '/admin/post-types/separator.php';
|
||||||
|
|||||||
Reference in New Issue
Block a user