LinkTitles extension for MediaWiki
Automatically add links to existing pages.
All Classes Namespaces Functions Variables Modules Pages
LinkTitles\Source Class Reference

Represents a page that is a potential link target. More...

Public Member Functions

 canBeLinked ()
 Determines whether or not this page may be linked to. More...
 
 hasDesiredNamespace ()
 Determines whether the Source is in a desired namespace, i.e. More...
 
 hasNoAutolinksMagicWord ()
 Determines whether the source page contains the NOAUTOLINKS magic word. More...
 
 getTitle ()
 Gets the title. More...
 
 getNamespace ()
 Gets the namespace of the source Title. More...
 
 getContent ()
 Gets the Content object for the source page. More...
 
 hasContent ()
 Determines whether the source page has content. More...
 
 getText ()
 Gets the text of the corresponding Wiki page. More...
 
 setText ($text)
 Unserializes text to the page's content. More...
 
 getPage ()
 Returns the source page object. More...
 

Static Public Member Functions

static createFromTitle (\Title $title, Config $config)
 Creates a Source object from a . More...
 
static createFromTitleAndText (\Title $title, $text, Config $config)
 Creates a Source object with a given Title and a text. More...
 
static createFromPageandContent (\WikiPage $page,\Content $content, Config $config)
 Creates a Source object with a given WikiPage and a Content. More...
 
static createFromParser (\Parser $parser, Config $config)
 Creates a Source object with a given Parser. More...
 
static createFromParserAndText (\Parser $parser, $text, Config $config)
 Creates a Source object with a given Parser and text. More...
 

Public Attributes

 $config
 The LinKTitles configuration for this Source.
 

Private Member Functions

 __construct (Config $config)
 Private constructor. More...
 

Private Attributes

 $title
 
 $text
 
 $page
 
 $content
 

Detailed Description

Represents a page that is a potential link target.

Definition at line 29 of file Source.php.

Constructor & Destructor Documentation

LinkTitles\Source::__construct ( Config  $config)
private

Private constructor.

Use one of the factories to created a Source object.

Parameters
Config$configLinkTitles configuration

Definition at line 125 of file Source.php.

Member Function Documentation

LinkTitles\Source::canBeLinked ( )

Determines whether or not this page may be linked to.

Returns
[type] [description]

Definition at line 133 of file Source.php.

static LinkTitles\Source::createFromPageandContent ( \WikiPage  $page,
\Content  $content,
Config  $config 
)
static

Creates a Source object with a given WikiPage and a Content.

This factory can be called e.g. from an onPageContentSave event handler which knows both these parameters.

Parameters
\WikiPage$pageWikiPage to link from
\Content$contentPage content
Config$configLinkTitles configuration
Returns
Source Source object created from the title and the text

Definition at line 84 of file Source.php.

static LinkTitles\Source::createFromParser ( \Parser  $parser,
Config  $config 
)
static

Creates a Source object with a given Parser.

Parameters
\Parser$parserParser object from which to create the Source.
Config$configLinKTitles Configuration
Returns
Source Source object created from the parser and the text.

Definition at line 98 of file Source.php.

static LinkTitles\Source::createFromParserAndText ( \Parser  $parser,
  $text,
Config  $config 
)
static

Creates a Source object with a given Parser and text.

This factory can be called e.g. from an onInternalParseBeforeLinks event handler which knows these parameters.

Parameters
\Parser$parserParser object from which to create the Source.
String$textString representation of the page content.
Config$configLinKTitles Configuration
Returns
Source Source object created from the parser and the text.

Definition at line 115 of file Source.php.

static LinkTitles\Source::createFromTitle ( \Title  $title,
Config  $config 
)
static

Creates a Source object from a .

Parameters
\Title$titleTitle object from which to create the Source.
Returns
Source Source object created from the title.

Definition at line 50 of file Source.php.

static LinkTitles\Source::createFromTitleAndText ( \Title  $title,
  $text,
Config  $config 
)
static

Creates a Source object with a given Title and a text.

This factory can be called e.g. from a onPageContentSave event handler which knows both these parameters.

Parameters
\Title$titleTitle of the source page
String$textString representation of the page content
Config$configLinkTitles configuration
Returns
Source Source object created from the title and the text

Definition at line 67 of file Source.php.

LinkTitles\Source::getContent ( )

Gets the Content object for the source page.

The value is cached.

Returns
Content object.

Definition at line 187 of file Source.php.

LinkTitles\Source::getNamespace ( )

Gets the namespace of the source Title.

Returns
integer namespace index.

Definition at line 176 of file Source.php.

LinkTitles\Source::getPage ( )

Returns the source page object.

Returns
WikiPage for the source title.

Definition at line 234 of file Source.php.

LinkTitles\Source::getText ( )

Gets the text of the corresponding Wiki page.

The value is cached.

Returns
String Text of the Wiki page.

Definition at line 210 of file Source.php.

LinkTitles\Source::getTitle ( )

Gets the title.

Returns
Title of the source page.

Definition at line 160 of file Source.php.

LinkTitles\Source::hasContent ( )

Determines whether the source page has content.

Returns
boolean True if the source page has content.

Definition at line 199 of file Source.php.

LinkTitles\Source::hasDesiredNamespace ( )

Determines whether the Source is in a desired namespace, i.e.

a namespace that is listed in the sourceNamespaces config setting or is NS_MAIN.

Returns
boolean True if the Source is in a 'good' namespace.

Definition at line 142 of file Source.php.

LinkTitles\Source::hasNoAutolinksMagicWord ( )

Determines whether the source page contains the NOAUTOLINKS magic word.

Returns
boolean True if the page contains the NOAUTOLINKS magic word.

Definition at line 151 of file Source.php.

LinkTitles\Source::setText (   $text)

Unserializes text to the page's content.

Parameters
String$textText to unserialize.
Returns
The source's updated content object.

Definition at line 224 of file Source.php.


The documentation for this class was generated from the following file: