Modularize!
This commit is contained in:
@@ -193,139 +193,6 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
|
||||
);
|
||||
|
||||
if ( 'yes' == get_option( 'sportspress_load_calendars_module', 'yes' ) ) {
|
||||
|
||||
$settings = array_merge( $settings,
|
||||
|
||||
array(
|
||||
array( 'title' => __( 'Event List', 'sportspress' ), 'type' => 'title', 'id' => 'event_list_options' ),
|
||||
),
|
||||
|
||||
apply_filters( 'sportspress_event_list_options', array(
|
||||
array(
|
||||
'title' => __( 'Teams', 'sportspress' ),
|
||||
'desc' => __( 'Display logos', 'sportspress' ),
|
||||
'id' => 'sportspress_event_list_show_logos',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Title Format', 'sportspress' ),
|
||||
'id' => 'sportspress_event_list_title_format',
|
||||
'default' => 'title',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'title' => __( 'Title', 'sportspress' ),
|
||||
'teams' => __( 'Teams', 'sportspress' ),
|
||||
'homeaway' => sprintf( '%s | %s', __( 'Home', 'sportspress' ), __( 'Away', 'sportspress' ) ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Time/Results Format', 'sportspress' ),
|
||||
'id' => 'sportspress_event_list_time_format',
|
||||
'default' => 'combined',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'combined' => __( 'Combined', 'sportspress' ),
|
||||
'separate' => __( 'Separate', 'sportspress' ),
|
||||
'time' => __( 'Time Only', 'sportspress' ),
|
||||
'results' => __( 'Results Only', 'sportspress' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Pagination', 'sportspress' ),
|
||||
'desc' => __( 'Paginate', 'sportspress' ),
|
||||
'id' => 'sportspress_event_list_paginated',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Limit', 'sportspress' ),
|
||||
'id' => 'sportspress_event_list_rows',
|
||||
'class' => 'small-text',
|
||||
'default' => '10',
|
||||
'desc' => __( 'events', 'sportspress' ),
|
||||
'type' => 'number',
|
||||
'custom_attributes' => array(
|
||||
'min' => 1,
|
||||
'step' => 1
|
||||
),
|
||||
),
|
||||
)),
|
||||
|
||||
array(
|
||||
array( 'type' => 'sectionend', 'id' => 'event_list_options' ),
|
||||
array( 'title' => __( 'Event Blocks', 'sportspress' ), 'type' => 'title', 'id' => 'event_blocks_options' ),
|
||||
),
|
||||
|
||||
apply_filters( 'sportspress_event_blocks_options', array(
|
||||
array(
|
||||
'title' => __( 'Title', 'sportspress' ),
|
||||
'desc' => __( 'Display calendar title', 'sportspress' ),
|
||||
'id' => 'sportspress_event_blocks_show_title',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Details', 'sportspress' ),
|
||||
'desc' => __( 'Display competition', 'sportspress' ),
|
||||
'id' => 'sportspress_event_blocks_show_league',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Display season', 'sportspress' ),
|
||||
'id' => 'sportspress_event_blocks_show_season',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => '',
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Display venue', 'sportspress' ),
|
||||
'id' => 'sportspress_event_blocks_show_venue',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Pagination', 'sportspress' ),
|
||||
'desc' => __( 'Paginate', 'sportspress' ),
|
||||
'id' => 'sportspress_event_blocks_paginated',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Limit', 'sportspress' ),
|
||||
'id' => 'sportspress_event_blocks_rows',
|
||||
'class' => 'small-text',
|
||||
'default' => '10',
|
||||
'desc' => __( 'events', 'sportspress' ),
|
||||
'type' => 'number',
|
||||
'custom_attributes' => array(
|
||||
'min' => 1,
|
||||
'step' => 1
|
||||
),
|
||||
),
|
||||
)),
|
||||
|
||||
array(
|
||||
array( 'type' => 'sectionend', 'id' => 'event_list_options' ),
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
} // End event settings
|
||||
|
||||
return apply_filters( 'sportspress_event_settings', $settings );
|
||||
}
|
||||
|
||||
|
||||
@@ -60,12 +60,12 @@ class SP_Settings_General extends SP_Settings_Page {
|
||||
|
||||
array(
|
||||
'title' => __( 'Mode', 'sportspress' ),
|
||||
'id' => 'sportspress_mode',
|
||||
'default' => 'team',
|
||||
'id' => 'sportspress_load_individual_mode_module',
|
||||
'default' => 'no',
|
||||
'type' => 'radio',
|
||||
'options' => array(
|
||||
'team' => __( 'Teams', 'sportspress' ),
|
||||
'player' => __( 'Players', 'sportspress' ) . ' ' . __( '(Beta)', 'sportspress' ),
|
||||
'no' => __( 'Team vs team', 'sportspress' ),
|
||||
'yes' => __( 'Player vs player', 'sportspress' ),
|
||||
),
|
||||
'desc_tip' => _x( 'Who competes in events?', 'mode setting description', 'sportspress' ),
|
||||
),
|
||||
@@ -344,8 +344,8 @@ class SP_Settings_General extends SP_Settings_Page {
|
||||
*/
|
||||
function current_mode_setting() {
|
||||
?>
|
||||
<input type="hidden" name="sportspress_current_mode" value="<?php echo get_option( 'sportspress_mode', 'team' ); ?>">
|
||||
<?php if ( sp_array_value( $_POST, 'sportspress_mode', 'team' ) !== sp_array_value( $_POST, 'sportspress_current_mode', 'team' ) ) { ?>
|
||||
<input type="hidden" name="sportspress_individual_mode_module_loaded" value="<?php echo get_option( 'sportspress_load_individual_mode_module', 'no' ); ?>">
|
||||
<?php if ( sp_array_value( $_POST, 'sportspress_load_individual_mode_module', 'no' ) !== sp_array_value( $_POST, 'sportspress_individual_mode_module_loaded', 'no' ) ) { ?>
|
||||
<script type="text/javascript">
|
||||
window.onload = function() {
|
||||
window.location = window.location.href;
|
||||
|
||||
@@ -195,7 +195,6 @@ class SP_Settings_Modules extends SP_Settings_Page {
|
||||
|
||||
<div class="sp-modules-main">
|
||||
<?php foreach ( SP()->modules->data as $section => $modules ) { ?>
|
||||
<?php if ( 'team' == $section && 'team' != get_option( 'sportspress_mode', 'team' ) ) continue; ?>
|
||||
<table class="sp-modules-table widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr><th>
|
||||
|
||||
@@ -107,53 +107,6 @@ class SP_Settings_Teams extends SP_Settings_Page {
|
||||
|
||||
);
|
||||
|
||||
if ( 'yes' == get_option( 'sportspress_load_league_tables_module', 'yes' ) ) {
|
||||
|
||||
$settings = array_merge( $settings,
|
||||
|
||||
array(
|
||||
array( 'title' => __( 'League Tables', 'sportspress' ), 'type' => 'title', 'id' => 'table_options' ),
|
||||
),
|
||||
|
||||
apply_filters( 'sportspress_table_options', array(
|
||||
array(
|
||||
'title' => __( 'Teams', 'sportspress' ),
|
||||
'desc' => __( 'Display logos', 'sportspress' ),
|
||||
'id' => 'sportspress_table_show_logos',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Pagination', 'sportspress' ),
|
||||
'desc' => __( 'Paginate', 'sportspress' ),
|
||||
'id' => 'sportspress_table_paginated',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Limit', 'sportspress' ),
|
||||
'id' => 'sportspress_table_rows',
|
||||
'class' => 'small-text',
|
||||
'default' => '10',
|
||||
'desc' => __( 'teams', 'sportspress' ),
|
||||
'type' => 'number',
|
||||
'custom_attributes' => array(
|
||||
'min' => 1,
|
||||
'step' => 1
|
||||
),
|
||||
),
|
||||
)),
|
||||
|
||||
array(
|
||||
array( 'type' => 'sectionend', 'id' => 'table_options' ),
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
} // End team settings
|
||||
|
||||
return apply_filters( 'sportspress_team_settings', $settings );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user