mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Bugtracker #4168 - stray [br] display in places
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
+ ----------------------------------------------------------------------------+
|
+ ----------------------------------------------------------------------------+
|
||||||
| e107 website system
|
| e107 website system
|
||||||
@@ -12,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/bbcode_handler.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/bbcode_handler.php,v $
|
||||||
| $Revision: 1.10 $
|
| $Revision: 1.11 $
|
||||||
| $Date: 2007-07-31 20:10:44 $
|
| $Date: 2007-10-28 20:45:22 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -60,10 +59,8 @@ class e_bbcode
|
|||||||
krsort($this->bbLocation);
|
krsort($this->bbLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If $bb_strip is TRUE, all bbcodes are stripped. If FALSE, none are stripped.
|
||||||
|
// If a comma separated (lower case) list is passed, only the listed codes are stripped (and the rest are processed)
|
||||||
// If $bb_strip is TRUE, all bbcodes are stripped. If FALSE, none are stripped.
|
|
||||||
// If a comma separated (lower case) list is passed, only the listed codes are stripped (and the rest are processed)
|
|
||||||
function parseBBCodes($value, $p_ID, $force_lower = 'default', $bb_strip = FALSE)
|
function parseBBCodes($value, $p_ID, $force_lower = 'default', $bb_strip = FALSE)
|
||||||
{
|
{
|
||||||
global $postID;
|
global $postID;
|
||||||
@@ -103,6 +100,11 @@ class e_bbcode
|
|||||||
$match_count = preg_match($pattern,$cont,$matches);
|
$match_count = preg_match($pattern,$cont,$matches);
|
||||||
$bbparam = (isset($matches[5])) ? $matches[5] : '';
|
$bbparam = (isset($matches[5])) ? $matches[5] : '';
|
||||||
$bbword = (isset($matches[2])) ? $matches[2] : '';
|
$bbword = (isset($matches[2])) ? $matches[2] : '';
|
||||||
|
if($cont[1] != '/')
|
||||||
|
{
|
||||||
|
$bbstart = $cont;
|
||||||
|
$bbsep = varset($matches[4]);
|
||||||
|
}
|
||||||
if ($force_lower) $bbword = strtolower($bbword);
|
if ($force_lower) $bbword = strtolower($bbword);
|
||||||
if ($nopro && ($bbword == 'code') && ($matches[1] == '/')) $nopro = FALSE; // End of code block
|
if ($nopro && ($bbword == 'code') && ($matches[1] == '/')) $nopro = FALSE; // End of code block
|
||||||
if (($bbword) && ($bbword == trim($bbword)) && !$nopro)
|
if (($bbword) && ($bbword == trim($bbword)) && !$nopro)
|
||||||
@@ -146,18 +148,16 @@ class e_bbcode
|
|||||||
case 'bbcode' :
|
case 'bbcode' :
|
||||||
if (($code_stack[0]['code'] == $bbword) && ($code_stack[0]['numbers'] == $matches[3]))
|
if (($code_stack[0]['code'] == $bbword) && ($code_stack[0]['numbers'] == $matches[3]))
|
||||||
{
|
{
|
||||||
$stacktext = $this->proc_bbcode($bbword,$code_stack[0]['param'],$stacktext,$bbparam);
|
$stacktext = $this->proc_bbcode($bbword,$code_stack[0]['param'],$stacktext,$bbparam, $bbsep, $bbstart.$stacktext.$cont);
|
||||||
array_shift($code_stack);
|
array_shift($code_stack);
|
||||||
// Intentionally don't terminate here - may be some text we can clean up
|
// Intentionally don't terminate here - may be some text we can clean up
|
||||||
$bbword=''; // Necessary to make sure we don't double process if several instances on stack
|
$bbword=''; // Necessary to make sure we don't double process if several instances on stack
|
||||||
while (count($unmatch_stack) != 0) { array_unshift($code_stack,array_pop($unmatch_stack)); }
|
while (count($unmatch_stack) != 0) { array_unshift($code_stack,array_pop($unmatch_stack)); }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
{
|
{
|
||||||
$found = TRUE; // Terminate on unmatched bbcode
|
$found = TRUE; // Terminate on unmatched bbcode
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (count($code_stack) == 0)
|
if (count($code_stack) == 0)
|
||||||
@@ -176,9 +176,13 @@ class e_bbcode
|
|||||||
if (array_key_exists('_'.$bbword,$this->bbLocation))
|
if (array_key_exists('_'.$bbword,$this->bbLocation))
|
||||||
{ // Single code to process
|
{ // Single code to process
|
||||||
if (count($code_stack) == 0)
|
if (count($code_stack) == 0)
|
||||||
|
{
|
||||||
$result .= $this->proc_bbcode('_'.$bbword,$bbparam);
|
$result .= $this->proc_bbcode('_'.$bbword,$bbparam);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
$stacktext .= $this->proc_bbcode('_'.$bbword,$bbparam);
|
$stacktext .= $this->proc_bbcode('_'.$bbword,$bbparam);
|
||||||
|
}
|
||||||
$is_proc = TRUE;
|
$is_proc = TRUE;
|
||||||
}
|
}
|
||||||
elseif (array_key_exists($bbword,$this->bbLocation))
|
elseif (array_key_exists($bbword,$this->bbLocation))
|
||||||
@@ -219,7 +223,7 @@ class e_bbcode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basically done - just tidy up now
|
// Basically done - just tidy up now
|
||||||
// If there's still anything on the stack, we need to process it
|
// If there's still anything on the stack, we need to process it
|
||||||
while (count($code_stack) != 0)
|
while (count($code_stack) != 0)
|
||||||
{
|
{
|
||||||
@@ -241,12 +245,12 @@ class e_bbcode
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function proc_bbcode($code, $param1='',$code_text_par='', $param2='')
|
function proc_bbcode($code, $param1='',$code_text_par='', $param2='', $sep='', $full_text='')
|
||||||
// Invoke an actual bbcode handler
|
// Invoke an actual bbcode handler
|
||||||
// $code - textual value of the bbcode (already begins with '_' if a single code)
|
// $code - textual value of the bbcode (already begins with '_' if a single code)
|
||||||
// $param1 - any text after '=' in the opening code
|
// $param1 - any text after '=' in the opening code
|
||||||
// $code_text_par - text between the opening and closing codes
|
// $code_text_par - text between the opening and closing codes
|
||||||
// $param2 - any text after '=' for the closing code
|
// $param2 - any text after '=' for the closing code
|
||||||
{
|
{
|
||||||
global $tp, $postID, $code_text, $parm;
|
global $tp, $postID, $code_text, $parm;
|
||||||
$parm = $param1;
|
$parm = $param1;
|
||||||
@@ -303,4 +307,3 @@ function proc_bbcode($code, $param1='',$code_text_par='', $param2='')
|
|||||||
return $bbcode_output.$bbcode_return;
|
return $bbcode_output.$bbcode_return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
Reference in New Issue
Block a user