diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2011-01-02 22:14:51 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2011-01-02 22:14:51 +1100 |
| commit | 7ae3678554b049515b398403a04e7ffe87b4f4c0 (patch) | |
| tree | 712b8fcbbf4d01a2236506c63d9f98ada35836d2 | |
| parent | cff02371ce9e638dcff5db152a49f5e437d4eb58 (diff) | |
Fixed URL matching with double dashes in hostname
| -rw-r--r-- | inc/functions.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/inc/functions.php b/inc/functions.php index 76b44cb3..54e3a287 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -284,7 +284,10 @@ function markup(&$body) { global $board; - + + if(MARKUP_URLS) + $body = preg_replace(URL_REGEX, "<a href=\"$0\">$0</a>", $body); + if(AUTO_UNICODE) { $body = str_replace('...', '…', $body); $body = str_replace('<--', '←', $body); @@ -321,22 +324,24 @@ // Find the position of the cite $position = strpos($body, $cites[0][$index]); + + + // Replace the found string with "xxxx[...]". (allows duplicate tags). Keeps whitespace. $body = substr_replace($body, str_repeat('x', strlen($cites[0][$index]) - $whitespace[0] - $whitespace[1]), $position + $whitespace[0], strlen($cites[0][$index]) - $whitespace[0] - $whitespace[1]); - + $temp .= substr($body, $previousPosition, $position-$previousPosition) . $cites[1][$index] . $replacement . $cites[3][$index]; $previousPosition = $position+strlen($cites[0][$index]); } + // The rest $temp .= substr($body, $previousPosition); - + $body = $temp; } $body = str_replace("\r", '', $body); - - if(MARKUP_URLS) - $body = preg_replace(URL_REGEX, "<a href=\"$0\">$0</a>", $body); + $body = preg_replace("/(^|\n)([\s]+)?(>)([^\n]+)?($|\n)/m", '$1$2<span class="quote">$3$4</span>$5', $body); if(WIKI_MARKUP) { |
