Browse Source

URL markup

pull/40/head
Savetheinternet 14 years ago
parent
commit
5f0a3aa146
  1. 3
      inc/config.php
  2. 6
      inc/functions.php

3
inc/config.php

@ -66,6 +66,9 @@
// Automatically convert things like "..." to Unicode characters ("�")
define('AUTO_UNICODE', true);
// Whether to turn URLs into functional links
define('MARKUP_URLS', true);
define('URL_REGEX', "/(https?|ftp)\:\/\/([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?([a-z0-9-.]*)\.([a-z]{2,3})(\:[0-9]{2,5})?(\/([a-z0-9+\$_-]\.?)+)*\/?(\?[a-z+&\$_.-][a-z0-9;:@&%=+\/\$_.-]*)?(#[a-z_.-][a-z0-9+\$_.-]*)?/");
// Allowed file extensions
$allowed_ext = Array('jpg', 'jpeg', 'bmp', 'gif', 'png');

6
inc/functions.php

@ -125,12 +125,12 @@
$body = str_replace("\r", '', $body);
if(MARKUP_URLS)
$body = preg_replace(URL_REGEX, "<a href=\"$0\">$0</a>", $body);
$body = preg_replace("/(^|\n)([\s]+)?(&gt;)([^\n]+)?($|\n)/m", '$1$2<span class="quote">$3$4</span>$5', $body);
$body = preg_replace("/(^|\n)==(.+?)==\n?/m", "<h2>$2</h2>", $body);
$body = preg_replace("/'''(.+?)'''/m", "<strong>$1</strong>", $body);
$body = preg_replace("/\n/", '<br/>', $body);
}

Loading…
Cancel
Save