'.NL;
$renderer->doc .= '
';
} else {
// needs to be a div, otherwise abc-ui won't work
$renderer->doc .= '
';
}
if ($this->getConf('library') == 'abc-ui') {
$renderer->doc .= '%%player_top'.NL;
}
$renderer->doc .= hsc($src);
if ($this->getConf('library') == 'abc2svg') {
$renderer->doc .= '
';
}
$renderer->doc .= '
'.NL;
}
/**
* Get line of ABC with specific information field
*
* @param string $src ABC code source
* @param string $field ABC information field identifier
*
* @return string information field, whole line
*/
function _getAbcLine($src, $field) {
if (preg_match("/^\s?".$field."\s?:(.*?)$/m", $src, $result)) {
return $result[0];
} else {
return false;
}
}
/**
* Replace first string
*
* @author Zombat [https://stackoverflow.com/users/81205/zombat]
* @source https://stackoverflow.com/a/1252710/340300
* @license CC BY-SA 3.0 [https://creativecommons.org/licenses/by-sa/3.0/]
*
* @param string $haystack
* @param string $needle
* @param string $replace
*
* @return string
*/
function _replace_first($haystack, $needle, $replace) {
$pos = strpos($haystack, $needle);
if ($pos !== false) {
$newstring = substr_replace($haystack, $replace, $pos, strlen($needle));
}
return $newstring;
}
}