Performs the actual linking of content to existing pages. More...
Public Member Functions | |
__construct (Config &$config) | |
Constructs a new instance of the Linker class. More... | |
linkContent (Source $source) | |
Core function of the extension, performs the actual parsing of the content. More... | |
Static Public Member Functions | |
static | lock () |
Increases an internal static lock counter by 1. More... | |
static | unlock () |
Decreases an internal static lock counter by 1. More... | |
Public Attributes | |
$config | |
LinkTitles configuration. | |
Private Member Functions | |
simpleModeCallback (array $matches) | |
Callback for preg_replace_callback in simple mode. More... | |
smartModeCallback (array $matches) | |
Callback function for use with preg_replace_callback. More... | |
Private Attributes | |
$linkValue | |
The link value of the target page that is currently being evaluated. More... | |
Static Private Attributes | |
static | $locked = 0 |
Performs the actual linking of content to existing pages.
Definition at line 29 of file Linker.php.
LinkTitles\Linker::__construct | ( | Config & | $config | ) |
Constructs a new instance of the Linker class.
Config | $config | LinkTitles configuration object. |
Definition at line 56 of file Linker.php.
LinkTitles\Linker::linkContent | ( | Source | $source | ) |
Core function of the extension, performs the actual parsing of the content.
This method receives a Title object and the string representation of the source page. It does not work on a WikiPage object directly because the callbacks in the Extension class do not always get a WikiPage object in the first place.
\Title | &$title | Title object for the current page. |
String | $text | String that holds the article content |
Definition at line 72 of file Linker.php.
|
static |
Increases an internal static lock counter by 1.
If the Linker class is locked (counter > 0), linkContent() will be a no-op. Locking is necessary to enable nested <noautolinks> and <autolinks> tags in parseOnRender mode.
Definition at line 212 of file Linker.php.
|
private |
Callback for preg_replace_callback in simple mode.
array | $matches | Matches provided by preg_replace_callback |
Definition at line 165 of file Linker.php.
|
private |
Callback function for use with preg_replace_callback.
This essentially performs a case-sensitive comparison of the current page title and the occurrence found on the page; if the cases do not match, it builds an aliased (piped) link. If $wgCapitalLinks is set to true, the case of the first letter is ignored by MediaWiki and we don't need to build a piped link if only the case of the first letter is different.
array | $matches | Matches provided by preg_replace_callback |
Definition at line 187 of file Linker.php.
|
static |
Decreases an internal static lock counter by 1.
If the Linker class is locked (counter > 0), linkContent() will be a no-op. Locking is necessary to enable nested <noautolinks> and <autolinks> tags in parseOnRender mode.
Definition at line 223 of file Linker.php.
|
private |
The link value of the target page that is currently being evaluated.
This may be either the page name or the page name prefixed with the name space if the target's name space is not NS_MAIN.
This is an instance variable (rather than a local method variable) so it can be accessed in the preg_replace_callback callbacks.
Definition at line 47 of file Linker.php.