src/shortcodes/ShortcodeParser.php
public function getShortcodesFromContent($content)
    {
        $content = $this->getContentWithoutIgnoreBlocks($content);

        if (false === strpos($content, '[')) {
            return [];
        }

        $result = [];

        $regex = "\[([A-Za-z_]+[^\ \]]+)";
        preg_match_all('/' . $regex . '/', $content, $matches);

        if (!empty($matches[1])) {
            foreach ($matches[1] as $match) {
                $result[$match] = $match;
            }
        }

        if ($result) {
            return array_keys($result);
        }

        return $result;
    }
public function getShortcodesFromContent($content)
    {
        $content = $this->getContentWithoutIgnoreBlocks($content);

        if (false === strpos($content, '[')) {
            return [];
        }

        $result = [];

        $regex = "\[([A-Za-z_]+[^\ \]]+)";
        preg_match_all('/' . $regex . '/', $content, $matches);

        if (!empty($matches[1])) {
            foreach ($matches[1] as $match) {
                $result[$match] = $match;
            }
        }

        if ($result) {
            return array_keys($result);
        }

        return $result;
    }
public function getShortcodesFromContent ( $ content ) { $ content = $ this -> getContentWithoutIgnoreBlocks ( $ content ) ; if ( false === strpos ( $ content , '[' ) ) { return [ ] ; } $ result = [ ] ; $ regex = "\[([A-Za-z_]+[^\ \]]+)" ; preg_match_all ( '/' . $ regex . '/' , $ content , $ matches ) ; if ( ! empty ( $ matches [ 1 ] ) ) { foreach ( $ matches [ 1 ] as $ match ) { $ result [ $ match ] = $ match ; } } if ( $ result ) { return array_keys ( $ result ) ; } return $ result ; }
Get the list of all shortcodes found in given content
@param string $content Content to process
@return array
Get the list of all shortcodes found in given content