mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 01:39:30 +02:00
Implement PreferShortTitles option
This commit is contained in:
@ -45,6 +45,8 @@
|
||||
// extract the current page's title.
|
||||
$my_title = $article->getTitle()->getText();
|
||||
|
||||
( $wgLinkTitlesPreferShortTitles ) ? $sort_order = 'DESC' : $sort_order = '';
|
||||
|
||||
// Build an SQL query and fetch all page titles ordered
|
||||
// by length from shortest to longest.
|
||||
// Only titles from 'normal' pages (namespace uid = 0)
|
||||
@ -55,7 +57,7 @@
|
||||
'page_title',
|
||||
'page_namespace = 0',
|
||||
__METHOD__,
|
||||
array( 'ORDER BY' => 'length(page_title) DESC' ));
|
||||
array( 'ORDER BY' => 'length(page_title) ' . $sort_order ));
|
||||
|
||||
// Iterate through the page titles
|
||||
$new_text = $text;
|
||||
|
@ -45,6 +45,9 @@
|
||||
|
||||
// Hook up our custom function to the ArticleSave event.
|
||||
$wgHooks['ArticleSave'][] = 'LinkTitles::onArticleSave';
|
||||
|
||||
// Configuration variables
|
||||
$wgLinkTitlesPreferShortTitles = false;
|
||||
|
||||
// vim: ts=2:sw=2:noet
|
||||
|
||||
|
Reference in New Issue
Block a user