use DateTime;
use DateTimeImmutable;
use Shaarli\Bookmark\Bookmark;
+use Shaarli\Render\TemplatePage;
use Slim\Http\Request;
use Slim\Http\Response;
}
$formatter = $this->container->formatterFactory->getFormatter();
+ $formatter->addContextData('base_path', $this->container->basePath);
// We pre-format some fields for proper output.
foreach ($linksToDisplay as $key => $bookmark) {
$linksToDisplay[$key] = $formatter->format($bookmark);
];
// Hooks are called before column construction so that plugins don't have to deal with columns.
- $data = $this->executeHooks($data);
+ $this->executePageHooks('render_daily', $data, TemplatePage::DAILY);
$data['cols'] = $this->calculateColumns($data['linksToDisplay']);
- foreach ($data as $key => $value) {
- $this->assignView($key, $value);
- }
+ $this->assignAllView($data);
$mainTitle = $this->container->conf->get('general.title', 'Shaarli');
$this->assignView(
t('Daily') .' - '. format_date($dayDate, false) . ' - ' . $mainTitle
);
- return $response->write($this->render('daily'));
+ return $response->write($this->render(TemplatePage::DAILY));
}
/**
'date' => $dayDatetime,
'date_rss' => $dayDatetime->format(DateTime::RSS),
'date_human' => format_date($dayDatetime, false, true),
- 'absolute_url' => $indexUrl . '/daily?day=' . $day,
+ 'absolute_url' => $indexUrl . 'daily?day=' . $day,
'links' => [],
];
$this->assignView('hide_timestamps', $this->container->conf->get('privacy.hide_timestamps', false));
$this->assignView('days', $dataPerDay);
- $rssContent = $this->render('dailyrss');
+ $rssContent = $this->render(TemplatePage::DAILY_RSS);
$cache->cache($rssContent);
return $columns;
}
-
- /**
- * @param mixed[] $data Variables passed to the template engine
- *
- * @return mixed[] Template data after active plugins render_picwall hook execution.
- */
- protected function executeHooks(array $data): array
- {
- $this->container->pluginManager->executeHooks(
- 'render_daily',
- $data,
- ['loggedin' => $this->container->loginManager->isLoggedIn()]
- );
-
- return $data;
- }
}