From 895f7ae639b916287dee4184f3a2a4bdc8424e3e Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Wed, 18 Apr 2018 11:42:14 -0400 Subject: * Server Code: Don't try to transpose stuff inside curly braces --- page.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'page.php') 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('{', "}" ), $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 ) { -- cgit 1.4.1