/** * Generate a FeedItem object from a given revision table row * Borrows Recent Changes' feed generation functions for formatting; * includes a diff to the previous revision (if any). * * @param stdClass|array $row Database row * @return FeedItem */ function feedItem($row) { $rev = new Revision($row); $rev->setTitle($this->getTitle()); $text = FeedUtils::formatDiffRow($this->getTitle(), $this->getTitle()->getPreviousRevisionID($rev->getId()), $rev->getId(), $rev->getTimestamp(), $rev->getComment()); if ($rev->getComment() == '') { global $wgContLang; $title = $this->msg('history-feed-item-nocomment', $rev->getUserText(), $wgContLang->timeanddate($rev->getTimestamp()), $wgContLang->date($rev->getTimestamp()), $wgContLang->time($rev->getTimestamp()))->inContentLanguage()->text(); } else { $title = $rev->getUserText() . $this->msg('colon-separator')->inContentLanguage()->text() . FeedItem::stripComment($rev->getComment()); } return new FeedItem($title, $text, $this->getTitle()->getFullURL('diff=' . $rev->getId() . '&oldid=prev'), $rev->getTimestamp(), $rev->getUserText(), $this->getTitle()->getTalkPage()->getFullURL()); }
/** * @param Revision $revision * @return string */ protected function feedItemDesc($revision) { if ($revision) { $msg = wfMessage('colon-separator')->inContentLanguage()->text(); $content = $revision->getContent(); if ($content instanceof TextContent) { // only textual content has a "source view". $html = nl2br(htmlspecialchars($content->getNativeData())); } else { //XXX: we could get an HTML representation of the content via getParserOutput, but that may // contain JS magic and generally may not be suitable for inclusion in a feed. // Perhaps Content should have a getDescriptiveHtml method and/or a getSourceText method. //Compare also FeedUtils::formatDiffRow. $html = ''; } return '<p>' . htmlspecialchars($revision->getUserText()) . $msg . htmlspecialchars(FeedItem::stripComment($revision->getComment())) . "</p>\n<hr />\n<div>" . $html . "</div>"; } return ''; }
protected function feedItemDesc($row) { $revision = Revision::newFromId($row->rev_id); if ($revision) { //XXX: include content model/type in feed item? return '<p>' . htmlspecialchars($revision->getUserText()) . $this->msg('colon-separator')->inContentLanguage()->escaped() . htmlspecialchars(FeedItem::stripComment($revision->getComment())) . "</p>\n<hr />\n<div>" . nl2br(htmlspecialchars($revision->getContent()->serialize())) . "</div>"; } return ''; }
/** * @param $revision Revision * @return string */ protected function feedItemDesc($revision) { if ($revision) { $msg = wfMessage('colon-separator')->inContentLanguage()->text(); return '<p>' . htmlspecialchars($revision->getUserText()) . $msg . htmlspecialchars(FeedItem::stripComment($revision->getComment())) . "</p>\n<hr />\n<div>" . nl2br(htmlspecialchars($revision->getText())) . "</div>"; } return ''; }
protected function feedItemDesc($revision) { if ($revision) { return '<p>' . htmlspecialchars($revision->getUserText()) . wfMsgForContent('colon-separator') . htmlspecialchars(FeedItem::stripComment($revision->getComment())) . "</p>\n<hr />\n<div>" . nl2br(htmlspecialchars($revision->getText())) . "</div>"; } return ''; }
protected function feedItemDesc($row) { $revision = Revision::newFromId($row->rev_id); if ($revision) { return '<p>' . htmlspecialchars($revision->getUserText()) . ': ' . htmlspecialchars(FeedItem::stripComment($revision->getComment())) . "</p>\n<hr />\n<div>" . nl2br(htmlspecialchars($revision->getText())) . "</div>"; } return ''; }
/** * Feed item description and property value output manipulation * * @since 1.8 * * @param array $items * @param string $pageContent * * @return string */ protected function feedItemDescription($items, $pageContent) { return htmlspecialchars(FeedItem::stripComment(implode(',', $items)) . FeedItem::stripComment($pageContent)); }