/** * 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 ); }