public function testDataAtributesDash() { $html = '<body>testbody<span data-dash="dash">frml</span></body>'; $compiled = htmlparser::parse($html); $clean = htmlparser::compile($compiled); $this->assertEquals($html, $clean); }
public static function compile($page, $language = '') { $context = pobject::getContext(); $me = $context["arCurrentObject"]; include_once $me->store->get_config('code') . "modules/mod_url.php"; include_once $me->store->get_config('code') . "modules/mod_htmlparser.php"; if (!$language) { $language = $me->nls; } $page = URL::RAWtoAR($page, $language); $newpage = $page; $nodes = htmlparser::parse($newpage, array('noTagResolving' => true)); // FIXME: the isChanged check is paranoia mode on. New code ahead. // will only use the new compile method when it is needed (htmlblocks) // otherwise just return the $page, so 99.9% of the sites don't walk // into bugs. 21-05-2007 $isChanged = page::compileWorker($nodes); if ($isChanged) { return htmlparser::compile($nodes); } else { return $page; } }
function esiInclude($page) { /* TODO: [v] alt [v] onerror */ global $ARCurrent, $AR; // parse <esi:include src="view.html"> $regExp = '|<esi:include.*?' . '>|i'; preg_match_all($regExp, $page, $matches); foreach ($matches[0] as $match) { $parts = htmlparser::parse($match); $src = $parts['children'][0]['attribs']['src']; $alt = $parts['children'][0]['attribs']['alt']; $onerror = $parts['children'][0]['attribs']['onerror']; $replacement = ESI::esiFetch($src); if ($replacement == false && isset($alt)) { $replacement = ESI::esiFetch($alt); } if ($replacement == false && isset($onerror) && $onerror == "continue") { $replacement = ""; } if ($replacement !== false) { $page = str_replace($match, $replacement, $page); } else { return false; } } return $page; }