diff --git a/admin/globals/continents.php b/admin/globals/continents.php deleted file mode 100644 index 3d1c84d4..00000000 --- a/admin/globals/continents.php +++ /dev/null @@ -1,14 +0,0 @@ - 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' ); diff --git a/admin/globals/formats.php b/admin/globals/formats.php deleted file mode 100644 index 6e3e97e7..00000000 --- a/admin/globals/formats.php +++ /dev/null @@ -1,16 +0,0 @@ - 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 ); diff --git a/admin/globals/sports.php b/admin/globals/sports.php deleted file mode 100644 index 783e455b..00000000 --- a/admin/globals/sports.php +++ /dev/null @@ -1,23 +0,0 @@ - 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; $sportspress_countries = array( @@ -206,5 +225,40 @@ function sportspress_define_countries_global() { ); 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' ); diff --git a/admin/settings/options-event.php b/admin/settings/options-event.php index c724b28d..597a6064 100644 --- a/admin/settings/options-event.php +++ b/admin/settings/options-event.php @@ -1,134 +1,136 @@ options =& $sportspress_options; + add_action( 'admin_init', array( $this, 'page_init' ), 1 ); + } - $args = array( - 'post_type' => 'sp_result', - 'numberposts' => -1, - 'posts_per_page' => -1, - 'orderby' => 'menu_order', - 'order' => 'ASC' - ); - $data = get_posts( $args ); - ?> -
- - - - - - - - - - - - - - - - > - - - - - -
>
post_name ); ?>>post_name; ?>for / post_name; ?>against
-
-
- - + 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( + 'post_type' => 'sp_result', + 'numberposts' => -1, + 'posts_per_page' => -1, + 'orderby' => 'menu_order', + 'order' => 'ASC' + ); + $data = get_posts( $args ); + ?> +
+ + + + + + + + + + + + + + + + > + + + + + +
>
post_name ); ?>>post_name; ?>for / post_name; ?>against
+
+
+ + +
+
-
-
-
- + 'sp_outcome', - 'numberposts' => -1, - 'posts_per_page' => -1, - 'orderby' => 'menu_order', - 'order' => 'ASC' - ); - $data = get_posts( $args ); - ?> -
- - - - - - - - - - - - - - - > - - - - -
post_title; ?>post_name; ?>
-
-
- - + function outcomes_callback() { + $args = array( + 'post_type' => 'sp_outcome', + 'numberposts' => -1, + 'posts_per_page' => -1, + 'orderby' => 'menu_order', + 'order' => 'ASC' + ); + $data = get_posts( $args ); + ?> +
+ + + + + + + + + > + + + + +
post_title; ?>post_name; ?>
+
+
+ + +
+
-
-
-
- + -
- - class="hidden"> -
- 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 ); + ?> +
+ + class="hidden"> +
+ -
- -
- options =& $sportspress_options; + add_action( 'admin_init', array( $this, 'page_init' ), 1 ); + } -function sportspress_player_settings_metrics_callback() { - $args = array( - 'post_type' => 'sp_metric', - 'numberposts' => -1, - 'posts_per_page' => -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 ); + ?> +
+ +
+ options, 'player_list_link_posts', true ); + ?> +
+ +
+ options, 'player_gallery_show_names_on_hover', true ); + ?> +
+ +
+ '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_statistic', + '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' ) : '—'; ?> 
-
-
- - + ); + $data = get_posts( $args ); + ?> +
+ + + + + + + + + + > + + + + + +
post_title; ?>ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?>ID ); ?>
+
+
+ + +
+
-
-
-
- + 'sp_statistic', - '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 ); ?>
-
-
- - -
-
-
-
- -
- -
- '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 ); ?>
-
-
- - -
-
-
-
- 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 ); + ?> +
+ +
+
+ +
+ '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 ); ?>
+
+
+ + +
+
+
+
+ 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 ); + ?>