From 876f5d4de09f6215c3e65146460027d0dd244bc8 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 3 Feb 2014 19:38:15 -0800 Subject: transmit, receive, and parse bookmarks --- mod/item.php | 21 ++++++++++++++++----- mod/page.php | 4 ++-- 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index 6d421009b..88bf46a9f 100644 --- a/mod/item.php +++ b/mod/item.php @@ -887,13 +887,24 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) { $replaced = false; $r = null; - $termtype = ((strpos($tag,'#') === 0) ? TERM_HASHTAG : TERM_UNKNOWN); - $termtype = ((strpos($tag,'@') === 0) ? TERM_MENTION : $termtype); + + $termtype = ((strpos($tag,'#') === 0) ? TERM_HASHTAG : TERM_UNKNOWN); + $termtype = ((strpos($tag,'@') === 0) ? TERM_MENTION : $termtype); + $termtype = ((strpos($tag,'#^[') === 0) ? TERM_BOOKMARK : $termtype); + //is it a hash tag? if(strpos($tag,'#') === 0) { - // if the tag is replaced... - if(strpos($tag,'[zrl=')) { + if(strpos($tag,'#^[') === 0) { + if(preg_match('/#\^\[(url|zrl)=(.*?)\](.*?)\[\/(url|zrl)\]/',$tag,$match)) { + $basetag = $match[3]; + $url = $match[2]; + $replaced = true; + + } + } + // if the tag is already replaced... + elseif(strpos($tag,'[zrl=')) { //...do nothing return $replaced; } @@ -904,7 +915,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) { $body = str_replace($tag,$newtag,$body); $replaced = true; } - else { + if(! $replaced) { //base tag has the tags name only $basetag = str_replace('_',' ',substr($tag,1)); //create text for link diff --git a/mod/page.php b/mod/page.php index 56592116f..df17dbf52 100644 --- a/mod/page.php +++ b/mod/page.php @@ -38,7 +38,7 @@ function page_content(&$a) { $channel_address = argv(1); $page_id = argv(2); -dbg(1); + $u = q("select channel_id from channel where channel_address = '%s' limit 1", dbesc($channel_address) ); @@ -63,7 +63,7 @@ dbg(1); dbesc($page_id), intval(ITEM_WEBPAGE) ); -dbg(0); + if(! $r) { // Check again with no permissions clause to see if it is a permissions issue -- cgit v1.2.3