$filter = new Twig_SimpleFilter('getDomain', 'Tools::getDomain');
$this->tpl->addFilter($filter);
+ # filter for reading time
+ $filter = new Twig_SimpleFilter('getReadingTime', 'Tools::getReadingTime');
+ $this->tpl->addFilter($filter);
+
# Pagination
$this->pagination = new Paginator($this->user->getConfigValue('pager'), 'p');
}
return FALSE;
}
+
+ public static function getReadingTime($text) {
+ $word = str_word_count(strip_tags($text));
+ $minutes = floor($word / 200);
+ $seconds = floor($word % 200 / (200 / 60));
+ $time = array('minutes' => $minutes, 'seconds' => $seconds);
+
+ return $minutes;
+ }
}
\ No newline at end of file
footer {
clear: both;
+}
+
+.reading-time {
+ font-size: 13px;
}
\ No newline at end of file
<a title="{% trans "toggle mark as read" %}" class="tool archive {% if entry.is_read == 0 %}archive-off{% endif %}" href="./?action=toggle_archive&id={{ entry.id|e }}"><span></span></a></li>
<li><a title="{% trans "toggle favorite" %}" class="tool fav {% if entry.is_fav == 0 %}fav-off{% endif %}" href="./?action=toggle_fav&id={{ entry.id|e }}"><span></span></a></li>
<li><a title="{% trans "delete" %}" class="tool delete" href="./?action=delete&id={{ entry.id|e }}"><span></span></a></li>
+ <li class="reading-time">{{ entry.content| getReadingTime }} min</li>
</li>
</ul>
<p>{{ entry.content|striptags|slice(0, 300) }}...</p>