Extension:MobileMeta
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 . |
This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored. |
![]() Release status: unmaintained |
|
---|---|
Implementation | Tag |
Description | Adds <meta name="viewport" content="width=device-width, initial-scale=1.0" /> tag into the page header. |
Author(s) | Andy Chow |
Latest version | 0.1 (2013-04-25) |
MediaWiki | 1.19+ |
Database changes | No |
License | MIT License |
Download | No link |
Example | http://m.transitunlimited.org/ |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|
The MobileMeta extension adds <meta name="viewport" content="width=device-width, initial-scale=1.0" /> tag into the page header. Because of the new skinning method beginning Mediawiki version 1.18, it is no longer preferable to add include the tag in the skin itself. This would be suitable if the mobile version of the site is operated on a separate Mediawiki installation.
InstallationEdit
Install this file MobileMeta.php in the extension directory:
<?php
/*
* MobileMeta.php - A MediaWiki tag extension for adding <meta> description to a page.
* @author Andy Chow
* @version 0.1
* @copyright Copyright (C) 2013 Transit Unlimited Services LLC
* @license The MIT License - http://www.opensource.org/licenses/mit-license.php
* -----------------------------------------------------------------------
* Description:
* This is a MediaWiki extension which adds <meta name="viewport" content="width=device-width, initial-scale=1.0" /> tag
* into the page header.
* Requirements:
* MediaWiki 1.19.x
* PHP 4.x, 5.x or higher
* Installation:
* 1. Drop this script (MobileMeta.php) in $IP/extensions
* Note: $IP is your MediaWiki install dir.
* 2. Enable the extension by adding this line to your LocalSettings.php:
* require_once('extensions/MobileMeta.php');
* Version Notes:
* version 0.1:
* Initial release.
*
* -----------------------------------------------------------------------
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
* -----------------------------------------------------------------------
*/
if( !defined( 'MEDIAWIKI' ) ) {
echo "This file is part of MediaWiki, it is not a valid entry point.\n";
exit( 1 );
}
# Credits
$wgExtensionCredits['parserhook'][] = array(
'name' => 'MobileMeta',
'author' => 'Andy Chow',
'url' => 'https://www.mediawiki.org/wiki/Extension:MobileMeta',
'description' => 'Adds the <code><meta name="viewport" content="width=device-width, initial-scale=1.0" /></code> tag to the page header',
'version'=> '0.1'
);
# $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$wgHooks['OutputPageBeforeHTML'][] = 'insertMetaDescription';
function insertMetaDescription( $out ) {
$out->addMeta( 'viewport', 'width=device-width, initial-scale=1.0' );
return true;
}
Configuration parametersEdit
None.