Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Io/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public function loadXmlString($html)
// - help link in footer not terminated
// - selected branch/tag in CVS "sticky tag" dropdown has not attribute value
// - self closing elements with no trailing slash
// - excessive form close tags
// - remove navheader because of its often incomplete form tags
$html = str_replace('Help</strong></td>', 'Help</a></strong></td>', $html);
$html = str_replace('selected>', 'selected="selected">', $html);
$html = preg_replace('#<((?:input|br|hr|img)[^\/\>]*)>#', '<$1 />', $html);
$html = preg_replace('#(</table>\s*)</form>\s*(</div>)#', '$1$2', $html);
$html = preg_replace('#\<div class\=\"vc_navheader\"\>.*?\<\/div\>#s','', $html);

// replace named HTML entities with their UTF-8 value
$html = str_replace(array_values($this->entities), array_keys($this->entities), $html);
Expand Down
9 changes: 9 additions & 0 deletions tests/Io/LoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,13 @@ public function testLoadInvalidMarkupSelectedAttributeNoValue()

$this->assertEquals('selected', (string)$xml['selected']);
}

public function testLoadRemovedNavHeader()
{
$str = '<body><div class="vc_navheader"> invalid <asd> </okay> </div> </body>';
$xml = $this->loader->loadXmlString($str);

$this->assertFalse(isset($xml->div));
$this->assertEquals(0, count($xml));
}
}