diff --git a/.gitignore b/.gitignore
index b871be44..a0a73782 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ composer.lock
/vendor/
.idea/
*.swp
+build/
diff --git a/.travis.yml b/.travis.yml
index 20c077a0..8f3feeb4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,10 +10,7 @@ install:
- composer install --dev --no-interaction
script:
- - mkdir -p build/logs
- - php vendor/bin/phpunit --coverage-clover build/logs/clover.xml
+ - vendor/bin/phpunit
after_script:
- php vendor/bin/coveralls
- - wget https://scrutinizer-ci.com/ocular.phar
- - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
diff --git a/composer.json b/composer.json
index 96c16d2f..30307c67 100644
--- a/composer.json
+++ b/composer.json
@@ -1,27 +1,31 @@
{
- "name": "paquettg/php-html-parser",
+ "name": "muchrm/php-html-parser",
"type": "library",
"version": "1.7.0",
"description": "An HTML DOM parser. It allows you to manipulate HTML. Find tags on an HTML page with selectors just like jQuery.",
"keywords": ["html", "dom", "parser"],
- "homepage": "https://github.com/paquettg/php-html-parser",
+ "homepage": "https://github.com/muchrm/php-html-parser",
"license": "MIT",
"authors": [
{
"name": "Gilles Paquette",
"email": "paquettg@gmail.com",
"homepage": "http://gillespaquette.ca"
+ },
+ {
+ "name": "Pongpanot Chuaysakun",
+ "email": "muchrm.me@gmail.com"
}
],
"require": {
- "php": ">=5.6",
+ "php": "^5.6 || ^7.0",
"ext-mbstring": "*",
"paquettg/string-encode": "~0.1.0"
},
"require-dev": {
- "phpunit/phpunit": "~5.7.0",
- "satooshi/php-coveralls": "~1.0.0",
- "mockery/mockery": "~0.9.0"
+ "phpunit/phpunit": "~7",
+ "php-coveralls/php-coveralls": "~2.0.0",
+ "mockery/mockery": "~1"
},
"autoload": {
"psr-0": {
diff --git a/phpunit.xml b/phpunit.xml
index 64a402ac..7cd7a5b2 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -24,4 +24,7 @@
+
+
+
diff --git a/src/PHPHtmlParser/Dom.php b/src/PHPHtmlParser/Dom.php
index 22b56ec6..7f9e0f2c 100644
--- a/src/PHPHtmlParser/Dom.php
+++ b/src/PHPHtmlParser/Dom.php
@@ -470,47 +470,35 @@ protected function clean($str)
// skip entire cleanup step
return $str;
}
-
// remove white space before closing tags
- $str = mb_eregi_replace("'\s+>", "'>", $str);
- $str = mb_eregi_replace('"\s+>', '">', $str);
-
+ $str = preg_replace("#'\s+>#i", "'>", $str);
+ $str = preg_replace('#"\s+>#i', '">', $str);
// clean out the \n\r
$replace = ' ';
if ($this->options->get('preserveLineBreaks')) {
$replace = '
';
}
$str = str_replace(["\r\n", "\r", "\n"], $replace, $str);
-
// strip the doctype
- $str = mb_eregi_replace("", '', $str);
-
+ $str = preg_replace("##i", '', $str);
// strip out comments
- $str = mb_eregi_replace("", '', $str);
-
+ $str = preg_replace("##i", '', $str);
// strip out cdata
- $str = mb_eregi_replace("", '', $str);
-
+ $str = preg_replace("##i", '', $str);
// strip out