summaryrefslogtreecommitdiff
path: root/src/Readability.php
diff options
context:
space:
mode:
authorAndres Rey <[email protected]>2016-11-23 12:17:22 +0000
committerAndres Rey <[email protected]>2016-11-23 12:17:22 +0000
commit8a24f09d3da047c3b489e7789db7da217ec398fa (patch)
tree974215305fd03c3c3c16fcd5afd609f1152f6cd4 /src/Readability.php
parenta1b4d982e6e4799d0575b083a333f59d089876a7 (diff)
Added horrible way to restore score. Should be gone in next versions (or whe I learn to code properly)
Diffstat (limited to 'src/Readability.php')
-rw-r--r--src/Readability.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Readability.php b/src/Readability.php
index 6bc9603..a6390c9 100644
--- a/src/Readability.php
+++ b/src/Readability.php
@@ -433,4 +433,24 @@ class Readability extends Element implements ReadabilityInterface
{
return $this->initialized;
}
+
+ /**
+ * Reloads the score stores in the data-readability tag.
+ *
+ * @return int|bool
+ */
+ public function reloadScore()
+ {
+ if (method_exists($this->node, 'getAttribute')) {
+ if ($this->node->hasAttribute('data-readability')) {
+ $this->initialized = true;
+ $score = $this->node->getAttribute('data-readability');
+ $this->setContentScore($score);
+
+ return $score;
+ }
+ }
+
+ return false;
+ }
}