ObjectPreview: Avoid linking a flat command attribute inside a command

This commit is contained in:
Markus Frosch 2019-03-26 11:58:06 +01:00
parent e64ace7ccf
commit a6e32d763f
1 changed files with 11 additions and 5 deletions

View File

@ -99,17 +99,23 @@ class ObjectPreview
$classes[] = 'logfile'; $classes[] = 'logfile';
} }
$type = $object->getShortTableName();
$plain = Html::wantHtml($file->getContent())->render(); $plain = Html::wantHtml($file->getContent())->render();
$plain = preg_replace_callback( $plain = preg_replace_callback(
'/^(\s+import\s+\&quot\;)(.+)(\&quot\;)/m', '/^(\s+import\s+\&quot\;)(.+)(\&quot\;)/m',
[$this, 'linkImport'], [$this, 'linkImport'],
$plain $plain
); );
$plain = preg_replace_callback(
'/^(\s+(?:check_|event_)?command\s+=\s+\&quot\;)(.+)(\&quot\;)/m', if ($type !== 'command') {
[$this, 'linkCommand'], $plain = preg_replace_callback(
$plain '/^(\s+(?:check_|event_)?command\s+=\s+\&quot\;)(.+)(\&quot\;)/m',
); [$this, 'linkCommand'],
$plain
);
}
$plain = preg_replace_callback( $plain = preg_replace_callback(
'/^(\s+host_name\s+=\s+\&quot\;)(.+)(\&quot\;)/m', '/^(\s+host_name\s+=\s+\&quot\;)(.+)(\&quot\;)/m',
[$this, 'linkHost'], [$this, 'linkHost'],