public function filter($in)
{
$regexp = '/^([^:;]+:\\/\\/)([^:;]+:?.*?)@(.*)$/i';
if (!is_string($in) || empty($in)) {
return $in;
}
preg_match_all($regexp, $in, $tokens);
if (empty($tokens[0])) {
return h($in);
}
$protocol = Hash::get($tokens, '1.0');
$credentials = Hash::get($tokens, '2.0');
$tail = Hash::get($tokens, '3.0');
$link = $this->Html->tag('a', '******', ['class' => 'filtered-credentials', 'title' => h($credentials), 'onclick' => "this.innerHTML = this.title"]);
return h($protocol) . $link . '@' . h($tail);
}