Browse Source

Wiki markup addition and ability to disable/enable it

pull/40/head
Savetheinternet 14 years ago
parent
commit
a4299fe4a6
  1. 2
      inc/config.php
  2. 9
      inc/functions.php

2
inc/config.php

@ -101,6 +101,8 @@
// Automatically convert things like "..." to Unicode characters ("�") // Automatically convert things like "..." to Unicode characters ("�")
define('AUTO_UNICODE', true, true); define('AUTO_UNICODE', true, true);
// Use some Wiki-like syntax (''em'', '''strong''', ==Heading==, etc)
define('WIKI_MARKUP', true, true);
// Whether to turn URLs into functional links // Whether to turn URLs into functional links
define('MARKUP_URLS', true, true); define('MARKUP_URLS', true, true);
define('URL_REGEX', '/' . '(https?|ftp):\/\/' . '([\w\-]+\.)+[a-zA-Z]{2,6}' . '(\/([\w\-~\.#\/?=&;:+%]+))?' . '/', true); define('URL_REGEX', '/' . '(https?|ftp):\/\/' . '([\w\-]+\.)+[a-zA-Z]{2,6}' . '(\/([\w\-~\.#\/?=&;:+%]+))?' . '/', true);

9
inc/functions.php

@ -209,10 +209,13 @@
if(MARKUP_URLS) if(MARKUP_URLS)
$body = preg_replace(URL_REGEX, "<a href=\"$0\">$0</a>", $body); $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)([\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); if(WIKI_MARKUP) {
$body = preg_replace("/(^|\n)==(.+?)==\n?/m", "<h2>$2</h2>", $body);
$body = preg_replace("/'''(.+?)'''/m", "<strong>$1</strong>", $body);
$body = preg_replace("/''(.+?)''/m", "<em>$1</em>", $body);
}
$body = preg_replace("/\n/", '<br/>', $body); $body = preg_replace("/\n/", '<br/>', $body);
} }

Loading…
Cancel
Save