X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fnetwork.php;h=23e03d03b0b724e133359050cdfff3fee13c383b;hb=9cd9ad647d0a81d29ee3091b99776ee63a27e622;hp=d89ad6c4d31aff9e38d948624dba16ab41d899b0;hpb=11c3e4aefc7135d28900a9a0e9b35631573e1ac1;p=friendica.git diff --git a/mod/network.php b/mod/network.php index d89ad6c4d3..23e03d03b0 100644 --- a/mod/network.php +++ b/mod/network.php @@ -48,8 +48,6 @@ function network_init(App $a) return; } - Hook::add('head', __FILE__, 'network_infinite_scroll_head'); - $is_a_date_query = false; $group_id = (($a->argc > 1 && is_numeric($a->argv[1])) ? intval($a->argv[1]) : 0); @@ -287,10 +285,17 @@ function network_content(App $a, $update = 0, $parent = 0) $arr = ['query' => DI::args()->getQueryString()]; Hook::callAll('network_content_init', $arr); + if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll') && ($_GET['mode'] ?? '') != 'minimal') { + $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl'); + $o = Renderer::replaceMacros($tpl, ['$reload_uri' => DI::args()->getQueryString()]); + } else { + $o = ''; + } + if (!empty($_GET['file'])) { - $o = networkFlatView($a, $update); + $o .= networkFlatView($a, $update); } else { - $o = networkThreadedView($a, $update, $parent); + $o .= networkThreadedView($a, $update, $parent); } if (!$update && ($o === '')) { @@ -599,7 +604,7 @@ function networkThreadedView(App $a, $update, $parent) if ($update) { if (!empty($parent)) { // Load only a single thread - $conditionFields['id'] = $parent; + $conditionFields['parent'] = $parent; } elseif ($order === 'post') { // Only load new toplevel posts $conditionFields['unseen'] = true; @@ -635,9 +640,7 @@ function network_display_post($a, $pager, $mark_all, $update, $ordering, $items) $parents_str = implode(', ', $parents_arr); } - $query_string = DI::args()->getQueryString(); - - $pager->setQueryString($query_string); + $pager->setQueryString(DI::args()->getQueryString()); // We aren't going to try and figure out at the item, group, and page // level which items you've seen and which you haven't. If you're looking @@ -734,34 +737,3 @@ function network_tabs(App $a) // --- end item filter tabs } - -/** - * Network hook into the HTML head to enable infinite scroll. - * - * Since the HTML head is built after the module content has been generated, we need to retrieve the base query string - * of the page to make the correct asynchronous call. This is obtained through the Pager that was instantiated in - * networkThreadedView or networkFlatView. - * - * @param App $a - * @param string $htmlhead The head tag HTML string - * @throws \Friendica\Network\HTTPException\InternalServerErrorException - * @global Pager $pager - */ -function network_infinite_scroll_head(App $a, &$htmlhead) -{ - /// @TODO this will have to be converted to a static property of the converted Module\Network class - /** - * @var $pager Pager - */ - global $pager; - - if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll') - && ($_GET['mode'] ?? '') != 'minimal' - ) { - $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl'); - $htmlhead .= Renderer::replaceMacros($tpl, [ - '$pageno' => $pager->getPage(), - '$reload_uri' => $pager->getBaseQueryString() - ]); - } -}