id = 'config';
$this->label = __( 'Configure', 'sportspress' );
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
add_action( 'sportspress_admin_field_results', array( $this, 'results_setting' ) );
add_action( 'sportspress_admin_field_outcomes', array( $this, 'outcomes_setting' ) );
add_action( 'sportspress_admin_field_columns', array( $this, 'columns_setting' ) );
add_action( 'sportspress_admin_field_metrics', array( $this, 'metrics_setting' ) );
add_action( 'sportspress_admin_field_performance', array( $this, 'performance_setting' ) );
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
}
/**
* Get settings array
*
* @return array
*/
public function get_settings() {
return apply_filters('sportspress_event_settings', array(
array( 'title' => __( 'Configure SportsPress', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'config_options' ),
array(
'title' => __( 'Sport', 'sportspress' ),
'id' => 'sportspress_sport',
'default' => 'soccer',
'type' => 'select',
'options' => SP()->sports->options,
),
array( 'type' => 'results' ),
array( 'type' => 'outcomes' ),
array( 'type' => 'columns' ),
array( 'type' => 'metrics' ),
array( 'type' => 'performance' ),
array( 'type' => 'statistics' ),
array( 'type' => 'sectionend', 'id' => 'config_options' ),
)); // End event settings
}
/**
* Output the settings
*/
public function output() {
global $current_section;
$tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option('sportspress_tax_classes' ) ) ) );
if ( $current_section == 'standard' || in_array( $current_section, array_map( 'sanitize_title', $tax_classes ) ) ) {
$this->output_tax_rates();
} else {
$settings = $this->get_settings();
SP_Admin_Settings::output_fields( $settings );
}
}
/**
* Save settings
*/
public function save() {
global $current_section, $wpdb;
if ( ! $current_section ) {
$settings = $this->get_settings();
SP_Admin_Settings::save_fields( $settings );
} else {
$this->save_tax_rates();
}
$wpdb->query( "DELETE FROM `$wpdb->options` WHERE `option_name` LIKE ('_transient_sp_tax_rates_%') OR `option_name` LIKE ('_transient_timeout_sp_tax_rates_%')" );
}
/**
* Output results settings.
*
* @access public
* @return void
*/
public function results_setting() {
$main_result = get_option( 'sportspress_main_result', 0 );
$args = array(
'post_type' => 'sp_result',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
|
|
'sp_outcome',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
|
|
|
|
>
| post_title; ?> |
post_name; ?> |
|
|
'sp_column',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
|
|
|
|
|
|
|
>
| post_title; ?> |
post_name; ?> |
ID, $row->post_name ); ?> |
ID ); ?> |
ID ); ?> |
|
|
'sp_metric',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
|
|
|
|
|
>
| post_title; ?> |
ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?> |
|
|
|
'sp_performance',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
|
|
|
|
|
>
| post_title; ?> |
ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?> |
ID ); ?> |
|
|