]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - inc/poche/PocheReadability.php
3 class PocheReadability
extends Readability
6 * Get the article title as an H1.
10 protected function getArticleTitle() {
15 $curTitle = $origTitle = $this->getInnerText($this->dom
->getElementsByTagName('title')->item(0));
16 } catch(Exception
$e) {}
18 if (preg_match('/ [\|\-] /', $curTitle))
20 $curTitle = preg_replace('/(.*)[\|\-] .*/i', '$1', $origTitle);
22 if (count(explode(' ', $curTitle)) < 3) {
23 $curTitle = preg_replace('/[^\
|\
-]*[\
|\
-](.*)/i
', '$1', $origTitle);
26 else if(strlen($curTitle) > 150 || strlen($curTitle) < 15)
28 $hOnes = $this->dom
->getElementsByTagName('h1');
29 if($hOnes->length
== 1)
31 $curTitle = $this->getInnerText($hOnes->item(0));
35 $curTitle = trim($curTitle);
37 if (count(explode(' ', $curTitle)) <= 4) {
38 $curTitle = $origTitle;
41 $articleTitle = $this->dom
->createElement('h1');
42 $articleTitle->innerHTML
= $curTitle;