/** * Applies all contained content fixers to the provided HTML content. * The resulting content is then suitible for display to the end user. * * @param string $content Html * @param Title $title * @return string Html */ public function apply($content, Title $title) { $dom = self::createDOM($content); $xpath = new DOMXPath($dom); foreach ($this->contentFixers as $i => $contentFixer) { $found = $xpath->query($contentFixer->getXPath()); if (!$found) { wfDebugLog('Flow', __METHOD__ . ': Invalid XPath from ' . get_class($contentFixer) . ' of: ' . $contentFixer->getXPath()); unset($this->contentFixers[$i]); continue; } foreach ($found as $node) { $contentFixer->apply($node, $title); } } return Utils::getInnerHtml($dom->getElementsByTagName('body')->item(0)); }