diff --git a/admin/hooks/gettext.php b/admin/hooks/gettext.php index 524d181d..24335fa6 100644 --- a/admin/hooks/gettext.php +++ b/admin/hooks/gettext.php @@ -1,6 +1,9 @@ $value ): + if ( $untranslated_text == $key ): + $translated_text = $value; + endif; + endforeach; + endif; return $translated_text; } diff --git a/admin/includes/globals.php b/admin/includes/globals.php index d9d5758e..c0814acc 100644 --- a/admin/includes/globals.php +++ b/admin/includes/globals.php @@ -6,6 +6,45 @@ function sportspress_define_globals() { $sportspress_options = (array)get_option( 'sportspress', array() ); + // Text + global $sportspress_text_options; + + $sportspress_text_options = array( + 'Calendar', + 'Calendars', + 'Current Team', + 'Event', + 'Events', + 'Friendly', + 'League', + 'Leagues', + 'League Table', + 'League Tables', + 'Nationality', + 'Number', + 'Past Teams', + 'Played', + 'Player', + 'Players', + 'Player List', + 'Player Lists', + 'Position', + 'Positions', + 'Pos', + 'Rank', + 'Roster', + 'Schedule', + 'Season', + 'Seasons', + 'Staff', + 'Team', + 'Teams', + 'Venue', + 'Venues', + ); + + sort( $sportspress_text_options ); + // Continents global $sportspress_continents; diff --git a/admin/settings/options-event.php b/admin/settings/options-event.php index 597a6064..8efccaeb 100644 --- a/admin/settings/options-event.php +++ b/admin/settings/options-event.php @@ -1,7 +1,5 @@ options =& $sportspress_options; diff --git a/admin/settings/options-general.php b/admin/settings/options-general.php index f5d59b65..38511688 100644 --- a/admin/settings/options-general.php +++ b/admin/settings/options-general.php @@ -1,7 +1,5 @@ options =& $sportspress_options; diff --git a/admin/settings/options-player.php b/admin/settings/options-player.php index 91ccb52a..191c66c4 100644 --- a/admin/settings/options-player.php +++ b/admin/settings/options-player.php @@ -1,7 +1,5 @@ options =& $sportspress_options; diff --git a/admin/settings/options-team.php b/admin/settings/options-team.php index 5042a43c..28d706f0 100644 --- a/admin/settings/options-team.php +++ b/admin/settings/options-team.php @@ -1,7 +1,5 @@ options =& $sportspress_options; diff --git a/admin/settings/options-text.php b/admin/settings/options-text.php index a03ba162..d24058cd 100644 --- a/admin/settings/options-text.php +++ b/admin/settings/options-text.php @@ -1,30 +1,12 @@ 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' ) ), - ); - usort( $this->strings, array( $this, 'compare_label' ) ); - + $this->strings =& $sportspress_text_options; add_action( 'admin_init', array( $this, 'page_init' ), 1 ); } - private function compare_label( $a, $b ) { - return strcmp( $a[1], $b[1] ); - } - - function page_init() { register_setting( 'sportspress_text', @@ -41,8 +23,8 @@ class SportsPressTextSettingsPage { foreach ( $this->strings as $string ): add_settings_field( - $string[0], - $string[1], + sanitize_title( $string ), + __( $string, 'sportspress' ), array( $this, 'text_callback' ), 'sportspress_text', 'text' @@ -52,10 +34,10 @@ class SportsPressTextSettingsPage { public function text_callback( $test ) { $string = array_shift( $this->strings ); - $key = $string[0]; - $placeholder = $string[1]; - $text = sportspress_array_value( $this->options, $key . '_string', null ); - ?>
options, 'text', array() ), $string, null ); + ?>