Open main menu

Extension:Colorize/es

This page is a translated version of the page Extension:Colorize and the translation is 22% complete.

Other languages:
English • ‎español • ‎বাংলা • ‎日本語


MediaWiki extensions manual
OOjs UI icon advanced.svg
Colorize
Release status: estable
Implementación Tag
Descripción Makes text to appear more fun
Autor(es) Javier Valcarce García (javier.{NOSPAM}valcarce @gmail.com)
Última versión 0.2 (2013-04-05)
MediaWiki 1.15+
Licencia Ninguna licencia especificó
Descarga see code below
Translate the Colorize extension if it is available at translatewiki.net
Verificar uso y versión de la matriz.

The Colorize extension allows to colorize text between <colorize> and </colorize> tags to make it to appear more fun.

Instalación

As usual. Copy PHP code into a file named Colorize.php and put it in your MW extensions directory then change LocalSettings.php

Changes to LocalSettings.php

  • Añade el siguiente código a tu LocalSettings.php (preferiblemente al final):
    require_once "$IP/extensions/Colorize/Colorize.php";
    
  • Yes Hecho – Navega a Special:Version en tu wiki para verificar que la apariencia se haya instalado correctamente.

Código

<?php
$wgExtensionFunctions[] = "wfColorizeSetup";
$wgExtensionCredits['parserhook'][] = array(
    'name' => 'Colorize',
    'url' => 'https://www.mediawiki.org/wiki/Extension:Colorize',
    'author' => 'Javier Valcarce Garcia',
    'version' => '0.2',
    'description' => 'Makes text to appear more fun',
);
 
function wfColorizeSetup() {
 
    global $wgParser;
    $wgParser->setHook( "colorize", "wfColorizeRender" );
}
 
function wfColorizeRender( $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, 220);
    $g = rand(20, 220);
    $b = rand(20, 220);
 
    $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);
}