linkify hash tags
This commit is contained in:
parent
9f606be540
commit
098478e3a5
|
@ -12,13 +12,13 @@ function bbcode($Text) {
|
||||||
$Text = nl2br($Text);
|
$Text = nl2br($Text);
|
||||||
|
|
||||||
// Set up the parameters for a URL search string
|
// 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
|
// Set up the parameters for a MAIL search string
|
||||||
$MAILSearchString = $URLSearchString . " a-zA-Z0-9\.@";
|
$MAILSearchString = $URLSearchString . " a-zA-Z0-9\.@";
|
||||||
|
|
||||||
// Perform URL Search
|
// 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" >$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" >$2</a>', $Text);
|
||||||
//$Text = preg_replace("(\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text);
|
//$Text = preg_replace("(\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text);
|
||||||
|
|
||||||
// Perform MAIL Search
|
// Perform MAIL Search
|
||||||
|
|
|
@ -121,6 +121,11 @@ function item_post(&$a) {
|
||||||
|
|
||||||
if(count($tags)) {
|
if(count($tags)) {
|
||||||
foreach($tags as $tag) {
|
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) {
|
if(strpos($tag,'@') === 0) {
|
||||||
$name = substr($tag,1);
|
$name = substr($tag,1);
|
||||||
if((strpos($name,'@')) || (strpos($name,'http://'))) {
|
if((strpos($name,'@')) || (strpos($name,'http://'))) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user