public function extract($content)
    {
        $pattern = $this->getRegex();

        preg_match_all("/$pattern/s", $content, $matches);

        $objects = [];

        foreach ($matches as $key => $match) {
            $name = null;

            if ($key == 0) {
                $name = 'original';
            } elseif ($key == 2) {
                $name = 'name';
            } elseif ($key == 3) {
                $name = 'attributes';
            } elseif ($key == 5) {
                $name = 'content';
            }

            if (!is_null($name)) {
                foreach ($match as $k => $v) {
                    if (!isset($objects[$k])) {
                        $objects[$k] = [];
                    }

                    if ($name == 'attributes') {
                        $attributes = $this->parseAttr($v);

                        if (!is_array($attributes)) {
                            $attributes = [];
                        }

                        $objects[$k][$name] = $attributes;
                    } elseif ($name == 'content') {
                        if ($this->hasShortcode($v)) {
                            $objects[$k][$name] = $this->extract($v);
                        } else {
                            $objects[$k][$name] = $v;
                        }
                    } else {
                        $objects[$k][$name] = $v;
                    }
                }
            }
        }

        return $objects;
    }
public function extract($content)
    {
        $pattern = $this->getRegex();

        preg_match_all("/$pattern/s", $content, $matches);

        $objects = [];

        foreach ($matches as $key => $match) {
            $name = null;

            if ($key == 0) {
                $name = 'original';
            } elseif ($key == 2) {
                $name = 'name';
            } elseif ($key == 3) {
                $name = 'attributes';
            } elseif ($key == 5) {
                $name = 'content';
            }

            if (!is_null($name)) {
                foreach ($match as $k => $v) {
                    if (!isset($objects[$k])) {
                        $objects[$k] = [];
                    }

                    if ($name == 'attributes') {
                        $attributes = $this->parseAttr($v);

                        if (!is_array($attributes)) {
                            $attributes = [];
                        }

                        $objects[$k][$name] = $attributes;
                    } elseif ($name == 'content') {
                        if ($this->hasShortcode($v)) {
                            $objects[$k][$name] = $this->extract($v);
                        } else {
                            $objects[$k][$name] = $v;
                        }
                    } else {
                        $objects[$k][$name] = $v;
                    }
                }
            }
        }

        return $objects;
    }
public function extract ( $ content ) { $ pattern = $ this -> getRegex ( ) ; preg_match_all ( "/$pattern/s" , $ content , $ matches ) ; $ objects = [ ] ; foreach ( $ matches as $ key => $ match ) { $ name = null ; if ( $ key == 0 ) { $ name = 'original' ; } elseif ( $ key == 2 ) { $ name = 'name' ; } elseif ( $ key == 3 ) { $ name = 'attributes' ; } elseif ( $ key == 5 ) { $ name = 'content' ; } if ( ! is_null ( $ name ) ) { foreach ( $ match as $ k => $ v ) { if ( ! isset ( $ objects [ $ k ] ) ) { $ objects [ $ k ] = [ ] ; } if ( $ name == 'attributes' ) { $ attributes = $ this -> parseAttr ( $ v ) ; if ( ! is_array ( $ attributes ) ) { $ attributes = [ ] ; } $ objects [ $ k ] [ $ name ] = $ attributes ; } elseif ( $ name == 'content' ) { if ( $ this -> hasShortcode ( $ v ) ) { $ objects [ $ k ] [ $ name ] = $ this -> extract ( $ v ) ; } else { $ objects [ $ k ] [ $ name ] = $ v ; } } else { $ objects [ $ k ] [ $ name ] = $ v ; } } } } return $ objects ; }
Return an array of shortcodes associative array
@param string $content
@return array
Return an array of shortcodes associative array