aboutsummaryrefslogtreecommitdiff
path: root/lib/models/OpenGraphURLCollection.class.php
diff options
context:
space:
mode:
authorPhilipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de>2024-09-24 10:53:31 +0200
committerPhilipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de>2024-09-24 10:53:31 +0200
commit4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch)
tree5c07151ae61276d334e88f6309c30d439a85c12e /lib/models/OpenGraphURLCollection.class.php
parentda0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff)
parent97a188592c679890a25c37ab78463add76a52ff7 (diff)
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/models/OpenGraphURLCollection.class.php')
-rw-r--r--lib/models/OpenGraphURLCollection.class.php57
1 files changed, 0 insertions, 57 deletions
diff --git a/lib/models/OpenGraphURLCollection.class.php b/lib/models/OpenGraphURLCollection.class.php
deleted file mode 100644
index f575945..0000000
--- a/lib/models/OpenGraphURLCollection.class.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/**
- * Specialized version of SimpleORMapCollection that accepts only
- * OpenGraphURL objects and provides a method that renders the collection
- * to html.
- *
- * @author Jan-Hendrik Willms <tleilax+studip@gmail.com>
- * @license GPL2 or any later version
- */
-class OpenGraphURLCollection extends SimpleORMapCollection
-{
- /**
- * Returns the class name of the object this collection accepts.
- *
- * @return String containing the provided class name 'OpenGraphURL'
- */
- public function getClassName()
- {
- return 'OpenGraphURL';
- }
-
- /**
- * Renders the collection to html. The collection is usually wrapped in
- * a wrapper element but in some edge cases you might want to choose not
- * to do so. This is enabled by the only parameter this method accepts.
- *
- * Note: I advice you not to exclude the wrapper. The javascript that
- * handles the collection will fail!
- *
- * @param bool $with_wrapper Should the collection be wrapped in a wrapper
- * element (optional, defaults to true)
- * @return String containing the rendered collection as a html chunk
- */
- public function render($with_wrapper = true)
- {
- if (!Config::Get()->OPENGRAPH_ENABLE || count($this) === 0) {
- return '';
- }
-
- $rendered_urls = $this->sendMessage('render');
- $rendered_urls = array_filter($rendered_urls);
-
- if (count($rendered_urls) === 0) {
- return '';
- }
-
- if ($with_wrapper) {
- $template = $GLOBALS['template_factory']->open('shared/opengraph-container.php');
- $template->urls = $rendered_urls;
- $result = $template->render();
- } else {
- $result = implode("\n", $rendered_urls);
- }
-
- return $result;
- }
-}