Use preg_replace to remove leading zero from timed statistic

This commit is contained in:
Brian Miyaji
2017-01-14 08:11:46 +11:00
parent cefb48b3b4
commit 32d446710b
5 changed files with 8 additions and 8 deletions

View File

@@ -427,7 +427,7 @@ class SP_Meta_Box_Event_Performance {
if ( '00' != $hours )
$timeval = $hours . ':' . $timeval;
$timeval = ereg_replace( '^0', '', $timeval );
$timeval = preg_replace( '/^0/', '', $timeval );
?>
<input class="sp-player-<?php echo $column; ?>-input sp-convert-time-input sp-sync-input" type="text" name="sp_times[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo esc_attr( $timeval ); ?>" placeholder="<?php echo $placeholder; ?>" />

View File

@@ -200,7 +200,7 @@ class SP_Meta_Box_Player_Statistics {
if ( '00' != $hours )
$timeval = $hours . ':' . $timeval;
$timeval = ereg_replace( '^0', '', $timeval );
$timeval = preg_replace( '/^0/', '', $timeval );
// Convert placeholder
$intval = intval( $placeholder );
@@ -210,7 +210,7 @@ class SP_Meta_Box_Player_Statistics {
if ( '00' != $hours )
$placeholder = $hours . ':' . $placeholder;
$placeholder = ereg_replace( '^0', '', $placeholder );
$placeholder = preg_replace( '/^0/', '', $placeholder );
}
if ( $readonly ) {

View File

@@ -215,7 +215,7 @@ class SP_Event extends SP_Custom_Post{
if ( '00' != $hours )
$timeval = $hours . ':' . $timeval;
$timeval = ereg_replace( '^0', '', $timeval );
$timeval = preg_replace( '/^0/', '', $timeval );
$performance[ $team ][ $player ][ $performance_key ] = $timeval;
endforeach;

View File

@@ -603,7 +603,7 @@ class SP_Player_List extends SP_Custom_Post {
if ( '00' != $hours )
$timeval = $hours . ':' . $timeval;
$timeval = ereg_replace( '^0', '', $timeval );
$timeval = preg_replace( '/^0/', '', $timeval );
$placeholders[ $player ][ $key ] = $timeval;
endforeach;
@@ -642,7 +642,7 @@ class SP_Player_List extends SP_Custom_Post {
if ( '00' != $hours )
$timeval = $hours . ':' . $timeval;
$timeval = ereg_replace( '^0', '', $timeval );
$timeval = preg_replace( '/^0/', '', $timeval );
$merged[ $player ][ $key ] = $timeval;
endforeach;

View File

@@ -612,7 +612,7 @@ class SP_Player extends SP_Custom_Post {
if ( '00' != $hours )
$timeval = $hours . ':' . $timeval;
$timeval = ereg_replace( '^0', '', $timeval );
$timeval = preg_replace( '/^0/', '', $timeval );
$placeholders[ $season ][ $key ] = $timeval;
endforeach;
@@ -692,7 +692,7 @@ class SP_Player extends SP_Custom_Post {
if ( '00' != $hours )
$timeval = $hours . ':' . $timeval;
$timeval = ereg_replace( '^0', '', $timeval );
$timeval = preg_replace( '/^0/', '', $timeval );
$merged[ $season ][ $performance_key ] = $timeval;
endforeach;