From 96a9c327e2a4c13368432aa9331d62fbbdc94dd6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Mon, 1 Aug 2005 23:47:22 +0000 Subject: [PATCH] * Refactored namespace selector to it's own function * Killed one undefined variable warning * some other cleanup like html-safe message fixes --- includes/GlobalFunctions.php | 36 +++++++++++++++++++++++++++++-- includes/SpecialAllpages.php | 12 ++--------- includes/SpecialContributions.php | 17 ++++----------- includes/SpecialRecentchanges.php | 30 ++++++++------------------ 4 files changed, 49 insertions(+), 46 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 7673e64cc3..c1303a4e6c 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1151,7 +1151,7 @@ function wfGetSiteNotice() { * * @param string $element * @param array $attribs Name=>value pairs. Values will be escaped. - * @param bool $contents NULL to make an open tag only; '' for a contentless closed tag (default) + * @param string $contents NULL to make an open tag only; '' for a contentless closed tag (default) * @return string */ function wfElement( $element, $attribs = null, $contents = '') { @@ -1182,7 +1182,7 @@ function wfElement( $element, $attribs = null, $contents = '') { * * @param string $element * @param array $attribs Name=>value pairs. Values will be escaped. - * @param bool $contents NULL to make an open tag only; '' for a contentless closed tag (default) + * @param string $contents NULL to make an open tag only; '' for a contentless closed tag (default) * @return string */ function wfElementClean( $element, $attribs = array(), $contents = '') { @@ -1195,6 +1195,38 @@ function wfElementClean( $element, $attribs = array(), $contents = '') { return wfElement( $element, $attribs, $contents ); } +/** + * Create a namespace selector + * + * @param mixed $selected The namespace which should be selected, default '' + * @param string $allnamespaces Value of a special item denoting all namespaces. Null to not include (default) + * @return Html string containing the namespace selector + */ +function &HTMLnamespaceselector($selected = '', $allnamespaces = null) { + global $wgContLang; + $s = "\n"; + return $s; +} + /** Global singleton instance of MimeMagic. This is initialized on demand, * please always use the wfGetMimeMagic() function to get the instance. * diff --git a/includes/SpecialAllpages.php b/includes/SpecialAllpages.php index a735b9cfb9..8ab20b1ef2 100644 --- a/includes/SpecialAllpages.php +++ b/includes/SpecialAllpages.php @@ -49,16 +49,7 @@ function namespaceForm ( $namespace = NS_MAIN, $from = '' ) { global $wgContLang, $wgScript; $t = Title::makeTitle( NS_SPECIAL, "Allpages" ); - $namespaceselect = "'; + $namespaceselect = HTMLnamespaceselector($namespace, null); $frombox = "'; @@ -220,6 +211,7 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) { $sk = $wgUser->getSkin(); + $fromTitle = null; if ($from!="") { $fromTitle = Title::newFromURL( $from ); $fromNS = $fromTitle->getNamespace(); diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index 35afe173ec..0e55285048 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -245,19 +245,10 @@ function wfSpecialContributions( $par = null ) { "type" => "hidden", "value" => $target)); $nsform .= "

"; - $nsform .= htmlspecialchars(wfMsg('namespace')) . " \n"; + $nsform .= wfMsgHtml('namespace'); + + $nsform .= HTMLnamespaceselector($ns, ''); + $nsform .= wfElement("input", array( "type" => "submit", "value" => wfMsg('allpagessubmit'))); diff --git a/includes/SpecialRecentchanges.php b/includes/SpecialRecentchanges.php index 7405e688e1..653cf84264 100644 --- a/includes/SpecialRecentchanges.php +++ b/includes/SpecialRecentchanges.php @@ -187,7 +187,7 @@ function wfSpecialRecentchanges( $par, $specialPage ) { wfAppendToArrayIfNotDefault( 'invert', $invert, $defaults, $nondefaults); // Add end of the texts - $wgOut->addHTML( '

' . rcOptionsPanel( $defaults, $nondefaults ) ); + $wgOut->addHTML( '
' . rcOptionsPanel( $defaults, $nondefaults ) . "\n" ); $wgOut->addHTML( rcNamespaceForm( $namespace, $invert, $nondefaults) . '
'); } @@ -458,34 +458,22 @@ function rcNamespaceForm ( $namespace, $invert, $nondefaults ) { global $wgContLang, $wgScript; $t = Title::makeTitle( NS_SPECIAL, 'Recentchanges' ); - $namespaceselect = "'; + $namespaceselect = HTMLnamespaceselector($namespace, ''); + $submitbutton = ''; + $invertbox = "'; + + $out = "
\n"; - $out = ''; - $out .= "
\n"; foreach ( $nondefaults as $key => $value ) { if ($key != 'namespace' && $key != 'invert') - $out .= ""; + $out .= wfElement('input', array( 'type' => 'hidden', 'name' => $key, 'value' => $value)); } - - $submitbutton = ''; - $invertbox = "'; - $out .= ''; $out .= "
- - $namespaceselect $submitbutton $invertbox + + $namespaceselect $submitbutton $invertbox
"; $out .= '
'; return $out; -- 2.20.1