Adjust text options to modify front-end only

This commit is contained in:
Brian Miyaji
2014-03-22 12:57:47 +11:00
parent 019cb20c5f
commit 27e76e0ea8
3 changed files with 41 additions and 44 deletions

View File

@@ -70,14 +70,13 @@ function sportspress_gettext( $translated_text, $untranslated_text, $domain ) {
$translated_text = $venue->name;
endif;
endif;
endif;
if ( isset( $sportspress_options['text'] ) ):
foreach( $sportspress_options['text'] as $key => $value ):
if ( $untranslated_text == $key ):
$translated_text = $value;
endif;
endforeach;
if ( isset( $sportspress_options['text'] ) ):
foreach( $sportspress_options['text'] as $key => $value ):
if ( $translated_text == $key ):
$translated_text = $value;
endif;
endforeach;
endif;
endif;
return $translated_text;

View File

@@ -10,40 +10,39 @@ function sportspress_define_globals() {
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',
'Substitute',
'Team',
'Teams',
'Venue',
'Venues',
__( 'Article', 'sportspress' ),
__( 'Current Team', 'sportspress' ),
__( 'Date', 'sportspress' ),
__( 'Details', 'sportspress' ),
__( 'days', 'sportspress' ),
__( 'Event', 'sportspress' ),
__( 'Friendly', 'sportspress' ),
__( 'hrs', 'sportspress' ),
__( 'League', 'sportspress' ),
__( 'mins', 'sportspress' ),
__( 'Nationality', 'sportspress' ),
__( 'Past Teams', 'sportspress' ),
__( 'Player', 'sportspress' ),
__( 'Position', 'sportspress' ),
__( 'Pos', 'sportspress' ),
__( 'Preview', 'sportspress' ),
__( 'Rank', 'sportspress' ),
__( 'Recap', 'sportspress' ),
__( 'Results', 'sportspress' ),
__( 'Season', 'sportspress' ),
__( 'secs', 'sportspress' ),
__( 'Staff', 'sportspress' ),
__( 'Substitute', 'sportspress' ),
__( 'Team', 'sportspress' ),
__( 'Teams', 'sportspress' ),
__( 'Time', 'sportspress' ),
__( 'Total', 'sportspress' ),
__( 'Venue', 'sportspress' ),
__( 'View all players', 'sportspress' ),
__( 'View all events', 'sportspress' ),
__( 'View full table', 'sportspress' ),
);
sort( $sportspress_text_options );
// Continents

View File

@@ -24,7 +24,7 @@ class SportsPressTextSettingsPage {
foreach ( $this->strings as $string ):
add_settings_field(
sanitize_title( $string ),
__( $string, 'sportspress' ),
$string,
array( $this, 'text_callback' ),
'sportspress_text',
'text'
@@ -35,9 +35,8 @@ class SportsPressTextSettingsPage {
public function text_callback( $test ) {
$string = array_shift( $this->strings );
$key = sanitize_title( $string );
$localized = $string;
$text = sportspress_array_value( sportspress_array_value( $this->options, 'text', array() ), $string, null );
?><fieldset><input id="sportspress_text_<?php echo $key; ?>" name="sportspress[text][<?php echo $string; ?>]" type="text" class="regular-text" value="<?php echo $text; ?>" placeholder="<?php echo $localized; ?>"></fieldset><?php
?><fieldset><input id="sportspress_text_<?php echo $key; ?>" name="sportspress[text][<?php echo $string; ?>]" type="text" class="regular-text" value="<?php echo $text; ?>" placeholder="<?php echo $string; ?>"></fieldset><?php
}
}