MediaWiki  1.28.1
Go to the documentation of this file.
1 <?php
31  private $text;
36  private $url;
41  private $suggestedTitle;
53  private $score;
62  public function __construct( $score, $text = null, Title $suggestedTitle = null,
63  $suggestedTitleID = null ) {
64  $this->score = $score;
65  $this->text = $text;
66  if ( $suggestedTitle ) {
68  }
69  $this->suggestedTitleID = $suggestedTitleID;
70  }
76  public function getText() {
77  return $this->text;
78  }
85  public function setText( $text, $setTitle = true ) {
86  $this->text = $text;
87  if ( $setTitle && $text !== '' && $text !== null ) {
89  }
90  }
97  public function getSuggestedTitle() {
98  return $this->suggestedTitle;
99  }
105  public function setSuggestedTitle( Title $title = null ) {
106  $this->suggestedTitle = $title;
107  if ( $title !== null ) {
108  $this->url = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
109  }
110  }
117  public function getSuggestedTitleID() {
119  }
125  public function setSuggestedTitleID( $suggestedTitleID = null ) {
126  $this->suggestedTitleID = $suggestedTitleID;
127  }
133  public function getScore() {
134  return $this->score;
135  }
141  public function setScore( $score ) {
142  $this->score = $score;
143  }
150  public function getURL() {
151  return $this->url;
152  }
158  public function setURL( $url ) {
159  $this->url = $url;
160  }
168  public static function fromTitle( $score, Title $title ) {
169  return new self( $score, $title->getPrefixedText(), $title, $title->getArticleID() );
170  }
179  public static function fromText( $score, $text ) {
180  $suggestion = new self( $score, $text );
181  if ( $text ) {
182  $suggestion->setSuggestedTitle( Title::makeTitle( 0, $text ) );
183  }
184  return $suggestion;
185  }
187 }
Search suggestion.
Get the article ID for this Title from the link cache, adding it if necessary.
Definition: Title.php:3209
setSuggestedTitle(Title $title=null)
Set the suggested title.
Title null $suggestedTitle
the suggested title
Definition: Defines.php:226
string $text
the suggestion
Get the prefixed title with spaces.
Definition: Title.php:1455
wfExpandUrl($url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Title object in the case this suggestion is based on a title.
Suggestion score.
__construct($score, $text=null, Title $suggestedTitle=null, $suggestedTitleID=null)
Construct a new suggestion.
The suggestion text.
float null $score
The suggestion score.
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:953
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
setText($text, $setTitle=true)
Set the suggestion text.
Set the suggested title ID.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
string $url
the suggestion URL
Suggestion URL, can be the link to the Title or maybe in the future a link to the search results for ...
Set the suggestion score.
Title ID in the case this suggestion is based on a title.
static fromTitle($score, Title $title)
Create suggestion from Title.
static fromText($score, $text)
Create suggestion from text Will also create a title if text if not empty.
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:511
Set the suggestion URL.
int null $suggestedTitleID
NOTE: even if suggestedTitle is a redirect suggestedTitleID is the ID of the target page...