×
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
    (copy from muts media wiki)
     
    imported>DrOwl
    Line 23: Line 23:
    <pre>
    <pre>
    <?php
    <?php
    # RSS-Feed Mediawiki extension
    # Figlet Mediawiki extension
    # using shell figlet
    # using magpieRSS (http://magpierss.sourceforge.net/)
    # by DrOwl 21.06.2005
    #modded from
    # by mutante 25.03.2005
    # by mutante 25.03.2005


    $wgExtensionFunctions[] = "wffigltExtension";
    require_once('magpierss-0.71.1/rss_fetch.inc');
    $wgExtensionFunctions[] = "wfRssExtension";


    function wfRssExtension() {
    function wffigletExtension() {
    global $wgParser;
    global $wgParser;
    $wgParser->setHook( "rss", "renderRss" );
    $wgParser->setHook( "rss", "renderFiglet" );
    }
    }




    function renderRss( $input ) {
    function renderFiglet( $input ) {


    $input =~ /[Aa-Zz]|[1-0];
    # $input = mysql_escape_string($input);
    # $input = mysql_escape_string($input);
    $figlet = passthru('echo $input | /home/drowl/figlet/figlet -d /home/drowl/figlet/fonts');

    $output="<pre>";

    $output.="$figlet";
    $rss = fetch_rss($input);
    $output.="</pre>";

    $output="<table><tr><th>Channel Title: </th><th>" . $rss->channel['title'] . "</th></tr>";
    $output.="<tr><td>";
    foreach ($rss->items as $item) {
    $href = $item['link'];
    $title = $item['title'];
    $output.="<td colspan='2'><a href='$href'>$title</a></td></tr>";
    }
    $output.="</table>";


    return $output;
    return $output;

    Revision as of 00:43, 21 May 2005

    Integrate RSS feeds into wiki pages using magpieRSS (a PHP RSS parser class) in a custom Mediawiki extension:

    (For example to interwiki syndicate RecentChanges pages.)

    mutante 20:57, 25 Mar 2005 (UTC)


    Syntax

    <rss>URL</rss>

    Example

    <rss>http://slashdot.org/slashdot.rss</rss>

    Result

    <rss>http://slashdot.org/slashdot.rss</rss>

    (not installed on wikipedia, but here)

    Source

    <?php
    # Figlet Mediawiki extension
    # using shell figlet 
    # by DrOwl 21.06.2005
    #modded from
    # by mutante 25.03.2005
    
    $wgExtensionFunctions[] = "wffigltExtension";
    
    function wffigletExtension() {
    global $wgParser;
    $wgParser->setHook( "rss", "renderFiglet" );
    }
    
    
    function renderFiglet( $input ) {
    
    $input =~ /[Aa-Zz]|[1-0];
    # $input = mysql_escape_string($input);
    $figlet = passthru('echo $input | /home/drowl/figlet/figlet -d /home/drowl/figlet/fonts');
    $output="<pre>";
    $output.="$figlet";
    $output.="

    ";

    return $output;

    }

    ?>

    Improved Version by Duesentrieb

    Also have a look at User:Duesentrieb/RSS for a modified version with a few more features -- Duesentrieb 01:29, 2 May 2005 (UTC)

    This includes converting different charsets using iconv and an option to hide the description (shortened list). Thanks for your help , Duesentrieb, I didnt feel like messing with the charset conversion especially. mutante 22:31, 5 May 2005 (UTC)

    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.