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,15 +70,14 @@ function sportspress_gettext( $translated_text, $untranslated_text, $domain ) {
$translated_text = $venue->name; $translated_text = $venue->name;
endif; endif;
endif; endif;
endif;
if ( isset( $sportspress_options['text'] ) ): if ( isset( $sportspress_options['text'] ) ):
foreach( $sportspress_options['text'] as $key => $value ): foreach( $sportspress_options['text'] as $key => $value ):
if ( $untranslated_text == $key ): if ( $translated_text == $key ):
$translated_text = $value; $translated_text = $value;
endif; endif;
endforeach; endforeach;
endif; endif;
endif;
return $translated_text; return $translated_text;
} }

View File

@@ -10,38 +10,37 @@ function sportspress_define_globals() {
global $sportspress_text_options; global $sportspress_text_options;
$sportspress_text_options = array( $sportspress_text_options = array(
'Calendar', __( 'Article', 'sportspress' ),
'Calendars', __( 'Current Team', 'sportspress' ),
'Current Team', __( 'Date', 'sportspress' ),
'Event', __( 'Details', 'sportspress' ),
'Events', __( 'days', 'sportspress' ),
'Friendly', __( 'Event', 'sportspress' ),
'League', __( 'Friendly', 'sportspress' ),
'Leagues', __( 'hrs', 'sportspress' ),
'League Table', __( 'League', 'sportspress' ),
'League Tables', __( 'mins', 'sportspress' ),
'Nationality', __( 'Nationality', 'sportspress' ),
'Number', __( 'Past Teams', 'sportspress' ),
'Past Teams', __( 'Player', 'sportspress' ),
'Played', __( 'Position', 'sportspress' ),
'Player', __( 'Pos', 'sportspress' ),
'Players', __( 'Preview', 'sportspress' ),
'Player List', __( 'Rank', 'sportspress' ),
'Player Lists', __( 'Recap', 'sportspress' ),
'Position', __( 'Results', 'sportspress' ),
'Positions', __( 'Season', 'sportspress' ),
'Pos', __( 'secs', 'sportspress' ),
'Rank', __( 'Staff', 'sportspress' ),
'Roster', __( 'Substitute', 'sportspress' ),
'Schedule', __( 'Team', 'sportspress' ),
'Season', __( 'Teams', 'sportspress' ),
'Seasons', __( 'Time', 'sportspress' ),
'Staff', __( 'Total', 'sportspress' ),
'Substitute', __( 'Venue', 'sportspress' ),
'Team', __( 'View all players', 'sportspress' ),
'Teams', __( 'View all events', 'sportspress' ),
'Venue', __( 'View full table', 'sportspress' ),
'Venues',
); );
sort( $sportspress_text_options ); sort( $sportspress_text_options );

View File

@@ -24,7 +24,7 @@ class SportsPressTextSettingsPage {
foreach ( $this->strings as $string ): foreach ( $this->strings as $string ):
add_settings_field( add_settings_field(
sanitize_title( $string ), sanitize_title( $string ),
__( $string, 'sportspress' ), $string,
array( $this, 'text_callback' ), array( $this, 'text_callback' ),
'sportspress_text', 'sportspress_text',
'text' 'text'
@@ -35,9 +35,8 @@ class SportsPressTextSettingsPage {
public function text_callback( $test ) { public function text_callback( $test ) {
$string = array_shift( $this->strings ); $string = array_shift( $this->strings );
$key = sanitize_title( $string ); $key = sanitize_title( $string );
$localized = $string;
$text = sportspress_array_value( sportspress_array_value( $this->options, 'text', array() ), $string, null ); $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
} }
} }