Extension:Raptorize

From MediaWiki.org
Jump to navigation Jump to search
Smiley.svg This extension is for fun

It is not meant to be taken seriously.

MediaWiki extensions manual
OOjs UI icon advanced.svg
Raptorize
Release status: stable
Implementation Tag
Description Converts text to a Raptor font
Author(s) Tarbosaurustalk
Latest version 1.4.1 (2013-07-26)
Database changes No
License GPL v2+
Download See the code section
<raptor>
Translate the Raptorize extension if it is available at translatewiki.net

The Raptorize extension converts any text inside the tag into a raptor font. Edited from Extension:Colorize.

Needs this font.

Installation[edit]

Copy the above code to a file called Raptorize.php, and install in your extensions directory under the folder Raptorize. Then, add the following to LocalSettings.php:

require_once("$IP/extensions/Raptorize/Raptorize.php");

Usage[edit]

Just put the text you want in between the <raptor> tags, and it gets converted into raptor font.

Code[edit]

<?php
if( !defined( 'MEDIAWIKI' ) ) exit;

$wgExtensionFunctions[] = "wfRaptorSetup";
$wgExtensionCredits[parserhook][] = array(
        'path' => __FILE__,
        'name' => "Raptorize",
        'description' => "Allows to show text in raptor script",
        'version' => "1.4.1",
        'author' => "Tarbosaurus",
        'url' => "https://www.mediawiki.org/wiki/Extension:Raptorize",
);
 
function wfRaptorSetup() {
 
    global $wgParser;
    $wgParser->setHook( "raptor", "wfRaptorRender" );
}
 
function wfRaptorRender( $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++)
      {
 
    $output .= 
      '<span style="font-size: 18px; font-family: raptorian sans;">';
    $output .= $input[$i];
    $output .= '</span>';
      }
 
    return utf8_encode($output);
}