Skip to content

Commit

Permalink
Make ShortcodeParser findMatches public static
Browse files Browse the repository at this point in the history
  • Loading branch information
HansSchouten committed Aug 8, 2022
1 parent 325ba19 commit a2d0c37
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Modules/GrapesJS/ShortcodeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function doShortcodes($html, array $context = [], $maxDepth = 25)
*/
protected function doBlockShortcodes($html, array $context, $maxDepth)
{
$matches = $this->findMatches('block', $html);
$matches = self::findMatches('block', $html);
if (empty($matches)) {
return $html;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ protected function doBlockShortcodes($html, array $context, $maxDepth)
*/
protected function doPageShortcodes($html)
{
$matches = $this->findMatches('page', $html);
$matches = self::findMatches('page', $html);

if (empty($matches)) {
return $html;
Expand Down Expand Up @@ -155,7 +155,7 @@ protected function doPageShortcodes($html)
*/
protected function doThemeUrlShortcodes($html)
{
$matches = $this->findMatches('theme-url', $html);
$matches = self::findMatches('theme-url', $html);

if (empty($matches)) {
return $html;
Expand All @@ -177,7 +177,7 @@ protected function doThemeUrlShortcodes($html)
*/
protected function doBlocksContainerShortcodes($html)
{
$matches = $this->findMatches('blocks-container', $html);
$matches = self::findMatches('blocks-container', $html);

if (empty($matches)) {
return $html;
Expand All @@ -198,7 +198,7 @@ protected function doBlocksContainerShortcodes($html)
* @param $html
* @return array an array with for each $shortcode occurrence an array of attributes
*/
protected function findMatches($shortcode, $html)
public static function findMatches($shortcode, $html)
{
// RegEx: https://www.regextester.com/104625
$regex = '/\[' . $shortcode . '(\s.*?)?\](?:([^\[]+)?\[\/' . $shortcode . '\])?/';
Expand Down

0 comments on commit a2d0c37

Please sign in to comment.