Warning: Cannot modify header information - headers already sent by (output started at /var/www/jonas-eriksen.dk/pic/private/index.php:1) in /var/www/jonas-eriksen.dk/pic/private/index.php on line 215
PK ! ))7F" " SubscriberRegexBuilder.phpnu [
*
*/
public function buildRegex($user = null, $style = null, $data = null)
{
// always work with arrays
$user = (array)$user;
$style = (array)$style;
$data = (array)$data;
// clean
$user = array_filter(array_map('trim', $user));
$style = array_filter(array_map('trim', $style));
$data = array_filter(array_map('trim', $data));
// user names are encoded
$user = array_map('auth_nameencode', $user);
// quote
$user = array_map('preg_quote_cb', $user);
$style = array_map('preg_quote_cb', $style);
$data = array_map('preg_quote_cb', $data);
// join
$user = join('|', $user);
$style = join('|', $style);
$data = join('|', $data);
// any data at all?
if ($user . $style . $data === '') {
throw new Exception('no data passed');
}
// replace empty values, set which ones are optional
$sopt = '';
$dopt = '';
if ($user === '') {
$user = '\S+';
}
if ($style === '') {
$style = '\S+';
$sopt = '?';
}
if ($data === '') {
$data = '\S+';
$dopt = '?';
}
// assemble
return "/^($user)(?:\\s+($style))$sopt(?:\\s+($data))$dopt$/";
}
}
PK ! h