reading time
This commit is contained in:
parent
4856a6316f
commit
8807414d1b
@ -485,6 +485,17 @@ class Page {
|
||||
return $list;
|
||||
}
|
||||
|
||||
// Returns the amount of minutes takes to read the page
|
||||
public function readingTime() {
|
||||
$words = $this->content(true);
|
||||
$words = strip_tags($words);
|
||||
$words = str_word_count($words);
|
||||
$average = $words / 200;
|
||||
$minutes = round($average);
|
||||
|
||||
return $minutes;
|
||||
}
|
||||
|
||||
// Returns relative time (e.g. "1 minute ago")
|
||||
// Based on http://stackoverflow.com/a/18602474
|
||||
// Modified for Bludit
|
||||
|
Loading…
Reference in New Issue
Block a user