βάλτε αυτό.
random έγραψε:μάλλον βάλτε αυτό, που κουκουλώνει το bug του urlencodeΚώδικας: Επιλογή όλων
<?php
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This file is a MediaWiki extension, it is not a valid entry point' );
}
class pirategov {
}
$wgExtensionCredits['outputpagehook'][] = array(
'name'=>'PirateGov Hook',
'url'=>'http://www.mediawiki.org/wiki/Extension:PirateGov',
'author'=>'qwertyuiopasdfghjklz',
'description'=>'it adds a [Vote+][Vote-][edit][talk] of every section that begins with Vote:.',
'version'=>'0.00001c'
);
$wgHooks['OutputPageBeforeHTML'][] = 'wfPirateGov';
function wfPirateGov(&$outputpage, &$text) {
global $wgVoteplustext;
global $wgVoteminustext ;
global $wgServer;
global $wgScriptPath;
$geteditsectionhint=wfMsg('editsectionhint');
$cutgeteditsectionhint= substr($geteditsectionhint, 0, strpos($geteditsectionhint, ':'));
$text = preg_replace(
"/<span class=\"editsection\">\[<a href=\"(.+)\" title=\"$cutgeteditsectionhint: Vote:(.+)\">".wfMsg('editsection')."<\/a>\]<\/span>/i",
"<span class=\"editsection\"> [<a href=\"$1&summary=Vote: $2 plus\">$wgVoteplustext</a>] [<a href=\"$1&summary=Vote: $2 minus\">$wgVoteminustext </a>] [<a href=\"$1\" title=\"$2\">".wfMsg('editsection')."</a>] [<a href=\"$wgServer$wgScriptPath/index.php?title=".wfMsg('sp-contributions-talk').":$outputpage->mPagetitle/$2\" title=\"$2\">".wfMsg('sp-contributions-talk')."</a>] </span>"
,$text);
return true;
}
το bug που διoρθώνει ο παραπάνω κώδικας είναι γιατί ενώ στο δικό μου Localhost επιτρέπεται η κλήση
http://hostname/index.php/σελίδα
στο pirategov1 πρέπει υποχρεωτικά να καλεσεις
http://hostname/index.php?title=σελίδα