aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php29
1 files changed, 16 insertions, 13 deletions
diff --git a/index.php b/index.php
index c2aaf84a..067b8fcb 100644
--- a/index.php
+++ b/index.php
@@ -616,6 +616,20 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager)
616 $linksToDisplay[$key]['timestamp'] = $link['created']->getTimestamp(); 616 $linksToDisplay[$key]['timestamp'] = $link['created']->getTimestamp();
617 } 617 }
618 618
619 $dayDate = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $day.'_000000');
620 $data = array(
621 'pagetitle' => $conf->get('general.title') .' - '. format_date($dayDate, false),
622 'linksToDisplay' => $linksToDisplay,
623 'day' => $dayDate->getTimestamp(),
624 'dayDate' => $dayDate,
625 'previousday' => $previousday,
626 'nextday' => $nextday,
627 );
628
629 /* Hook is called before column construction so that plugins don't have
630 to deal with columns. */
631 $pluginManager->executeHooks('render_daily', $data, array('loggedin' => isLoggedIn()));
632
619 /* We need to spread the articles on 3 columns. 633 /* We need to spread the articles on 3 columns.
620 I did not want to use a JavaScript lib like http://masonry.desandro.com/ 634 I did not want to use a JavaScript lib like http://masonry.desandro.com/
621 so I manually spread entries with a simple method: I roughly evaluate the 635 so I manually spread entries with a simple method: I roughly evaluate the
@@ -623,7 +637,7 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager)
623 */ 637 */
624 $columns = array(array(), array(), array()); // Entries to display, for each column. 638 $columns = array(array(), array(), array()); // Entries to display, for each column.
625 $fill = array(0, 0, 0); // Rough estimate of columns fill. 639 $fill = array(0, 0, 0); // Rough estimate of columns fill.
626 foreach($linksToDisplay as $key => $link) { 640 foreach($data['linksToDisplay'] as $key => $link) {
627 // Roughly estimate length of entry (by counting characters) 641 // Roughly estimate length of entry (by counting characters)
628 // Title: 30 chars = 1 line. 1 line is 30 pixels height. 642 // Title: 30 chars = 1 line. 1 line is 30 pixels height.
629 // Description: 836 characters gives roughly 342 pixel height. 643 // Description: 836 characters gives roughly 342 pixel height.
@@ -639,18 +653,7 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager)
639 $fill[$index] += $length; 653 $fill[$index] += $length;
640 } 654 }
641 655
642 $dayDate = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $day.'_000000'); 656 $data['cols'] = $columns;
643 $data = array(
644 'pagetitle' => $conf->get('general.title') .' - '. format_date($dayDate, false),
645 'linksToDisplay' => $linksToDisplay,
646 'cols' => $columns,
647 'day' => $dayDate->getTimestamp(),
648 'dayDate' => $dayDate,
649 'previousday' => $previousday,
650 'nextday' => $nextday,
651 );
652
653 $pluginManager->executeHooks('render_daily', $data, array('loggedin' => isLoggedIn()));
654 657
655 foreach ($data as $key => $value) { 658 foreach ($data as $key => $value) {
656 $pageBuilder->assign($key, $value); 659 $pageBuilder->assign($key, $value);