function formatRow( $row ) { $attribs = array(); $columns = array(); $this->mCurrentRow = $row; $this->mCurrentItem = WikilogItem::newFromRow( $row ); if ( !$this->mCurrentItem->getIsPublished() ) { $attribs['class'] = 'wl-draft'; } foreach ( $this->getFieldNames() as $field => $name ) { $value = isset( $row->$field ) ? $row->$field : null; $formatted = strval( $this->formatValue( $field, $value ) ); if ( $formatted == '' ) { $formatted = WL_NBSP; } $class = 'TablePager_col_' . htmlspecialchars( $field ); $columns[] = "<td class=\"$class\">$formatted</td>"; } return Xml::tags( 'tr', $attribs, implode( "\n", $columns ) ) . "\n"; }
/** * Generates and returns a single feed entry. * @param $row The wikilog comment database entry. * @return A new WlSyndicationEntry object. */ function formatFeedEntry( $row ) { global $wgMimeType; # Create comment object. $item = $this->mSingleItem ? $this->mSingleItem : WikilogItem::newFromRow( $row ); $comment = WikilogComment::newFromRow( $item, $row ); # Prepare some strings. if ( $comment->mUserID ) { $usertext = $comment->mUserText; } else { $usertext = wfMsgForContent( 'wikilog-comment-anonsig', $comment->mUserText, ''/*talk*/, $comment->mAnonName ); } if ( $this->mSingleItem ) { $title = wfMsgForContent( 'wikilog-comment-feed-title1', $comment->mID, $usertext ); } else { $title = wfMsgForContent( 'wikilog-comment-feed-title2', $comment->mID, $usertext, $comment->mItem->mName ); } # Create new syndication entry. $entry = new WlSyndicationEntry( self::makeEntryId( $comment ), $title, $comment->mUpdated, $comment->getCommentArticleTitle()->getFullUrl() ); # Comment text. if ( $comment->mCommentRev ) { list( $article, $parserOutput ) = WikilogUtils::parsedArticle( $comment->mCommentTitle, true ); $content = Sanitizer::removeHTMLcomments( $parserOutput->getText() ); if ( $content ) { $entry->setContent( new WlTextConstruct( 'html', $content ) ); } } # Author. $usertitle = Title::makeTitle( NS_USER, $comment->mUserText ); $useruri = $usertitle->exists() ? $usertitle->getFullUrl() : null; $entry->addAuthor( $usertext, $useruri ); # Timestamp $entry->setPublished( $comment->mTimestamp ); return $entry; }
public function formatRow( $row ) { # Retrieve comment data. $item = $this->mSingleItem ? $this->mSingleItem : WikilogItem::newFromRow( $row ); $comment = WikilogComment::newFromRow( $item, $row ); $comment->loadText(); $doReply = $this->mReplyTrigger && $comment->mID == $this->mReplyTrigger; $html = $this->mFormatter->startCommentThread( $comment ); $html .= $this->mFormatter->formatComment( $comment, $doReply ); if ( $doReply && is_callable( $this->mReplyCallback ) ) { if ( ( $res = call_user_func( $this->mReplyCallback, $comment ) ) ) { $html .= WikilogUtils::wrapDiv( 'wl-indent', $res ); } } return $html; }