Aae34a7973a8d98e53764a1c89090c55

Here's a nice little template for MediaWiki that allows to embed generic html using the <htm> tag :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
# html
# 
# Tag :
#   <htm>html code</htm>
# 
# Enjoy !

$wgExtensionFunctions[] = 'wfhtml';
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'html',
        'description' => 'Display html',
        'author' => 'Guillaume Riflet',
        'url' => 'http://meta.wikimedia.org/wiki/html'
);

function wfhtml() {
        global $wgParser;
        $wgParser->setHook('htm', 'renderhtml');
}

# The callback function for converting the input text to HTML output
function renderhtml($input) {      
        $output=$input;
        return $output;
}
?>

Refactorings

No refactoring yet !

Aae34a7973a8d98e53764a1c89090c55

griflet

January 29, 2008, January 29, 2008 18:47, permalink

No rating. Login to rate!

Hmmm, nice!
And about this variant that does the "feeling lucky" magic link? It creates a <goto> tag. Pretty neat, huh? ;)
Sure saves me a-lot-of-time when posting articles in mediawiki or in wordpress...

BTW, remember to append 'include("extensions/goto.php");' to the LocalSettings.php file in your mediawiki directory.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
# goto
# 
# Tag :
#   <goto>search string</goto>
# 
# Enjoy !

$wgExtensionFunctions[] = 'wfgoto';
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'goto',
        'description' => 'Google "Feeling Lucky" linking',
        'author' => 'Guillaume Riflet',
        'url' => 'http://meta.wikimedia.org/wiki/goto'
);

function wfgoto() {
        global $wgParser;
        $wgParser->setHook('goto', 'rendergoto');
}

# The callback function for converting the input text to HTML output
function rendergoto($input) {      
        $output='<a href="http://www.google.com/search?hl=en&q='.$input.'&btnI=kudos" >'.$input.'</a>';
        return $output;
}
?>
Be2f49544c8f9e781c770618cb290347

Ric

February 18, 2008, February 18, 2008 22:09, permalink

No rating. Login to rate!

I have a job based on this project up on rentacoder....http://www.rentacoder.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=867795
and have a good budget to get this done... can you help me?
You seem to be the guru of this stuff.
Thanks in advance.
Ric

Your refactoring





Format Copy from initial code

or Cancel