Hello!
i've done a tiny extension for integrating maps from
www.frappr.com into
mediawikis.
Hope anyone find's it usefull ...
I've you find bugs / have improvments ... just fix / make them ;)
Have fun!
Mit freundlichen Grüßen / Best regards
Alexander Menk
- self soft -
--
visit
www.self-soft.de
== BEGIN Frappr.php ==
<?php
/**
* Extension for Mapping Service
www.frappr.com
* general DOCs:
*
http://meta.wikimedia.org/wiki/Write_your_own_MediaWiki_extension
*
* Installation:
* 1) copy this as Frappr.php to extensions
* 2) add include("extensions/Frappr.php"); to the end of your
LocalSettings.php
*
* Usage:
* <frappr>param1|param2|param3...</frappr>
* where param1 ... n are the parameters in the order used in the java
script below :)
*
* done by Alexander Menk, self soft, Germany. visit
www.self-soft.de for
contact information
* released on 10.12.2005 as public domain - no warranty
**/
$wgExtensionFunctions[] = "wfFrapprLink";
function wfFrapprLink() {
global $wgParser;
# register the extension with the WikiText parser
$wgParser->setHook( "frappr", "renderFrappr" );
}
# The callback function for converting the input text to HTML output
function renderFrappr( $input, $argv = "") {
$arguments = explode("|",$input);
$clean = array();
# clean up parameters (for security reasons)
foreach($arguments as $val)
$clean[] = (float)$val;
$output = "<script>
var frappr_mapheight = ".$clean[0].";
var frappr_mapwidth = ".$clean[1].";
var frappr_maplat = ".$clean[2].";
var frappr_maplon = ".$clean[3].";
var frappr_mapzoom = ".$clean[4].";
var frappr_host = \"http://www.frappr.com/\";var gid =
".$clean[5].";</script>
<script
src=\"http://www.frappr.com/ajax/mapwidget.js\"></script>…gt;</script>";
return $output;
}
?>
=== END Frappr.php ===