Fix activation warnings

This commit is contained in:
Brian Miyaji
2014-03-29 04:11:59 +11:00
parent 8a9e211f5b
commit 222cd0d2f8
8 changed files with 2322 additions and 2299 deletions

View File

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

View File

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

View File

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

View File

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

View File

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