From 81999a4926d4a17d9cb8557f0819f7bbbf13c881 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 13 Sep 2005 17:32:55 +0000 Subject: [PATCH] * Cleaned out some unused globals * Using the ternary operator * Safe XHTML output with htmlspecialchars() --- includes/QueryPage.php | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 4616d592b5..558b733051 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -306,7 +306,7 @@ class QueryPage { */ function doFeed( $class = '' ) { global $wgFeedClasses; - global $wgOut, $wgLanguageCode, $wgLang; + if( isset($wgFeedClasses[$class]) ) { $feed = new $wgFeedClasses[$class]( $this->feedTitle(), @@ -341,12 +341,7 @@ class QueryPage { } $title = Title::MakeTitle( intval( $row->namespace ), $row->title ); if( $title ) { - if( isset( $row->timestamp ) ) { - $date = $row->timestamp; - } else { - $date = ''; - } - + $date = isset( $row->timestamp ) ? $row->timestamp : ''; $comments = ''; if( $title ) { $talkpage = $title->getTalkPage(); @@ -366,21 +361,15 @@ class QueryPage { } function feedItemDesc( $row ) { - return isset( $row->comment ) - ? htmlspecialchars( $row->comment ) - : ''; + return isset( $row->comment ) ? htmlspecialchars( $row->comment ) : ''; } function feedItemAuthor( $row ) { - if( isset( $row->user_text ) ) { - return $row->user_text; - } else { - return ''; - } + return isset( $row->user_text ) ? $row->user_text : ''; } function feedTitle() { - global $wgLanguageCode, $wgSitename, $wgLang; + global $wgLanguageCode, $wgSitename; $page = SpecialPage::getPage( $this->getName() ); $desc = $page->getDescription(); return "$wgSitename - $desc [$wgLanguageCode]"; @@ -391,7 +380,6 @@ class QueryPage { } function feedUrl() { - global $wgLang; $title = Title::MakeTitle( NS_SPECIAL, $this->getName() ); return $title->getFullURL(); } @@ -409,7 +397,7 @@ class PageQueryPage extends QueryPage { function formatResult( $skin, $result ) { global $wgContLang; $nt = Title::makeTitle( $result->namespace, $result->title ); - return $skin->makeKnownLinkObj( $nt, $wgContLang->convert( $nt->getPrefixedText() ) ); + return $skin->makeKnownLinkObj( $nt, htmlspecialchars( $wgContLang->convert( $nt->getPrefixedText() ) ) ); } } -- 2.20.1