summaryrefslogtreecommitdiffstats
path: root/library/Icingadb/Util
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
commit7c19368db58f16858fde7f1c5fe50c0d640c0482 (patch)
treeb416482e821607bcef8656c462d39ff995d65db0 /library/Icingadb/Util
parentAdding upstream version 1.1.1. (diff)
downloadicingadb-web-7c19368db58f16858fde7f1c5fe50c0d640c0482.tar.xz
icingadb-web-7c19368db58f16858fde7f1c5fe50c0d640c0482.zip
Adding upstream version 1.1.2.upstream/1.1.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Icingadb/Util')
-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;