From b41106f2fbebfd0bbc2bfc70efd3421073469f44 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 2 Feb 2013 16:34:00 -0800 Subject: allow non-linkable locations, self-linked locations and get rid of google default location link --- include/ItemObject.php | 14 +++----------- include/conversation.php | 27 ++++++++++++++++++++------- 2 files changed, 23 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/ItemObject.php b/include/ItemObject.php index c4f1093c6..d3d2b7283 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -135,16 +135,8 @@ class Item extends BaseObject { $profile_link = chanlink_url($item['author']['xchan_url']); $profile_name = $item['author']['xchan_name']; - $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => ''); - call_hooks('render_location',$locate); - $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate)); - -// are we still using $item['tag']? Need to check... - $tags = array(); - foreach(explode(',',$item['tag']) as $tag){ - $tag = trim($tag); - if ($tag!="") $tags[] = bbcode($tag); - } + $location = format_location($item); + $showlike = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : ''); $showdislike = ((x($dlike,$item['uri']) && feature_enabled($conv->get_profile_owner(),'dislike')) @@ -200,7 +192,7 @@ class Item extends BaseObject { 'template' => $this->get_template(), 'type' => implode("",array_slice(explode("/",$item['verb']),-1)), - 'tags' => $tags, + 'tags' => array(), 'body' => $body, 'text' => strip_tags($body), 'id' => $this->get_id(), diff --git a/include/conversation.php b/include/conversation.php index 524b4340c..200e876d9 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -548,10 +548,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { $profile_avatar = $item['author']['xchan_photo_m']; - $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => ''); - call_hooks('render_location',$locate); - - $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate)); + $location = format_location($item); localize_item($item); if($mode === 'network-new') @@ -1085,9 +1082,25 @@ function find_thread_parent_index($arr,$x) { return false; } -function render_location_google($item) { - $location = (($item['location']) ? '' . $item['location'] . '' : ''); - $coord = (($item['coord']) ? '' . $item['coord'] . '' : ''); +function format_location($item) { + + if(strpos($item['location'],'#') === 0) { + $location = substr($item['location'],1); + $location = ((strpos($location,'[') !== false) ? bbcode($location) : $location); + } + else { + $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => ''); + call_hooks('render_location',$locate); + $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_default($locate)); + } + return $location; +} + +function render_location_default($item) { + + $location = $item['location']; + $coord = $item['coord']; + if($coord) { if($location) $location .= '
(' . $coord . ')'; -- cgit v1.2.3