MyBB Community Forums

Full Version: MyCode lists randomly adding an extra list item
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[attachment=45819]

I checked the post to see if there was an extra list icon somewhere but there isn't and there isn't any extra spaces either... This is happening for all posts using MyCode built in list from the editor.

coming from edits made from the dice roller mycode (plugin makes edits to class_parser.php)

Heres the code for the links in the plugin page that when clicked make edits
    if ($mybb->input['diceroller'] == 'edit') {
        $result = $PL->edit_core("diceroller", "inc/class_parser.php",
                                array('search' => '$replace = "<blockquote',
                                      'before' => "global \$plugins;\n\$message = \$plugins->run_hooks(\"parse_quote_message\", \$message);"),
                                true
        );
    } elseif ($mybb->input['diceroller'] == 'undo') {
        $result = $PL->edit_core("diceroller", "inc/class_parser.php",
                                array(),
                                true
        );
    } else {
        return;
    }

heres the commented edits in class_parser.php
/* + PL:diceroller + */ global $plugins;
/* + PL:diceroller + */ $message = $plugins->run_hooks("parse_quote_message", $message);

and the referenced function inside the diceroller.php
/**
 * Roll quoted dice so that their seed matches the PID of the quoted post.
 */
function diceroller_quote($message) {
    global $patterns;

    // Remove newlines for regex matching.
    $message = str_replace("\n", '<br />', $message);

    $message = preg_replace_callback($patterns[4], 'diceroller_quote_callback', $message);

    return $message;
}

and the $patters array
 $patterns = array(
     // [roll=low-high] | e.g. [roll=1-6]
     '/\[roll=([\"\']?)(\d+)-(\d+)(([\+\-]\d+)?)\1\]/',
     // [roll=(N)dS(+/-F)] | e.g. [roll=d6] | [roll=1d6] | [roll=1d6+10] | [roll=1d6-10]
     '/\[roll=([\"\']?)(\d*)d(\d+)([\+\-]\d+)?\1\]/',
     // [roll=weighed list] | e.g. [roll=2,2,1]
     '/\[roll=([\"\']?)(\d+(,\d+)*)\1\]/',
     // [roll=alias] | e.g. [roll=strength]
     '/\[roll=([\"\']?)(\w+)\1\]/',
     '/(\[quote=([\"\']|&quot;|).*?\2(.*?)\])(.*\[roll=[\dd\-\,]+\].*)(\[\/quote\])/',
     // [code|php][roll=*][/code|php]
     '/\[(code|php)\](.*?\[roll=[\dd\-\,]+\].*?)\[\/\1\](\r\n?|\n?)/'
 );