diff options
author | friendica <info@friendica.com> | 2013-04-15 03:00:08 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-04-15 03:00:08 -0700 |
commit | 7e6890832b15d8417cb812cbaa00d3ed8c954ef0 (patch) | |
tree | ff94dd547504ac2f3a65a18bda3a8804fdb5da43 /mod | |
parent | ab5151c470e630aa3864bbed927dd02f7b192166 (diff) | |
download | volse-hubzilla-7e6890832b15d8417cb812cbaa00d3ed8c954ef0.tar.gz volse-hubzilla-7e6890832b15d8417cb812cbaa00d3ed8c954ef0.tar.bz2 volse-hubzilla-7e6890832b15d8417cb812cbaa00d3ed8c954ef0.zip |
turn all Red links into zrls (not the old zrls, the new bbcode zrl which means we can zidify them)
Diffstat (limited to 'mod')
-rw-r--r-- | mod/item.php | 8 | ||||
-rwxr-xr-x | mod/like.php | 6 | ||||
-rw-r--r-- | mod/message.php | 7 | ||||
-rwxr-xr-x | mod/mood.php | 2 | ||||
-rw-r--r-- | mod/photos.php | 8 | ||||
-rwxr-xr-x | mod/poke.php | 2 | ||||
-rwxr-xr-x | mod/subthread.php | 6 | ||||
-rw-r--r-- | mod/tagger.php | 12 |
8 files changed, 26 insertions, 25 deletions
diff --git a/mod/item.php b/mod/item.php index 89059c205..a9b658441 100644 --- a/mod/item.php +++ b/mod/item.php @@ -785,14 +785,14 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) { //is it a hash tag? if(strpos($tag,'#') === 0) { //if the tag is replaced... - if(strpos($tag,'[url=')) + if(strpos($tag,'[zrl=')) //...do nothing return $replaced; //base tag has the tags name only $basetag = str_replace('_',' ',substr($tag,1)); //create text for link $url = $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag); - $newtag = '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]'; + $newtag = '#[zrl=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/zrl]'; //replace tag by the link $body = str_replace($tag, $newtag, $body); $replaced = true; @@ -809,7 +809,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) { //is it a person tag? if(strpos($tag,'@') === 0) { //is it already replaced? - if(strpos($tag,'[url=')) + if(strpos($tag,'[zrl=')) return $replaced; $stat = false; //get the person's name @@ -905,7 +905,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) { //create profile link $profile = str_replace(',','%2c',$profile); $url = $profile; - $newtag = '@[url=' . $profile . ']' . $newname . '[/url]'; + $newtag = '@[zrl=' . $profile . ']' . $newname . '[/zrl]'; $body = str_replace('@' . $name, $newtag, $body); //append tag to str_tags if(! stristr($str_tags,$newtag)) { diff --git a/mod/like.php b/mod/like.php index ce7d28f5c..35a94ab78 100755 --- a/mod/like.php +++ b/mod/like.php @@ -153,9 +153,9 @@ function like_content(&$a) { $arr['author_xchan'] = $observer['xchan_hash']; - $ulink = '[url=' . $thread_owner['xchan_url'] . ']' . $thread_owner['xchan_name'] . '[/url]'; - $alink = '[url=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/url]'; - $plink = '[url=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/url]'; + $ulink = '[zrl=' . $thread_owner['xchan_url'] . ']' . $thread_owner['xchan_name'] . '[/zrl]'; + $alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]'; + $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]'; $arr['body'] = sprintf( $bodyverb, $alink, $ulink, $plink ); diff --git a/mod/message.php b/mod/message.php index 94a8344ea..93b5c2494 100644 --- a/mod/message.php +++ b/mod/message.php @@ -160,9 +160,10 @@ function item_redir_and_replace_images($body, $images, $cid) { $newbody = ''; for($i = 0; $i < count($images); $i++) { - $search = '/\[url\=(.*?)\]\[!#saved_image' . $i . '#!\]\[\/url\]' . '/is'; - $replace = '[url=' . z_path() . '/redir/' . $cid - . '?f=1&url=' . '$1' . '][!#saved_image' . $i . '#!][/url]' ; + $search = '/\[zrl\=(.*?)\]\[!#saved_image' . $i . '#!\]\[\/zrl\]' . '/is'; +//FIXME + $replace = '[zrl=' . z_path() . '/redir/' . $cid + . '?f=1&url=' . '$1' . '][!#saved_image' . $i . '#!][/zrl]' ; $img_end = strpos($origbody, '[!#saved_image' . $i . '#!][/url]') + strlen('[!#saved_image' . $i . '#!][/url]'); $process_part = substr($origbody, 0, $img_end); diff --git a/mod/mood.php b/mod/mood.php index b5414ca12..0c611997c 100755 --- a/mod/mood.php +++ b/mod/mood.php @@ -60,7 +60,7 @@ function mood_init(&$a) { $mid = item_message_id(); - $action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/url]' , $verbs[$verb]); + $action = sprintf( t('%1$s is currently %2$s'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]); $item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_UNSEEN; if(! $parent_mid) $item_flags |= ITEM_THREAD_TOP; diff --git a/mod/photos.php b/mod/photos.php index f5d2bed97..0564cb3ff 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -413,13 +413,13 @@ function photos_post(&$a) { } if($profile) { if(substr($notify,0,4) === 'cid:') - $taginfo[] = array($newname,$profile,$notify,$r[0],'@[url=' . str_replace(',','%2c',$profile) . ']' . $newname . '[/url]'); + $taginfo[] = array($newname,$profile,$notify,$r[0],'@[zrl=' . str_replace(',','%2c',$profile) . ']' . $newname . '[/zrl]'); else $taginfo[] = array($newname,$profile,$notify,null,$str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]'); if(strlen($str_tags)) $str_tags .= ','; $profile = str_replace(',','%2c',$profile); - $str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]'; + $str_tags .= '@[zrl=' . $profile . ']' . $newname . '[/zrl]'; } } } @@ -487,9 +487,9 @@ function photos_post(&$a) { $arr['tag'] = $tagged[4]; $arr['inform'] = $tagged[2]; $arr['origin'] = 1; - $arr['body'] = sprintf( t('%1$s was tagged in %2$s by %3$s'), '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ; + $arr['body'] = sprintf( t('%1$s was tagged in %2$s by %3$s'), '[zrl=' . $tagged[1] . ']' . $tagged[0] . '[/zrl]', '[zrl=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('a photo') . '[/zrl]', '[zrl=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/zrl]') ; - $arr['body'] .= "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . ']' . '[img]' . $a->get_baseurl() . "/photo/" . $p[0]['resource_id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ; + $arr['body'] .= "\n\n" . '[zrl=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . ']' . '[img]' . $a->get_baseurl() . "/photo/" . $p[0]['resource_id'] . '-' . $best . '.' . $ext . '[/img][/zrl]' . "\n" ; $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>'; $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n"); diff --git a/mod/poke.php b/mod/poke.php index 1738fd8dd..2ccbfbd77 100755 --- a/mod/poke.php +++ b/mod/poke.php @@ -104,7 +104,7 @@ function poke_init(&$a) { $arr['obj_type'] = ACTIVITY_OBJ_PERSON; $arr['origin'] = 1; - $arr['body'] = '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' . ' ' . t($verbs[$verb][0]) . ' ' . '[url=' . $target['url'] . ']' . $target['name'] . '[/url]'; + $arr['body'] = '[zrl=' . $poster['url'] . ']' . $poster['name'] . '[/zrl]' . ' ' . t($verbs[$verb][0]) . ' ' . '[zrl=' . $target['url'] . ']' . $target['name'] . '[/zrl]'; $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . $a->get_baseurl() . '/contact/' . $target['id'] . '</id>'; $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $target['url'] . '" />' . "\n"); diff --git a/mod/subthread.php b/mod/subthread.php index c91052395..66dc86eb2 100755 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -126,9 +126,9 @@ EOT; $arr['author-link'] = $contact['url']; $arr['author-avatar'] = $contact['thumb']; - $ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; - $alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]'; - $plink = '[url=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]'; + $ulink = '[zrl=' . $contact['url'] . ']' . $contact['name'] . '[/zrl]'; + $alink = '[zrl=' . $item['author-link'] . ']' . $item['author-name'] . '[/zrl]'; + $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/zrl]'; $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink ); $arr['verb'] = $activity; diff --git a/mod/tagger.php b/mod/tagger.php index ff99a2f8a..b8e90e2fd 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -97,7 +97,7 @@ EOT; if(! isset($bodyverb)) return; - $termlink = html_entity_decode('⌗') . '[url=' . $a->get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/url]'; + $termlink = html_entity_decode('⌗') . '[zrl=' . $a->get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/zrl]'; $arr = array(); @@ -116,9 +116,9 @@ EOT; $arr['author-link'] = $contact['url']; $arr['author-avatar'] = $contact['thumb']; - $ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; - $alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]'; - $plink = '[url=' . $item['plink'] . ']' . $post_type . '[/url]'; + $ulink = '[zrl=' . $contact['url'] . ']' . $contact['name'] . '[/zrl]'; + $alink = '[zrl=' . $item['author-link'] . ']' . $item['author-name'] . '[/zrl]'; + $plink = '[zrl=' . $item['plink'] . ']' . $post_type . '[/zrl]'; $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink, $termlink ); $arr['verb'] = ACTIVITY_TAG; @@ -152,7 +152,7 @@ EOT; if((! $blocktags) && (! stristr($item['tag'], ']' . $term . '[' ))) { q("update item set tag = '%s' where id = %d limit 1", - dbesc($item['tag'] . (strlen($item['tag']) ? ',' : '') . '#[url=' . $a->get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/url]'), + dbesc($item['tag'] . (strlen($item['tag']) ? ',' : '') . '#[zrl=' . $a->get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/zrl]'), intval($item['id']) ); } @@ -168,7 +168,7 @@ EOT; ); if(count($x) && !$x[0]['blocktags'] && (! stristr($r[0]['tag'], ']' . $term . '['))) { q("update item set tag = '%s' where id = %d limit 1", - dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . $a->get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/url]'), + dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[zrl=' . $a->get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/zrl]'), intval($r[0]['id']) ); } |