diff --git a/includes/admin/settings/class-sp-settings-events.php b/includes/admin/settings/class-sp-settings-events.php index 143694f0..e0e51847 100644 --- a/includes/admin/settings/class-sp-settings-events.php +++ b/includes/admin/settings/class-sp-settings-events.php @@ -37,250 +37,283 @@ class SP_Settings_Events extends SP_Settings_Page { */ public function get_settings() { - return apply_filters( 'sportspress_event_settings', array( - - array( 'title' => __( 'Event Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'event_options' ), + $settings = array_merge( array( - 'title' => __( 'Link', 'sportspress' ), - 'desc' => __( 'Link events', 'sportspress' ), - 'id' => 'sportspress_link_events', - 'default' => 'yes', - 'type' => 'checkbox', + array( 'title' => __( 'Event Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'event_options' ), ), - array( - 'title' => __( 'Templates', 'sportspress' ), - 'desc' => __( 'Logos', 'sportspress' ), - 'id' => 'sportspress_event_show_logos', - 'default' => 'yes', - 'type' => 'checkbox', - 'checkboxgroup' => 'start', - ), - - array( - 'desc' => __( 'Results', 'sportspress' ), - 'id' => 'sportspress_event_show_results', - 'default' => 'yes', - 'type' => 'checkbox', - 'checkboxgroup' => '', - ), - - array( - 'desc' => __( 'Details', 'sportspress' ), - 'id' => 'sportspress_event_show_details', - 'default' => 'yes', - 'type' => 'checkbox', - 'checkboxgroup' => '', - ), - - array( - 'desc' => __( 'Venue', 'sportspress' ), - 'id' => 'sportspress_event_show_venue', - 'default' => 'yes', - 'type' => 'checkbox', - 'checkboxgroup' => '', - ), - - array( - 'desc' => __( 'Players', 'sportspress' ), - 'id' => 'sportspress_event_show_players', - 'default' => 'yes', - 'type' => 'checkbox', - 'checkboxgroup' => '', - ), - - array( - 'desc' => __( 'Staff', 'sportspress' ), - 'id' => 'sportspress_event_show_staff', - 'default' => 'yes', - 'type' => 'checkbox', - 'checkboxgroup' => '', - ), - - array( - 'desc' => __( 'Total', 'sportspress' ), - 'id' => 'sportspress_event_show_total', - 'default' => 'yes', - 'type' => 'checkbox', - 'checkboxgroup' => 'end', - ), - - array( - 'title' => __( 'Limit', 'sportspress' ), - 'id' => 'sportspress_event_teams', - 'class' => 'small-text', - 'default' => '2', - 'desc' => __( 'teams', 'sportspress' ), - 'type' => 'number', - 'custom_attributes' => array( - 'min' => 1, - 'step' => 1 + apply_filters( 'sportspress_event_options', array( + array( + 'title' => __( 'Link', 'sportspress' ), + 'desc' => __( 'Link events', 'sportspress' ), + 'id' => 'sportspress_link_events', + 'default' => 'yes', + 'type' => 'checkbox', ), - ), - - array( 'type' => 'delimiter' ), - array( - 'title' => __( 'Player Performance', 'sportspress' ), - 'id' => 'sportspress_event_performance_mode', - 'default' => 'values', - 'type' => 'radio', - 'options' => array( - 'values' => __( 'Values', 'sportspress' ), - 'icons' => __( 'Icons', 'sportspress' ), + array( + 'title' => __( 'Templates', 'sportspress' ), + 'desc' => __( 'Logos', 'sportspress' ), + 'id' => 'sportspress_event_show_logos', + 'default' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => 'start', ), - ), - array( - 'title' => __( 'Venues', 'sportspress' ), - 'desc' => __( 'Display maps', 'sportspress' ), - 'id' => 'sportspress_event_show_maps', - 'default' => 'yes', - 'type' => 'checkbox', - 'checkboxgroup' => 'start', - ), - - array( - 'desc' => __( 'Link venues', 'sportspress' ), - 'id' => 'sportspress_link_venues', - 'default' => 'no', - 'type' => 'checkbox', - 'checkboxgroup' => 'end', - ), - - array( - 'title' => __( 'Full Time', 'sportspress' ), - 'id' => 'sportspress_event_minutes', - 'class' => 'small-text', - 'default' => '90', - 'desc' => __( 'mins', 'sportspress' ), - 'type' => 'number', - 'custom_attributes' => array( - 'min' => 0, - 'step' => 1 + array( + 'desc' => __( 'Results', 'sportspress' ), + 'id' => 'sportspress_event_show_results', + 'default' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => '', ), - ), - array( - 'title' => __( 'Comments', 'sportspress' ), - 'desc' => __( 'Allow people to post comments on new articles', 'sportspress' ), - 'id' => 'sportspress_event_comment_status', - 'default' => 'no', - 'type' => 'checkbox', - ), - - array( 'type' => 'sectionend', 'id' => 'event_options' ), - - array( 'title' => __( 'Event List', 'sportspress' ), 'type' => 'title', 'id' => 'event_list_options' ), - - 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( + 'desc' => __( 'Details', 'sportspress' ), + 'id' => 'sportspress_event_show_details', + 'default' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => '', ), - ), - 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( + 'desc' => __( 'Venue', 'sportspress' ), + 'id' => 'sportspress_event_show_venue', + 'default' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => '', ), - ), - 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( + 'desc' => __( 'Players', 'sportspress' ), + 'id' => 'sportspress_event_show_players', + 'default' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => '', ), - ), - array( 'type' => 'sectionend', 'id' => 'event_list_options' ), - - array( 'title' => __( 'Event Blocks', 'sportspress' ), 'type' => 'title', 'id' => 'event_blocks_options' ), - - 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( + 'desc' => __( 'Staff', 'sportspress' ), + 'id' => 'sportspress_event_show_staff', + 'default' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => '', ), - ), - array( 'type' => 'sectionend', 'id' => 'event_list_options' ), + array( + 'desc' => __( 'Total', 'sportspress' ), + 'id' => 'sportspress_event_show_total', + 'default' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => 'end', + ), + + array( + 'title' => __( 'Limit', 'sportspress' ), + 'id' => 'sportspress_event_teams', + 'class' => 'small-text', + 'default' => '2', + 'desc' => __( 'teams', 'sportspress' ), + 'type' => 'number', + 'custom_attributes' => array( + 'min' => 1, + 'step' => 1 + ), + ), + + array( 'type' => 'delimiter' ), - )); // End event settings + array( + 'title' => __( 'Player Performance', 'sportspress' ), + 'id' => 'sportspress_event_performance_mode', + 'default' => 'values', + 'type' => 'radio', + 'options' => array( + 'values' => __( 'Values', 'sportspress' ), + 'icons' => __( 'Icons', 'sportspress' ), + ), + ), + + array( + 'title' => __( 'Venues', 'sportspress' ), + 'desc' => __( 'Display maps', 'sportspress' ), + 'id' => 'sportspress_event_show_maps', + 'default' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => 'start', + ), + + array( + 'desc' => __( 'Link venues', 'sportspress' ), + 'id' => 'sportspress_link_venues', + 'default' => 'no', + 'type' => 'checkbox', + 'checkboxgroup' => 'end', + ), + + array( + 'title' => __( 'Full Time', 'sportspress' ), + 'id' => 'sportspress_event_minutes', + 'class' => 'small-text', + 'default' => '90', + 'desc' => __( 'mins', 'sportspress' ), + 'type' => 'number', + 'custom_attributes' => array( + 'min' => 0, + 'step' => 1 + ), + ), + + array( + 'title' => __( 'Comments', 'sportspress' ), + 'desc' => __( 'Allow people to post comments on new articles', 'sportspress' ), + 'id' => 'sportspress_event_comment_status', + 'default' => 'no', + 'type' => 'checkbox', + ), + )), + + array( + array( 'type' => 'sectionend', 'id' => 'event_options' ), + ) + + ); + + 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 ); } /** diff --git a/includes/admin/settings/class-sp-settings-general.php b/includes/admin/settings/class-sp-settings-general.php index a8af0976..e8fe445d 100644 --- a/includes/admin/settings/class-sp-settings-general.php +++ b/includes/admin/settings/class-sp-settings-general.php @@ -40,41 +40,49 @@ class SP_Settings_General extends SP_Settings_Page { $presets = SP_Admin_Sports::get_preset_options(); - $settings = array( - array( 'title' => __( 'General Options', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'general_options' ), - - array( 'type' => 'timezone' ), + $settings = array_merge( array( - 'title' => __( 'Sport', 'sportspress' ), - 'id' => 'sportspress_sport', - 'default' => 'custom', - 'type' => 'sport', - 'options' => $presets, + array( 'title' => __( 'General Options', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'general_options' ), ), - array( - 'title' => __( 'Google Maps', 'sportspress' ), - 'id' => 'sportspress_map_type', - 'default' => 'ROADMAP', - 'type' => 'select', - 'options' => array( - 'ROADMAP' => __( 'Default', 'sportspress' ), - 'SATELLITE' => __( 'Satellite', 'sportspress' ), - 'HYBRID' => __( 'Hybrid', 'sportspress' ), - 'TERRAIN' => __( 'Terrain', 'sportspress' ), + apply_filters( 'sportspress_general_options', array( + array( 'type' => 'timezone' ), + + array( + 'title' => __( 'Sport', 'sportspress' ), + 'id' => 'sportspress_sport', + 'default' => 'custom', + 'type' => 'sport', + 'options' => $presets, ), - ), - array( 'type' => 'sectionend', 'id' => 'general_options' ), + array( + 'title' => __( 'Google Maps', 'sportspress' ), + 'id' => 'sportspress_map_type', + 'default' => 'ROADMAP', + 'type' => 'select', + 'options' => array( + 'ROADMAP' => __( 'Default', 'sportspress' ), + 'SATELLITE' => __( 'Satellite', 'sportspress' ), + 'HYBRID' => __( 'Hybrid', 'sportspress' ), + 'TERRAIN' => __( 'Terrain', 'sportspress' ), + ), + ), + )), - array( 'title' => __( 'Styles and Scripts', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'script_styling_options' ), - - array( 'type' => 'frontend_styles' ), + array( + array( 'type' => 'sectionend', 'id' => 'general_options' ), + array( 'title' => __( 'Styles and Scripts', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'script_styling_options' ), + ) + ); + + $options = array( + array( 'type' => 'frontend_styles' ), ); if ( ( $styles = SP_Frontend_Scripts::get_styles() ) && array_key_exists( 'sportspress-general', $styles ) ): - $settings = array_merge( $settings, array( + $options = array_merge( $options, array( array( 'title' => __( 'Align', 'sportspress' ), 'id' => 'sportspress_table_text_align', @@ -103,7 +111,7 @@ class SP_Settings_General extends SP_Settings_Page { )); endif; - $settings = array_merge( $settings, array( + $options = array_merge( $options, array( array( 'title' => __( 'Custom CSS', 'sportspress' ), 'id' => 'sportspress_custom_css', @@ -154,8 +162,10 @@ class SP_Settings_General extends SP_Settings_Page { 'type' => 'checkbox', 'checkboxgroup' => 'end', ), - - array( + )); + + if ( apply_filters( 'sportspress_enable_header', false ) ) { + $options[] = array( 'title' => __( 'Header Offset', 'sportspress' ), 'id' => 'sportspress_header_offset', 'class' => 'small-text', @@ -166,8 +176,10 @@ class SP_Settings_General extends SP_Settings_Page { 'custom_attributes' => array( 'step' => 1 ), - ), + ); + } + $settings = array_merge( $settings, apply_filters( 'sportspress_script_styling_options', $options ), array( array( 'type' => 'sectionend', 'id' => 'script_styling_options' ), )); diff --git a/includes/admin/settings/class-sp-settings-modules.php b/includes/admin/settings/class-sp-settings-modules.php new file mode 100644 index 00000000..8582adb0 --- /dev/null +++ b/includes/admin/settings/class-sp-settings-modules.php @@ -0,0 +1,210 @@ +id = 'modules'; + $this->label = __( 'Modules', 'sportspress' ); + $this->theme = wp_get_theme(); + + $this->sections = apply_filters( 'sportspress_module_sections', array( + 'general' => __( 'General' ), + 'event' => __( 'Events' ), + 'team' => __( 'Teams' ), + 'player' => __( 'Players' ), + 'staff' => __( 'Staff' ), + 'other' => __( 'Other' ), + )); + + add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); + add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) ); + add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) ); + } + + /** + * Output modules + * + * @access public + * @return void + */ + public function output() { + ?> +
+ +