-
-// Shortcuts
-function wfOpenElement( $element, $attribs = null ) { return wfElement( $element, $attribs, null ); }
-function wfCloseElement( $element ) { return "</$element>"; }
-
-/**
- * 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)
- * @param bool $includehidden Include hidden namespaces?
- * @return Html string containing the namespace selector
- */
-function &HTMLnamespaceselector($selected = '', $allnamespaces = null, $includehidden=false) {
- global $wgContLang;
- if( $selected !== '' ) {
- if( is_null( $selected ) ) {
- // No namespace selected; let exact match work without hitting Main
- $selected = '';
- } else {
- // Let input be numeric strings without breaking the empty match.
- $selected = intval( $selected );
- }
- }
- $s = "<select id='namespace' name='namespace' class='namespaceselector'>\n\t";
- $arr = $wgContLang->getFormattedNamespaces();
- if( !is_null($allnamespaces) ) {
- $arr = array($allnamespaces => wfMsgHtml('namespacesall')) + $arr;
- }
- foreach ($arr as $index => $name) {
- if ($index < NS_MAIN) continue;
-
- $name = $index !== 0 ? $name : wfMsgHtml('blanknamespace');
-
- if ($index === $selected) {
- $s .= wfElement("option",
- array("value" => $index, "selected" => "selected"),
- $name);
- } else {
- $s .= wfElement("option", array("value" => $index), $name);
- }
- }
- $s .= "\n</select>\n";
- return $s;
+function wfOpenElement( $element, $attribs = null ) {
+ return Xml::openElement( $element, $attribs );
+}
+function wfCloseElement( $element ) {
+ return "</$element>";
+}
+function HTMLnamespaceselector($selected = '', $allnamespaces = null, $includehidden=false) {
+ return Xml::namespaceSelector( $selected, $allnamespaces, $includehidden );