$default_url, ), $atts)); // check for city name if (!empty($atts[0])) { $city = $atts[0]; if (false === ($directory = ff_meta_getmetadata (get_option( 'ff_meta_dir' ))) || empty($directory[$city])) { return ''; } $url = $directory[$city]; } if (empty($url) || false === ($metadata = ff_meta_getmetadata ($url))) { return ''; } $outstr = "
';
$contact = $metadata['contact'];
// Output -- rather ugly but the data is not uniform, some fields are URIs, some are usernames, ...
if (!empty($contact['email'])) {
$outstr .= sprintf("E-Mail: %s
\n", $contact['email'], $contact['email']);
}
if (!empty($contact['ml'])) {
$outstr .= sprintf("Mailingliste: %s
\n", $contact['ml'], $contact['ml']);
}
if (!empty($contact['irc'])) {
$outstr .= sprintf("IRC: %s
\n", $contact['irc'], $contact['irc']);
}
if (!empty($contact['twitter'])) {
// catch username instead of URI
if ($contact['twitter'][0] === "@") {
$twitter_url = 'http://twitter.com/'.ltrim($contact['twitter'], "@");
$twitter_handle = $contact['twitter'];
} else {
$twitter_url = $contact['twitter'];
$twitter_handle = '@' . substr($contact['twitter'], strrpos($contact['twitter'], '/') + 1);
}
$outstr .= sprintf("Twitter: %s
\n", $twitter_url, $twitter_handle);
}
if (!empty($contact['facebook'])) {
$outstr .= sprintf("Facebook: %s
\n", $contact['facebook'], $contact['facebook']);
}
if (!empty($contact['googleplus'])) {
$outstr .= sprintf("G+: %s
\n", $contact['googleplus'], $contact['googleplus']);
}
if (!empty($contact['jabber'])) {
$outstr .= sprintf("XMPP: %s
\n", $contact['jabber'], $contact['jabber']);
}
$outstr .= '
Data from external URLs is cached for this number of minutes.
"; } function ff_meta_dir_callback() { $url = get_option( 'ff_meta_dir' ); if (empty($url)) { $url = "https://raw.githubusercontent.com/freifunk/directory.api.freifunk.net/master/directory.json"; } echo "" ."Please keep the default unless you really know what you are doing.
"; } function ff_meta_url_callback() { $url = get_option( 'ff_meta_url' ); if (empty($url)) { $url = "http://meta.hamburg.freifunk.net/ffhh.json"; } echo "" ."This will be the default for all tags without url=\"xyz\" or city parameter.
"; } function ff_meta_options_page() { ?>