/** * Output a given item. * @param FeedItem $item */ function outItem($item) { global $wgMimeType; // @codingStandardsIgnoreStart Ignore long lines and formatting issues. ?> <entry> <id><?php print $item->getUniqueId(); ?> </id> <title><?php print $item->getTitle(); ?> </title> <link rel="alternate" type="<?php print $wgMimeType; ?> " href="<?php print wfExpandUrl($item->getUrl(), PROTO_CURRENT); ?> "/> <?php if ($item->getDate()) { ?> <updated><?php print $this->formatTime($item->getDate()); ?> Z</updated> <?php } ?> <summary type="html"><?php print $item->getDescription(); ?> </summary> <?php if ($item->getAuthor()) { ?> <author><name><?php print $item->getAuthor(); ?> </name></author><?php } ?> </entry> <?php /* @todo FIXME: Need to add comments <?php if( $item->getComments() ) { ?><dc:comment><?php print $item->getComments() ?></dc:comment><?php }?> */ }
/** * Creates a string containing all additional elements specified in * $additionalElements. * @param elements array an associative array containing key => value pairs * @param indentString string a string that will be inserted before every generated line * @return string the XML tags corresponding to $additionalElements */ function _createAdditionalElements($elements, $indentString = "", $htmlSupport = FALSE) { $ae = ""; if (is_array($elements)) { foreach ($elements as $key => $value) { if ($value["html"] && $htmlSupport) { $item = new FeedItem(); $item->description = $value["content"]; $item->descriptionHtmlSyndicated = TRUE; $ae .= $indentString . "<{$key}>" . $item->getDescription() . "</{$key}>\n"; } else { $ae .= $indentString . "<{$key}>" . htmlspecialchars($value["content"]) . "</{$key}>\n"; } } } return $ae; }