more debugging

This commit is contained in:
Nathan Coad
2018-01-18 17:44:11 +11:00
parent 5d3a7ffbf1
commit dc7353e1e2

View File

@@ -53,9 +53,12 @@ function _booking_ucname($string) {
}
if ($prefixes) {
watchdog('booking_debug', "Checking prefixes");
preg_match("/\b($prefixes)(\w)/", $string, $matches);
watchdog('booking_debug', "<pre>Prefixes match test: \n@info</pre>", array('@info' => print_r( $matches, true)));
// capitalize letter after certain name prefixes e.g 'Mc'
//$string = preg_replace("/\\b($prefixes)(\\w)/e", '"$1".strtoupper("$2")', $string);
$string = preg_replace_callback('/\\b($prefixes)(\\w)/', function ($m) {
$string = preg_replace_callback("/\b($prefixes)(\w)/", function ($m) {
watchdog('booking_debug', "<pre>Prefixes match: \n@info</pre>", array('@info' => print_r( $m, true)));
return $m[1] . strtoupper($m[2]);
}, $string);