diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-06-10 01:52:48 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-06-10 01:52:48 +0000 |
commit | c0495aace43585be811873f6f243bdd04ffcac54 (patch) | |
tree | 6ccc9cc1cc29841241ac92dec68df4a904399ba9 /phpBB/includes/bbcode.php | |
parent | e9bec6c557abece75afddb8b1c092866462669b4 (diff) | |
download | forums-c0495aace43585be811873f6f243bdd04ffcac54.tar forums-c0495aace43585be811873f6f243bdd04ffcac54.tar.gz forums-c0495aace43585be811873f6f243bdd04ffcac54.tar.bz2 forums-c0495aace43585be811873f6f243bdd04ffcac54.tar.xz forums-c0495aace43585be811873f6f243bdd04ffcac54.zip |
Updates in line with 2.0.1
git-svn-id: file:///svn/phpbb/trunk@2630 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/bbcode.php')
-rw-r--r-- | phpBB/includes/bbcode.php | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 90583de35a..f5c3cadba5 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -483,20 +483,34 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_ // Mark the lowest nesting level if needed. if ($mark_lowest_level && ($curr_nesting_depth == 1)) { + if ($open_tag[0] == '[code]') + { + $code_entities_match = array('#<#', '#>#', '#"#', '#:#', '#\[#', '#\]#', '#\(#', '#\)#', '#\{#', '#\}#'); + $code_entities_replace = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}'); + $between_tags = preg_replace($code_entities_match, $code_entities_replace, $between_tags); + } $text = $before_start_tag . substr($start_tag, 0, $start_length - 1) . ":$curr_nesting_depth:$uid]"; $text .= $between_tags . substr($close_tag_new, 0, $close_tag_new_length - 1) . ":$curr_nesting_depth:$uid]"; } else { - if ($open_is_regexp) + if ($open_tag[0] == '[code]') { - $text = $before_start_tag . $start_tag; + $text = $before_start_tag . '[code]'; + $text .= $between_tags . '[/code]'; } else { - $text = $before_start_tag . substr($start_tag, 0, $start_length - 1) . ":$uid]"; + if ($open_is_regexp) + { + $text = $before_start_tag . $start_tag; + } + else + { + $text = $before_start_tag . substr($start_tag, 0, $start_length - 1) . ":$uid]"; + } + $text .= $between_tags . substr($close_tag_new, 0, $close_tag_new_length - 1) . ":$uid]"; } - $text .= $between_tags . substr($close_tag_new, 0, $close_tag_new_length - 1) . ":$uid]"; } $text .= $after_end_tag; @@ -606,7 +620,7 @@ function make_clickable($text) // matches an "xxxx://yyyy" URL at the start of a line, or after a space. // xxxx can only be alpha characters. // yyyy is anything up to the first space, newline, or comma. - $ret = preg_replace("#([\n ])([a-z]+?)://([^,\t \n\r]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $ret); + $ret = preg_replace("#([\n ])([a-z]+?)://([^\t <\n\r]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $ret); // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing // Must contain at least 2 dots. xxxx contains either alphanum, or "-" @@ -614,7 +628,7 @@ function make_clickable($text) // zzzz is optional.. will contain everything up to the first space, newline, or comma. // This is slightly restrictive - it's not going to match stuff like "forums.foo.com" // This is to keep it from getting annoying and matching stuff that's not meant to be a link. - $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^,\t \n\r]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $ret); + $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^\t <\n\r]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $ret); // matches an email@domain type address at the start of a line, or after a space. // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". |