protected function actionTest($params) { $content = '<html> <site:img id="1" lightbox="1" path="testing"> <img src="blabla" /> </site:img> <site:img id="2" lightbox="0" path="testing2"><img src="blabla2" /></site:img> <site:img id="2" lightbox="0" path="testing3"></site:img> <p>Paragraph</p> '; $tags = \GO\Base\Util\TagParser::getTags('site:img', $content); var_dump($tags); }
public static function replaceContentTags($content = '') { $tagParser = new TagParser(); $tagParser->tagStart = '<site:'; $tagParser->tagEnd = '>'; $tags = $tagParser->getTags($content); // var_dump($tags); foreach ($tags as $tag) { switch ($tag['tagName']) { case 'link': $template = self::processLink($tag['params'], $tag['outerText']); $content = str_replace($tag['outerText'], $template, $content); break; case 'img': $template = self::processImage($tag['params']); $content = str_replace($tag['outerText'], $template, $content); break; } } return $content; }