public function processElementTags($parentTag, & $content, $processUncacheable= false, $removeUnprocessed= false, $prefix= "[[", $suffix= "]]", $tokens= array (), $depth= 0) { $this->_processingTag = true; $this->_processingUncacheable = (boolean) $processUncacheable; $this->_removingUnprocessed = (boolean) $removeUnprocessed; $depth = $depth > 0 ? $depth - 1 : 0; $processed= 0; $tags= array (); $this->modx->documentOutput = $content; $this->modx->invokeEvent('OnParseDocument', array('content' => &$content)); $content = $this->modx->documentOutput; unset($this->modx->documentOutput); if ($collected= $this->collectElementTags($content, $tags, $prefix, $suffix, $tokens)) { $tagMap= array (); foreach ($tags as $tag) { $token= substr($tag[1], 0, 1); if (!$processUncacheable && $token === '!') { if ($removeUnprocessed) { $tagMap[$tag[0]]= ''; } } elseif (!empty ($tokens) && !in_array($token, $tokens)) { $collected--; continue; } if ($tag[0] === $parentTag) { $tagMap[$tag[0]]= ''; $processed++; continue; } $tagOutput= $this->processTag($tag, $processUncacheable); if (($tagOutput === null || $tagOutput === false) && $removeUnprocessed) { $tagMap[$tag[0]]= ''; $processed++; } elseif ($tagOutput !== null && $tagOutput !== false) { $tagMap[$tag[0]]= $tagOutput; if ($tag[0] !== $tagOutput) $processed++; } } $this->mergeTagOutput($tagMap, $content); if ($depth > 0) { $processed+= $this->processElementTags($parentTag, $content, $processUncacheable, $removeUnprocessed, $prefix, $suffix, $tokens, $depth); } } $this->_processingTag = false; return $processed; }