Represents a page that is a potential link target. More...
Public Member Functions | |
__construct ($namespace, $title, Config &$config) | |
Constructs a new Target object. More... | |
getTitleText () | |
Gets the string representation of the target title. More... | |
getPrefixedTitleText () | |
getNsText () | |
Gets the string representation of the target's namespace. More... | |
getNsPrefix () | |
Gets the namespace prefix. More... | |
getRegexSafeTitle () | |
Gets the title string with certain characters escaped that may interfere with regular expressions. More... | |
getCaseSensitiveRegex () | |
Builds a regular expression of the title. More... | |
getCaseInsensitiveRegex () | |
Builds a regular expression pattern for the title in a case-insensitive way. More... | |
getCaseSensitiveLinkValueRegex () | |
Gets the (cached) regex for the link value. More... | |
getContent () | |
Returns the of the target page. More... | |
mayLinkTo (Source $source) | |
Examines the current target page. More... | |
isSameTitle (Source $source) | |
Determines if the Target's title is the same as another title. More... | |
redirectsTo ($source) | |
Checks whether this target redirects to the source. More... | |
Public Attributes | |
$wordStart | |
Regex that matches the start of a word; this expression depends on the setting of LinkTitles->wordStartOnly;. | |
$wordEnd | |
Regex that matches the end of a word; this expression depends on the setting of LinkTitles->wordEndOnly;. | |
Private Member Functions | |
buildRegex ($searchTerm) | |
Builds the basic regex that is used to match target page titles in a source text. More... | |
Private Attributes | |
$title | |
A Title object for the target page currently being examined. | |
$content | |
Caches the target page content as a object. | |
$config | |
LinkTitles configuration. | |
$caseSensitiveLinkValueRegex | |
$nsText | |
Represents a page that is a potential link target.
Definition at line 29 of file Target.php.
LinkTitles\Target::__construct | ( | $namespace, | |
$title, | |||
Config & | $config | ||
) |
Constructs a new Target object.
The parameters may be taken from database rows, for example.
Int | $namespace | Name space of the target page |
String | &$title | Title of the target page |
Definition at line 75 of file Target.php.
|
private |
Builds the basic regex that is used to match target page titles in a source text.
String | $searchTerm | Target page title (special characters must be quoted) |
Definition at line 154 of file Target.php.
LinkTitles\Target::getCaseInsensitiveRegex | ( | ) |
Builds a regular expression pattern for the title in a case-insensitive way.
Definition at line 144 of file Target.php.
LinkTitles\Target::getCaseSensitiveLinkValueRegex | ( | ) |
Gets the (cached) regex for the link value.
Depending on the $config->capitalLinks setting, the title has to be searched for either in a strictly case-sensitive way, or in a 'fuzzy' way where the first letter of the title may be either case.
Definition at line 167 of file Target.php.
LinkTitles\Target::getCaseSensitiveRegex | ( | ) |
Builds a regular expression of the title.
Definition at line 135 of file Target.php.
LinkTitles\Target::getContent | ( | ) |
Returns the of the target page.
The value is cached.
Definition at line 185 of file Target.php.
LinkTitles\Target::getNsPrefix | ( | ) |
Gets the namespace prefix.
This is the namespace text followed by a colon, or an empty string if the namespace text evaluates to false (e.g. NS_MAIN).
Definition at line 118 of file Target.php.
LinkTitles\Target::getNsText | ( | ) |
Gets the string representation of the target's namespace.
May be false if the namespace is NS_MAIN. The value is cached.
Definition at line 106 of file Target.php.
LinkTitles\Target::getRegexSafeTitle | ( | ) |
Gets the title string with certain characters escaped that may interfere with regular expressions.
Definition at line 127 of file Target.php.
LinkTitles\Target::getTitleText | ( | ) |
Gets the string representation of the target title.
Definition at line 92 of file Target.php.
LinkTitles\Target::isSameTitle | ( | Source | $source | ) |
Determines if the Target's title is the same as another title.
Definition at line 225 of file Target.php.
LinkTitles\Target::mayLinkTo | ( | Source | $source | ) |
Examines the current target page.
Returns true if it may be linked; false if not. This depends on two settings: $wgLinkTitlesCheckRedirect and $wgLinkTitlesEnableNoTargetMagicWord and whether the target page is a redirect or contains the NOAUTOLINKTARGET magic word.
Source | source |
Definition at line 202 of file Target.php.
LinkTitles\Target::redirectsTo | ( | $source | ) |
Checks whether this target redirects to the source.
Definition at line 234 of file Target.php.