mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 17:59:29 +02:00
Change names of private static variables.
This commit is contained in:
@ -30,15 +30,15 @@
|
|||||||
/// This class contains only static functions; do not instantiate.
|
/// This class contains only static functions; do not instantiate.
|
||||||
class LinkTitles {
|
class LinkTitles {
|
||||||
/// A Title object for the page that is being parsed.
|
/// A Title object for the page that is being parsed.
|
||||||
private static $mCurrentTitle;
|
private static $currentTitle;
|
||||||
|
|
||||||
/// A Title object for the target page currently being examined.
|
/// A Title object for the target page currently being examined.
|
||||||
private static $mTargetTitle;
|
private static $targetTitle;
|
||||||
|
|
||||||
/// The content object for the currently processed target page.
|
/// The content object for the currently processed target page.
|
||||||
/// This variable is necessary to be able to prevent loading the target
|
/// This variable is necessary to be able to prevent loading the target
|
||||||
/// content twice.
|
/// content twice.
|
||||||
private static $mTargetContent;
|
private static $targetContent;
|
||||||
|
|
||||||
/// Holds the page title of the currently processed target page
|
/// Holds the page title of the currently processed target page
|
||||||
/// as a string.
|
/// as a string.
|
||||||
@ -121,7 +121,7 @@
|
|||||||
$templatesDelimiter = '{{[^|]+?}}|{{.+\||';
|
$templatesDelimiter = '{{[^|]+?}}|{{.+\||';
|
||||||
};
|
};
|
||||||
|
|
||||||
LinkTitles::$mCurrentTitle = $article->getTitle();
|
LinkTitles::$currentTitle = $article->getTitle();
|
||||||
$text = $content->getContentHandler()->serializeContent($content);
|
$text = $content->getContentHandler()->serializeContent($content);
|
||||||
$newText = $text;
|
$newText = $text;
|
||||||
|
|
||||||
@ -153,7 +153,7 @@
|
|||||||
// targets. This includes the current page.
|
// targets. This includes the current page.
|
||||||
$black_list = str_replace( '_', ' ',
|
$black_list = str_replace( '_', ' ',
|
||||||
'("' . implode( '", "',$wgLinkTitlesBlackList ) .
|
'("' . implode( '", "',$wgLinkTitlesBlackList ) .
|
||||||
LinkTitles::$mCurrentTitle->getDbKey() . '")' );
|
LinkTitles::$currentTitle->getDbKey() . '")' );
|
||||||
|
|
||||||
// Build an SQL query and fetch all page titles ordered by length from
|
// Build an SQL query and fetch all page titles ordered by length from
|
||||||
// shortest to longest. Only titles from 'normal' pages (namespace uid
|
// shortest to longest. Only titles from 'normal' pages (namespace uid
|
||||||
@ -197,7 +197,7 @@
|
|||||||
|
|
||||||
// Escape certain special characters in the page title to prevent
|
// Escape certain special characters in the page title to prevent
|
||||||
// regexp compilation errors
|
// regexp compilation errors
|
||||||
LinkTitles::$targetTitleText = LinkTitles::$mTargetTitle->getText();
|
LinkTitles::$targetTitleText = LinkTitles::$targetTitle->getText();
|
||||||
$quotedTitle = preg_quote(LinkTitles::$targetTitleText, '/');
|
$quotedTitle = preg_quote(LinkTitles::$targetTitleText, '/');
|
||||||
|
|
||||||
// Depending on the global configuration setting $wgCapitalLinks,
|
// Depending on the global configuration setting $wgCapitalLinks,
|
||||||
@ -341,8 +341,8 @@
|
|||||||
/// Sets member variables for the current target page.
|
/// Sets member variables for the current target page.
|
||||||
private static function newTarget( $titleString ) {
|
private static function newTarget( $titleString ) {
|
||||||
// @todo Make this wiki namespace aware.
|
// @todo Make this wiki namespace aware.
|
||||||
LinkTitles::$mTargetTitle = Title::makeTitle( NS_MAIN, $titleString );
|
LinkTitles::$targetTitle = Title::makeTitle( NS_MAIN, $titleString );
|
||||||
LinkTitles::$mTargetContent = null;
|
LinkTitles::$targetContent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the content of the current target page.
|
/// Returns the content of the current target page.
|
||||||
@ -352,11 +352,11 @@
|
|||||||
/// @note It is absolutely necessary that the newTarget()
|
/// @note It is absolutely necessary that the newTarget()
|
||||||
/// function is called for every new page.
|
/// function is called for every new page.
|
||||||
private static function getTargetContent() {
|
private static function getTargetContent() {
|
||||||
if ( ! isset( $mTargetContent ) ) {
|
if ( ! isset( $targetContent ) ) {
|
||||||
LinkTitles::$mTargetContent = WikiPage::factory(
|
LinkTitles::$targetContent = WikiPage::factory(
|
||||||
LinkTitles::$mTargetTitle)->getContent();
|
LinkTitles::$targetTitle)->getContent();
|
||||||
};
|
};
|
||||||
return LinkTitles::$mTargetContent;
|
return LinkTitles::$targetContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Examines the current target page. Returns true if it may be linked;
|
/// Examines the current target page. Returns true if it may be linked;
|
||||||
@ -374,7 +374,7 @@
|
|||||||
// (unlinked).
|
// (unlinked).
|
||||||
if ( $wgLinkTitlesCheckRedirect ) {
|
if ( $wgLinkTitlesCheckRedirect ) {
|
||||||
$redirectTitle = LinkTitles::getTargetContent()->getUltimateRedirectTarget();
|
$redirectTitle = LinkTitles::getTargetContent()->getUltimateRedirectTarget();
|
||||||
if ( $redirectTitle && $redirectTitle->equals(LinkTitles::$mCurrentTitle) ) {
|
if ( $redirectTitle && $redirectTitle->equals(LinkTitles::$currentTitle) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user