diff options
author | tcit <tcit@tcit.fr> | 2014-09-27 17:54:13 +0200 |
---|---|---|
committer | tcit <tcit@tcit.fr> | 2014-09-27 17:54:13 +0200 |
commit | 04a7674bdd20f2f24b32de69c086ecffdf20ceb4 (patch) | |
tree | bcc26634c68a8689ad511513c316058647e90789 /inc/3rdparty/libraries/readability/Readability.php | |
parent | 657245dcbdbca323621952d2b6f9e991dd94fa03 (diff) | |
parent | a15108e65b12ceaf50821783bcaa1ee3fee10d13 (diff) | |
download | wallabag-04a7674bdd20f2f24b32de69c086ecffdf20ceb4.tar.gz wallabag-04a7674bdd20f2f24b32de69c086ecffdf20ceb4.tar.zst wallabag-04a7674bdd20f2f24b32de69c086ecffdf20ceb4.zip |
merge refactor and dev
Diffstat (limited to 'inc/3rdparty/libraries/readability/Readability.php')
-rwxr-xr-x[-rw-r--r--] | inc/3rdparty/libraries/readability/Readability.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/inc/3rdparty/libraries/readability/Readability.php b/inc/3rdparty/libraries/readability/Readability.php index d0f09d74..4fa3ba63 100644..100755 --- a/inc/3rdparty/libraries/readability/Readability.php +++ b/inc/3rdparty/libraries/readability/Readability.php | |||
@@ -679,6 +679,7 @@ class Readability | |||
679 | } else { | 679 | } else { |
680 | $topCandidate->innerHTML = $page->documentElement->innerHTML; | 680 | $topCandidate->innerHTML = $page->documentElement->innerHTML; |
681 | $page->documentElement->innerHTML = ''; | 681 | $page->documentElement->innerHTML = ''; |
682 | $this->reinitBody(); | ||
682 | $page->documentElement->appendChild($topCandidate); | 683 | $page->documentElement->appendChild($topCandidate); |
683 | } | 684 | } |
684 | } else { | 685 | } else { |
@@ -794,8 +795,7 @@ class Readability | |||
794 | { | 795 | { |
795 | // TODO: find out why element disappears sometimes, e.g. for this URL http://www.businessinsider.com/6-hedge-fund-etfs-for-average-investors-2011-7 | 796 | // TODO: find out why element disappears sometimes, e.g. for this URL http://www.businessinsider.com/6-hedge-fund-etfs-for-average-investors-2011-7 |
796 | // in the meantime, we check and create an empty element if it's not there. | 797 | // in the meantime, we check and create an empty element if it's not there. |
797 | if (!isset($this->body->childNodes)) $this->body = $this->dom->createElement('body'); | 798 | $this->reinitBody(); |
798 | $this->body->innerHTML = $this->bodyCache; | ||
799 | 799 | ||
800 | if ($this->flagIsActive(self::FLAG_STRIP_UNLIKELYS)) { | 800 | if ($this->flagIsActive(self::FLAG_STRIP_UNLIKELYS)) { |
801 | $this->removeFlag(self::FLAG_STRIP_UNLIKELYS); | 801 | $this->removeFlag(self::FLAG_STRIP_UNLIKELYS); |
@@ -1134,5 +1134,18 @@ class Readability | |||
1134 | public function removeFlag($flag) { | 1134 | public function removeFlag($flag) { |
1135 | $this->flags = $this->flags & ~$flag; | 1135 | $this->flags = $this->flags & ~$flag; |
1136 | } | 1136 | } |
1137 | |||
1138 | /** | ||
1139 | * Will recreate previously deleted body property | ||
1140 | * | ||
1141 | * @return void | ||
1142 | */ | ||
1143 | protected function reinitBody() { | ||
1144 | if (!isset($this->body->childNodes)) { | ||
1145 | $this->body = $this->dom->createElement('body'); | ||
1146 | $this->body->innerHTML = $this->bodyCache; | ||
1147 | } | ||
1148 | } | ||
1149 | |||
1137 | } | 1150 | } |
1138 | ?> \ No newline at end of file | 1151 | ?> \ No newline at end of file |