Fixing E_NOTICE
[lhc/web/wiklou.git] / includes / Category.php
index e924b5e..37127d5 100644 (file)
@@ -50,7 +50,7 @@ abstract class CategoryListBase {
         * @return mixed Normalized name, or false if the name was invalid.
         */
        private static function setNamesCallback( $name ) {
-               $title = Title::newFromText( $name );
+               $title = Title::newFromText( "Category:$name" );
                if( !is_object( $title ) ) {
                        return false;
                }
@@ -206,6 +206,7 @@ class Category extends CategoryListBase {
        public function getSubcatCount() { return $this->getX( 'mSubcats' ); }
        /** @return mixed Number of member files, or false on failure */
        public function getFileCount() { return $this->getX( 'mFiles' ); }
+
        /**
         * This is not implemented in the base class, because arrays of Titles are
         * evil.
@@ -216,8 +217,7 @@ class Category extends CategoryListBase {
                if( !$this->initialize() ) {
                        return false;
                }
-               # FIXME is there a better way to do this?
-               return Title::newFromText( "Category:{$this->mNames[0]}" );
+               return Title::makeTitleSafe( NS_CATEGORY, $this->mNames[0] );
        }
 
        /** Generic accessor */