Skip to content

Commit f110ce0

Browse files
committed
Updated contributing and changelog
1 parent f16bc81 commit f110ce0

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
### Changed
1818
- Fixed issue with \ causing an infite loop.
19+
- CDATA should not be altered when cleanupInput is false.
20+
1921

2022
### Removed
2123
- Removed curl interface and curl implementation.

Diff for: CONTRIBUTING.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,11 @@ This page contains guidelines for contributing to the PHPHtmlParser package. Ple
44

55
## Coding Guidelines
66

7-
We follow the [PSR-4](https://www.php-fig.org/psr/psr-4/) autoloading standard and follow the [PSR-12](https://www.php-fig.org/psr/psr-12/) coding style guide. Please ensure you comply to these standards when creating a PR.
7+
We follow the [PSR-4](https://www.php-fig.org/psr/psr-4/) autoloading standard and follow the [PSR-12](https://www.php-fig.org/psr/psr-12/) coding style guide. To make it easy to comply with the coding standard we use php-cs-fixer to manage the style of the code base. Before pushing your code please ensure you run the following on your changes.
8+
9+
```bash
10+
./vendor/bin/php-cs-fixer fix
11+
```
12+
13+
Please ensure you comply to these standards when creating a PR to make it easy to review and merge.
14+
Thank you.

Diff for: src/PHPHtmlParser/Dom.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,6 @@ protected function clean(string $str): string
520520
}
521521
}
522522

523-
//sometime need predicate an encode is from encoding
524-
if ($this->options->get('useFromEncoding') != NULL) {
525-
$str = mb_convert_encoding( $str, "UTF-8", $this->options->get('useFromEncoding'));
526-
}
527-
528523
// remove white space before closing tags
529524
$str = \mb_eregi_replace("'\s+>", "'>", $str);
530525
if ($str === false) {
@@ -619,7 +614,7 @@ protected function parse(): void
619614
$this->root = new HtmlNode('root');
620615
$this->root->setHtmlSpecialCharsDecode($this->options->htmlSpecialCharsDecode);
621616
$activeNode = $this->root;
622-
while ($activeNode!== null) {
617+
while ($activeNode !== null) {
623618
if ($activeNode && $activeNode->tag->name() === 'script'
624619
&& $this->options->get('cleanupInput') != true
625620
) {

Diff for: src/PHPHtmlParser/Dom/AbstractNode.php

+1
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ public function getAncestor(int $id)
244244
if ($this->parent->id() == $id) {
245245
return $this->parent;
246246
}
247+
247248
return $this->parent->getAncestor($id);
248249
}
249250
}

Diff for: tests/DomTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ public function tearDown()
1313
}
1414

1515
/**
16-
* <![CDATA[ should not be modified when cleanupInput is set to false
16+
* <![CDATA[ should not be modified when cleanupInput is set to false.
1717
*/
1818
public function testParsingCData()
1919
{
2020
$html = "<script type=\"text/javascript\">/* <![CDATA[ */var et_core_api_spam_recaptcha = '';/* ]]> */</script>";
2121
$dom = new Dom();
22-
$dom->setOptions(['cleanupInput' => false,]);
22+
$dom->setOptions(['cleanupInput' => false]);
2323
$dom->load($html);
2424
$this->assertSame($html, $dom->root->outerHtml());
2525
}

0 commit comments

Comments
 (0)