Backend for songs.zachdecook.com
* Server Code: Don't try to transpose stuff inside curly braces
Zach DeCook 2018-04-18
parent 4a514b2 · commit 895f7ae
-rw-r--r--page.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/page.php b/page.php
index 47f39d3..38d97ad 100644
--- a/page.php
+++ b/page.php
@@ -140,7 +140,7 @@ function load_song( $number, $transp = 0 )
}
$class = ! isset( $songKey ) ? "tabs chord$transp" : "tabs chord" . transpadd( $songKey, $transp );
$line = str_replace(
- array('{','}'),
+ array('{','}'),
array('</b>{', "}<b class='$class'>" ),
$line );
@@ -313,12 +313,15 @@ function z_transpose2( $line, $transp )
$newchords = z_transparray( $transp );
$newline = '';
$space = 0; ///@< Spaces that need to be added or removed.
+ $inCurly = 0;
for($i = 0; $i < strlen($line); $i++)
{
$char = $line[$i];
$nchar = isset($line[$i+1]) ? $line[$i+1] : '';
$upchar = strtoupper($line[$i]);
$cval = ord($upchar);
+ if ( $char == '}' && $inCurly ){ $inCurly = 0;}
+ if ( $char == '{' || $inCurly ){ $inCurly = 1; $newline .= $char; continue;}
// A-G
if( $cval <= 71 && $cval >=65 )
{