Skip to content

Commit

Permalink
Merge commit '6f665c2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-KM committed Oct 21, 2018
2 parents 3c723ca + 6f665c2 commit 9a7c8de
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"php": ">=5.3.0",
"phpzip/phpzip": "~2.0.7",
"grandt/phpresizegif": "~1.0.3",
"grandt/relativepath": "~1.0.1"
"grandt/relativepath": "~1.0.1",
"masterminds/html5": "^2.1"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 5 additions & 4 deletions src/PHPePub/Core/EPub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace PHPePub\Core;

use com\grandt\BinStringStatic;
use Masterminds\HTML5;
use DOMDocument;
use DOMXPath;
use PHPePub\Core\Structure\Ncx;
Expand Down Expand Up @@ -354,8 +355,8 @@ function addChapter($chapterName, $fileName, $chapterData = null, $autoSplit = f
* @return array
*/
function findIdAttributes($chapterData) {
$xmlDoc = new DOMDocument();
@$xmlDoc->loadHTML($chapterData);
$html5 = new HTML5();
$xmlDoc = $html5->loadHTML($chapterData);

$xpath = new DomXpath($xmlDoc);

Expand Down Expand Up @@ -416,8 +417,8 @@ protected function processChapterExternalReferences(&$doc, $externalReferences =
if ($isDocAString) {
$doc = StringHelper::removeComments($doc);

$xmlDoc = new DOMDocument();
@$xmlDoc->loadHTML($doc);
$html5 = new HTML5();
$xmlDoc = $html5->loadHTML($doc);
} else {
$xmlDoc = $doc;
}
Expand Down
5 changes: 3 additions & 2 deletions src/PHPePub/Core/EPubChapterSplitter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace PHPePub\Core;

use Masterminds\HTML5;
use DOMDocument;

/**
Expand Down Expand Up @@ -77,8 +78,8 @@ function splitChapter($chapter, $splitOnSearchString = false, $searchString = '/
);
}

$xmlDoc = new DOMDocument();
@$xmlDoc->loadHTML($chapter);
$html5 = new HTML5();
$xmlDoc = $html5->loadHTML($chapter);

$head = $xmlDoc->getElementsByTagName("head");
$body = $xmlDoc->getElementsByTagName("body");
Expand Down
3 changes: 2 additions & 1 deletion tests/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"require": {
"php": ">=5.3.0",
"phpzip/phpzip": ">=2.0.7"
"phpzip/phpzip": ">=2.0.7",
"masterminds/html5": "^2.1"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 9a7c8de

Please sign in to comment.