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

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

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

@param string $text short code attributes

@return array|string
Parse short code attributes