diff options
author | memiks <memiks@memiks.fr> | 2013-04-23 07:22:19 -0500 |
---|---|---|
committer | memiks <memiks@memiks.fr> | 2013-04-23 07:22:19 -0500 |
commit | 4ddbd26787ebbf4c5e01061ac9dbee4f8c21421b (patch) | |
tree | edc16feb3deeb94294dbf461ced404e611b6d9f2 /inc/Readability.php | |
parent | 8444bb0600f2432835a7ceaad8c87d4e63f26bd4 (diff) | |
download | wallabag-4ddbd26787ebbf4c5e01061ac9dbee4f8c21421b.tar.gz wallabag-4ddbd26787ebbf4c5e01061ac9dbee4f8c21421b.tar.zst wallabag-4ddbd26787ebbf4c5e01061ac9dbee4f8c21421b.zip |
Ajout du global msg et gestion du retour dans Readability
Diffstat (limited to 'inc/Readability.php')
-rw-r--r-- | inc/Readability.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/inc/Readability.php b/inc/Readability.php index c50bf2ef..19298c13 100644 --- a/inc/Readability.php +++ b/inc/Readability.php | |||
@@ -80,7 +80,7 @@ class Readability | |||
80 | public $debug = false; | 80 | public $debug = false; |
81 | protected $body = null; // | 81 | protected $body = null; // |
82 | protected $bodyCache = null; // Cache the body HTML in case we need to re-use it later | 82 | protected $bodyCache = null; // Cache the body HTML in case we need to re-use it later |
83 | protected $flags = self::FLAG_CLEAN_CONDITIONALLY; // 1 | 2 | 4; // Start with all flags set. | 83 | protected $flags = Self::FLAG_CLEAN_CONDITIONALLY; // 1 | 2 | 4; // Start with all flags set. |
84 | protected $success = false; // indicates whether we were able to extract or not | 84 | protected $success = false; // indicates whether we were able to extract or not |
85 | 85 | ||
86 | /** | 86 | /** |
@@ -90,7 +90,7 @@ class Readability | |||
90 | public $regexps = array( | 90 | public $regexps = array( |
91 | 'unlikelyCandidates' => '/combx|comment|comments|community|disqus|extra|foot|header|menu|remark|rss|shoutbox|sidebar|sponsor|ad-break|agegate|pagination|pager|popup|tweet|twitter/i', | 91 | 'unlikelyCandidates' => '/combx|comment|comments|community|disqus|extra|foot|header|menu|remark|rss|shoutbox|sidebar|sponsor|ad-break|agegate|pagination|pager|popup|tweet|twitter/i', |
92 | 'okMaybeItsACandidate' => '/and|article|body|column|main|shadow/i', | 92 | 'okMaybeItsACandidate' => '/and|article|body|column|main|shadow/i', |
93 | 'positive' => '/article|body|content|entry|hentry|main|page|pagination|post|text|blog|story/i', | 93 | 'positive' => '/article|body|content|entry|hentry|main|page|pagination|post|text|blog|story|attachment/i', |
94 | 'negative' => '/combx|comment|comments|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|shoutbox|sidebar|sponsor|shopping|tags|tool|widget/i', | 94 | 'negative' => '/combx|comment|comments|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|shoutbox|sidebar|sponsor|shopping|tags|tool|widget/i', |
95 | 'divToPElements' => '/<(a|blockquote|dl|div|ol|p|pre|table|ul)/i', | 95 | 'divToPElements' => '/<(a|blockquote|dl|div|ol|p|pre|table|ul)/i', |
96 | 'replaceBrs' => '/(<br[^>]*>[ \n\r\t]*){2,}/i', | 96 | 'replaceBrs' => '/(<br[^>]*>[ \n\r\t]*){2,}/i', |
@@ -106,7 +106,7 @@ class Readability | |||
106 | * Create instance of Readability | 106 | * Create instance of Readability |
107 | * @param string UTF-8 encoded string | 107 | * @param string UTF-8 encoded string |
108 | * @param string (optional) URL associated with HTML (used for footnotes) | 108 | * @param string (optional) URL associated with HTML (used for footnotes) |
109 | */ | 109 | */ |
110 | function __construct($html, $url=null) | 110 | function __construct($html, $url=null) |
111 | { | 111 | { |
112 | /* Turn all double br's into p's */ | 112 | /* Turn all double br's into p's */ |
@@ -185,6 +185,7 @@ class Readability | |||
185 | $articleContent = $this->dom->createElement('div'); | 185 | $articleContent = $this->dom->createElement('div'); |
186 | $articleContent->setAttribute('id', 'readability-content'); | 186 | $articleContent->setAttribute('id', 'readability-content'); |
187 | $articleContent->innerHTML = '<p>Sorry, Readability was unable to parse this page for content.</p>'; | 187 | $articleContent->innerHTML = '<p>Sorry, Readability was unable to parse this page for content.</p>'; |
188 | return $this->success; | ||
188 | } | 189 | } |
189 | 190 | ||
190 | $overlay->setAttribute('id', 'readOverlay'); | 191 | $overlay->setAttribute('id', 'readOverlay'); |