From: friendica Date: Fri, 10 Feb 2012 02:10:12 +0000 (-0800) Subject: add openstreetmap X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bb5588b5eb8d6c292c78ce276774c75dac2386fc;p=friendica-addons.git add openstreetmap --- diff --git a/openstreetmap.tgz b/openstreetmap.tgz new file mode 100644 index 00000000..85da0748 Binary files /dev/null and b/openstreetmap.tgz differ diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php new file mode 100755 index 00000000..d76414c4 --- /dev/null +++ b/openstreetmap/openstreetmap.php @@ -0,0 +1,51 @@ + + * + * + */ + + +function openstreetmap_install() { + + register_hook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location'); + + logger("installed openstreetmap"); +} + + +function openstreetmap_uninstall() { + + unregister_hook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location'); + + logger("removed openstreetmap"); +} + + + +function openstreetmap_location($a, &$item) { + + $location = ''; + $coord = ''; + + $location = (($item['location']) ? '' . $item['location'] . '' : ''); + + if($item['coord']) { + $coords = explode(' ', $item['coord']); + if(count($coords) > 1) { + $coord = '' . $item['coord'] . '' ; + } + } + if(strlen($coord)) { + if($location) + $location .= '
(' . $coord . ')'; + else + $location = '' . $coord . ''; + } + $item['html'] = $location; + return; +} + diff --git a/randplace.tgz b/randplace.tgz index 937c02d5..98b28a9d 100755 Binary files a/randplace.tgz and b/randplace.tgz differ diff --git a/randplace/randplace.php b/randplace/randplace.php index 35503850..df713766 100755 --- a/randplace/randplace.php +++ b/randplace/randplace.php @@ -136,7 +136,8 @@ function randplace_post_hook($a, &$item) { function randplace_settings_post($a,$post) { if(! local_user()) return; - set_pconfig(local_user(),'randplace','enable',intval($_POST['randplace'])); + if($_POST['randplace-submit']) + set_pconfig(local_user(),'randplace','enable',intval($_POST['randplace'])); } @@ -175,6 +176,6 @@ function randplace_settings(&$a,&$s) { /* provide a submit button */ - $s .= '
'; + $s .= '
'; }