我不懂 php... (自學還未開始... 工作&家庭壓力太大....)
現在我想可不可以把上面提供的 mod 改成這樣來達到\r
"沒設定, 預設就是只留一層"
試了一會後我把碼改成這樣...
代碼: 選擇全部
#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]------------------------------------------
#
return $bbcode_tpl;
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Nested Quote Limit Mod : Begin
function returnInts ($var) {
return (is_int ($var)) ? $var : null;
}
// Nested Quote Limit Mod : End
#
#-----[ FIND ]------------------------------------------
#
// [code] and
for posting code (HTML, PHP, C etc etc) in your posts.
$text = bbencode_second_pass_code($text, $uid, $bbcode_tpl);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Nested Quote Limit Mod : Begin
{
$nqlm_level = 1;
// Make sure there's enough quotes in the entire message to even
// meet the limit.
$num_quotes = preg_match_all ("/\[quote:$uid/si", $text, $matches);
if ($num_quotes > $nqlm_level) {
// Define default values.
$curr_pos = 1;
$level = 0;
while (isset ($curr_pos) && ($curr_pos < strlen ($text))) {
// Find all instances of quote tags.
$curr_pos_cmp[0] = strpos ($text, "[quote:$uid]", $curr_pos);
$curr_pos_cmp[1] = strpos ($text, "[quote:$uid=", $curr_pos);
$curr_pos_cmp[2] = strpos ($text, "[/quote:$uid]", $curr_pos);
// Filter out all the empty values to determine if we should
// continue or bail. Also makes the array play nice with min ().
$curr_pos_cmp = array_filter ($curr_pos_cmp, 'returnInts');
if (!empty ($curr_pos_cmp)) {
// Find the first tag we should deal with.
$curr_pos = min ($curr_pos_cmp);
// Set everything to false so things won't get messy with the loop.
$quote_open = null;
$quote_open_user = null;
$quote_close = null;
// Find out which type of tag we're dealing with.\r
switch ($curr_pos) {
case $curr_pos_cmp[0]:
$quote_open = true;
break;
case $curr_pos_cmp[1]:
$quote_open_user = true;
break;
case $curr_pos_cmp[2]:
$quote_close = true;
break;
}
} else {
// $curr_pos_cmp array is empty so there's nothing left to do.
$curr_pos = null;
}
// If we have a tag we'll start.
if (isset ($curr_pos)) {
// If we're in front of an opening quote tag at the maxmimum
// level, we'll insert a [quote_kill] tag.
if ((isset ($quote_open) || isset ($quote_open_user)) && $level == $nqlm_level) {
$text = substr_replace ($text, "[quote_kill:$uid]", $curr_pos, 0);
$curr_pos += strlen ("[quote_kill:$uid]");
}
// Depending on the type of tag we have, increase or decrease
// the level count and set the cursor ahead of the tag.
if (isset ($quote_open)) {
$level++;
$curr_pos += strlen ("[quote:$uid]");
} else if (isset ($quote_open_user)) {
$level++;
// Find the ending of the quote tag for usernames.
$end_bracket_pos = strpos ($text, ']', $curr_pos);
$curr_pos += (($end_bracket_pos + 1) - $curr_pos);
} else if (isset ($quote_close)) {
$level--;
$curr_pos += strlen ("[/quote:$uid]");
}
// Now we're positioned after a quote closing quote tag at
// the maximum level, so we'll insert an ending [/quote_kill] tag
if (isset ($quote_close) && $level == $nqlm_level) {
$text = substr_replace ($text, "[/quote_kill:$uid]", $curr_pos, 0);
$curr_pos += strlen ("[/quote_kill:$uid]");
}
}
}
// We've now traversed all of the text and have inserted [quote_kill]
// tags as needed. Now all we delete the tags and everything inside.
$text = preg_replace ("/(\s*)\[quote_kill:$uid\](.*?)\[\/quote_kill:$uid\](\s*)/si", ' ', $text);
}
}
// Nested Quote Limit Mod : End[/code]
這樣真的顯示不到累積 QUOTE 但是原文仍有... @@