_wptexturize_pushpop_element

The timeline below displays how wordpress function _wptexturize_pushpop_element has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.4

/**
 * Searches for disabled element tags. Pushes element to stack on tag open
 * and pops on tag close.
 *
 * Assumes first char of `$text` is tag opening and last char is tag closing.
 * Assumes second char of `$text` is optionally `/` to indicate closing as in `</html>`.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string   $text              Text to check. Must be a tag like `<html>` or `[shortcode]`.
 * @param string[] $stack             Array of open tag elements.
 * @param string[] $disabled_elements Array of tag names to match against. Spaces are not allowed in tag names.
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements)
{
    // Is it an opening tag or closing tag?
    if (isset($text[1]) && '/' !== $text[1]) {
        $opening_tag = true;
        $name_offset = 1;
    } elseif (0 === count($stack)) {
        // Stack is empty. Just stop.
        return;
    } else {
        $opening_tag = false;
        $name_offset = 2;
    }
    // Parse out the tag name.
    $space = strpos($text, ' ');
    if (false === $space) {
        $space = -1;
    } else {
        $space -= $name_offset;
    }
    $tag = substr($text, $name_offset, $space);
    // Handle disabled tags.
    if (in_array($tag, $disabled_elements, true)) {
        if ($opening_tag) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that.
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturized.
             */
            array_push($stack, $tag);
        } elseif (end($stack) === $tag) {
            array_pop($stack);
        }
    }
}

WordPress Version: 6.1

/**
 * Searches for disabled element tags. Pushes element to stack on tag open
 * and pops on tag close.
 *
 * Assumes first char of `$text` is tag opening and last char is tag closing.
 * Assumes second char of `$text` is optionally `/` to indicate closing as in `</html>`.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string   $text              Text to check. Must be a tag like `<html>` or `[shortcode]`.
 * @param string[] $stack             Array of open tag elements.
 * @param string[] $disabled_elements Array of tag names to match against. Spaces are not allowed in tag names.
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements)
{
    // Is it an opening tag or closing tag?
    if (isset($text[1]) && '/' !== $text[1]) {
        $opening_tag = true;
        $name_offset = 1;
    } elseif (0 === count($stack)) {
        // Stack is empty. Just stop.
        return;
    } else {
        $opening_tag = false;
        $name_offset = 2;
    }
    // Parse out the tag name.
    $space = strpos($text, ' ');
    if (false === $space) {
        $space = -1;
    } else {
        $space -= $name_offset;
    }
    $tag = substr($text, $name_offset, $space);
    // Handle disabled tags.
    if (in_array($tag, $disabled_elements, true)) {
        if ($opening_tag) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that.
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturized.
             */
            array_push($stack, $tag);
        } elseif (end($stack) == $tag) {
            array_pop($stack);
        }
    }
}

WordPress Version: 5.5

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close.
 *
 * Assumes first char of $text is tag opening and last char is tag closing.
 * Assumes second char of $text is optionally '/' to indicate closing as in </html>.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string   $text              Text to check. Must be a tag like `<html>` or `[shortcode]`.
 * @param string[] $stack             Array of open tag elements.
 * @param string[] $disabled_elements Array of tag names to match against. Spaces are not allowed in tag names.
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements)
{
    // Is it an opening tag or closing tag?
    if (isset($text[1]) && '/' !== $text[1]) {
        $opening_tag = true;
        $name_offset = 1;
    } elseif (0 === count($stack)) {
        // Stack is empty. Just stop.
        return;
    } else {
        $opening_tag = false;
        $name_offset = 2;
    }
    // Parse out the tag name.
    $space = strpos($text, ' ');
    if (false === $space) {
        $space = -1;
    } else {
        $space -= $name_offset;
    }
    $tag = substr($text, $name_offset, $space);
    // Handle disabled tags.
    if (in_array($tag, $disabled_elements, true)) {
        if ($opening_tag) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that.
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturized.
             */
            array_push($stack, $tag);
        } elseif (end($stack) == $tag) {
            array_pop($stack);
        }
    }
}

WordPress Version: 5.4

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close.
 *
 * Assumes first char of $text is tag opening and last char is tag closing.
 * Assumes second char of $text is optionally '/' to indicate closing as in </html>.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string   $text              Text to check. Must be a tag like `<html>` or `[shortcode]`.
 * @param string[] $stack             Array of open tag elements.
 * @param string[] $disabled_elements Array of tag names to match against. Spaces are not allowed in tag names.
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements)
{
    // Is it an opening tag or closing tag?
    if (isset($text[1]) && '/' !== $text[1]) {
        $opening_tag = true;
        $name_offset = 1;
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
        return;
    } else {
        $opening_tag = false;
        $name_offset = 2;
    }
    // Parse out the tag name.
    $space = strpos($text, ' ');
    if (false === $space) {
        $space = -1;
    } else {
        $space -= $name_offset;
    }
    $tag = substr($text, $name_offset, $space);
    // Handle disabled tags.
    if (in_array($tag, $disabled_elements)) {
        if ($opening_tag) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that.
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturized.
             */
            array_push($stack, $tag);
        } elseif (end($stack) == $tag) {
            array_pop($stack);
        }
    }
}

