Extension:CorrectMainPageTitle
From MediaWiki.org
|
CorrectMainPageTitle Release status: beta |
|||
|---|---|---|---|
| Implementation | User interface | ||
| Description | Corrects the main page HTML title. | ||
| Author(s) | VittGamtalk | ||
| Last version | 1.1 (2010-10-14) | ||
| MediaWiki | Tested on 1.16.0 | ||
| PHP | Tested on 5.3.3 | ||
| License | GPLv3 | ||
| Download | See below | ||
|
|||
| Check usage and version matrix | |||
This extension puts the correct HTML title in the main page, like in Wikimedia wikis.
Contents |
Download instructions [edit]
Please copy and paste the code found below and place it in $IP/extensions/CorrectMainPageTitle.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
Installation [edit]
To install this extension, add the following to LocalSettings.php:
require_once("$IP/extensions/CorrectMainPageTitle.php");
Changelog [edit]
- Version 1.1, 2010-10-14
- Fixed the PHP error "Object of class Title could not be converted to int"; thanks to User:朝彦 (see Extension talk:CorrectMainPageTitle)
- Version 1.0, 2010-08-27
- First release
Code [edit]
<?php # CorrectMainPageTitle v1.1 # Copyright (C) 2010 VittGam (www.VittGam.net) # # 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 # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. if (!defined('MEDIAWIKI')) {die('Not a valid entry point.');} $wgExtensionCredits['other'][]=array( 'name'=>'CorrectMainPageTitle', 'author'=>'[http://www.VittGam.net/ VittGam]', 'version'=>'1.1', 'url'=>'http://www.mediawiki.org/wiki/Extension:CorrectMainPageTitle', 'description'=>'Corrects the main page HTML title.' ); $wgHooks['MediaWikiPerformAction'][]='CorrectMainPageTitle'; function CorrectMainPageTitle($output,$article,$title,$user,$request,$wiki) { if (in_array(strtolower($request->getText('action')),array('','view','print','submit','purge')) && $title->getText()==wfMsg('mainpage')) { $output->setHTMLTitle(wfMsg('pagetitle-view-mainpage')); } return true; }