Fix non-alphanumeric abbreviations
This commit is contained in:
@@ -45,7 +45,7 @@ class SP_Meta_Box_Outcome_Details extends SP_Meta_Box_Config {
|
||||
</p>
|
||||
<p><strong><?php _e( 'Abbreviation', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<input name="sp_abbreviation" type="text" id="sp_abbreviation" value="<?php echo $abbreviation; ?>" placeholder="<?php echo substr( $post->post_title, 0, 1 ); ?>">
|
||||
<input name="sp_abbreviation" type="text" id="sp_abbreviation" value="<?php echo $abbreviation; ?>" placeholder="<?php echo mb_substr( $post->post_title, 0, 1 ); ?>">
|
||||
</p>
|
||||
<p><strong><?php _e( 'Color', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
|
||||
@@ -505,7 +505,7 @@ class SP_Player extends SP_Custom_Post {
|
||||
if ( $outcomes ):
|
||||
$outcome = reset( $outcomes );
|
||||
$abbreviation = sp_get_abbreviation( $outcome->ID );
|
||||
if ( empty( $abbreviation ) ) $abbreviation = strtoupper( substr( $outcome->post_title, 0, 1 ) );
|
||||
if ( empty( $abbreviation ) ) $abbreviation = mb_strtoupper( mb_substr( $outcome->post_title, 0, 1 ) );
|
||||
$totals['streak'] = $abbreviation . $streak['count'];
|
||||
endif;
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ class SP_Team extends SP_Custom_Post {
|
||||
$outcome = reset( $outcomes );
|
||||
$abbreviation = get_post_meta( $outcome->ID, 'sp_abbreviation', true );
|
||||
if ( ! $abbreviation )
|
||||
$abbreviation = substr( $outcome->post_title, 0, 1 );
|
||||
$abbreviation = mb_substr( $outcome->post_title, 0, 1 );
|
||||
$totals['streak'] = $abbreviation . $streak['count'];
|
||||
endif;
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ function sp_team_abbreviation( $post = 0, $forced = false ) {
|
||||
if ( $abbreviation ) {
|
||||
return $abbreviation;
|
||||
} else {
|
||||
return $forced ? substr( strtoupper( sp_team_short_name( $post ) ), 0, 3 ) : sp_team_short_name( $post );
|
||||
return $forced ? mb_substr( mb_strtoupper( sp_team_short_name( $post ) ), 0, 3 ) : sp_team_short_name( $post );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -418,7 +418,7 @@ if ( !function_exists( 'sp_get_post_abbreviation' ) ) {
|
||||
if ( $abbreviation ):
|
||||
return $abbreviation;
|
||||
else:
|
||||
return substr( get_the_title( $post_id ), 0, 1 );
|
||||
return mb_substr( get_the_title( $post_id ), 0, 1 );
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user