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

View File

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