Fix activation warnings
This commit is contained in:
@@ -40,6 +40,12 @@ class SP_Settings_Config extends SP_Settings_Page {
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings() {
|
||||
$sports = sp_get_sport_options();
|
||||
$sport_options = array();
|
||||
foreach ( $sports as $slug => $data ):
|
||||
$sport_options[ $slug ] = $data['name'];
|
||||
endforeach;
|
||||
|
||||
return apply_filters('sportspress_event_settings', array(
|
||||
|
||||
array( 'title' => __( 'Configure SportsPress', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'config_options' ),
|
||||
@@ -49,7 +55,7 @@ class SP_Settings_Config extends SP_Settings_Page {
|
||||
'id' => 'sportspress_sport',
|
||||
'default' => 'soccer',
|
||||
'type' => 'select',
|
||||
'options' => SP()->sports->options,
|
||||
'options' => $sport_options,
|
||||
),
|
||||
|
||||
array( 'type' => 'results' ),
|
||||
@@ -73,12 +79,6 @@ class SP_Settings_Config extends SP_Settings_Page {
|
||||
* Save settings
|
||||
*/
|
||||
public function save() {
|
||||
$settings = $this->get_settings();
|
||||
SP_Admin_Settings::save_fields( $settings );
|
||||
|
||||
if ( isset( $_POST['sportspress_primary_result'] ) )
|
||||
update_option( 'sportspress_primary_result', $_POST['sportspress_primary_result'] );
|
||||
|
||||
if ( isset( $_POST['sportspress_sport'] ) && ! empty( $_POST['sportspress_sport'] ) && get_option( 'sportspress_sport', null ) != $_POST['sportspress_sport'] ):
|
||||
|
||||
$sport = SP()->sports->$_POST['sportspress_sport'];
|
||||
@@ -162,7 +162,13 @@ class SP_Settings_Config extends SP_Settings_Page {
|
||||
endif;
|
||||
endforeach;
|
||||
endforeach;
|
||||
update_option( 'sportspress_primary_result', 0 );
|
||||
elseif ( isset( $_POST['sportspress_primary_result'] ) ):
|
||||
update_option( 'sportspress_primary_result', $_POST['sportspress_primary_result'] );
|
||||
endif;
|
||||
|
||||
$settings = $this->get_settings();
|
||||
SP_Admin_Settings::save_fields( $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -86,7 +86,9 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
|
||||
);
|
||||
|
||||
foreach ( SP()->text->event as $key => $value ):
|
||||
$strings = sp_get_text_options();
|
||||
|
||||
foreach ( sp_array_value( $strings, 'event', array() ) as $key => $value ):
|
||||
$settings[] = array(
|
||||
'title' => $value,
|
||||
'id' => 'sportspress_event_' . $key . '_text',
|
||||
|
||||
@@ -91,7 +91,9 @@ class SP_Settings_General extends SP_Settings_Page {
|
||||
|
||||
);
|
||||
|
||||
foreach ( SP()->text->general as $key => $value ):
|
||||
$strings = sp_get_text_options();
|
||||
|
||||
foreach ( sp_array_value( $strings, 'general', array() ) as $key => $value ):
|
||||
$settings[] = array(
|
||||
'title' => $value,
|
||||
'id' => 'sportspress_' . $key . '_text',
|
||||
|
||||
@@ -62,7 +62,9 @@ class SP_Settings_Players extends SP_Settings_Page {
|
||||
|
||||
);
|
||||
|
||||
foreach ( SP()->text->player as $key => $value ):
|
||||
$strings = sp_get_text_options();
|
||||
|
||||
foreach ( sp_array_value( $strings, 'player', array() ) as $key => $value ):
|
||||
$settings[] = array(
|
||||
'title' => $value,
|
||||
'id' => 'sportspress_player_' . $key . '_text',
|
||||
|
||||
@@ -63,7 +63,9 @@ class SP_Settings_Teams extends SP_Settings_Page {
|
||||
|
||||
);
|
||||
|
||||
foreach ( SP()->text->team as $key => $value ):
|
||||
$strings = sp_get_text_options();
|
||||
|
||||
foreach ( sp_array_value( $strings, 'team', array() ) as $key => $value ):
|
||||
$settings[] = array(
|
||||
'title' => $value,
|
||||
'id' => 'sportspress_team_' . $key . '_text',
|
||||
|
||||
Reference in New Issue
Block a user