diff --git a/freifunk_marker.png b/freifunk_marker.png new file mode 100644 index 0000000..279c962 Binary files /dev/null and b/freifunk_marker.png differ diff --git a/freifunkmeta.php b/freifunkmeta.php index 228e9f4..ece7799 100644 --- a/freifunkmeta.php +++ b/freifunkmeta.php @@ -35,6 +35,9 @@ if ( ! shortcode_exists( 'ff_services' ) ) { if ( ! shortcode_exists( 'ff_contact' ) ) { add_shortcode( 'ff_contact', 'ff_meta_shortcode_handler'); } +if ( ! shortcode_exists( 'ff_location' ) ) { + add_shortcode( 'ff_location', 'ff_meta_shortcode_handler'); +} // Example: // [ff_state] // [ff_state hamburg] @@ -63,6 +66,94 @@ function ff_meta_shortcode_handler( $atts, $content, $name ) { $outstr .= sprintf('%s', $state['nodes']); break; + case 'ff_location': + // normal per-city code + $loc = $metadata['location']; + $loc_name = (isset($loc['address']) && isset($loc['address']['Name'])) ? $loc['address']['Name'] : ''; + $loc_street = (isset($loc['address']) && isset($loc['address']['Street'])) ? $loc['address']['Street'] : ''; + $loc_zip = (isset($loc['address']) && isset($loc['address']['Zipcode'])) ? $loc['address']['Zipcode'] : ''; + $loc_city = isset($loc['city']) ? $loc['city'] : ''; + $loc_lon = isset($loc['lon']) ? $loc['lon'] : ''; + $loc_lat = isset($loc['lat']) ? $loc['lat'] : ''; + if (empty($loc_name) || empty($loc_street) || empty($loc_zip)) { + return ''; + } + + // TODO: style address + map as single box + // TODO: once it is "ready" package openlayers.js into the plugin (cf. http://docs.openlayers.org/library/deploying.html) + // TODO: handle missing values (i.e. only name & city) + $outstr .= '
';
+ $outstr .= sprintf('%s
%s
%s %s',
+ $loc_name, $loc_street, $loc_zip, $loc_city);
+ $outstr .= '