Merge "Remove user preference "noconvertlink""
[lhc/web/wiklou.git] / includes / Linker.php
index 867b88b..23bfd61 100644 (file)
@@ -159,9 +159,6 @@ class Linker {
         * link() replaces the old functions in the makeLink() family.
         *
         * @since 1.18 Method exists since 1.16 as non-static, made static in 1.18.
-        * You can call it using this if you want to keep compat with these:
-        * $linker = class_exists( 'DummyLinker' ) ? new DummyLinker() : new Linker();
-        * $linker->link( ... );
         *
         * @param $target        Title  Can currently only be a Title, but this may
         *   change to support Images, literal URLs, etc.
@@ -281,9 +278,9 @@ class Linker {
                wfProfileIn( __METHOD__ );
                # We don't want to include fragments for broken links, because they
                # generally make no sense.
-               if ( in_array( 'broken', $options ) && $target->mFragment !== '' ) {
+               if ( in_array( 'broken', $options ) && $target->hasFragment() ) {
                        $target = clone $target;
-                       $target->mFragment = '';
+                       $target->setFragment( '' );
                }
 
                # If it's a broken link, add the appropriate query pieces, unless
@@ -387,7 +384,7 @@ class Linker {
 
                // If the target is just a fragment, with no title, we return the fragment
                // text.  Otherwise, we return the title text itself.
-               if ( $target->getPrefixedText() === '' && $target->getFragment() !== '' ) {
+               if ( $target->getPrefixedText() === '' && $target->hasFragment() ) {
                        return htmlspecialchars( $target->getFragment() );
                }
                return htmlspecialchars( $target->getPrefixedText() );
@@ -451,8 +448,7 @@ class Linker {
                        if ( !$name ) {
                                return $title;
                        }
-                       $ret = SpecialPage::getTitleFor( $name, $subpage );
-                       $ret->mFragment = $title->getFragment();
+                       $ret = SpecialPage::getTitleFor( $name, $subpage, $title->getFragment() );
                        return $ret;
                } else {
                        return $title;