*/
private static function expandAttributes( $attribs ) {
$out = '';
- if( is_array( $attribs ) ) {
+ if( is_null( $attribs ) ) {
+ return null;
+ } elseif( is_array( $attribs ) ) {
foreach( $attribs as $name => $val )
$out .= " {$name}=\"" . Sanitizer::encodeAttribute( $val ) . '"';
+ return $out;
+ } else {
+ throw new MWException( 'Expected attribute array, got something else in ' . __METHOD__ );
}
- return $out;
}
/**
* @param bool $hidden Include hidden namespaces? [WTF? --RC]
* @return string
*/
- public static function namespaceSelector( $selected = '', $all = null, $hidden = false ) {
+ public static function namespaceSelector( $selected = '', $all = null, $hidden = false, $element_name = 'namespace' ) {
global $wgContLang;
$namespaces = $wgContLang->getFormattedNamespaces();
$options = array();
$options[] = self::option( $name, $index, $index === $selected );
}
- return Xml::openElement( 'select', array( 'id' => 'namespace', 'name' => 'namespace',
+ return Xml::openElement( 'select', array( 'id' => 'namespace', 'name' => $element_name,
'class' => 'namespaceselector' ) )
. "\n"
. implode( "\n", $options )