diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2004-09-16 18:33:22 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2004-09-16 18:33:22 +0000 |
commit | 2fa463cdeb5d8e4f2373aa834154ca27ea21c97a (patch) | |
tree | 87059418d9b487f76bf1c99ae7ec3184a62cd8ef /phpBB/includes/bbcode.php | |
parent | d80f8d577ebdc1489b2dcf49bdb9a266d29d1ef1 (diff) | |
download | forums-2fa463cdeb5d8e4f2373aa834154ca27ea21c97a.tar forums-2fa463cdeb5d8e4f2373aa834154ca27ea21c97a.tar.gz forums-2fa463cdeb5d8e4f2373aa834154ca27ea21c97a.tar.bz2 forums-2fa463cdeb5d8e4f2373aa834154ca27ea21c97a.tar.xz forums-2fa463cdeb5d8e4f2373aa834154ca27ea21c97a.zip |
- more updates, mostly bugfixes to the bbcode parser
- changed current_user in sessions (please review)
- give more flexibility to style authors in regard to the pagination elements
- profile fields updates (included a sample constuct into viewtopic_body.html - have to be documented extensivly)
- code optimizations (use of strpos, sizeof, loops not iterating functions on every call, memory savings...)
- and last but not least --- hopefully not introduced more bugs than healthy (*cough*)
git-svn-id: file:///svn/phpbb/trunk@4984 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/bbcode.php')
-rw-r--r-- | phpBB/includes/bbcode.php | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index f9b8fcbce3..4e56a2be77 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -257,10 +257,12 @@ class bbcode } break; case 12: - $this->bbcode_cache[$bbcode_id] = array('preg' => array( - '#\[attachment=([0-9]+):$uid\]#' => $this->bbcode_tpl('inline_attachment_open', $bbcode_id), - '#\[\/attachment:$uid\]#' => $this->bbcode_tpl('inline_attachment_close', $bbcode_id) - )); + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array( + '[/attachment:$uid]' => $this->bbcode_tpl('inline_attachment_close', $bbcode_id)), + 'preg' => array( + '#\[attachment=([0-9]+):$uid\]#' => $this->bbcode_tpl('inline_attachment_open', $bbcode_id)) + ); break; default: if (isset($rowset[$bbcode_id])) @@ -461,23 +463,22 @@ class bbcode switch ($type) { case 'php': + // Not the english way, but valid because of hardcoded syntax highlighting + if (strpos($code, '<span class="syntaxdefault"><br /></span>') === 0) + { + $code = substr($code, 41); + } + default: $code = str_replace("\t", ' ', $code); $code = str_replace(' ', ' ', $code); $code = str_replace(' ', ' ', $code); - $match = array( - '#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#', - '#<!\-\- m \-\-><a href="(.*?)" target="_blank">.*?</a><!\-\- m \-\->#', - '#<!\-\- w \-\-><a href="http:\/\/(.*?)" target="_blank">.*?</a><!\-\- w \-\->#', - '#<!\-\- l \-\-><a href="(.*?)" target="_blank">.*?</a><!\-\- l \-\->#', - '#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', - '#^[\n]#' - ); - - $replace = array('\1', '\1', '\1', '\1', '\1', ''); - - $code = preg_replace($match, $replace, $code); + // remove newline at the beginning + if ($code{0} == "\n") + { + $code = substr($code, 1); + } } $code = $this->bbcode_tpl('code_open') . $code . $this->bbcode_tpl('code_close'); |