Hi all,
I'm using a news program I found on Hotscripts called phpFree News - I'm not a php programmer and the person that has taken this script up is stumped as well...so I hope one you guys can help out.
The auto formatting for urls has a problem.
When you enter an url in the text field it is suppose to format it as "clickable"... but entering results in this:
We can't figure out how to remove the break tag from the formatted url.
Here is the bit of code:
==========================================
$contents = preg_replace("/(^|\s)( "\\1<a href=\" $contents);
===========================================
Here is the entire section.
=============================
// Function: BBCode Replacement
function ConvertText ($contents)
{
$contents = preg_replace("/\[b\](.*?)\[\/b\]/si", "<b>\\1</b>", $contents);
$contents = preg_replace("/\[i\](.*?)\[\/i\]/si", "<i>\\1</i>", $contents);
$contents = preg_replace("/\[u\](.*?)\[\/u\]/si", "<u>\\1</u>", $contents);
$contents = preg_replace("/\[p\](.*?)\[\/p\]/si", "<p>\\1</p>", $contents);
$contents = preg_replace("/\[code\](.*?)\[\/code\]/si", "<blockquote><pre>\\1</pre></blockquote>", $contents);
$contents = preg_replace("/\[quote\](.*?)\[\/quote\]/si", "<blockquote>\\1</blockquote>", $contents);
$contents = preg_replace("/(^|\s)(http:\/\/\S+)/si", "\\1<a href=\"\\2\">\\2</a>", $contents);
$contents = preg_replace("/(^|\s)( "\\1<a href=\" $contents);
$contents = preg_replace("/\[url\](http|https|ftp)
\/\/\S+?)\[\/url\]/si", "<a href=\"\\1\\2\" target=\"_blank\">\\1\\2</a>", $contents);
$contents = preg_replace("/\[url\](\S+?)\[\/url\]/si", "<a href=\" target=\"_blank\">\\1</a>", $contents);
$contents = preg_replace("/\(.*?)\[\/url\]/si", "<a href=\"\\1\\2\" target=\"_blank\">\\3</a>", $contents);
$contents = preg_replace("/\[url=(\S+?)\](\S+?)\[\/url\]/si", "<a href=\"[URL unfurl="true"]http://\\1\" target=\"_blank\">\\2</a>", $contents);
$contents = preg_replace("/\[email\](\S+?@\S+?\\.\S+?)\[\/email\]/si", "<a href=\"mailto:\\1\">\\1</a>", $contents);
$contents = preg_replace("/\(.*?)\[\/email\]/si", "<a href=\"mailto:\\1\">\\2</a>", $contents);
$contents = preg_replace("/\
(\S+?)\[\/img\]/si", "<img src=\"\\1\" border=0 alt=\"\\1\">", $contents);
return $contents;
}
===============================================
Should anyone know how to fix this we would be very appreciative! Please let me know if you need more info.
Thanks
Daf
I'm using a news program I found on Hotscripts called phpFree News - I'm not a php programmer and the person that has taken this script up is stumped as well...so I hope one you guys can help out.
The auto formatting for urls has a problem.
When you enter an url in the text field it is suppose to format it as "clickable"... but entering results in this:
We can't figure out how to remove the break tag from the formatted url.
Here is the bit of code:
==========================================
$contents = preg_replace("/(^|\s)( "\\1<a href=\" $contents);
===========================================
Here is the entire section.
=============================
// Function: BBCode Replacement
function ConvertText ($contents)
{
$contents = preg_replace("/\[b\](.*?)\[\/b\]/si", "<b>\\1</b>", $contents);
$contents = preg_replace("/\[i\](.*?)\[\/i\]/si", "<i>\\1</i>", $contents);
$contents = preg_replace("/\[u\](.*?)\[\/u\]/si", "<u>\\1</u>", $contents);
$contents = preg_replace("/\[p\](.*?)\[\/p\]/si", "<p>\\1</p>", $contents);
$contents = preg_replace("/\[code\](.*?)\[\/code\]/si", "<blockquote><pre>\\1</pre></blockquote>", $contents);
$contents = preg_replace("/\[quote\](.*?)\[\/quote\]/si", "<blockquote>\\1</blockquote>", $contents);
$contents = preg_replace("/(^|\s)(http:\/\/\S+)/si", "\\1<a href=\"\\2\">\\2</a>", $contents);
$contents = preg_replace("/(^|\s)( "\\1<a href=\" $contents);
$contents = preg_replace("/\[url\](http|https|ftp)
$contents = preg_replace("/\[url\](\S+?)\[\/url\]/si", "<a href=\" target=\"_blank\">\\1</a>", $contents);
$contents = preg_replace("/\(.*?)\[\/url\]/si", "<a href=\"\\1\\2\" target=\"_blank\">\\3</a>", $contents);
$contents = preg_replace("/\[url=(\S+?)\](\S+?)\[\/url\]/si", "<a href=\"[URL unfurl="true"]http://\\1\" target=\"_blank\">\\2</a>", $contents);
$contents = preg_replace("/\[email\](\S+?@\S+?\\.\S+?)\[\/email\]/si", "<a href=\"mailto:\\1\">\\1</a>", $contents);
$contents = preg_replace("/\(.*?)\[\/email\]/si", "<a href=\"mailto:\\1\">\\2</a>", $contents);
$contents = preg_replace("/\
return $contents;
}
===============================================
Should anyone know how to fix this we would be very appreciative! Please let me know if you need more info.
Thanks
Daf