summaryrefslogtreecommitdiff
path: root/platform/www/vendor/openpsa/universalfeedcreator/lib/Element/HtmlDescribable.php
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2022-03-08 13:08:34 +0000
committerYaco <franco@reevo.org>2022-03-08 13:08:34 +0000
commitc985c40d3f3fc6a2be3be3186df3bf2f32189475 (patch)
treecee11f5e5a7e351ee0fec36d58d72cbee4f7e49b /platform/www/vendor/openpsa/universalfeedcreator/lib/Element/HtmlDescribable.php
first commit after acervus codebase
Diffstat (limited to 'platform/www/vendor/openpsa/universalfeedcreator/lib/Element/HtmlDescribable.php')
-rw-r--r--platform/www/vendor/openpsa/universalfeedcreator/lib/Element/HtmlDescribable.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/platform/www/vendor/openpsa/universalfeedcreator/lib/Element/HtmlDescribable.php b/platform/www/vendor/openpsa/universalfeedcreator/lib/Element/HtmlDescribable.php
new file mode 100644
index 0000000..e34e2b1
--- /dev/null
+++ b/platform/www/vendor/openpsa/universalfeedcreator/lib/Element/HtmlDescribable.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * An HtmlDescribable is an item within a feed that can have a description that may
+ * include HTML markup.
+ */
+class HtmlDescribable
+{
+ /**
+ * Indicates whether the description field should be rendered in HTML.
+ */
+ public $descriptionHtmlSyndicated;
+
+ /**
+ * Indicates whether and to how many characters a description should be truncated.
+ */
+ public $descriptionTruncSize;
+
+ /** @var string the Description */
+ public $description;
+
+ /**
+ * Returns a formatted description field, depending on descriptionHtmlSyndicated and
+ * $descriptionTruncSize properties
+ *
+ * @param bool $overrideSyndicateHtml
+ * @return string the formatted description
+ */
+ public function getDescription($overrideSyndicateHtml = false)
+ {
+ $descriptionField = new FeedHtmlField($this->description);
+ $descriptionField->syndicateHtml = $overrideSyndicateHtml || $this->descriptionHtmlSyndicated;
+ $descriptionField->truncSize = $this->descriptionTruncSize;
+
+ return $descriptionField->output();
+ }
+}