2015-12-17 10:47:05 +01:00
|
|
|
<div class="controls">
|
|
|
|
<?= $this->tabs ?>
|
|
|
|
<h1><?= $title ?></h1>
|
2016-05-02 10:30:01 +02:00
|
|
|
<span class="action-links" data-base-target="_self">
|
2016-03-23 01:31:33 +01:00
|
|
|
<?= $this->addLink ?>
|
|
|
|
</span>
|
2015-12-17 10:47:05 +01:00
|
|
|
</div>
|
2016-07-28 09:11:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
|
|
|
|
$decode = function($str) { return htmlspecialchars_decode($str, ENT_COMPAT | ENT_SUBSTITUTE | ENT_HTML5); };
|
|
|
|
} else {
|
|
|
|
$decode = function($str) { return htmlspecialchars_decode($str, ENT_COMPAT | ENT_IGNORE); };
|
|
|
|
}
|
|
|
|
|
|
|
|
$view = $this;
|
|
|
|
$linkObject = function ($match) use ($view, $decode) {
|
|
|
|
|
|
|
|
if ($match[2] === 'Service') {
|
|
|
|
return $match[0];
|
|
|
|
}
|
2016-08-23 16:22:06 +02:00
|
|
|
if ($match[2] === 'CheckCommand') {
|
|
|
|
$match[2] = 'command';
|
|
|
|
}
|
2016-07-28 09:11:09 +02:00
|
|
|
|
|
|
|
$name = $decode($match[3]);
|
|
|
|
return sprintf(
|
|
|
|
'%s %s "%s" {',
|
|
|
|
$match[1],
|
|
|
|
$match[2],
|
|
|
|
$view->qlink(
|
|
|
|
$name,
|
|
|
|
'director/' . $match[2],
|
|
|
|
array('name' => $name),
|
|
|
|
array('data-base-target' => '_next')
|
|
|
|
)
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
function linkObjects($config, $linkCallback) {
|
|
|
|
$pattern = '/^(object|template)\s([A-Z][A-Za-z]*?)\s"(.+?)"\s{/m';
|
|
|
|
|
|
|
|
return preg_replace_callback(
|
|
|
|
$pattern,
|
|
|
|
$linkCallback,
|
|
|
|
$config
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function highlight($what, $line, $severity) {
|
|
|
|
$lines = explode("\n", $what);
|
|
|
|
$lines[$line - 1] = '<span class="highlight ' . $severity . '">' . $lines[$line - 1] . '</span>';
|
|
|
|
return implode("\n", $lines);
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
2015-12-17 10:47:05 +01:00
|
|
|
|
|
|
|
<div class="content">
|
2016-07-28 09:11:09 +02:00
|
|
|
<pre class="generated-config">
|
|
|
|
<?php if ($this->highlight): ?>
|
|
|
|
<?= highlight(linkObjects($this->escape($file->getContent()), $linkObject), $highlight, $highlightSeverity) ?>
|
|
|
|
<?php else: ?>
|
|
|
|
<?= linkObjects($this->escape($file->getContent()), $linkObject) ?>
|
|
|
|
<?php endif ?>
|
2015-12-17 10:47:05 +01:00
|
|
|
</pre>
|
|
|
|
</div>
|