From d288d466f94941cd8aabd26549f6ef22fbc88329 Mon Sep 17 00:00:00 2001 From: sunra Date: Fri, 20 May 2016 14:59:36 +0300 Subject: [PATCH 01/14] updated to new version --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1fb2302..2901985 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ php-simple-html-dom-parser ========================== -Version 1.5 +Version 1.5.1 Adaptation for Composer and PSR-0 of: @@ -20,7 +20,7 @@ Install composer.phar ```json "require": { - "sunra/php-simple-html-dom-parser": "v1.5.0" + "sunra/php-simple-html-dom-parser": "1.5.1" } ``` From d600a1e0a731c46e72236d4fe7084b2c7d3f81ac Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Fri, 20 May 2016 14:37:44 +0200 Subject: [PATCH 02/14] Remove change_log.txt from generated archives --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 35af101..d8664ed 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,4 @@ /Src/Sunra/PhpSimple/simplehtmldom_1_5/example export-ignore /Src/Sunra/PhpSimple/simplehtmldom_1_5/manual export-ignore /Src/Sunra/PhpSimple/simplehtmldom_1_5/testcase export-ignore +/Src/Sunra/PhpSimple/simplehtmldom_1_5/change_log.txt export-ignore From bc2aa6fa9b234ecf6882950c6cd6586ceead1162 Mon Sep 17 00:00:00 2001 From: John Nicholls Date: Wed, 1 Jun 2016 12:08:28 +0100 Subject: [PATCH 03/14] Add type hinting and DocBlock comments To enable IDEs to understand the responses from find() --- .../simplehtmldom_1_5/simple_html_dom.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php index aa4357f..a214a33 100644 --- a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php +++ b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php @@ -131,7 +131,7 @@ class simple_html_dom_node public $tag_start = 0; private $dom = null; - function __construct($dom) + function __construct(simple_html_dom $dom) { $this->dom = $dom; $dom->nodes[] = $this; @@ -504,8 +504,14 @@ function makeup() return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>'; } - // find elements by css selector - //PaperG - added ability for find to lowercase the value of the selector. + /** + * find elements by css selector + * PaperG - added ability for find to lowercase the value of the selector. + * @param string $selector + * @param null $idx + * @param bool $lowercase + * @return simple_html_dom_node[]|simple_html_dom_node|null + */ function find($selector, $idx=null, $lowercase=false) { $selectors = $this->parse_selector($selector); @@ -977,6 +983,7 @@ function appendChild($node) {$node->parent($this); return $node;} */ class simple_html_dom { + /** @var simple_html_dom_node $root */ public $root = null; public $nodes = array(); public $callback = null; @@ -1724,5 +1731,3 @@ function getElementByTagName($name) {return $this->find($name, 0);} function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);} function loadFile() {$args = func_get_args();$this->load_file($args);} } - -?> From 8cbcf7bd6175f03ef09f7ba1764e12c3e4cdf4ae Mon Sep 17 00:00:00 2001 From: John Nicholls Date: Thu, 2 Jun 2016 11:01:24 +0100 Subject: [PATCH 04/14] tweak to DocBlock $idx can be int or null --- Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php index a214a33..400b570 100644 --- a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php +++ b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php @@ -507,9 +507,9 @@ function makeup() /** * find elements by css selector * PaperG - added ability for find to lowercase the value of the selector. - * @param string $selector - * @param null $idx - * @param bool $lowercase + * @param string $selector + * @param int|null $idx + * @param bool $lowercase * @return simple_html_dom_node[]|simple_html_dom_node|null */ function find($selector, $idx=null, $lowercase=false) From f1ebe0c264167edf1aae12a6e6618c010c5f94f3 Mon Sep 17 00:00:00 2001 From: Michele Carino Date: Sun, 17 Jul 2016 16:06:25 +0200 Subject: [PATCH 05/14] Declare explicit dependency on mbstring extension mbstring extension is needed for charset guessing --- composer.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 6d21ae1..b3d1758 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,10 @@ } ], "require": { - "php": ">=5.3.2" + "php": ">=5.3.2", + "ext-mbstring": "*" }, "autoload": { "psr-0": { "Sunra\\PhpSimple\\HtmlDomParser": "Src/" } } -} \ No newline at end of file +} From 54c507a6ec1de6b0324b3ddc30b43f2d5d6dda5b Mon Sep 17 00:00:00 2001 From: sunra Date: Wed, 16 Nov 2016 03:32:33 +0200 Subject: [PATCH 06/14] Author name added --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b3d1758..bc258d2 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,8 @@ "homepage": "https://github.com/sunra/php-simple-html-dom-parser", "license": "MIT", "authors": [ - { + { + "name": "S.C. Chen", "homepage": "http://sourceforge.net/projects/simplehtmldom/" }, { From 59521c9847915bd2ec845df2f07d7dedb05f8e05 Mon Sep 17 00:00:00 2001 From: sunra Date: Wed, 23 Nov 2016 00:56:01 +0200 Subject: [PATCH 07/14] "spaces" corrected --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bc258d2..49d9170 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "license": "MIT", "authors": [ { - "name": "S.C. Chen", + "name": "S.C. Chen", "homepage": "http://sourceforge.net/projects/simplehtmldom/" }, { From 75b9b1cb64502d8f8c04dc11b5906b969af247c6 Mon Sep 17 00:00:00 2001 From: sunra Date: Wed, 23 Nov 2016 00:57:47 +0200 Subject: [PATCH 08/14] 1.5.2 version --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2901985..945a683 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ php-simple-html-dom-parser ========================== -Version 1.5.1 +Version 1.5.2 Adaptation for Composer and PSR-0 of: @@ -20,7 +20,7 @@ Install composer.phar ```json "require": { - "sunra/php-simple-html-dom-parser": "1.5.1" + "sunra/php-simple-html-dom-parser": "1.5.2" } ``` From bd180b6344160261f4483a40738ce34f25fe9b07 Mon Sep 17 00:00:00 2001 From: Kyle Tse Date: Thu, 8 Dec 2016 21:23:19 +0800 Subject: [PATCH 09/14] Decode Attribute --- Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php index 400b570..50d079f 100644 --- a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php +++ b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php @@ -952,8 +952,8 @@ function get_display_size() } // camel naming conventions - function getAllAttributes() {return $this->attr;} - function getAttribute($name) {return $this->__get($name);} + function getAllAttributes() {return array_map('html_entity_decode', $this->attr);} + function getAttribute($name) {return html_entity_decode($this->__get($name));} function setAttribute($name, $value) {$this->__set($name, $value);} function hasAttribute($name) {return $this->__isset($name);} function removeAttribute($name) {$this->__set($name, null);} From ec710a0084d4076b2e3006d307448fabbba2d827 Mon Sep 17 00:00:00 2001 From: sunra Date: Sat, 17 Dec 2016 13:17:23 +0200 Subject: [PATCH 10/14] issues/37 old php version std value corrected --- Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php index 50d079f..df46ee4 100644 --- a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php +++ b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php @@ -73,7 +73,7 @@ // ----------------------------------------------------------------------------- // get html dom from file // $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1. -function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) +function file_get_html($url, $use_include_path = false, $context=null, $offset=0, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) { // We DO force the tags to be terminated. $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText); From 55b70173e8694c8f28904a7516ae1cbeb4211f13 Mon Sep 17 00:00:00 2001 From: Zinta <> Date: Wed, 10 May 2017 21:07:44 +0200 Subject: [PATCH 11/14] fixing Call to undefined function mb_detect_encoding() error this happens with minimal php installation ( missing php-mbstring library) --- Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php index df46ee4..279d589 100644 --- a/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php +++ b/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php @@ -1245,7 +1245,7 @@ protected function parse_charset() if (empty($charset)) { // Have php try to detect the encoding from the text given to us. - $charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) ); + $charset = (function_exists('mb_detect_encoding')) ? mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) ) : false; if (is_object($debugObject)) {$debugObject->debugLog(2, 'mb_detect found: ' . $charset);} // and if this doesn't work... then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need... From c5b9ba05a0c05accf8cb0501f64172f6665703f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edvard=20=C3=85kerberg?= Date: Tue, 7 Nov 2017 11:42:45 +0100 Subject: [PATCH 12/14] Update composer.json --- composer.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 49d9170..cdb3c9c 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "sunra/php-simple-html-dom-parser", + "name": "eddieace/php-simple-html-dom-parser", "type": "library", "description": "Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.", "keywords": ["html", "dom", "parser"], @@ -14,10 +14,15 @@ "name": "Sunra", "email": "sunra@yandex.ru", "homepage": "https://github.com/sunra" + }, + { + "name": "Edvard", + "email": "edvard@4film.se", + "homepage": "https://github.com/eddieace" } ], "require": { - "php": ">=5.3.2", + "php": ">=7.1.0", "ext-mbstring": "*" }, "autoload": { From b8b591015b33ccb3c8bc3602dd569917d8cddc08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edvard=20=C3=85kerberg?= Date: Tue, 7 Nov 2017 11:44:01 +0100 Subject: [PATCH 13/14] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cdb3c9c..add1308 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { "name": "eddieace/php-simple-html-dom-parser", "type": "library", - "description": "Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.", + "description": "Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 7+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.", "keywords": ["html", "dom", "parser"], - "homepage": "https://github.com/sunra/php-simple-html-dom-parser", + "homepage": "https://github.com/eddieace/php-simple-html-dom-parser", "license": "MIT", "authors": [ { From b43095e603a22fc467decf1b2248bee4f1885375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edvard=20=C3=85kerberg?= Date: Tue, 7 Nov 2017 11:48:52 +0100 Subject: [PATCH 14/14] Update composer.json --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index add1308..03473d2 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,7 @@ "homepage": "https://github.com/eddieace" } ], + "minimum-stability": "stable", "require": { "php": ">=7.1.0", "ext-mbstring": "*"