fix replace _

This commit is contained in:
Tim Fry 2024-11-24 09:15:37 -04:00
parent d401aebb7a
commit 8e2077036a
1 changed files with 1 additions and 2 deletions

View File

@ -346,13 +346,12 @@ if (count($_POST) > 0) {
foreach ($phrase_details as &$row) {
$file = basename($row['phrase_detail_data']);
$basename = substr($file, 0, strlen($file) - 4);
// $display_name = ucfirst(str_replace('_', ' ', $basename));
$display_name = basename(str_replace($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/', '', $row['phrase_detail_data']));
//remove the file ending
if (str_ends_with($display_name, '.wav') || str_ends_with($display_name, '.mp3') || str_ends_with($display_name, '.flac') || str_ends_with($display_name, '.mp4') || str_ends_with($display_name, '.gsm')) {
$display_name = substr($display_name, 0, strlen($display_name) - 4);
}
$row['phrase_detail_display_name'] = ucfirst($display_name);
$row['phrase_detail_display_name'] = ucfirst(str_replace('_', ' ', $basename));
}
echo "window.phrase_details = " . json_encode($phrase_details, true) . ";\n";
}