Merge "Add 'avoidhours' option to Language#formatTimePeriod"
[lhc/web/wiklou.git] / includes / editpage / TextboxBuilder.php
index d0a2f8f..103b3e5 100644 (file)
@@ -24,7 +24,8 @@
 
 namespace MediaWiki\EditPage;
 
-use MWNamespace;
+use MediaWiki\MediaWikiServices;
+use Sanitizer;
 use Title;
 use User;
 
@@ -57,16 +58,14 @@ class TextboxBuilder {
         * @return mixed[]
         */
        public function mergeClassesIntoAttributes( array $classes, array $attribs ) {
-               if ( !count( $classes ) ) {
+               if ( $classes === [] ) {
                        return $attribs;
                }
 
-               if ( isset( $attribs['class'] ) ) {
-                       $classes[] = $attribs['class'];
-               }
-               $attribs['class'] = implode( ' ', $classes );
-
-               return $attribs;
+               return Sanitizer::mergeAttributes(
+                       $attribs,
+                       [ 'class' => implode( ' ', $classes ) ]
+               );
        }
 
        /**
@@ -76,7 +75,8 @@ class TextboxBuilder {
        public function getTextboxProtectionCSSClasses( Title $title ) {
                $classes = []; // Textarea CSS
                if ( $title->isProtected( 'edit' ) &&
-                       MWNamespace::getRestrictionLevels( $title->getNamespace() ) !== [ '' ]
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->
+                       getRestrictionLevels( $title->getNamespace() ) !== [ '' ]
                ) {
                        # Is the title semi-protected?
                        if ( $title->isSemiProtected() ) {