+ /**
+ * An alternative to titleToKey() that doesn't trim trailing spaces
+ * @param $titlePart string Title part with spaces
+ * @return string Title part with underscores
+ */
+ public function titlePartToKey( $titlePart ) {
+ return substr( $this->titleToKey( $titlePart . 'x' ), 0, - 1 );
+ }
+
+ /**
+ * An alternative to keyToTitle() that doesn't trim trailing spaces
+ * @param $keyPart string Key part with spaces
+ * @return string Key part with underscores
+ */
+ public function keyPartToTitle( $keyPart ) {
+ return substr( $this->keyToTitle( $keyPart . 'x' ), 0, - 1 );
+ }
+
+ public function getPossibleErrors() {
+ return array_merge( parent::getPossibleErrors(), array(
+ array( 'invalidtitle', 'title' ),
+ array( 'invalidtitle', 'key' ),
+ ) );
+ }
+