monitoring: Fix `$this' usage in a closure

This commit is contained in:
Eric Lippmann 2014-09-23 23:00:19 -07:00
parent cde3ec6bc8
commit c4d13a7850
1 changed files with 4 additions and 3 deletions

View File

@ -12,10 +12,11 @@
<?php return; endif ?>
<?php
function contactsLink($match, $self) {
$self = $this;
function contactsLink($match, $view) {
$links = array();
foreach (preg_split('/,\s/', $match[1]) as $contact) {
$links[] = $self->qlink($contact, 'monitoring/show/contact', array('contact' => $contact));
$links[] = $view->qlink($contact, 'monitoring/show/contact', array('contact' => $contact));
}
return '[' . implode(', ', $links) . ']';
}
@ -39,7 +40,7 @@ function contactsLink($match, $self) {
$msg = preg_replace_callback(
'/^\[([^\]]+)\]/',
function($match) { return contactsLink($match, $this); },
function($match) use ($self) { return contactsLink($match, $self); },
$this->escape($event->output)
);
break;