src/Compilers/ShortcodeCompiler.php
protected function parseAttributes($text)
    {
        // decode attribute values
        $text = htmlspecialchars_decode($text, ENT_QUOTES);

        $attributes = [];
        // attributes pattern
        $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
        // Match
        if (preg_match_all($pattern, preg_replace('/[\x{00a0}\x{200b}]+/u', " ", $text), $match, PREG_SET_ORDER)) {
            foreach ($match as $m) {
                if (!empty($m[1])) {
                    $attributes[strtolower($m[1])] = stripcslashes($m[2]);
                } elseif (!empty($m[3])) {
                    $attributes[strtolower($m[3])] = stripcslashes($m[4]);
                } elseif (!empty($m[5])) {
                    $attributes[strtolower($m[5])] = stripcslashes($m[6]);
                } elseif (isset($m[7]) && strlen($m[7])) {
                    $attributes[] = stripcslashes($m[7]);
                } elseif (isset($m[8])) {
                    $attributes[] = stripcslashes($m[8]);
                }
            }
        } else {
            $attributes = ltrim($text);
        }

        // return attributes
        return is_array($attributes) ? $attributes : [$attributes];
    }
protected function parseAttributes($text)
    {
        // decode attribute values
        $text = htmlspecialchars_decode($text, ENT_QUOTES);

        $attributes = [];
        // attributes pattern
        $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
        // Match
        if (preg_match_all($pattern, preg_replace('/[\x{00a0}\x{200b}]+/u', " ", $text), $match, PREG_SET_ORDER)) {
            foreach ($match as $m) {
                if (!empty($m[1])) {
                    $attributes[strtolower($m[1])] = stripcslashes($m[2]);
                } elseif (!empty($m[3])) {
                    $attributes[strtolower($m[3])] = stripcslashes($m[4]);
                } elseif (!empty($m[5])) {
                    $attributes[strtolower($m[5])] = stripcslashes($m[6]);
                } elseif (isset($m[7]) && strlen($m[7])) {
                    $attributes[] = stripcslashes($m[7]);
                } elseif (isset($m[8])) {
                    $attributes[] = stripcslashes($m[8]);
                }
            }
        } else {
            $attributes = ltrim($text);
        }

        // return attributes
        return is_array($attributes) ? $attributes : [$attributes];
    }
protected function parseAttributes ( $ text ) { // decode attribute values $ text = htmlspecialchars_decode ( $ text , ENT_QUOTES ) ; $ attributes = [ ] ; // attributes pattern $ pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/' ; // Match if ( preg_match_all ( $ pattern , preg_replace ( '/[\x{00a0}\x{200b}]+/u' , " " , $ text ) , $ match , PREG_SET_ORDER ) ) { foreach ( $ match as $ m ) { if ( ! empty ( $ m [ 1 ] ) ) { $ attributes [ strtolower ( $ m [ 1 ] ) ] = stripcslashes ( $ m [ 2 ] ) ; } elseif ( ! empty ( $ m [ 3 ] ) ) { $ attributes [ strtolower ( $ m [ 3 ] ) ] = stripcslashes ( $ m [ 4 ] ) ; } elseif ( ! empty ( $ m [ 5 ] ) ) { $ attributes [ strtolower ( $ m [ 5 ] ) ] = stripcslashes ( $ m [ 6 ] ) ; } elseif ( isset ( $ m [ 7 ] ) && strlen ( $ m [ 7 ] ) ) { $ attributes [ ] = stripcslashes ( $ m [ 7 ] ) ; } elseif ( isset ( $ m [ 8 ] ) ) { $ attributes [ ] = stripcslashes ( $ m [ 8 ] ) ; } } } else { $ attributes = ltrim ( $ text ) ; } // return attributes return is_array ( $ attributes ) ? $ attributes : [ $ attributes ] ; }
Parse the shortcode attributes

@author Wordpress
@return array
Parse the shortcode attributes