User:Alnokta/Fixtabs.php
From MediaWiki.org
<?php /** * Extension for wikipedia mirror sites to have the tabs point to the right locations * By Ryan Schmidt (aka Skizzerz) and licensed under the GNU GPL. */ $wgHooks['SkinTemplateContentActions'][] = 'efTabFix'; function efTabFix(&$ca) { global $wgTitle; $u = 'http://ar.wikipedia.org/w/index.php?title=' . $wgTitle->getPrefixedURL(); if(array_key_exists('edit', $ca)) $ca['edit']['href'] = $u.'&action=edit'; if(array_key_exists('history', $ca)) $ca['history']['href'] = $u.'&action=history'; if(array_key_exists('talk', $ca)) { $t = $wgTitle->getTalkNsText(); $t = wfUrlencode( str_replace(' ', '_', $t) ); $t = str_replace( '%28', '(', str_replace( '%29', ')', $t ) ); #prettify, might not be too safe though $b = $wgTitle->getText(); $b = wfUrlencode( str_replace(' ', '_', $b) ); $b = str_replace( '%28', '(', str_replace( '%29', ')', $b ) ); #prettify, might not be too safe though $ca['talk']['href'] = 'http://ar.wikipedia.org/wiki/' . $t . ':' . $b; } return true; }