/** * Returns an array with common header and footer system message * parameters that are used in 'wikilog-comment-header' and * 'wikilog-comment-footer'. * * Note: *Content* language should be used for everything but final * strings (like tooltips). These messages are intended to be customized * by the wiki admin, and we don't want to require changing it for the * 300+ languages suported by MediaWiki. * * Parameters should be HTML-formated. They are substituded using * 'replaceafter' parameter to wfMsgExt(). * * @param $comment Comment. * @return Array with message parameters. */ public function getCommentMsgParams( $comment ) { global $wgContLang; if ( $comment->mUserID ) { $authorPlain = htmlspecialchars( $comment->mUserText ); $authorFmt = wfMsgExt( 'wikilog-simple-signature', array( 'content', 'parseinline', 'replaceafter' ), Xml::wrapClass( $this->mSkin->userLink( $comment->mUserID, $comment->mUserText ), 'wl-comment-author' ), $this->mSkin->userTalkLink( $comment->mUserID, $comment->mUserText ), $comment->mUserText ); } else { $authorPlain = htmlspecialchars( $comment->mAnonName ); $authorFmt = wfMsgForContent( 'wikilog-comment-anonsig', Xml::wrapClass( $this->mSkin->userLink( $comment->mUserID, $comment->mUserText ), 'wl-comment-author' ), $this->mSkin->userTalkLink( $comment->mUserID, $comment->mUserText ), htmlspecialchars( $comment->mAnonName ) ); } list( $date, $time, $tz ) = WikilogUtils::getLocalDateTime( $comment->mTimestamp ); $permalink = $this->getCommentPermalink( $comment, $date, $time, $tz ); $extra = array(); if ( $this->mShowItem && $comment->mItem ) { # Display item title. $extra[] = wfMsgForContent( 'wikilog-comment-note-item', $this->mSkin->link( $comment->mItem->mTitle, $comment->mItem->mName ) ); } if ( $comment->mID && $comment->mCommentTitle && $comment->mCommentTitle->exists() ) { if ( $comment->mUpdated != $comment->mTimestamp ) { # Comment was edited. list( $updDate, $updTime, $updTz ) = WikilogUtils::getLocalDateTime( $comment->mUpdated ); $extra[] = $this->mSkin->link( $comment->mCommentTitle, wfMsgForContent( 'wikilog-comment-note-edited', $updDate, $updTime, $updTz ), array( 'title' => wfMsg( 'wikilog-comment-history' ) ), array( 'action' => 'history' ), 'known' ); } } if ( $extra ) { $extra = wfMsgForContent( 'parentheses', $wgContLang->pipeList( $extra ) ); } else { $extra = ""; } return array( /* $1 */ $authorPlain, /* $2 */ $authorFmt, /* $3 */ $date, /* $4 */ $time, /* $5 */ $permalink, /* $6 */ $extra ); }
/** * Returns an array with common header and footer system message * parameters. */ public function getMsgParams( $extended = false, $pout = null ) { global $wgContLang, $wgWikilogEnableTags; $authors = array_keys( $this->mAuthors ); $authorsFmt = WikilogUtils::authorList( $authors ); $commentsFmt = WikilogUtils::getCommentsWikiText( $this ); $categories = array(); $categoriesFmt = ''; $tags = array(); $tagsFmt = ''; if ( $extended ) { if ( $pout !== null ) { $categories = $pout->getCategoryLinks(); if ( count( $categories ) > 0 ) { $categoriesFmt = wfMsgExt( 'wikilog-summary-categories', array( 'content', 'parsemag' ), count( $categories ), WikilogUtils::categoryList( $categories ) ); } else { $categoriesFmt = wfMsgExt( 'wikilog-summary-uncategorized', array( 'content', 'parsemag' ) ); } } if ( $wgWikilogEnableTags ) { $tags = array_keys( $this->mTags ); $tagsFmt = WikilogUtils::tagList( $tags ); } } list( $date, $time, $tz ) = WikilogUtils::getLocalDateTime( $this->mPubDate ); /* * This is probably the largest amount of parameters to a * system message in MediaWiki. This is the price of allowing * the user to customize the presentation of wikilog articles. */ return array( /* $1 */ $this->mParentTitle->getPrefixedURL(), /* $2 */ $this->mParentName, /* $3 */ $this->mTitle->getPrefixedURL(), /* $4 */ $this->mName, /* $5 */ count( $authors ), /* $6 */ ( count( $authors ) > 0 ? $authors[0] : '' ), /* $7 */ $authorsFmt, /* $8 */ $date, /* $9 */ $time, /* $10 */ $commentsFmt, /* $11 */ count( $categories ), /* $12 */ $categoriesFmt, /* $13 */ count( $tags ), /* $14 */ $tagsFmt, /* $15 */ $tz ); }
function formatRow( $row ) { global $wgParser; # Retrieve article parser output and other data. $item = WikilogItem::newFromRow( $row ); list( $article, $parserOutput ) = WikilogUtils::parsedArticle( $item->mTitle ); list( $summary, $content ) = WikilogUtils::splitSummaryContent( $parserOutput ); if ( empty( $summary ) ) { $summary = $content; $hasMore = false; } else { $hasMore = true; } # Some general data. $authors = WikilogUtils::authorList( array_keys( $item->mAuthors ) ); $tags = implode( wfMsgForContent( 'comma-separator' ), array_keys( $item->mTags ) ); $comments = WikilogUtils::getCommentsWikiText( $item ); $divclass = 'wl-entry' . ( $item->getIsPublished() ? '' : ' wl-draft' ); $itemPubdate = $item->getPublishDate(); list( $publishedDate, $publishedTime, $publishedTz ) = WikilogUtils::getLocalDateTime( $itemPubdate ); $itemUpdated = $item->getUpdatedDate(); list( $updatedDate, $updatedTime, ) = WikilogUtils::getLocalDateTime( $itemUpdated ); # Template parameters. $vars = array( 'class' => $divclass, 'wikilogTitle' => $item->mParentName, 'wikilogPage' => $item->mParentTitle->getPrefixedText(), 'title' => $item->mName, 'page' => $item->mTitle->getPrefixedText(), 'authors' => $authors, 'tags' => $tags, 'published' => $item->getIsPublished() ? '*' : '', 'date' => $publishedDate, 'time' => $publishedTime, 'tz' => $publishedTz, 'updatedDate' => $updatedDate, 'updatedTime' => $updatedTime, 'summary' => $wgParser->insertStripItem( $summary ), 'hasMore' => $hasMore ? '*' : '', 'comments' => $comments ); $frame = $wgParser->getPreprocessor()->newCustomFrame( $vars ); $text = $frame->expand( $this->mTemplate ); return $this->parse( $text ); }