]> git.mxchange.org Git - friendica.git/commitdiff
linkify hash tags
authorFriendika <info@friendika.com>
Tue, 9 Nov 2010 06:39:03 +0000 (22:39 -0800)
committerFriendika <info@friendika.com>
Tue, 9 Nov 2010 06:39:03 +0000 (22:39 -0800)
include/bbcode.php
mod/item.php

index a315c3e38d8976a12bee8dbfc69e355608ef49aa..961494b167ee7aba5953f020347d0b88c8ccbe4f 100644 (file)
@@ -12,13 +12,13 @@ function bbcode($Text) {
        $Text = nl2br($Text);
 
        // Set up the parameters for a URL search string
-       $URLSearchString = " a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'";
+       $URLSearchString = " a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%";
        // Set up the parameters for a MAIL search string
        $MAILSearchString = $URLSearchString . " a-zA-Z0-9\.@";
 
        // Perform URL Search
-       $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="$1" target="_blank">$1</a>', $Text);
-       $Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text);
+       $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="$1" >$1</a>', $Text);
+       $Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '<a href="$1" >$2</a>', $Text);
        //$Text = preg_replace("(\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text);
 
        // Perform MAIL Search
index 75822936a48b94b6f58b51988afda23d935fbd39..430500f99876906ef5d4fe1d48d05f31c3748e44 100644 (file)
@@ -121,6 +121,11 @@ function item_post(&$a) {
 
        if(count($tags)) {
                foreach($tags as $tag) {
+                       if(strpos($tag,'#') === 0) {
+                               $basetag = substr($tag,1);
+                               $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?search=' . urlencode($basetag) . ']' . $basetag . '[/url]',$body);
+                               continue;
+                       }
                        if(strpos($tag,'@') === 0) {
                                $name = substr($tag,1);
                                if((strpos($name,'@')) || (strpos($name,'http://'))) {