WordPress Version: 4.5

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close.
 *
 * Assumes first char of $text is tag opening and last char is tag closing.
 * Assumes second char of $text is optionally '/' to indicate closing as in </html>.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. Must be a tag like `<html>` or `[shortcode]`.
 * @param array  $stack List of open tag elements.
 * @param array  $disabled_elements The tag names to match against. Spaces are not allowed in tag names.
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements)
{
    // Is it an opening tag or closing tag?
    if (isset($text[1]) && '/' !== $text[1]) {
        $opening_tag = true;
        $name_offset = 1;
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
        return;
    } else {
        $opening_tag = false;
        $name_offset = 2;
    }
    // Parse out the tag name.
    $space = strpos($text, ' ');
    if (false === $space) {
        $space = -1;
    } else {
        $space -= $name_offset;
    }
    $tag = substr($text, $name_offset, $space);
    // Handle disabled tags.
    if (in_array($tag, $disabled_elements)) {
        if ($opening_tag) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $tag);
        } elseif (end($stack) == $tag) {
            array_pop($stack);
        }
    }
}

WordPress Version: 4.3

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close.
 *
 * Assumes first char of $text is tag opening and last char is tag closing.
 * Assumes second char of $text is optionally '/' to indicate closing as in </html>.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. Must be a tag like `<html>` or `[shortcode]`.
 * @param array  $stack List of open tag elements.
 * @param array  $disabled_elements The tag names to match against. Spaces are not allowed in tag names.
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements)
{
    // Is it an opening tag or closing tag?
    if ('/' !== $text[1]) {
        $opening_tag = true;
        $name_offset = 1;
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
        return;
    } else {
        $opening_tag = false;
        $name_offset = 2;
    }
    // Parse out the tag name.
    $space = strpos($text, ' ');
    if (false === $space) {
        $space = -1;
    } else {
        $space -= $name_offset;
    }
    $tag = substr($text, $name_offset, $space);
    // Handle disabled tags.
    if (in_array($tag, $disabled_elements)) {
        if ($opening_tag) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $tag);
        } elseif (end($stack) == $tag) {
            array_pop($stack);
        }
    }
}

WordPress Version: 4.1

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close.
 *
 * Assumes first char of $text is tag opening and last char is tag closing.
 * Assumes second char of $text is optionally '/' to indicate closing as in </html>.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. Must be a tag like `<html>` or `[shortcode]`.
 * @param array $stack List of open tag elements.
 * @param array $disabled_elements The tag names to match against. Spaces are not allowed in tag names.
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements)
{
    // Is it an opening tag or closing tag?
    if ('/' !== $text[1]) {
        $opening_tag = true;
        $name_offset = 1;
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
        return;
    } else {
        $opening_tag = false;
        $name_offset = 2;
    }
    // Parse out the tag name.
    $space = strpos($text, ' ');
    if (false === $space) {
        $space = -1;
    } else {
        $space -= $name_offset;
    }
    $tag = substr($text, $name_offset, $space);
    // Handle disabled tags.
    if (in_array($tag, $disabled_elements)) {
        if ($opening_tag) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $tag);
        } elseif (end($stack) == $tag) {
            array_pop($stack);
        }
    }
}

WordPress Version: 4.0

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close.
 *
 * Assumes first char of $text is tag opening and last char is tag closing.
 * Assumes second char of $text is optionally '/' to indicate closing as in </html>.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. Must be a tag like <html> or [shortcode].
 * @param array $stack List of open tag elements.
 * @param array $disabled_elements The tag names to match against. Spaces are not allowed in tag names.
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements)
{
    // Is it an opening tag or closing tag?
    if ('/' !== $text[1]) {
        $opening_tag = true;
        $name_offset = 1;
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
        return;
    } else {
        $opening_tag = false;
        $name_offset = 2;
    }
    // Parse out the tag name.
    $space = strpos($text, ' ');
    if (FALSE === $space) {
        $space = -1;
    } else {
        $space -= $name_offset;
    }
    $tag = substr($text, $name_offset, $space);
    // Handle disabled tags.
    if (in_array($tag, $disabled_elements)) {
        if ($opening_tag) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $tag);
        } elseif (end($stack) == $tag) {
            array_pop($stack);
        }
    }
}

WordPress Version: 9.3

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: 9.2

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: .10

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: 3.9

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: 8.5

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: 8.4

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: .30

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: 8.3

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: .20

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: 8.2

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: .10

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: 3.8

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: .40

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: 7.4

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: .30

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: 7.3

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: .20

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: 7.2

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: .10

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } elseif (0 == count($stack)) {
        // Stack is empty. Just stop.
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}

WordPress Version: 3.7

/**
 * Search for disabled element tags. Push element to stack on tag open and pop
 * on tag close. Assumes first character of $text is tag opening.
 *
 * @since 2.9.0
 * @access private
 *
 * @param string $text Text to check. First character is assumed to be $opening
 * @param array $stack Array used as stack of opened tag elements
 * @param string $disabled_elements Tags to match against formatted as regexp sub-expression
 * @param string $opening Tag opening character, assumed to be 1 character long
 * @param string $closing Tag closing character
 */
function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>')
{
    // Check if it is a closing tag -- otherwise assume opening tag
    if (strncmp($opening . '/', $text, 2)) {
        // Opening? Check $text+1 against disabled elements
        if (preg_match('/^' . $disabled_elements . '\b/', substr($text, 1), $matches)) {
            /*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */
            array_push($stack, $matches[1]);
        }
    } else {
        // Closing? Check $text+2 against disabled elements
        $c = preg_quote($closing, '/');
        if (preg_match('/^' . $disabled_elements . $c . '/', substr($text, 2), $matches)) {
            $last = array_pop($stack);
            // Make sure it matches the opening tag
            if ($last != $matches[1]) {
                array_push($stack, $last);
            }
        }
    }
}