Extension:PersistUseskin
<translate> This extension stores its source code on a wiki page.</translate> <translate> Please be aware that this code may be unreviewed or maliciously altered.</translate> <translate> They may contain security holes, outdated interfaces that are no longer compatible etc.</translate> <translate> Note:</translate> <translate> No [[<tvar name=localisation>Special:MyLanguage/Localisation#Translation resources</tvar>|localisation]] updates are provided for this extension by <tvar name=twn>translatewiki.net </tvar>.</translate> |
<translate> This extension is currently not actively maintained!</translate> <translate> Although it may still work, any bug reports or feature requests will more than likely be ignored.</translate> |
PersistUseskin Release status: unmaintained |
|
---|---|
Implementation | Parser extension |
Description | Persists use of &useskin=, if found in query string |
Author(s) | Smd~mediawikiwikitalk |
Latest version | 0.0.1 (2008-12-28) |
MediaWiki | 1.13.3 |
License | GPL |
Download | see below |
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Description
Persists use of &useskin=, if found in query string. Possibly the shortest MediaWiki extension ever (could be seen as one-liner :) ) ... For more, see comments in Code below
Download instructions
Please cut and paste the code found below and place it in $IP/extensions/PersistUseskin.php
. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php .
Installation
To install this extension, add the following to LocalSettings.php :
require_once( $IP.'/extensions/PersistUseskin.php' );
Code
<?php
# PersistUseskin MediaWiki extension
#
#
# Gives any user the choice to view wiki in any of the installed skins, by clicking on a link containing the '&useskin=' query string
# simply remove the '&useskin=' query string from the address, to go back to default skin
# you can then use a link like:
# [{{SERVER}}{{SCRIPTPATH}}/index.php?title={{PAGENAMEE}}&useskin=monobook monobook]
# to allow users to persistently browse the wiki in the chosen skin.
$wgExtensionCredits['parserhook'][] = array(
'name' => 'PersistUseskin',
'author' => 'http://www.mediawiki.org/wiki/User:Smd',
'url' => 'http://www.mediawiki.org/wiki/Extension:PersistUseskin',
'description' => 'Persists use of &useskin=, if found in query string',
'version'=>'0.0.1'
);
# URL hook list:
# GetInternalURL Used to modify fully-qualified URLs (useful for squid cache purging) # no trigger for local pages?
# GetLocalURL Used to modify local URLs as output into page links
# GetFullURL Used to modify fully-qualified URLs used in redirects/export/offsite data
$wgHooks['GetLocalURL'][] = 'PersistUseskin';
function PersistUseskin($title, $url, $query)
{
# for debug
# echo ("PersistUseskin title" . $title . "<br>\r\n" . " url " . $url . " query " . $query. "<br>\r\n". "<br>\r\n");
# if we found the 'useskin' query string - simply append it again to local link ...
if ($_GET["useskin"])
if ($_GET["useskin"] != "" )
$url .= "&useskin=" . $_GET["useskin"];
# that's it ! :) go back ...
return true;
}
?>
If Short urls are used, the following change might be required:
--- PersistUseskin.orig 2011-01-26 00:18:47.000000000 +0100
+++ PersistUseskin.php 2011-01-26 00:32:02.000000000 +0100
@@ -31,8 +31,10 @@ function PersistUseskin($title, $url, $q
# if we found the 'useskin' query string - simply append it again to local link ...
if ($_GET["useskin"])
- if ($_GET["useskin"] != "" )
- $url .= "&useskin=" . $_GET["useskin"];
+ if ($_GET["useskin"] != "" ) {
+ $qsa = strrchr ($url, '?') ? '&' : '?';
+ $url .= $qsa . "useskin=" . $_GET["useskin"];
+ }
# that's it ! :) go back ...
- Pages with script errors
- Pages with broken file links
- Extensions which host their code in-wiki
- Unmaintained extensions
- Extensions without an image
- Parser extensions
- Extensions without a compatibility policy
- Extensions with manual MediaWiki version
- Extensions with unknown license
- GetLocalURL extensions
- All extensions
- Extensions not in ExtensionJson
- Edit extensions