diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-12-23 02:28:56 -0800 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-12-23 02:28:56 -0800 |
commit | 60fc4f4b1ab37fbfe9021f3fa1395d66a4424ed2 (patch) | |
tree | 515c4b9c8286ae363f77722c91acb878151dc386 /inc/poche/PocheReadability.php | |
parent | cbfd5a1019f47fadefd8490dae9f039ae894298d (diff) | |
parent | da5fc42f615eeb45a702604970f94967507fb432 (diff) | |
download | wallabag-60fc4f4b1ab37fbfe9021f3fa1395d66a4424ed2.tar.gz wallabag-60fc4f4b1ab37fbfe9021f3fa1395d66a4424ed2.tar.zst wallabag-60fc4f4b1ab37fbfe9021f3fa1395d66a4424ed2.zip |
Merge pull request #363 from inthepoche/dev1.3.0
poche 1.3.0
Diffstat (limited to 'inc/poche/PocheReadability.php')
-rw-r--r-- | inc/poche/PocheReadability.php | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/inc/poche/PocheReadability.php b/inc/poche/PocheReadability.php deleted file mode 100644 index 48ae90d0..00000000 --- a/inc/poche/PocheReadability.php +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | class PocheReadability extends Readability | ||
4 | { | ||
5 | /** | ||
6 | * Get the article title as an H1. | ||
7 | * | ||
8 | * @return DOMElement | ||
9 | */ | ||
10 | protected function getArticleTitle() { | ||
11 | $curTitle = ''; | ||
12 | $origTitle = ''; | ||
13 | |||
14 | try { | ||
15 | $curTitle = $origTitle = $this->getInnerText($this->dom->getElementsByTagName('title')->item(0)); | ||
16 | } catch(Exception $e) {} | ||
17 | |||
18 | if (preg_match('/ [\|\-] /', $curTitle)) | ||
19 | { | ||
20 | $curTitle = preg_replace('/(.*)[\|\-] .*/i', '$1', $origTitle); | ||
21 | |||
22 | if (count(explode(' ', $curTitle)) < 3) { | ||
23 | $curTitle = preg_replace('/[^\|\-]*[\|\-](.*)/i', '$1', $origTitle); | ||
24 | } | ||
25 | } | ||
26 | else if(strlen($curTitle) > 150 || strlen($curTitle) < 15) | ||
27 | { | ||
28 | $hOnes = $this->dom->getElementsByTagName('h1'); | ||
29 | if($hOnes->length == 1) | ||
30 | { | ||
31 | $curTitle = $this->getInnerText($hOnes->item(0)); | ||
32 | } | ||
33 | } | ||
34 | |||
35 | $curTitle = trim($curTitle); | ||
36 | |||
37 | if (count(explode(' ', $curTitle)) <= 4) { | ||
38 | $curTitle = $origTitle; | ||
39 | } | ||
40 | |||
41 | $articleTitle = $this->dom->createElement('h1'); | ||
42 | $articleTitle->innerHTML = $curTitle; | ||
43 | |||
44 | return $articleTitle; | ||
45 | } | ||
46 | } \ No newline at end of file | ||