Extension:CorrectMainPageTitle
Jump to navigation
Jump to search
![]() | This extension stores its source code on a wiki page. Please be aware that this code may be unreviewed or maliciously altered. They may contain security holes, outdated interfaces that are no longer compatible etc. Note: No localisation updates are provided for this extension by translatewiki.net . |
CorrectMainPageTitle Release status: beta |
|||
---|---|---|---|
Implementation | User interface | ||
Description | Corrects the main page HTML title. | ||
Author(s) | VittGamtalk | ||
Latest version | 1.1 (2010-10-14) | ||
MediaWiki | Tested on 1.16.0 | ||
PHP | Tested on 5.3.3 | ||
License | GNU General Public License 3.0 or later | ||
Download | See below | ||
|
|||
Translate the CorrectMainPageTitle extension if it is available at translatewiki.net | |||
Check usage and version matrix. |
This extension puts the correct HTML title in the main page, like in Wikimedia wikis.
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;
}