Pass individual option groups through filter

This commit is contained in:
Brian Miyaji
2015-01-21 23:53:29 +11:00
parent ce3db85b5f
commit cabc1bc90e
8 changed files with 765 additions and 460 deletions

View File

@@ -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 );
}
/**

View File

@@ -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' ),
));

View File

@@ -0,0 +1,210 @@
<?php
/**
* SportsPress Module Settings
*
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin
* @version 1.6
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! class_exists( 'SP_Settings_Modules' ) ) :
/**
* SP_Settings_Modules
*/
class SP_Settings_Modules extends SP_Settings_Page {
/**
* Constructor
*/
public function __construct() {
$this->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() {
?>
<h3><?php _e( 'Modules', 'sportspress' ); ?></h3>
<div class="sp-modules-wrapper">
<div class="sp-modules-sidebar">
<?php if ( ! class_exists( 'SportsPress_Pro' ) ) { ?>
<table class="widefat" cellspacing="0">
<thead>
<tr><th>
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>/assets/images/modules/sportspress-pro-sidebar.png" alt="<?php _e( 'SportsPress Pro', 'sportspress' ); ?>">
</th></tr>
</thead>
<tbody>
<tr><td>
<p><?php _e( 'Looking for more advanced sports functionality? Upgrade to SportsPress Pro to get access to more advanced features for your team, club, or league website.','sportspress' ); ?></p>
<p class="sp-module-actions">
<span><?php _e( 'Starting at $49', 'sportspress' ); ?></span>
<a class="button button-primary" href="<?php echo apply_filters( 'sportspress_pro_url', 'http://sportspresspro.com/pricing/' ); ?>" target="_blank"><?php _e( 'Upgrade Now', 'sportspress' ); ?></a>
</p>
</td></tr>
</tbody>
</table>
<?php } ?>
<?php if ( ! class_exists( 'SportsPress_TV' ) ) { ?>
<table class="widefat" cellspacing="0">
<thead>
<tr><th>
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>/assets/images/modules/sportspress-tv-sidebar.png" alt="<?php _e( 'SportsPress TV', 'sportspress' ); ?>">
</th></tr>
</thead>
<tbody>
<tr><td>
<p><?php _e( 'Offer premium news & highlights from leading globals sports. SportsPress TV will keep your visitors entertained for hours.','sportspress' ); ?></p>
<p class="sp-module-actions">
<span><?php _e( 'Free', 'sportspress' ); ?></span>
<a class="button" href="<?php echo add_query_arg( array( 'tab' => 'search', 's' => 'sportspress+tv' ), admin_url( 'plugin-install.php' ) ); ?>"><?php _e( 'Install Now', 'sportspress' ); ?></a>
</p>
</td></tr>
</tbody>
</table>
<?php } ?>
<?php if ( ! class_exists( 'SportsPress_Twitter' ) ) { ?>
<table class="widefat" cellspacing="0">
<thead>
<tr><th>
<strong><?php _e( 'Twitter Module', 'sportspress' ); ?></strong>
</th></tr>
</thead>
<tbody>
<tr><td>
<p><?php _e( 'Help spread the word by tweeting with #SportsPress and get the Twitter module for free.','sportspress' ); ?></p>
<p class="sp-module-actions">
<span><?php _e( 'Free with tweet', 'sportspress' ); ?></span>
<a class="button" href="http://ctt.ec/d0sCF" target="_blank"><?php _e( 'Tweet', 'sportspress' ); ?></a>
</p>
</td></tr>
</tbody>
</table>
<?php } ?>
<?php if ( ! class_exists( 'SportsPress_Birthdays' ) ) { ?>
<table class="widefat" cellspacing="0">
<thead>
<tr><th>
<strong><?php _e( 'Birthdays Module', 'sportspress' ); ?></strong>
</th></tr>
</thead>
<tbody>
<tr><td>
<p><?php _e( 'Post your ★★★★★ review on WordPress.org and get the Birthdays module for free.','sportspress' ); ?></p>
<p class="sp-module-actions">
<span><?php _e( 'Free with review', 'sportspress' ); ?></span>
<a class="button" href="http://wordpress.org/support/view/plugin-reviews/sportspress#postform" target="_blank"><?php _e( 'Post Review', 'sportspress' ); ?></a>
</p>
</td></tr>
</tbody>
</table>
<?php } ?>
<table class="widefat" cellspacing="0">
<thead>
<tr><th>
<strong><?php _e( 'Documentation', 'sportspress' ); ?></strong>
</th></tr>
</thead>
<tbody>
<tr><td>
<ul class="sp-documentation-links">
<li><a href="http://sportspresspro.com/docs/" target="_blank"><?php _e( 'Getting Started', 'sportspress' ); ?></a></li>
<li><a href="http://sportspresspro.com/docs/roles-and-capabilities/" target="_blank"><?php _e( 'Roles and Capabilities', 'sportspress' ); ?></a></li>
<li><a href="http://sportspresspro.com/docs/theme-integration-guide/" target="_blank"><?php _e( 'Theme Integration Guide', 'sportspress' ); ?></a></li>
</ul>
</td></tr>
</tbody>
</table>
</div>
<div class="sp-modules-main">
<?php foreach ( SP()->modules->data as $section => $modules ) { ?>
<table class="sp-modules-table widefat" cellspacing="0">
<thead>
<tr><th>
<?php echo sp_array_value( $this->sections, $section, __( 'Modules', 'sportspress' ) ); ?>
</th></tr>
</thead>
<tbody>
<?php foreach ( $modules as $id => $module ) { ?>
<?php if ( isset( $module['class'] ) && ! class_exists( $module['class'] ) ) { ?>
<tr class="sp-module-unavailable"><td>
<input type="checkbox" disabled="disabled">
<label>
<i class="<?php echo sp_array_value( $module, 'icon', 'dashicons dashicons-admin-generic' ); ?>"></i>
<?php echo sp_array_value( $module, 'label', $id ); ?>
</label>
<a class="button" href="<?php echo sp_array_value( $module, 'link', apply_filters( 'sportspress_pro_url', 'http://sportspresspro.com/pricing/' ) ); ?>" target="_blank"><?php echo sp_array_value( $module, 'action', __( 'Upgrade to Pro', 'sportspress' ) ); ?></a>
</td></tr>
<?php } else { ?>
<tr><td>
<input type="checkbox" name="sportspress_load_<?php echo $id; ?>_module" id="sportspress_load_<?php echo $id; ?>_module" <?php checked( 'yes' == get_option( 'sportspress_load_' . $id . '_module', 'yes' ) ); ?>>
<label for="sportspress_load_<?php echo $id; ?>_module">
<i class="<?php echo sp_array_value( $module, 'icon', 'dashicons dashicons-admin-generic' ); ?>"></i>
<?php echo sp_array_value( $module, 'label', $id ); ?>
</label>
</td></tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<?php } ?>
</div>
</div>
<input type="hidden" name="sportspress_update_modules" value="1">
<?php if ( isset( $_POST[ 'sportspress_update_modules' ] ) ) { ?>
<script type="text/javascript">
window.onload = function() {
window.location = window.location.href;
}
</script>
<?php } ?>
<?php
}
/**
* Save settings
*/
public function save() {
foreach ( SP()->modules->data as $sections => $modules ) {
foreach ( $modules as $id => $module ) {
$name = 'sportspress_load_' . $id . '_module';
update_option( $name, isset( $_POST[ $name ] ) ? 'yes' : 'no' );
}
}
}
}
endif;
return new SP_Settings_Modules();

View File

@@ -35,85 +35,108 @@ class SP_Settings_Players extends SP_Settings_Page {
* @return array
*/
public function get_settings() {
$settings = array(
array( 'title' => __( 'Player Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_options' ),
$settings = array_merge(
array(
'title' => __( 'Link', 'sportspress' ),
'desc' => __( 'Link players', 'sportspress' ),
'id' => 'sportspress_link_players',
'default' => 'yes',
'type' => 'checkbox',
array( 'title' => __( 'Player Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_options' ),
),
array(
'title' => __( 'Templates', 'sportspress' ),
'desc' => __( 'Photo', 'sportspress' ),
'id' => 'sportspress_player_show_photo',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
),
array(
'desc' => __( 'Details', 'sportspress' ),
'id' => 'sportspress_player_show_details',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => '',
),
array(
'desc' => __( 'Career Total', 'sportspress' ),
'id' => 'sportspress_player_show_total',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end',
),
array(
'title' => __( 'Nationality', 'sportspress' ),
'desc' => __( 'Display national flags', 'sportspress' ),
'id' => 'sportspress_player_show_flags',
'default' => 'yes',
'type' => 'checkbox',
),
array( 'type' => 'sectionend', 'id' => 'player_options' ),
array( 'title' => __( 'Player Lists', 'sportspress' ), 'type' => 'title', 'id' => 'list_options' ),
array(
'title' => __( 'Players', 'sportspress' ),
'desc' => __( 'Display photos', 'sportspress' ),
'id' => 'sportspress_list_show_photos',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Pagination', 'sportspress' ),
'desc' => __( 'Paginate', 'sportspress' ),
'id' => 'sportspress_list_paginated',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'title' => __( 'Limit', 'sportspress' ),
'id' => 'sportspress_list_rows',
'class' => 'small-text',
'default' => '10',
'desc' => __( 'players', 'sportspress' ),
'type' => 'number',
'custom_attributes' => array(
'min' => 1,
'step' => 1
apply_filters( 'sportspress_player_options', array(
array(
'title' => __( 'Link', 'sportspress' ),
'desc' => __( 'Link players', 'sportspress' ),
'id' => 'sportspress_link_players',
'default' => 'yes',
'type' => 'checkbox',
),
),
array( 'type' => 'sectionend', 'id' => 'list_options' ),
); // End player settings
array(
'title' => __( 'Templates', 'sportspress' ),
'desc' => __( 'Photo', 'sportspress' ),
'id' => 'sportspress_player_show_photo',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
),
array(
'desc' => __( 'Details', 'sportspress' ),
'id' => 'sportspress_player_show_details',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => '',
),
array(
'desc' => __( 'Career Total', 'sportspress' ),
'id' => 'sportspress_player_show_total',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end',
),
array(
'title' => __( 'Nationality', 'sportspress' ),
'desc' => __( 'Display national flags', 'sportspress' ),
'id' => 'sportspress_player_show_flags',
'default' => 'yes',
'type' => 'checkbox',
),
) ),
array(
array( 'type' => 'sectionend', 'id' => 'player_options' ),
)
);
if ( 'yes' == get_option( 'sportspress_load_player_lists_module', 'yes' ) ) {
$settings = array_merge( $settings, array_merge(
array(
array( 'title' => __( 'Player Lists', 'sportspress' ), 'type' => 'title', 'id' => 'list_options' ),
),
apply_filters( 'sportspress_player_list_options', array(
array(
'title' => __( 'Players', 'sportspress' ),
'desc' => __( 'Display photos', 'sportspress' ),
'id' => 'sportspress_list_show_photos',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Pagination', 'sportspress' ),
'desc' => __( 'Paginate', 'sportspress' ),
'id' => 'sportspress_list_paginated',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'title' => __( 'Limit', 'sportspress' ),
'id' => 'sportspress_list_rows',
'class' => 'small-text',
'default' => '10',
'desc' => __( 'players', 'sportspress' ),
'type' => 'number',
'custom_attributes' => array(
'min' => 1,
'step' => 1
),
),
) ),
array(
array( 'type' => 'sectionend', 'id' => 'list_options' ),
)
));
} // End player settings
return apply_filters( 'sportspress_player_settings', $settings );
}

View File

@@ -36,46 +36,50 @@ class SP_Settings_Staff extends SP_Settings_Page {
*/
public function get_settings() {
return apply_filters( 'sportspress_staff_settings', array(
array( 'title' => __( 'Staff Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'staff_options' ),
return apply_filters( 'sportspress_staff_settings', array_merge(
array(
'title' => __( 'Link', 'sportspress' ),
'desc' => __( 'Link staff', 'sportspress' ),
'id' => 'sportspress_link_staff',
'default' => 'yes',
'type' => 'checkbox',
array( 'title' => __( 'Staff Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'staff_options' ),
),
array(
'title' => __( 'Templates', 'sportspress' ),
'desc' => __( 'Photo', 'sportspress' ),
'id' => 'sportspress_staff_show_photo',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
),
apply_filters( 'sportspress_staff_options', array(
array(
'title' => __( 'Link', 'sportspress' ),
'desc' => __( 'Link staff', 'sportspress' ),
'id' => 'sportspress_link_staff',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'title' => __( 'Templates', 'sportspress' ),
'desc' => __( 'Photo', 'sportspress' ),
'id' => 'sportspress_staff_show_photo',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
),
array(
'desc' => __( 'Details', 'sportspress' ),
'id' => 'sportspress_staff_show_details',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end',
),
array(
'title' => __( 'Nationality', 'sportspress' ),
'desc' => __( 'Display national flags', 'sportspress' ),
'id' => 'sportspress_staff_show_flags',
'default' => 'yes',
'type' => 'checkbox',
),
) ),
array(
'desc' => __( 'Details', 'sportspress' ),
'id' => 'sportspress_staff_show_details',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end',
),
array(
'title' => __( 'Nationality', 'sportspress' ),
'desc' => __( 'Display national flags', 'sportspress' ),
'id' => 'sportspress_staff_show_flags',
'default' => 'yes',
'type' => 'checkbox',
),
array( 'type' => 'sectionend', 'id' => 'staff_options' ),
)); // End staff settings
array( 'type' => 'sectionend', 'id' => 'staff_options' ),
)
) ); // End staff settings
}
}

View File

@@ -1,11 +1,11 @@
<?php
/**
* SportsPress General Settings
* SportsPress System Status
*
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin
* @version 1.4.1
* @version 1.6
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -43,7 +43,7 @@ class SP_Settings_Status extends SP_Settings_Page {
<div id="debug-report"><textarea readonly="readonly"></textarea></div>
</div>
<br/>
<table class="sp_status_table widefat" cellspacing="0">
<table class="sp-status-table widefat" cellspacing="0">
<thead>
<tr>
@@ -549,7 +549,7 @@ class SP_Settings_Status extends SP_Settings_Page {
var report = "";
jQuery('.sp_status_table thead, .sp_status_table tbody').each(function(){
jQuery('.sp-status-table thead, .sp-status-table tbody').each(function(){
if ( jQuery( this ).is('thead') ) {

View File

@@ -36,103 +36,125 @@ class SP_Settings_Teams extends SP_Settings_Page {
*/
public function get_settings() {
return apply_filters( 'sportspress_team_settings', array(
array( 'title' => __( 'Team Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'team_options' ),
$settings = array_merge(
array(
'title' => __( 'Link', 'sportspress' ),
'desc' => __( 'Link teams', 'sportspress' ),
'id' => 'sportspress_link_teams',
'default' => 'no',
'type' => 'checkbox',
array( 'title' => __( 'Team Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'team_options' ),
),
array(
'title' => __( 'Templates', 'sportspress' ),
'desc' => __( 'Logo', 'sportspress' ),
'id' => 'sportspress_team_show_logo',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
),
array(
'desc' => __( 'Details', 'sportspress' ),
'id' => 'sportspress_team_show_details',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => '',
),
array(
'desc' => __( 'Visit Site', 'sportspress' ),
'id' => 'sportspress_team_show_link',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end',
),
array(
'title' => __( 'Venue', 'sportspress' ),
'desc' => __( 'Link venues', 'sportspress' ),
'id' => 'sportspress_team_link_venues',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Abbreviation', 'sportspress' ),
'desc' => __( 'Abbreviate team names', 'sportspress' ),
'id' => 'sportspress_abbreviate_teams',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'title' => __( 'Visit Site', 'sportspress' ),
'desc' => __( 'Open link in a new window/tab', 'sportspress' ),
'id' => 'sportspress_team_site_target_blank',
'default' => 'no',
'type' => 'checkbox',
),
array( 'type' => 'sectionend', 'id' => 'team_options' ),
array( 'title' => __( 'League Tables', 'sportspress' ), 'type' => 'title', 'id' => 'table_options' ),
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
apply_filters( 'sportspress_team_options', array(
array(
'title' => __( 'Link', 'sportspress' ),
'desc' => __( 'Link teams', 'sportspress' ),
'id' => 'sportspress_link_teams',
'default' => 'no',
'type' => 'checkbox',
),
),
array( 'type' => 'sectionend', 'id' => 'table_options' ),
array(
'title' => __( 'Templates', 'sportspress' ),
'desc' => __( 'Logo', 'sportspress' ),
'id' => 'sportspress_team_show_logo',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
),
)); // End team settings
array(
'desc' => __( 'Details', 'sportspress' ),
'id' => 'sportspress_team_show_details',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => '',
),
array(
'desc' => __( 'Visit Site', 'sportspress' ),
'id' => 'sportspress_team_show_link',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end',
),
array(
'title' => __( 'Venue', 'sportspress' ),
'desc' => __( 'Link venues', 'sportspress' ),
'id' => 'sportspress_team_link_venues',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Abbreviation', 'sportspress' ),
'desc' => __( 'Abbreviate team names', 'sportspress' ),
'id' => 'sportspress_abbreviate_teams',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'title' => __( 'Visit Site', 'sportspress' ),
'desc' => __( 'Open link in a new window/tab', 'sportspress' ),
'id' => 'sportspress_team_site_target_blank',
'default' => 'no',
'type' => 'checkbox',
),
)),
array(
array( 'type' => 'sectionend', 'id' => 'team_options' ),
)
);
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 );
}
}

View File

@@ -37,16 +37,15 @@ class SP_Settings_Text extends SP_Settings_Page {
public function get_settings() {
$settings = array(
array( 'title' => __( 'Text', 'sportspress' ), 'type' => 'title', 'desc' => __( 'The following options affect how words are displayed on the frontend.', 'sportspress' ), 'id' => 'text_options' ),
);
$strings = sp_get_text_options();
$options = get_option( 'sportspress_text' );
$options = array();
foreach ( $strings as $string ):
$settings[] = array(
$options[] = array(
'title' => $string,
'id' => 'sportspress_text[' . $string . ']',
'default' => '',
@@ -56,7 +55,9 @@ class SP_Settings_Text extends SP_Settings_Page {
);
endforeach;
$settings[] = array( 'type' => 'sectionend', 'id' => 'text_options' );
$settings = array_merge( $settings, apply_filters( 'sportspress_text_options', $options ), array(
array( 'type' => 'sectionend', 'id' => 'text_options' )
));
return apply_filters( 'sportspress_text_settings', $settings ); // End event settings
}