MediaWiki  master
TitleFactory.php
Go to the documentation of this file.
1 <?php
24 
33 class TitleFactory {
34 
40  public function newFromDBkey( $key ) : ?Title {
41  return Title::newFromDBkey( $key );
42  }
43 
50  public function newFromLinkTarget( LinkTarget $linkTarget, $forceClone = '' ) : Title {
51  return Title::newFromLinkTarget( $linkTarget, $forceClone );
52  }
53 
59  public function castFromLinkTarget( ?LinkTarget $linkTarget ) : ?Title {
60  return Title::castFromLinkTarget( $linkTarget );
61  }
62 
70  public function newFromText( $text, $defaultNamespace = NS_MAIN ) : ?Title {
71  return Title::newFromText( $text, $defaultNamespace );
72  }
73 
81  public function newFromTextThrow( $text, $defaultNamespace = NS_MAIN ) : Title {
82  return Title::newFromTextThrow( $text, $defaultNamespace );
83  }
84 
90  public function newFromURL( $url ) : ?Title {
91  return Title::newFromURL( $url );
92  }
93 
100  public function newFromID( $id, $flags = 0 ) : ?Title {
101  return Title::newFromID( $id, $flags );
102  }
103 
109  public function newFromIDs( $ids ) : array {
110  return Title::newFromIDs( $ids );
111  }
112 
118  public function newFromRow( $row ) : Title {
119  return Title::newFromRow( $row );
120  }
121 
130  public function makeTitle( $ns, $title, $fragment = '', $interwiki = '' ) : Title {
131  return Title::makeTitle( $ns, $title, $fragment, $interwiki );
132  }
133 
142  public function makeTitleSafe( $ns, $title, $fragment = '', $interwiki = '' ) : ?Title {
143  return Title::makeTitleSafe( $ns, $title, $fragment, $interwiki );
144  }
145 
151  public function newMainPage( MessageLocalizer $localizer = null ) : Title {
152  return Title::newMainPage( $localizer );
153  }
154 
155 }
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:332
TitleFactory\newFromTextThrow
newFromTextThrow( $text, $defaultNamespace=NS_MAIN)
Definition: TitleFactory.php:81
TitleFactory\newFromText
newFromText( $text, $defaultNamespace=NS_MAIN)
Definition: TitleFactory.php:70
TitleFactory\newFromID
newFromID( $id, $flags=0)
Definition: TitleFactory.php:100
Title\newMainPage
static newMainPage(MessageLocalizer $localizer=null)
Create a new Title for the Main Page.
Definition: Title.php:657
MessageLocalizer
Interface for localizing messages in MediaWiki.
Definition: MessageLocalizer.php:27
NS_MAIN
const NS_MAIN
Definition: Defines.php:69
TitleFactory\makeTitleSafe
makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Definition: TitleFactory.php:142
Title\newFromRow
static newFromRow( $row)
Make a Title object from a DB row.
Definition: Title.php:527
$title
$title
Definition: testCompression.php:38
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:595
TitleFactory\newFromDBkey
newFromDBkey( $key)
Definition: TitleFactory.php:40
Title\newFromTextThrow
static newFromTextThrow( $text, $defaultNamespace=NS_MAIN)
Like Title::newFromText(), but throws MalformedTitleException when the title is invalid,...
Definition: Title.php:367
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:621
TitleFactory\newMainPage
newMainPage(MessageLocalizer $localizer=null)
Definition: TitleFactory.php:151
TitleFactory\castFromLinkTarget
castFromLinkTarget(?LinkTarget $linkTarget)
Definition: TitleFactory.php:59
TitleFactory\newFromRow
newFromRow( $row)
Definition: TitleFactory.php:118
Title\newFromDBkey
static newFromDBkey( $key)
Create a new Title from a prefixed DB key.
Definition: Title.php:245
Title\newFromURL
static newFromURL( $url)
THIS IS NOT THE FUNCTION YOU WANT.
Definition: Title.php:417
Title\newFromIDs
static newFromIDs( $ids)
Make an array of titles from an array of IDs.
Definition: Title.php:501
Title\newFromLinkTarget
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
Definition: Title.php:284
TitleFactory\newFromURL
newFromURL( $url)
Definition: TitleFactory.php:90
Title
Represents a title within MediaWiki.
Definition: Title.php:42
TitleFactory\newFromIDs
newFromIDs( $ids)
Definition: TitleFactory.php:109
TitleFactory
Creates Title objects.
Definition: TitleFactory.php:33
TitleFactory\makeTitle
makeTitle( $ns, $title, $fragment='', $interwiki='')
Definition: TitleFactory.php:130
Title\castFromLinkTarget
static castFromLinkTarget( $linkTarget)
Same as newFromLinkTarget, but if passed null, returns null.
Definition: Title.php:308
MediaWiki\Linker\LinkTarget
Definition: LinkTarget.php:26
Title\newFromID
static newFromID( $id, $flags=0)
Create a new Title from an article ID.
Definition: Title.php:476
TitleFactory\newFromLinkTarget
newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Definition: TitleFactory.php:50