Use MagicWord class to handle the magic word; update copyright year.

This commit is contained in:
Daniel Kraus
2013-02-23 12:35:39 +01:00
parent a6544b37d9
commit 6d38db71af
3 changed files with 20 additions and 9 deletions

View File

@ -2,7 +2,7 @@
/* /*
* \file LinkTitles.body.php * \file LinkTitles.body.php
* *
* Copyright 2012 Daniel Kraus <krada@gmx.net> * Copyright 2012-2013 Daniel Kraus <krada@gmx.net> ('bovender')
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -75,7 +75,8 @@
// If the page contains the magic word '__NOAUTOLINKS__', do not parse // If the page contains the magic word '__NOAUTOLINKS__', do not parse
// the content. // the content.
if ( strpos( $text, '__NOAUTOLINKS__' ) !== false ) { $mw = MagicWord::get('MAG_LINKTITLES_NOAUTOLINKS');
if ( $mw -> matchAndRemove( $text ) ) {
return true; return true;
} }

10
LinkTitles.i18n.magic.php Normal file
View File

@ -0,0 +1,10 @@
<?php
/*! \file LinkTitles.i18n.magic.php
*/
$magicWords = array();
$magicWords['en'] = array(
'MAG_LINKTITLES_NOAUTOLINKS' => '__NOAUTOLINKS__',
);

View File

@ -2,7 +2,7 @@
/* /*
* \file LinkTitles.php * \file LinkTitles.php
* *
* Copyright 2012 Daniel Kraus <krada@gmx.net> * Copyright 2012-2013 Daniel Kraus <krada@gmx.net> ('bovender')
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -42,20 +42,20 @@
$wgLinkTitlesFirstOnly = false; $wgLinkTitlesFirstOnly = false;
$wgLinkTitlesWordStartOnly = true; $wgLinkTitlesWordStartOnly = true;
$wgLinkTitlesWordEndOnly = true; $wgLinkTitlesWordEndOnly = true;
// $wgLinkTitlesIgnoreCase = true;
$wgLinkTitlesSmartMode = true; $wgLinkTitlesSmartMode = true;
$wgExtensionCredits['parserhook'][] = array( $wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__, 'path' => __FILE__,
'name' => 'LinkTitles', 'name' => 'LinkTitles',
'author' => '[http://www.mediawiki.org/wiki/User:Bovender Daniel Kraus]', 'author' => '[https://www.mediawiki.org/wiki/User:Bovender Daniel Kraus]',
'url' => 'http://www.mediawiki.org/wiki/Extension:LinkTitles', 'url' => 'https://www.mediawiki.org/wiki/Extension:LinkTitles',
'version' => '2.0.0', 'version' => '2.1.0',
'descriptionmsg' => 'linktitles-desc' 'descriptionmsg' => 'linktitles-desc'
); );
$wgExtensionMessagesFiles['LinkTitles'] = dirname( __FILE__ ) . '/LinkTitles.i18n.php'; $wgExtensionMessagesFiles['LinkTitles'] = __DIR__ . '/LinkTitles.i18n.php';
$wgAutoloadClasses['LinkTitles'] = dirname(__FILE__) . '/LinkTitles.body.php'; $wgExtensionMessagesFiles['LinkTitlesMagic'] = __DIR__ . '/LinkTitles.i18n.magic.php';
$wgAutoloadClasses['LinkTitles'] = __DIR__ . '/LinkTitles.body.php';
$wgExtensionFunctions[] = 'LinkTitles::setup'; $wgExtensionFunctions[] = 'LinkTitles::setup';
// vim: ts=2:sw=2:noet // vim: ts=2:sw=2:noet