private static function cleanSourcePublisher($publisher) { $publisher = trim(preg_replace('/[^' . Title::legalChars() . ']/', '', $publisher)); // remove stuff within parentheses $matches = array(); if (preg_match('\\(.*?\\)$/i', $publisher, $matches)) { $publisher = trim(mb_substr($publisher, 0, mb_strlen($publisher) - mb_strlen($matches[0]))); } return StructuredData::capitalizeTitleCase(rtrim($publisher, ' .')); }