×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    Figlet Extension: Difference between revisions

    Content added Content deleted
    imported>DrOwl
    No edit summary
    imported>DrOwl
    (modded again Owl & mutante 20.06.2006 - the slightly more secure 23 line version)
    Line 27: Line 27:
    <pre>
    <pre>
    <?php
    <?php
    # Figlet Mediawiki extension
    # Figlet Mediawiki extension
    # using shell figlet
    # using shell figlet
    # by DrOwl 21.06.2005
    # by DrOwl 21.06.2005 modded from
    # by mutante 25.03.2005
    #modded from
    # by mutante 25.03.2005
    # modded again 21.05.2005 ,mutante
    # modded again 21.05.2005 ,mutante
    # modded again Owl & mutante 20.06.2006 - the slightly more secure 23 line version
    $wgExtensionFunctions[] = "wfFigletExtension";
    # the short but working version, 19.06.2006
    #extension hook callback function
    # the slightly more secure version, 20.06.2006
    function wfFigletExtension() {
    #install extension hook
    global $wgParser;
    $wgExtensionFunctions[] = "wfFigletExtension";
    #install parser hook for <figlet> tags

    $wgParser->setHook( "figlet", "renderFiglet" );
    #extension hook callback function
    function wfFigletExtension() {
    global $wgParser;
    #install parser hook for <figlet> tags
    $wgParser->setHook( "figlet", "renderFiglet" );
    }

    function renderFiglet( $input ) {
    global $wgOutputEncoding;
    $input = mysql_escape_string($input);
    $input = escapeshellarg($input);

    $output="<pre>";
    \\$output.=`figlet $input`;
    $output.=shell_exec("figlet " . escapeshellarg($input));
    $output.="</pre>";

    return $output;
    }
    }
    function renderFiglet( $input ) {

    global $wgOutputEncoding;
    ?>
    $input = mysql_escape_string($input);
    $output="<pre>";
    $output.=shell_exec("figlet " . escapeshellarg($input));
    $output.="</pre>";
    return $output;
    }
    ?>
    </pre>
    </pre>



    Revision as of 19:48, 20 June 2006

    Integrate figlet text into wiki pages using figletlink in a custom Mediawiki extension:

    this is a first untested version with just monkey knolage of how to make it work

    Syntax

    <figlet>text</figlet>

    Example

    <figlet>moo</figlet>

    example Result

    | '_ ` _ \ / _ \ / _ \ 
    | | | | | | (_) | (_) |
    |_| |_| |_|\___/ \___/ 
    

    test Result

    <figlet>moo \\|uname /|uname \`\|uname`</figlet>

    (not installed on anything this is only beta i dont have figlet installed on this server)

    Source

    <?php
    	# Figlet Mediawiki extension
    	# using shell figlet
    	# by DrOwl 21.06.2005 modded from
    	# by mutante 25.03.2005
    	# modded again 21.05.2005 ,mutante
    	# modded again Owl & mutante 20.06.2006 - the slightly more secure 23 line version
    	$wgExtensionFunctions[] = "wfFigletExtension";
    	#extension hook callback function
    	function wfFigletExtension() {
    	global $wgParser;
    	#install parser hook for <figlet> tags
    	$wgParser->setHook( "figlet", "renderFiglet" );
    	}
    	function renderFiglet( $input ) {
    	global $wgOutputEncoding;
    	$input = mysql_escape_string($input);
    	$output="<pre>";
    	$output.=shell_exec("figlet " . escapeshellarg($input));
    	$output.="

    ";

    return $output; } ?>

    not installed yet, see ongoing talk.

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.