Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #105

Merged
merged 1 commit into from
Sep 4, 2023
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
1 change: 0 additions & 1 deletion src/voku/helper/AbstractDomParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ public static function replaceToPreserveHtmlEntities(string $html): string
$linksOld = [];

if (\strpos($html, 'http') !== false) {

// regEx for e.g.: [https://www.domain.de/foo.php?foobar=1&email=lars%40moelleken.org&guid=test1233312&{{foo}}#foo]
$regExUrl = '/(\[?\bhttps?:\/\/[^\s<>]+(?:\(\w+\)|[^[:punct:]\s]|\/|}|]))/i';
\preg_match_all($regExUrl, $html, $linksOld);
Expand Down
1 change: 0 additions & 1 deletion src/voku/helper/HtmlDomHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

final class HtmlDomHelper
{

/**
* @param string $html
* @param string $optionStr
Expand Down
2 changes: 0 additions & 2 deletions src/voku/helper/HtmlDomParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ protected function createDOMDocument(string $html, $libXMLExtraOptions = null, $
}

if ($documentFound === false) {

// UTF-8 hack: http://php.net/manual/en/domdocument.loadhtml.php#95251
$xmlHackUsed = false;
if (\stripos('<?xml', $html) !== 0) {
Expand Down Expand Up @@ -1124,7 +1123,6 @@ static function ($value) {
$html = (string) \preg_replace_callback(
'/(?<start>(<script [^>]*type=["\']?(?:' . $tags . ')+[^>]*>))(?<innerContent>.*)(?<end><\/script>)/isU',
function ($matches) {

// Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>],
// because often this looks like non-valid html in the template itself.
foreach ($this->templateLogicSyntaxInSpecialScriptTags as $logicSyntaxInSpecialScriptTag) {
Expand Down
1 change: 0 additions & 1 deletion src/voku/helper/SimpleHtmlDom.php
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,6 @@ protected function cleanHtmlWrapper(
||
$newDocument->getIsDOMDocumentCreatedWithoutHtmlWrapper()
) {

// Remove doc-type node.
if ($newDocument->getDocument()->doctype !== null) {
$newDocument->getDocument()->doctype->parentNode->removeChild($newDocument->getDocument()->doctype);
Expand Down
1 change: 0 additions & 1 deletion src/voku/helper/XmlDomParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ protected function createDOMDocument(string $xml, $libXMLExtraOptions = null, $u
}

if ($documentFound === false) {

// UTF-8 hack: http://php.net/manual/en/domdocument.loadhtml.php#95251
$xmlHackUsed = false;
/** @noinspection StringFragmentMisplacedInspection */
Expand Down
2 changes: 1 addition & 1 deletion tests/HtmlDomParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public function testIssue96()
$dom = new voku\helper\HtmlDomParser();
$dom->load($html);

foreach($dom->findMulti('.mydiv .mydiv-item') as $childEl) {
foreach ($dom->findMulti('.mydiv .mydiv-item') as $childEl) {
$childEl->class = 'replaced';
}
foreach ($dom->findMulti('.mydiv') as $myDivEl) {
Expand Down
3 changes: 2 additions & 1 deletion tests/XmlDomParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public function testXml()
);
}

public function testXMLWithoutLoadingDtd() {
public function testXMLWithoutLoadingDtd()
{
$cxmlData = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.024/cXML.dtd"><cXML payloadID="dsfsfsdds" timestamp="2022-12-21T15:35:02+01:00" xml:lang="en-US"><Header><From><Credential domain="NetworkId"><Identity>sdfdfsdf-123</Identity></Credential></From><To><Credential domain="NetworkId"><Identity>fsdfdsfdsfds-321</Identity></Credential></To><Sender><Credential domain="NetworkId"><Identity>fsdfdsfds-1234</Identity></Credential><UserAgent>vdmg: Moelleken, Lars (VDMG-Connect)</UserAgent></Sender></Header><Message><PunchOutOrderMessage><BuyerCookie/><PunchOutOrderMessageHeader operationAllowed="edit"><Total><Money currency="EUR">2.13</Money></Total></PunchOutOrderMessageHeader><ItemIn quantity="1"><ItemID><SupplierPartID>43423342</SupplierPartID></ItemID><ItemDetail><UnitPrice><Money currency="EUR">2.13</Money></UnitPrice><Description xml:lang="de">Stahlblech 10 mm 1200</Description><Classification domain="UNSPSC"/></ItemDetail></ItemIn></PunchOutOrderMessage></Message></cXML>';

$xmlParser = new \voku\helper\XmlDomParser();
Expand Down
Loading