I have the following error when executing this part of the code:
Cannot redeclare wfColoridoRender() (previously declared in /data/web/a1/eb/4e/.../htdocs/wiki/extensions/Colorido/Colorido.class.php:9) in /data/web/a1/eb/4e/.../htdocs/wiki/extensions/Colorido/Colorido.class.php on line 9
What is the problem in this code? I do not understand what is wrong
the code complete:
<?php
$wgHooks['ParserFirstCallInit'][] = 'onParserFirstCallInit';
function onParserFirstCallInit( Parser $parser ) {
$parser->setHook( 'colorido', 'wfColoridoRender' );
}
include_once wfColoridoRender( $input, $argv, $parser ) {
// Character styles
$input = utf8_decode($input);
$output = ""; // To stop the "Undefined Variable" errors in the webserver logfile
for ($i = 0; $i < strlen($input); $i++)
{
$s = rand(0, 9) * 8 + 150;
$w = rand(5, 9) * 100;
$r = rand(20, 230);
$g = rand(20, 230);
$b = rand(20, 230);
$output .=
'<span style="font-size: ' . strval($s) . '%; font-weight:'
. strval($w) . ';color: #' . dechex($r) . dechex($g) . dechex($b)
. ';">';
$output .= $input[$i];
$output .= '</span>';
}
return utf8_encode($output);
};