Add prefixed functions for multibyte alternatives
This commit is contained in:
@@ -45,7 +45,7 @@ class SP_Meta_Box_Outcome_Details extends SP_Meta_Box_Config {
|
|||||||
</p>
|
</p>
|
||||||
<p><strong><?php _e( 'Abbreviation', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Abbreviation', 'sportspress' ); ?></strong></p>
|
||||||
<p>
|
<p>
|
||||||
<input name="sp_abbreviation" type="text" id="sp_abbreviation" value="<?php echo $abbreviation; ?>" placeholder="<?php echo mb_substr( $post->post_title, 0, 1 ); ?>">
|
<input name="sp_abbreviation" type="text" id="sp_abbreviation" value="<?php echo $abbreviation; ?>" placeholder="<?php echo sp_substr( $post->post_title, 0, 1 ); ?>">
|
||||||
</p>
|
</p>
|
||||||
<p><strong><?php _e( 'Color', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Color', 'sportspress' ); ?></strong></p>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ class SP_Player extends SP_Custom_Post {
|
|||||||
if ( $outcomes ):
|
if ( $outcomes ):
|
||||||
$outcome = reset( $outcomes );
|
$outcome = reset( $outcomes );
|
||||||
$abbreviation = sp_get_abbreviation( $outcome->ID );
|
$abbreviation = sp_get_abbreviation( $outcome->ID );
|
||||||
if ( empty( $abbreviation ) ) $abbreviation = mb_strtoupper( mb_substr( $outcome->post_title, 0, 1 ) );
|
if ( empty( $abbreviation ) ) $abbreviation = sp_strtoupper( sp_substr( $outcome->post_title, 0, 1 ) );
|
||||||
$totals['streak'] = $abbreviation . $streak['count'];
|
$totals['streak'] = $abbreviation . $streak['count'];
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ class SP_Team extends SP_Custom_Post {
|
|||||||
$outcome = reset( $outcomes );
|
$outcome = reset( $outcomes );
|
||||||
$abbreviation = get_post_meta( $outcome->ID, 'sp_abbreviation', true );
|
$abbreviation = get_post_meta( $outcome->ID, 'sp_abbreviation', true );
|
||||||
if ( ! $abbreviation )
|
if ( ! $abbreviation )
|
||||||
$abbreviation = mb_substr( $outcome->post_title, 0, 1 );
|
$abbreviation = sp_substr( $outcome->post_title, 0, 1 );
|
||||||
$totals['streak'] = $abbreviation . $streak['count'];
|
$totals['streak'] = $abbreviation . $streak['count'];
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ function sp_team_abbreviation( $post = 0, $forced = false ) {
|
|||||||
if ( $abbreviation ) {
|
if ( $abbreviation ) {
|
||||||
return $abbreviation;
|
return $abbreviation;
|
||||||
} else {
|
} else {
|
||||||
return $forced ? mb_substr( mb_strtoupper( sp_team_short_name( $post ) ), 0, 3 ) : sp_team_short_name( $post );
|
return $forced ? sp_substr( sp_strtoupper( sp_team_short_name( $post ) ), 0, 3 ) : sp_team_short_name( $post );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,6 +123,22 @@ function sp_locate_template( $template_name, $template_path = '', $default_path
|
|||||||
return apply_filters('sportspress_locate_template', $template, $template_name, $template_path);
|
return apply_filters('sportspress_locate_template', $template, $template_name, $template_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sp_substr( $string = '' ) {
|
||||||
|
if ( function_exists( 'mb_substr' ) ) {
|
||||||
|
return mb_substr( $string );
|
||||||
|
} else {
|
||||||
|
return substr( $string );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function sp_strtoupper( $string = '' ) {
|
||||||
|
if ( function_exists( 'mb_strtoupper' ) ) {
|
||||||
|
return mb_strtoupper( $string );
|
||||||
|
} else {
|
||||||
|
return strtoupper( $string );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the timezone string.
|
* Get the timezone string.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user