summaryrefslogtreecommitdiffstats
path: root/library/Icingadb/Util/PluginOutput.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:45:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:45:00 +0000
commitbe4626482ba8761da39746a6ac60d133d3852a0f (patch)
tree45065832c85c4789237e94b3114360eac91d86f0 /library/Icingadb/Util/PluginOutput.php
parentReleasing progress-linux version 1.1.1-1~progress7.99u1. (diff)
downloadicingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.tar.xz
icingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.zip
Merging upstream version 1.1.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Icingadb/Util/PluginOutput.php')
-rw-r--r--library/Icingadb/Util/PluginOutput.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/library/Icingadb/Util/PluginOutput.php b/library/Icingadb/Util/PluginOutput.php
index 71d08b1..03055a9 100644
--- a/library/Icingadb/Util/PluginOutput.php
+++ b/library/Icingadb/Util/PluginOutput.php
@@ -64,6 +64,9 @@ class PluginOutput extends HtmlString
/** @var bool Whether the output contains HTML */
protected $isHtml;
+ /** @var int The maximum amount of characters to process */
+ protected $characterLimit = 1000;
+
/** @var bool Whether output will be enriched */
protected $enrichOutput = true;
@@ -94,6 +97,20 @@ class PluginOutput extends HtmlString
}
/**
+ * Set the maximum amount of characters to process
+ *
+ * @param int $limit
+ *
+ * @return $this
+ */
+ public function setCharacterLimit(int $limit): self
+ {
+ $this->characterLimit = $limit;
+
+ return $this;
+ }
+
+ /**
* Set whether the output should be enriched
*
* @param bool $state
@@ -185,6 +202,10 @@ class PluginOutput extends HtmlString
$output = $this->processHtml($output);
}
+ if ($this->characterLimit) {
+ $output = substr($output, 0, $this->characterLimit);
+ }
+
$this->renderedOutput = $output;
return $output;