Withoutaname has uploaded a new change for review. https://gerrit.wikimedia.org/r/150157
Change subject: Remove deprecated calls to wfMsg and updated BlogPage special pages ...................................................................... Remove deprecated calls to wfMsg and updated BlogPage special pages * Changed various calls to wfMsg to use either the new wfMessage global function or use SpecialPage::msg(). * Removed various globals from the special pages, changed to use getOutput(), getUser() and getRequest() inherited from SpecialPage. * Declared visibility for functions and variables, assumed public. Change-Id: Ia783a8e6288e72ed5b772c62082b2ba6ced533df --- M BlogHooks.php M BlogPage.php M SpecialArticleLists.php M SpecialArticlesHome.php M SpecialCreateBlogPost.php M TagCloudClass.php 6 files changed, 200 insertions(+), 301 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlogPage refs/changes/57/150157/1 diff --git a/BlogHooks.php b/BlogHooks.php index 9b056d6..c90d98f 100644 --- a/BlogHooks.php +++ b/BlogHooks.php @@ -65,7 +65,7 @@ } if ( !$wgUser->isAllowed( 'edit' ) || $wgUser->isBlocked() ) { - $wgOut->addHTML( wfMsg( 'blog-permission-required' ) ); + $wgOut->addHTML( wfMessage( 'blog-permission-required' )->parse() ); return false; } } @@ -107,8 +107,9 @@ foreach ( $res as $row ) { $ctg = Title::makeTitle( NS_CATEGORY, $row->cl_to ); $ctgname = $ctg->getText(); - $blogCat = wfMsgForContent( 'blog-category' ); - $userBlogCat = wfMsgForContent( 'blog-by-user-category', $blogCat ); + $userBlogCat = wfMessage( 'blog-by-user-category', + wfMessage( 'blog-category' )->inContentLanguage()->text() + )->inContentLanguage()->text(); if( strpos( $ctgname, $userBlogCat ) !== false ) { $user_name = trim( str_replace( $userBlogCat, '', $ctgname ) ); @@ -211,10 +212,10 @@ "Got UserProfile articles for user {$user_name} from DB\n" ); $categoryTitle = Title::newFromText( - wfMsgForContent( + wfMessage( 'blog-by-user-category', - wfMsgForContent( 'blog-category' ) - ) . " {$user_name}" + wfMessage( 'blog-category' )->inContentLanguage()->text() + )->inContentLanguage()->text() . " {$user_name}" ); $dbr = wfGetDB( DB_SLAVE ); @@ -256,30 +257,27 @@ $articleLink = Title::makeTitle( NS_CATEGORY, - wfMsgForContent( + wfMessage( 'blog-by-user-category', - wfMsgForContent( 'blog-category' ) - ) . " {$user_name}" + wfMessage( 'blog-category' )->inContentLanguage()->text() + )->inContentLanguage()->text() . " {$user_name}" ); if ( count( $articles ) > 0 ) { $output .= '<div class="user-section-heading"> <div class="user-section-title">' . - wfMsg( 'blog-user-articles-title' ) . + wfMessage( 'blog-user-articles-title' )->text() . '</div> <div class="user-section-actions"> <div class="action-right">'; if( $articleCount > 5 ) { $output .= '<a href="' . htmlspecialchars( $articleLink->getFullURL() ) . - '" rel="nofollow">' . wfMsg( 'user-view-all' ) . '</a>'; + '" rel="nofollow">' . wfMessage( 'user-view-all' )->text() . '</a>'; } $output .= '</div> - <div class="action-left">' . wfMsgExt( + <div class="action-left">' . wfMessage( 'user-count-separator', - 'parsemag', - count( $articles ), - $articleCount - ) . '</div> + )->numParams( count( $articles ), $articleCount )->text() . '</div> <div class="cleared"></div> </div> </div> @@ -305,22 +303,18 @@ <div class=\"number-of-votes\"> <div class=\"vote-number\">{$voteCount}</div> <div class=\"vote-text\">" . - wfMsgExt( + wfMessage( 'blog-user-articles-votes', - 'parsemag', - $voteCount - ) . + )->numParams( $voteCount )->text() . '</div> </div> <div class="article-title"> <a href="' . htmlspecialchars( $articleTitle->getFullURL() ) . "\">{$articleTitle->getText()}</a> <span class=\"item-small\">" . - wfMsgExt( + wfMessage( 'blog-user-article-comment', - 'parsemag', - $commentCount - ) . '</span> + )->numParams( $commentCount )->text() . '</span> </div> <div class="cleared"></div> </div>'; diff --git a/BlogPage.php b/BlogPage.php index 13ca2a2..aa40d9c 100644 --- a/BlogPage.php +++ b/BlogPage.php @@ -6,16 +6,16 @@ */ class BlogPage extends Article { - var $title = null; - var $authors = array(); + public $title = null; + public $authors = array(); - function __construct( Title $title ) { + public function __construct( Title $title ) { parent::__construct( $title ); $this->setContent(); $this->getAuthors(); } - function setContent() { + public function setContent() { // Get the page content for later use $this->pageContent = $this->getContent(); @@ -36,7 +36,7 @@ } } - function view() { + public function view() { global $wgOut, $wgUser, $wgBlogPageDisplay; wfProfileIn( __METHOD__ ); @@ -63,10 +63,9 @@ $wgOut->addHTML( "\t\t\t\t" . '<div class="blog-left-units">' . "\n" ); $wgOut->addHTML( - "\t\t\t\t\t" . '<h2>' . wfMsgExt( - 'blog-author-title', - 'parsemag', - count( $this->authors ) ) . '</h2>' . "\n" + "\t\t\t\t\t" . '<h2>' . + wfMessage( 'blog-author-title' )->numParams( count( $this->authors ) )->text() . + '</h2>' . "\n" ); // Why was this commented out? --ashley, 11 July 2011 if( count( $this->authors ) > 1 ) { @@ -132,19 +131,20 @@ * Get the authors of this blog post and store them in the authors member * variable. */ - function getAuthors() { + public function getAuthors() { global $wgContLang; $articleText = $this->pageContent; $categoryName = $wgContLang->getNsText( NS_CATEGORY ); - $blogCat = wfMsgForContent( 'blog-category' ); // This unbelievably weak and hacky regex is used to find out the // author's name from the category. See also getBlurb(), which uses a // similar regex. preg_match_all( "/\[\[(?:(?:c|C)ategory|{$categoryName}):\s?" . - wfMsgForContent( 'blog-by-user-category', $blogCat ) . + wfMessage( 'blog-by-user-category', + wfMessage( 'blog-category' )->inContentLanguage()->text() + )->inContentLanguage()->text() . " (.*)\]\]/", $articleText, $matches @@ -201,7 +201,7 @@ * * @return String */ - function getByLine() { + public function getByLine() { global $wgLang; $count = 0; @@ -215,7 +215,7 @@ true ); - $output = '<div class="blog-byline">' . wfMsg( 'blog-by' ) . ' '; + $output = '<div class="blog-byline">' . wfMessage( 'blog-by' )->text() . ' '; $authors = ''; foreach( $this->authors as $author ) { @@ -225,8 +225,8 @@ $authors .= ', '; } if ( $count == count( $this->authors ) && $count != 1 ) { - $authors .= wfMsg( 'word-separator' ) . wfMsg( 'blog-and' ) . - wfMsg( 'word-separator' ); + $authors .= wfMessage( 'word-separator' )->text() . wfMessage( 'blog-and' )->text() . + wfMessage( 'word-separator' )->text(); } $authors .= "<a href=\"{htmlspecialchars( $userTitle->getFullURL() )}\">{$author['user_name']}</a>"; } @@ -237,15 +237,15 @@ $edit_text = ''; if( $create_date != $edit_date ) { - $edit_text = ', ' . wfMsg( 'blog-last-edited', $edit_date ); + $edit_text = ', ' . wfMessage( 'blog-last-edited', $edit_date )->text(); } $output .= "\n" . '<div class="blog-byline-last-edited">' . - wfMsg( 'blog-created', $create_date ) . " {$edit_text}</div>"; + wfMessage( 'blog-created', $create_date )->text() . " {$edit_text}</div>"; return $output; } - function displayMultipleAuthorsMessage() { + public function displayMultipleAuthorsMessage() { $count = 0; $authors = ''; @@ -256,20 +256,20 @@ $authors .= ', '; } if ( $count == count( $this->authors ) ) { - $authors .= wfMsg( 'word-separator' ) . wfMsg( 'blog-and' ) . - wfMsg( 'word-separator' ); + $authors .= wfMessage( 'word-separator' )->text() . wfMessage( 'blog-and' )->text() . + wfMessage( 'word-separator' )->text(); } $authors .= "<a href=\"{htmlspecialchars( $userTitle->getFullURL() )}\">{$author['user_name']}</a>"; } $output = '<div class="multiple-authors-message">' . - wfMsg( 'blog-multiple-authors', $authors ) . + wfMessage( 'blog-multiple-authors', $authors )->text() . '</div>'; return $output; } - function displayAuthorBox( $author_index ) { + public function displayAuthorBox( $author_index ) { global $wgOut, $wgBlogPageDisplay; if ( $wgBlogPageDisplay['author'] == false ) { @@ -332,7 +332,7 @@ return $output; } - function getAuthorArticles( $author_index ) { + public function getAuthorArticles( $author_index ) { global $wgOut, $wgBlogPageDisplay, $wgMemc; if ( $wgBlogPageDisplay['author_articles'] == false ) { @@ -341,11 +341,12 @@ $user_name = $this->authors[$author_index]['user_name']; $user_id = $this->authors[$author_index]['user_id']; - $blogCat = wfMsgForContent( 'blog-category' ); $archiveLink = Title::makeTitle( NS_CATEGORY, - wfMsg( 'blog-by-user-category', $blogCat ) . " {$user_name}" + wfMessage( 'blog-by-user-category', + wfMessage( 'blog-category' )->inContentLanguage()->text() + )->text() . " {$user_name}" ); $articles = array(); @@ -361,7 +362,9 @@ wfDebugLog( 'BlogPage', "Got blog author articles for user {$user_name} from DB" ); $dbr = wfGetDB( DB_SLAVE ); $categoryTitle = Title::newFromText( - wfMsg( 'blog-by-user-category', $blogCat ) . " {$user_name}" + wfMessage( 'blog-by-user-category', + wfMessage( 'blog-category' )->inContentLanguage()->text() + )->text() . " {$user_name}" ); $res = $dbr->select( array( 'page', 'categorylinks'), @@ -410,7 +413,7 @@ } $output .= "<div class=\"more-container{$css_fix}\"> - <h3>" . wfMsg( 'blog-author-more-by', $user_name ) . '</h3>'; + <h3>" . wfMessage( 'blog-author-more-by', $user_name )->text() . '</h3>'; $x = 1; @@ -420,16 +423,14 @@ $output .= '<div class="author-article-item"> <a href="' . htmlspecialchars( $articleTitle->getFullURL() ) . "\">{$articleTitle->getText()}</a> <div class=\"author-item-small\">" . - wfMsgExt( + wfMessage( 'blog-author-votes', - 'parsemag', BlogPage::getVotesForPage( $article['page_id'] ) - ) . ', ' . - wfMsgExt( + )->text() . ', ' . + wfMessage( 'blog-author-comments', - 'parsemag', BlogPage::getCommentsForPage( $article['page_id'] ) - ) . + )->text() . '</div> </div>'; @@ -438,7 +439,7 @@ $output .= '<div class="author-archive-link"> <a href="' . htmlspecialchars( $archiveLink->getFullURL() ) . '">' . - wfMsg( 'blog-view-archive-link' ) . + wfMessage( 'blog-view-archive-link' )->text() . '</a> </div> </div>'; @@ -453,7 +454,7 @@ * * @return Array: array containing each editors' user ID and user name */ - function getEditorsList() { + public function getEditorsList() { global $wgMemc; $pageTitleId = $this->getId(); @@ -508,7 +509,7 @@ * * @return String: HTML or nothing */ - function recentEditors() { + public function recentEditors() { global $wgUploadPath, $wgBlogPageDisplay; if ( $wgBlogPageDisplay['recent_editors'] == false ) { @@ -521,8 +522,8 @@ if ( count( $editors ) > 0 ) { $output .= '<div class="recent-container"> - <h2>' . wfMsg( 'blog-recent-editors' ) . '</h2> - <div>' . wfMsg( 'blog-recent-editors-message' ) . '</div>'; + <h2>' . wfMessage( 'blog-recent-editors' )->text() . '</h2> + <div>' . wfMessage( 'blog-recent-editors-message' )->text() . '</div>'; foreach( $editors as $editor ) { $avatar = new wAvatar( $editor['user_id'], 'm' ); @@ -545,7 +546,7 @@ * * @return Array: array containing each voters' user ID and user name */ - function getVotersList() { + public function getVotersList() { global $wgMemc; // Gets the page ID for the query @@ -600,7 +601,7 @@ * * @return String: HTML or nothing */ - function recentVoters() { + public function recentVoters() { global $wgBlogPageDisplay; if ( $wgBlogPageDisplay['recent_voters'] == false ) { @@ -613,8 +614,8 @@ if( count( $voters ) > 0 ) { $output .= '<div class="recent-container bottom-fix"> - <h2>' . wfMsg( 'blog-recent-voters' ) . '</h2> - <div>' . wfMsg( 'blog-recent-voters-message' ) . '</div>'; + <h2>' . wfMessage( 'blog-recent-voters' )->text() . '</h2> + <div>' . wfMessage( 'blog-recent-voters-message' )->text() . '</div>'; foreach( $voters as $voter ) { $userTitle = Title::makeTitle( NS_USER, $voter['user_name'] ); @@ -635,7 +636,7 @@ * * @return String: HTML or nothing */ - function embedWidget() { + public function embedWidget() { global $wgBlogPageDisplay, $wgServer, $wgScriptPath; // Not enabled? ContentWidget not available? @@ -651,7 +652,7 @@ $output = ''; $output .= '<div class="recent-container bottom-fix"><h2>' . - wfMsg( 'blog-embed-title' ) . '</h2>'; + wfMessage( 'blog-embed-title' )->text() . '</h2>'; $output .= '<div class="blog-widget-embed">'; $output .= "<p><input type='text' size='20' onclick='this.select();' value='" . '<object width="300" height="450" id="content_widget" align="middle"> <param name="movie" value="content_widget.swf" /><embed src="' . @@ -668,7 +669,7 @@ * * @return String: HTML or nothing */ - function leftAdUnit() { + public function leftAdUnit() { global $wgBlogPageDisplay; if ( $wgBlogPageDisplay['left_ad'] == false ) { @@ -688,7 +689,7 @@ * * @return String: HTML or nothing */ - function getInTheNews() { + public function getInTheNews() { global $wgBlogPageDisplay, $wgMemc, $wgOut; if ( $wgBlogPageDisplay['in_the_news'] == false ) { @@ -696,12 +697,12 @@ } $output = ''; - $message = wfMsgForContent( 'inthenews' ); - if ( !wfEmptyMsg( 'inthenews', $message ) ) { - $newsArray = explode( "\n\n", $message ); + $message = wfMessage( 'inthenews' )->inContentLanguage(); + if ( !$message->isBlank() ) { + $newsArray = explode( "\n\n", $message->text() ); $newsItem = $newsArray[array_rand( $newsArray )]; $output = '<div class="blog-container"> - <h2>' . wfMsg( 'blog-in-the-news' ) . '</h2> + <h2>' . wfMessage( 'blog-in-the-news' )->text() . '</h2> <div>' . $wgOut->parse( $newsItem, false ) . '</div> </div>'; } @@ -715,7 +716,7 @@ * * @return String: HTML or nothing */ - function getPopularArticles() { + public function getPopularArticles() { global $wgMemc, $wgBlogPageDisplay; if ( $wgBlogPageDisplay['popular_articles'] == false ) { @@ -731,7 +732,7 @@ $popularBlogPosts = $data; } else { wfDebugLog( 'BlogPage', 'Got popular articles from DB' ); - $blogCat = wfMsgForContent( 'blog-category' ); + $blogCat = wfMessage( 'blog-category' )->inContentLanguage()->text(); $dbr = wfGetDB( DB_SLAVE ); // Code sporked from Rob Church's NewestPages extension // @todo FIXME: adding categorylinks table and that one where @@ -792,7 +793,7 @@ $html .= '</div>'; // .listpages-container $output = '<div class="blog-container"> - <h2>' . wfMsg( 'blog-popular-articles' ) . '</h2> + <h2>' . wfMessage( 'blog-popular-articles' )->text() . '</h2> <div>' . $html . '</div> </div>'; @@ -805,7 +806,7 @@ * * @return String: HTML or nothing */ - function getNewArticles() { + public function getNewArticles() { global $wgOut, $wgMemc, $wgBlogPageDisplay; if ( $wgBlogPageDisplay['new_articles'] == false ) { @@ -824,7 +825,7 @@ // We could do complicated LIKE stuff with the categorylinks table, // but I think we can safely assume that stuff in the NS_BLOG NS // is blog-related :) - //$blogCat = wfMsgForContent( 'blog-category' ); + //$blogCat = wfMessage( 'blog-category' )->inContentLanguage()->text(); $dbr = wfGetDB( DB_SLAVE ); // Code sporked from Rob Church's NewestPages extension $res = $dbr->select( @@ -859,7 +860,7 @@ $html .= '</div>'; // .listpages-container $output = '<div class="blog-container bottom-fix"> - <h2>' . wfMsg( 'blog-new-articles' ) . '</h2> + <h2>' . wfMessage( 'blog-new-articles' )->text() . '</h2> <div>' . $html . '</div> </div>'; @@ -872,7 +873,7 @@ * * @return String: HTML or nothing */ - function getRandomCasualGame() { + public function getRandomCasualGame() { global $wgBlogPageDisplay; if ( @@ -892,7 +893,7 @@ * * @return String: HTML or nothing */ - function getCommentsOfTheDay() { + public function getCommentsOfTheDay() { global $wgBlogPageDisplay, $wgMemc, $wgLang; if ( $wgBlogPageDisplay['comments_of_day'] == false ) { @@ -953,7 +954,7 @@ if( $comment['user_id'] != 0 ) { $commentPosterDisplay = $comment['user_name']; } else { - $commentPosterDisplay = wfMsg( 'blog-anonymous-name' ); + $commentPosterDisplay = wfMessage( 'blog-anonymous-name' )->text(); } $comment['comment_text'] = strip_tags( $comment['comment_text'] ); @@ -970,7 +971,7 @@ if ( count( $comments ) > 0 ) { $output = '<div class="blog-container"> - <h2>' . wfMsg( 'blog-comments-of-day' ) . '</h2>' . + <h2>' . wfMessage( 'blog-comments-of-day' )->text() . '</h2>' . $output . '</div>'; } @@ -1126,7 +1127,7 @@ $blurbText = preg_replace( '/[\n\r\t]/', ' ', $blurbText ); // replace any non-space whitespace with a space return $blurbFont . $blurbText. '. . . <a href="' . - htmlspecialchars( $title->getFullURL() ) . '">' . wfMsg( 'blog-more' ) . + htmlspecialchars( $title->getFullURL() ) . '">' . wfMessage( 'blog-more' )->text() . '</a></span>'; } @@ -1165,7 +1166,7 @@ * You probably have seen these in UserBoard, Comments...god knows where. * Seriously, this stuff is all over the place. */ - static function dateDiff( $date1, $date2 ) { + public static function dateDiff( $date1, $date2 ) { $dtDiff = $date1 - $date2; $totalDays = intval( $dtDiff / ( 24 * 60 * 60 ) ); @@ -1179,10 +1180,10 @@ return $dif; } - static function getTimeOffset( $time, $timeabrv, $timename ) { + public static function getTimeOffset( $time, $timeabrv, $timename ) { $timeStr = ''; if( $time[$timeabrv] > 0 ) { - $timeStr = wfMsgExt( "blog-time-{$timename}", 'parsemag', $time[$timeabrv] ); + $timeStr = wfMessage( "blog-time-{$timename}", $time[$timeabrv] )->text(); } if( $timeStr ) { $timeStr .= ' '; @@ -1190,7 +1191,7 @@ return $timeStr; } - static function getTimeAgo( $time ) { + public static function getTimeAgo( $time ) { $timeArray = self::dateDiff( time(), $time ); $timeStr = ''; $timeStrD = self::getTimeOffset( $timeArray, 'd', 'days' ); @@ -1206,7 +1207,7 @@ } } if( !$timeStr ) { - $timeStr = wfMsgExt( 'blog-time-seconds', 'parsemag', 1 ); + $timeStr = wfMessage( 'blog-time-seconds' )->numParams( 1 )->text(); } return $timeStr; } diff --git a/SpecialArticleLists.php b/SpecialArticleLists.php index b7deff1..e3978c0 100644 --- a/SpecialArticleLists.php +++ b/SpecialArticleLists.php @@ -20,9 +20,9 @@ * @param $limit Integer: show this many entries (LIMIT for SQL) */ public function execute( $limit ) { - global $wgMemc, $wgOut, $wgScriptPath; + global $wgMemc, $wgScriptPath; - $wgOut->setPageTitle( wfMsg( 'ah-new-articles' ) ); + $this->getOutput()->setPageTitle( $this->msg( 'ah-new-articles' )->text() ); if ( empty( $limit ) ) { $limit = 25; @@ -34,13 +34,13 @@ // @todo FIXME: this should be loaded when including the special page, // too, but if ( $this->including() ) does nothing, prolly because of // the parser cache - $wgOut->addModules( 'ext.blogPage.articlesHome' ); + $this->getOutput()->addModules( 'ext.blogPage.articlesHome' ); $imgPath = $wgScriptPath . '/extensions/BlogPage/images/'; $output = '<div class="left-articles">'; if ( !$this->including() ) { - $output .= '<h2>' . wfMsg( 'ah-new-articles' ) . '</h2>'; + $output .= '<h2>' . $this->msg( 'ah-new-articles' )->text() . '</h2>'; } // Try cache first @@ -81,7 +81,7 @@ $output .= '<div class="listpages-container">' . "\n"; if ( empty( $newBlogPosts ) ) { - $output .= wfMsg( 'ah-no-results' ); + $output .= $this->msg( 'ah-no-results' )->text(); } else { foreach( $newBlogPosts as $newBlogPost ) { $titleObj = Title::makeTitle( NS_BLOG, $newBlogPost['title'] ); @@ -110,17 +110,15 @@ '</div><!-- .listpages-blurb --> <div class="listpages-stats">' . "\n"; $output .= "<img src=\"{$imgPath}voteIcon.gif\" alt=\"\" border=\"0\" /> " . - wfMsgExt( + $this->msg( 'blog-author-votes', - 'parsemag', BlogPage::getVotesForPage( $newBlogPost['id'] ) - ); + )->text(); $output .= " <img src=\"{$imgPath}comment.gif\" alt=\"\" border=\"0\" /> " . - wfMsgExt( + $this->msg( 'blog-author-comments', - 'parsemag', BlogPage::getCommentsForPage( $newBlogPost['id'] ) - ) . '</div><!-- . listpages-stats --> + )->text() . '</div><!-- . listpages-stats --> </div><!-- .listpages-item --> <div class="cleared"></div>' . "\n"; } @@ -128,7 +126,7 @@ $output .= '</div>' . "\n"; // .listpages-container $output .= '</div>' . "\n"; // .left-articles - $wgOut->addHTML( $output ); + $this->getOutput()->addHTML( $output ); } } \ No newline at end of file diff --git a/SpecialArticlesHome.php b/SpecialArticlesHome.php index 771052a..58075aa 100644 --- a/SpecialArticlesHome.php +++ b/SpecialArticlesHome.php @@ -25,12 +25,12 @@ * @param $type String: what kind of articles to show? Default is 'popular' */ public function execute( $type ) { - global $wgContLang, $wgOut, $wgScriptPath, $wgSupressPageTitle; + global $wgContLang, $wgScriptPath, $wgSupressPageTitle; $wgSupressPageTitle = true; // Add CSS - $wgOut->addModules( 'ext.blogPage.articlesHome' ); + $this->getOutput()->addModules( 'ext.blogPage.articlesHome' ); if( !$type ) { $type = 'popular'; @@ -48,14 +48,14 @@ // Determine the page title and set it if ( $type == 'popular' ) { - $name = wfMsg( 'ah-popular-articles' ); - $name_right = wfMsg( 'ah-new-articles' ); + $name = $this->msg( 'ah-popular-articles' )->text(); + $name_right = $this->msg( 'ah-new-articles' )->text(); } else { - $name = wfMsg( 'ah-new-articles' ); - $name_right = wfMsg( 'ah-popular-articles' ); + $name = $this->msg( 'ah-new-articles' )->text(); + $name_right = $this->msg( 'ah-popular-articles' )->text(); } - $wgOut->setPageTitle( $name ); + $this->getOutput()->setPageTitle( $name ); $today = $wgContLang->date( wfTimestampNow() ); @@ -63,16 +63,16 @@ $output = '<div class="main-page-left">'; $output .= '<div class="logged-in-articles">'; $output .= '<h2>' . $name . '</h2>'; - //$output .= '<h2>' . $name . ' <span class="rss-feed"><a href="http://feeds.feedburner.com/Armchairgm"><img src="http://www.armchairgm.com/images/a/a7/Rss-icon.gif" border="0" alt="RSS" /></a> ' . wfMsg( 'ah-feed-rss' ) . '</span></h2>'; + //$output .= '<h2>' . $name . ' <span class="rss-feed"><a href="http://feeds.feedburner.com/Armchairgm"><img src="http://www.armchairgm.com/images/a/a7/Rss-icon.gif" border="0" alt="RSS" /></a> ' . $this->msg( 'ah-feed-rss' )->text() . '</span></h2>'; $output .= '<p class="main-page-sub-links"><a href="' . htmlspecialchars( SpecialPage::getTitleFor( 'CreateBlogPost' )->getFullURL() ) . '">' . - wfMsg( 'ah-write-article' ) . '</a> - <a href="' . + $this->msg( 'ah-write-article' )->text() . '</a> - <a href="' . // original used date( 'F j, Y' ) which returned something like // December 5, 2008 htmlspecialchars( Title::makeTitle( NS_CATEGORY, $today )->getFullURL() ) . '">' . - wfMsg( 'ah-todays-articles' ) . '</a> - <a href="' . + $this->msg( 'ah-todays-articles' )->text() . '</a> - <a href="' . htmlspecialchars( Title::newMainPage()->getFullURL() ) . '">' . - wfMsg( 'mainpage' ) . '</a></p>' . "\n\n"; + $this->msg( 'mainpage' )->text() . '</a></p>' . "\n\n"; if ( $type == 'popular' ) { $output .= $this->getPopularPosts(); @@ -100,20 +100,20 @@ // Most Votes $output .= '<div class="side-articles">'; - $output .= '<h2>' . wfMsg( 'ah-most-votes' ) . '</h2>'; + $output .= '<h2>' . $this->msg( 'ah-most-votes' )->text() . '</h2>'; $output .= $this->displayMostVotedPages( $date_categories ); $output .= '</div>'; // Most Comments $output .= '<div class="side-articles">'; - $output .= '<h2>' . wfMsg( 'ah-what-talking-about' ) . '</h2>'; + $output .= '<h2>' . $this->msg( 'ah-what-talking-about' )->text() . '</h2>'; $output .= $this->displayMostCommentedPages( $date_categories ); $output .= '</div>'; $output .= '</div>'; $output .= '<div class="cleared"></div>'; - $wgOut->addHTML( $output ); + $this->getOutput()->addHTML( $output ); } /** @@ -121,7 +121,7 @@ * @return Array: array containing today and the past $numberOfDays days in * the wiki's content language */ - function getDatesFromElapsedDays( $numberOfDays ) { + public function getDatesFromElapsedDays( $numberOfDays ) { global $wgContLang; $today = $wgContLang->date( wfTimestampNow() ); // originally date( 'F j, Y', time() ) $dates[$today] = 1; // Gets today's date string @@ -199,7 +199,7 @@ $output = '<div class="listpages-container">'; if ( empty( $popularBlogPosts ) ) { - $output .= wfMsg( 'ah-no-results' ); + $output .= $this->msg( 'ah-no-results' )->text(); } else { foreach( $popularBlogPosts as $popularBlogPost ) { $titleObj = Title::makeTitle( NS_BLOG, $popularBlogPost['title'] ); @@ -220,14 +220,14 @@ $titleObj->getText() . '</a> <div class="listpages-date">'; - $output .= '(' . wfMsg( 'blog-created-ago', + $output .= '(' . $this->msg( 'blog-created-ago', BlogPage::getTimeAgo( // need to strtotime() it because getCreateDate() now // returns the raw timestamp from the database; in the past // it converted it to UNIX timestamp via the SQL function // UNIX_TIMESTAMP but that was no good for our purposes strtotime( BlogPage::getCreateDate( $popularBlogPost['id'] ) ) - ) ) . ')'; + ) )->text() . ')'; $output .= "</div> <div class=\"listpages-blurb\">\n" . BlogPage::getBlurb( @@ -238,17 +238,15 @@ '</div><!-- .listpages-blurb --> <div class="listpages-stats">' . "\n"; $output .= "<img src=\"{$imgPath}voteIcon.gif\" alt=\"\" border=\"0\" /> " . - wfMsgExt( + $this->msg( 'blog-author-votes', - 'parsemag', BlogPage::getVotesForPage( $popularBlogPost['id'] ) - ); + )->text(); $output .= " <img src=\"{$imgPath}comment.gif\" alt=\"\" border=\"0\" /> " . - wfMsgExt( + $this->msg( 'blog-author-comments', - 'parsemag', BlogPage::getCommentsForPage( $popularBlogPost['id'] ) - ) . '</div><!-- . listpages-stats --> + )->text() . '</div><!-- . listpages-stats --> </div><!-- .listpages-item --> <div class="cleared"></div>' . "\n"; } @@ -266,7 +264,7 @@ * by commas * @return String: HTML */ - function displayMostVotedPages( $dateCategories ) { + public function displayMostVotedPages( $dateCategories ) { global $wgMemc; // Try cache first @@ -321,35 +319,7 @@ } // Here we output HTML - $output = '<div class="listpages-container">' . "\n"; - - if ( empty( $votedBlogPosts ) ) { - $output .= wfMsg( 'ah-no-results' ); - } else { - foreach ( $votedBlogPosts as $votedBlogPost ) { - $titleObj = Title::makeTitle( NS_BLOG, $votedBlogPost['title'] ); - $votes = BlogPage::getVotesForPage( $votedBlogPost['id'] ); - $output .= '<div class="listpages-item">' . "\n"; - $output .= '<div class="listpages-votebox">' . "\n"; - $output .= '<div class="listpages-votebox-number">' . - $votes . "</div>\n"; - $output .= '<div class="listpages-votebox-text">' . - wfMsgExt( - 'blog-author-votes', - 'parsemag', - $votes - ) . "</div>\n"; // .listpages-votebox-text - $output .= '</div>' . "\n"; // .listpages-votebox - $output .= '</div>' . "\n"; // .listpages-item - $output .= '<a href="' . htmlspecialchars( $titleObj->getFullURL() ) . '">' . - $titleObj->getText() . '</a>'; - $output .= '<div class="cleared"></div>'; - } - } - - $output .= "</div>\n"; // .listpages-container - - return $output; + return $this->getBlogPostDisplay( $votedBlogPosts ); } /** @@ -359,7 +329,7 @@ * by commas * @return String: HTML */ - function displayMostCommentedPages( $dateCategories ) { + public function displayMostCommentedPages( $dateCategories ) { global $wgMemc; // Try cache first @@ -413,30 +383,7 @@ $wgMemc->set( $key, $commentedBlogPosts, 60 * 15 ); } - $output = '<div class="listpages-container">'; - - if ( empty( $commentedBlogPosts ) ) { - $output .= wfMsg( 'ah-no-results' ); - } else { - foreach( $commentedBlogPosts as $commentedBlogPost ) { - $titleObj = Title::makeTitle( NS_BLOG, $commentedBlogPost['title'] ); - $output .= '<div class="listpages-item"> - <div class="listpages-votebox"> - <div class="listpages-commentbox-number">' . - BlogPage::getCommentsForPage( $commentedBlogPost['id'] ) . - '</div> - </div> - <a href="' . htmlspecialchars( $titleObj->getFullURL() ) . '">' . - $titleObj->getText() . - '</a> - </div><!-- .listpages-item --> - <div class="cleared"></div>' . "\n"; - } - } - - $output .= '</div>' . "\n"; // .listpages-container - - return $output; + return $this->getBlogPostDisplay( $commentedBlogPosts ); } /** @@ -445,7 +392,7 @@ * * @return String: HTML */ - function displayNewestPages() { + public function displayNewestPages() { global $wgMemc; // Try cache first @@ -483,34 +430,7 @@ $wgMemc->set( $key, $newBlogPosts, 60 * 15 ); } - $output = '<div class="listpages-container">' . "\n"; - if ( empty( $newBlogPosts ) ) { - $output .= wfMsg( 'ah-no-results' ); - } else { - foreach( $newBlogPosts as $newBlogPost ) { - $titleObj = Title::makeTitle( NS_BLOG, $newBlogPost['title'] ); - $votes = BlogPage::getVotesForPage( $newBlogPost['id'] ); - $output .= "\t\t\t\t" . '<div class="listpages-item">'; - $output .= '<div class="listpages-votebox">' . "\n"; - $output .= '<div class="listpages-votebox-number">' . - $votes . - "</div>\n"; // .listpages-votebox-number - $output .= '<div class="listpages-votebox-text">' . - wfMsgExt( - 'blog-author-votes', - 'parsemag', - $votes - ) . "</div>\n"; // .listpages-votebox-text - $output .= "</div>\n"; // .listpages-votebox - $output .= '<a href="' . htmlspecialchars( $titleObj->getFullURL() ) . '">' . - $titleObj->getText() . - '</a> - </div><!-- .listpages-item --> - <div class="cleared"></div>' . "\n"; - } - } - $output .= '</div>' . "\n"; // .listpages-container - return $output; + return $this->getBlogPostDisplay( $newBlogPosts ); } /** @@ -567,7 +487,7 @@ $output = '<div class="listpages-container">'; if ( empty( $newestBlogPosts ) ) { - $output .= wfMsg( 'ah-no-results' ); + $output .= $this->msg( 'ah-no-results' ); } else { foreach( $newestBlogPosts as $newestBlogPost ) { $titleObj = Title::makeTitle( NS_BLOG, $newestBlogPost['title'] ); @@ -588,14 +508,14 @@ $titleObj->getText() . '</a> <div class="listpages-date">'; - $output .= '(' . wfMsg( 'blog-created-ago', + $output .= '(' . $this->msg( 'blog-created-ago', BlogPage::getTimeAgo( // need to strtotime() it because getCreateDate() now // returns the raw timestamp from the database; in the past // it converted it to UNIX timestamp via the SQL function // UNIX_TIMESTAMP but that was no good for our purposes strtotime( BlogPage::getCreateDate( $newestBlogPost['id'] ) ) - ) ) . ')'; + ) )->text() . ')'; $output .= "</div> <div class=\"listpages-blurb\">\n" . BlogPage::getBlurb( @@ -606,17 +526,15 @@ '</div><!-- .listpages-blurb --> <div class="listpages-stats">' . "\n"; $output .= "<img src=\"{$imgPath}voteIcon.gif\" alt=\"\" border=\"0\" /> " . - wfMsgExt( + $this->msg( 'blog-author-votes', - 'parsemag', BlogPage::getVotesForPage( $newestBlogPost['id'] ) - ); + )->text(); $output .= " <img src=\"{$imgPath}comment.gif\" alt=\"\" border=\"0\" /> " . - wfMsgExt( + $this->msg( 'blog-author-comments', - 'parsemag', BlogPage::getCommentsForPage( $newestBlogPost['id'] ) - ) . '</div><!-- . listpages-stats --> + )->text() . '</div><!-- . listpages-stats --> </div><!-- .listpages-item --> <div class="cleared"></div>' . "\n"; } @@ -694,23 +612,31 @@ $wgMemc->set( $key, $popularBlogPosts, 60 * 15 ); } + return $this->getBlogPostDisplay( $popularBlogPosts ); + } + + /** + * @param array $blogposts + * + * @return string + */ + private function getBlogPostDisplay( array $blogposts ) { $output = '<div class="listpages-container">'; - if ( empty( $popularBlogPosts ) ) { - $output .= wfMsg( 'ah-no-results' ); + if ( empty( $blogposts ) ) { + $output .= $this->msg( 'ah-no-results' )->text(); } else { - foreach( $popularBlogPosts as $popularBlogPost ) { - $titleObj = Title::makeTitle( NS_BLOG, $popularBlogPost['title'] ); - $votes = BlogPage::getVotesForPage( $popularBlogPost['id'] ); + foreach( $blogposts as $blogpost ) { + $titleObj = Title::makeTitle( NS_BLOG, $blogposts['title'] ); + $votes = BlogPage::getVotesForPage( $blogpost['id'] ); $output .= '<div class="listpages-item">'; $output .= '<div class="listpages-votebox">' . "\n"; $output .= '<div class="listpages-votebox-number">' . $votes . "</div>\n"; $output .= '<div class="listpages-votebox-text">' . - wfMsgExt( + $this->msg( 'blog-author-votes', - 'parsemag', $votes - ) . "</div>\n"; // .listpages-votebox-text + )->text() . "</div>\n"; // .listpages-votebox-text $output .= '</div>' . "\n"; // .listpages-votebox $output .= '<a href="' . htmlspecialchars( $titleObj->getFullURL() ) . '">' . $titleObj->getText() . @@ -719,9 +645,8 @@ <div class="cleared"></div>' . "\n"; } } - $output .= '</div>' . "\n"; // .listpages-container return $output; } -} \ No newline at end of file +} diff --git a/SpecialCreateBlogPost.php b/SpecialCreateBlogPost.php index f385055..bb80af9 100644 --- a/SpecialCreateBlogPost.php +++ b/SpecialCreateBlogPost.php @@ -24,50 +24,43 @@ * @param $par Mixed: parameter passed to the special page or null */ public function execute( $par ) { - global $wgOut, $wgUser, $wgRequest, $wgContLang; + global $wgContLang; // If the user can't create blog posts, display an error - if( !$wgUser->isAllowed( 'createblogpost' ) ) { - $wgOut->permissionRequired( 'createblogpost' ); - return; - } + $this->checkPermissions(); // Show a message if the database is in read-only mode - if ( wfReadOnly() ) { - $wgOut->readOnlyPage(); - return; - } + $this->checkReadOnly(); // If user is blocked, s/he doesn't need to access this page - if( $wgUser->isBlocked() ) { - $wgOut->blockedPage( false ); - return false; + if( $this->getUser()->isBlocked() ) { + throw new UserBlockedError( $this->getUser()->getBlock() ); } // Set page title, robot policies, etc. $this->setHeaders(); // Add CSS & JS - $wgOut->addModules( 'ext.blogPage.create' ); + $this->getOutput()->addModules( 'ext.blogPage.create' ); // If the request was POSTed, we haven't submitted a request yet AND // we have a title, create the page...otherwise just display the // creation form if( - $wgRequest->wasPosted() && + $this->getRequest()->wasPosted() && $_SESSION['alreadysubmitted'] == false ) { $_SESSION['alreadysubmitted'] = true; // Protect against cross-site request forgery (CSRF) - if ( !$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { - $wgOut->addHTML( wfMsg( 'sessionfailure' ) ); + if ( !$this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) { + $this->getOutput()->addHTML( $this->msg( 'sessionfailure' )->text() ); return; } // Create a Title object, or try to, anyway - $userSuppliedTitle = $wgRequest->getVal( 'title2' ); + $userSuppliedTitle = $this->getRequest()->getVal( 'title2' ); $title = Title::makeTitleSafe( NS_BLOG, $userSuppliedTitle ); // @todo CHECKME: are these still needed? The JS performs these @@ -75,18 +68,12 @@ // The user didn't supply a title? Ask them to supply one. if ( !$userSuppliedTitle ) { - $wgOut->setPageTitle( wfMsg( 'errorpagetitle' ) ); - $wgOut->addWikiMsg( 'blog-create-error-need-title' ); - $wgOut->addReturnTo( $this->getPageTitle() ); - return; + throw new ErrorPageError( 'errorpagetitle', 'blog-create-error-need-title' ); } // The user didn't supply the blog post text? Ask them to supply it. - if ( !$wgRequest->getVal( 'pageBody' ) ) { - $wgOut->setPageTitle( wfMsg( 'errorpagetitle' ) ); - $wgOut->addWikiMsg( 'blog-create-error-need-content' ); - $wgOut->addReturnTo( $this->getPageTitle() ); - return; + if ( !$this->getRequest()->getVal( 'pageBody' ) ) { + throw new ErrorPageError( 'errorpagetitle', 'blog-create-error-need-content' ); } // Localized variables that will be used when creating the page @@ -96,10 +83,7 @@ // Create the blog page if it doesn't already exist $article = new Article( $title, 0 ); if ( $article->exists() ) { - $wgOut->setPageTitle( wfMsg( 'errorpagetitle' ) ); - $wgOut->addWikiMsg( 'blog-create-error-page-exists' ); - $wgOut->addReturnTo( $this->getPageTitle() ); - return; + throw new ErrorPageError( 'errorpagetitle', 'blog-create-error-page-exists' ); } else { // The blog post will be by default categorized into two // categories, "Articles by User $1" and "(today's date)", @@ -107,15 +91,16 @@ // we need to take those into account, too. $categories = array( '[[' . $localizedCatNS . ':' . - wfMsgForContent( + $this->msg( 'blog-by-user-category', - wfMsgForContent( 'blog-category' ) - ) . wfMsgForContent( 'word-separator' ) . - $wgUser->getName() . ']]', + $this->msg( 'blog-category' )->inContentLanguage()->text() + )->inContentLanguage()->text() . + $this->msg( 'word-separator' )->inContentLanguage()->text() . + $this->getUser()->getName() . ']]', "[[{$localizedCatNS}:{$today}]]" ); - $userSuppliedCategories = $wgRequest->getVal( 'pageCtg' ); + $userSuppliedCategories = $this->getRequest()->getVal( 'pageCtg' ); if ( !empty( $userSuppliedCategories ) ) { // Explode along commas so that we will have an array that // we can loop over @@ -137,10 +122,10 @@ // here and Template:Blog Bottom at the bottom, where we // have the comments tag right now '<vote />' . "\n" . '<!--start text-->' . "\n" . - $wgRequest->getVal( 'pageBody' ) . "\n\n" . + $this->getRequest()->getVal( 'pageBody' ) . "\n\n" . '<comments />' . "\n\n" . $wikitextCategories . "\n__NOEDITSECTION__", - wfMsgForContent( 'blog-create-summary' ) + $this->msg( 'blog-create-summary' )->inContentLanguage()->text() ); $articleId = $article->getID(); @@ -156,7 +141,7 @@ $vote = new Vote( $articleId ); $vote->insert( 1 ); - $stats = new UserStatsTrack( $wgUser->getID(), $wgUser->getName() ); + $stats = new UserStatsTrack( $this->getUser()->getID(), $this->getUser()->getName() ); $stats->updateWeeklyPoints( $stats->point_values['opinions_created'] ); $stats->updateMonthlyPoints( $stats->point_values['opinions_created'] ); //if( $wgEnableFacebook ) { @@ -170,7 +155,7 @@ //} // Redirect the user to the new blog post they just created - $wgOut->redirect( $title->getFullURL() ); + $this->getOutput()->redirect( $title->getFullURL() ); } } else { $_SESSION['alreadysubmitted'] = false; @@ -179,17 +164,16 @@ $output = ''; // Show the blog rules, if the message containing them ain't empty - $message = trim( wfMsgExt( 'blog-create-rules', array( 'parse', 'content' ) ) ); - // Yes, the strlen() is needed, I dunno why wfEmptyMsg() won't work - if( !wfEmptyMsg( 'blog-create-rules', $message ) && strlen( $message ) > 0 ) { - $output .= $message . '<br />'; + $message = $this->msg( 'blog-create-rules' )->inContentLanguage(); + if( !$message->isBlank() ) { + $output .= $message->parse() . '<br />'; } // Main form $output .= $this->displayForm(); // Show everything to the user - $wgOut->addHTML( $output ); + $this->getOutput()->addHTML( $output ); } } @@ -197,8 +181,8 @@ * Show the input field where the user can enter the blog post title. * @return String: HTML */ - function displayFormPageTitle() { - $output = '<span class="create-title">' . wfMsg( 'blog-create-title' ) . + public function displayFormPageTitle() { + $output = '<span class="create-title">' . $this->msg( 'blog-create-title' )->text() . '</span><br /><input class="createbox" type="text" tabindex="' . $this->tabCounter . '" name="title2" id="title" style="width: 500px;"><br /><br />'; $this->tabCounter++; @@ -209,8 +193,8 @@ * Show the input field where the user can enter the blog post body. * @return String: HTML */ - function displayFormPageText() { - $output = '<span class="create-title">' . wfMsg( 'blog-create-text' ) . + public function displayFormPageText() { + $output = '<span class="create-title">' . $this->msg( 'blog-create-text' )->text() . '</span><br />'; // The EditPage toolbar wasn't originally present here but I figured // that adding it might be more helpful than anything else. @@ -229,15 +213,15 @@ * Show the category cloud. * @return String: HTML */ - function displayFormPageCategories() { + public function displayFormPageCategories() { $cloud = new BlogTagCloud( 20 ); $tagcloud = '<div id="create-tagcloud">'; $tagnumber = 0; foreach ( $cloud->tags as $tag => $att ) { $tag = trim( $tag ); - $blogUserCat = wfMsgForContent( 'blog-by-user-category', - wfMsgForContent( 'blog-category' ) ); + $blogUserCat = $this->msg( 'blog-by-user-category', + $this->msg( 'blog-category' )->inContentLanguage()->text )->inContentLanguage()->text(); // Ignore "Articles by User X" categories if ( !preg_match( '/' . $blogUserCat . '/', $tag ) ) { $slashedTag = $tag; // define variable @@ -254,10 +238,10 @@ $tagcloud .= '</div>'; $output = '<div class="create-title">' . - wfMsg( 'blog-create-categories' ) . + $this->msg( 'blog-create-categories' )->text() . '</div> <div class="categorytext">' . - wfMsg( 'blog-create-category-help' ) . + $this->msg( 'blog-create-category-help' )->text() . '</div>' . "\n"; $output .= $tagcloud . "\n"; $output .= '<textarea class="createbox" tabindex="' . $this->tabCounter . @@ -273,22 +257,22 @@ * * @return String: HTML */ - function displayCopyrightWarning() { + public function displayCopyrightWarning() { global $wgRightsText; if ( $wgRightsText ) { $copywarnMsg = 'copyrightwarning'; $copywarnMsgParams = array( - '[[' . wfMsgForContent( 'copyrightpage' ) . ']]', + '[[' . $this->msg( 'copyrightpage' )->inContentLanguage()->text() . ']]', $wgRightsText ); } else { $copywarnMsg = 'copyrightwarning2'; $copywarnMsgParams = array( - '[[' . wfMsgForContent( 'copyrightpage' ) . ']]' + '[[' . $this->msg( 'copyrightpage' )->inContentLanguage()->text() . ']]' ); } return '<div class="copyright-warning">' . - wfMsgExt( $copywarnMsg, 'parse', $copywarnMsgParams ) . + $this->msg( $copywarnMsg, $copywarnMsgParams )->parse() . '</div>'; } @@ -296,9 +280,7 @@ * Show the form for creating new blog posts. * @return String: HTML */ - function displayForm() { - global $wgUser; - + public function displayForm() { $output = '<form id="editform" name="editform" method="post" action="' . htmlspecialchars( $this->getPageTitle()->getFullURL() ) . '" enctype="multipart/form-data">'; $output .= "\n" . $this->displayFormPageTitle() . "\n"; @@ -306,13 +288,13 @@ $output .= "\n" . $this->displayFormPageCategories() . "\n"; $output .= "\n" . $this->displayCopyrightWarning() . "\n"; - $output .= '<input type="button" value="' . wfMsg( 'blog-create-button' ) . + $output .= '<input type="button" value="' . $this->msg( 'blog-create-button' )->text() . '" name="wpSave" class="createsubmit site-button" accesskey="s" title="' . - wfMsg( 'tooltip-save' ) . ' [alt-s]" /> + $this->msg( 'tooltip-save' )->text() . ' [alt-s]" /> <input type="hidden" value="" name="wpSection" /> <input type="hidden" value="" name="wpEdittime" /> <input type="hidden" value="" name="wpTextbox1" id="wpTextbox1" /> - <input type="hidden" value="' . htmlspecialchars( $wgUser->getEditToken() ) . + <input type="hidden" value="' . htmlspecialchars( $this->getUser()->getEditToken() ) . '" name="wpEditToken" />'; $output .= "\n" . '</form>' . "\n"; diff --git a/TagCloudClass.php b/TagCloudClass.php index 3d37f2b..c56dda9 100644 --- a/TagCloudClass.php +++ b/TagCloudClass.php @@ -5,10 +5,10 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later */ class BlogTagCloud { - var $tags_min_pts = 8; - var $tags_max_pts = 32; - var $tags_highest_count = 0; - var $tags_size_type = 'pt'; + public $tags_min_pts = 8; + public $tags_max_pts = 32; + public $tags_highest_count = 0; + public $tags_size_type = 'pt'; public function __construct( $limit = 10 ) { $this->limit = $limit; @@ -29,11 +29,10 @@ ) ); - $message = trim( wfMsgForContent( 'blog-tagcloud-blacklist' ) ); + $message = trim( wfMessage( 'blog-tagcloud-blacklist' )->inContentLanguage() ); $catsExcluded = array(); - // Yes, the strlen() is needed, I dunno why wfEmptyMsg() won't work - if( !wfEmptyMsg( 'blog-tagcloud-blacklist', $message ) && strlen( $message ) > 0 ) { - $catsExcluded = explode( "\n* ", wfMsgForContent( 'blog-tagcloud-blacklist' ) ); + if( !$message->isBlank() ) { + $catsExcluded = explode( "\n* ", $message->text() ); } wfSuppressWarnings(); // prevent PHP from bitching about strtotime() -- To view, visit https://gerrit.wikimedia.org/r/150157 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia783a8e6288e72ed5b772c62082b2ba6ced533df Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlogPage Gerrit-Branch: master Gerrit-Owner: Withoutaname <drevit...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits