Add entry_before_display hook

See https://github.com/FreshRSS/FreshRSS/issues/252
pull/749/head
Marien Fressinaud 10 years ago
parent 08546af75f
commit 5932c3427b
  1. 5
      app/views/index/normal.phtml
  2. 11
      app/views/index/reader.phtml
  3. 6
      lib/Minz/ExtensionManager.php

@ -35,6 +35,11 @@ if (!empty($this->entries)) {
<a href="<?php echo Minz_Url::display(Minz_Request::currentRequest()); ?>"><?php echo _t('new_article'); ?></a>
</div><?php
foreach ($this->entries as $item) {
$item = Minz_ExtensionManager::callHook('entry_before_display', $item);
if (is_null($item)) {
continue;
}
if ($display_today && $item->isDay(FreshRSS_Days::TODAY, $today)) {
?><div class="day" id="day_today"><?php
echo _t('today');

@ -6,10 +6,13 @@ if (!empty($this->entries)) {
$content_width = FreshRSS_Context::$conf->content_width;
?>
<div id="stream" class="reader">
<?php foreach ($this->entries as $item) { ?>
<div class="flux<?php echo !$item->isRead() ? ' not_read' : ''; ?><?php echo $item->isFavorite() ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id(); ?>">
<div id="stream" class="reader"><?php
foreach ($this->entries as $item) {
$item = Minz_ExtensionManager::callHook('entry_before_display', $item);
if (is_null($item)) {
continue;
}
?><div class="flux<?php echo !$item->isRead() ? ' not_read' : ''; ?><?php echo $item->isFavorite() ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id(); ?>">
<div class="flux_content">
<div class="content <?php echo $content_width; ?>">
<?php

@ -13,8 +13,10 @@ class Minz_ExtensionManager {
private static $ext_auto_enabled = array();
// List of available hooks. Please keep this list sorted.
private static $hook_list = array(
'entry_before_insert' => array(), // function($entry)
'entry_before_display' => array(), // function($entry) -> Entry | null
'entry_before_insert' => array(), // function($entry) -> Entry | null
);
private static $ext_to_hooks = array();
@ -230,7 +232,7 @@ class Minz_ExtensionManager {
$args = func_get_args();
unset($args[0]);
$result = $args;
$result = $args[1];
foreach (self::$hook_list[$hook_name] as $function) {
$result = call_user_func_array($function, $args);

Loading…
Cancel
Save