aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorkalvn <kalvnthereal@gmail.com>2018-02-01 13:16:58 +0100
committerkalvn <kalvnthereal@gmail.com>2018-02-01 13:16:58 +0100
commit50142efd1b4b826f60b1e5673dba5ccbe26e0108 (patch)
tree6cffd9e5e733e10afcfc3010dbeeb4f08bb32f62 /index.php
parent499bd43c37a6ee3d13dabe8bdd0bb449ae57122a (diff)
downloadShaarli-50142efd1b4b826f60b1e5673dba5ccbe26e0108.tar.gz
Shaarli-50142efd1b4b826f60b1e5673dba5ccbe26e0108.tar.zst
Shaarli-50142efd1b4b826f60b1e5673dba5ccbe26e0108.zip
Executes daily hooks before creating columns.
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 d57789e6..ae0ce8f0 100644
--- a/index.php
+++ b/index.php
@@ -611,6 +611,20 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager)
611 $linksToDisplay[$key]['timestamp'] = $link['created']->getTimestamp(); 611 $linksToDisplay[$key]['timestamp'] = $link['created']->getTimestamp();
612 } 612 }
613 613
614 $dayDate = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $day.'_000000');
615 $data = array(
616 'pagetitle' => $conf->get('general.title') .' - '. format_date($dayDate, false),
617 'linksToDisplay' => $linksToDisplay,
618 'day' => $dayDate->getTimestamp(),
619 'dayDate' => $dayDate,
620 'previousday' => $previousday,
621 'nextday' => $nextday,
622 );
623
624 /* Hook is called before column construction so that plugins don't have
625 to deal with columns. */
626 $pluginManager->executeHooks('render_daily', $data, array('loggedin' => isLoggedIn()));
627
614 /* We need to spread the articles on 3 columns. 628 /* We need to spread the articles on 3 columns.
615 I did not want to use a JavaScript lib like http://masonry.desandro.com/ 629 I did not want to use a JavaScript lib like http://masonry.desandro.com/
616 so I manually spread entries with a simple method: I roughly evaluate the 630 so I manually spread entries with a simple method: I roughly evaluate the
@@ -618,7 +632,7 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager)
618 */ 632 */
619 $columns = array(array(), array(), array()); // Entries to display, for each column. 633 $columns = array(array(), array(), array()); // Entries to display, for each column.
620 $fill = array(0, 0, 0); // Rough estimate of columns fill. 634 $fill = array(0, 0, 0); // Rough estimate of columns fill.
621 foreach($linksToDisplay as $key => $link) { 635 foreach($data['linksToDisplay'] as $key => $link) {
622 // Roughly estimate length of entry (by counting characters) 636 // Roughly estimate length of entry (by counting characters)
623 // Title: 30 chars = 1 line. 1 line is 30 pixels height. 637 // Title: 30 chars = 1 line. 1 line is 30 pixels height.
624 // Description: 836 characters gives roughly 342 pixel height. 638 // Description: 836 characters gives roughly 342 pixel height.
@@ -634,18 +648,7 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager)
634 $fill[$index] += $length; 648 $fill[$index] += $length;
635 } 649 }
636 650
637 $dayDate = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $day.'_000000'); 651 $data['cols'] = $columns;
638 $data = array(
639 'pagetitle' => $conf->get('general.title') .' - '. format_date($dayDate, false),
640 'linksToDisplay' => $linksToDisplay,
641 'cols' => $columns,
642 'day' => $dayDate->getTimestamp(),
643 'dayDate' => $dayDate,
644 'previousday' => $previousday,
645 'nextday' => $nextday,
646 );
647
648 $pluginManager->executeHooks('render_daily', $data, array('loggedin' => isLoggedIn()));
649 652
650 foreach ($data as $key => $value) { 653 foreach ($data as $key => $value) {
651 $pageBuilder->assign($key, $value); 654 $pageBuilder->assign($key, $value);