render_location hook

This commit is contained in:
friendica 2012-02-09 15:02:59 -08:00
parent 171249966e
commit ec26f88be9

View file

@ -262,15 +262,10 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
else else
$profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']); $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
$location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''); $locate = array('location' => $item_location, 'coord' => $item['coord'], 'html' => '');
$coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : ''); call_hooks('render_location',$locate);
if($coord) {
if($location)
$location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
else
$location = '<span class="smalltext">' . $coord . '</span>';
}
$location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate));
localize_item($item); localize_item($item);
if($mode === 'network-new') if($mode === 'network-new')
@ -1008,3 +1003,17 @@ function find_thread_parent_index($arr,$x) {
return $k; return $k;
return false; return false;
} }
function render_location_google($item) {
$location = '';
$location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
$coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
if($coord) {
if($location)
$location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
else
$location = '<span class="smalltext">' . $coord . '</span>';
}
return $location;
}