From 819b374401b54c6506ec8905aa8dc653c3202548 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Wed, 27 Jul 2016 21:07:54 +0200 Subject: [PATCH] notifications.php - move some template creation to the end of the file --- mod/notifications.php | 61 +++++++++---------------------------------- 1 file changed, 13 insertions(+), 48 deletions(-) diff --git a/mod/notifications.php b/mod/notifications.php index ae27de864c..fa2c78cf67 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -78,11 +78,13 @@ function notifications_content(&$a) { if( (($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) { nav_set_selected('introductions'); + if(($a->argc > 2) && ($a->argv[2] == 'all')) $sql_extra = ''; else $sql_extra = " AND `ignore` = 0 "; + $notif_header = t('Notifications'); $notif_tpl = get_markup_template('notifications.tpl'); $notif_ignored_lnk .= '' @@ -231,18 +233,9 @@ function notifications_content(&$a) { else info( t('No introductions.') . EOL); - $o .= replace_macros($notif_tpl, array( - '$notif_header' => t('Notifications'), - '$tabs' => $tabs, - '$notif_ignored_lnk' => $notif_ignored_lnk, - '$notif_content' => $notif_content, - )); - - $o .= paginate($a); - return $o; - } else if (($a->argc > 1) && ($a->argv[1] == 'network')) { + $notif_header = t('Network Notifications'); $notif_tpl = get_markup_template('notifications.tpl'); $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, @@ -260,8 +253,6 @@ function notifications_content(&$a) { $tpl_item_comments = get_markup_template('notifications_comments_item.tpl'); $tpl_item_posts = get_markup_template('notifications_posts_item.tpl'); - $notif_content = array(); - if ($r) { foreach ($r as $it) { @@ -322,15 +313,9 @@ function notifications_content(&$a) { $notif_nocontent = t('No more network notifications.'); } - $o .= replace_macros($notif_tpl, array( - '$notif_header' => t('Network Notifications'), - '$tabs' => $tabs, - '$notif_content' => $notif_content, - '$notif_nocontent' => $notif_nocontent, - )); - } else if (($a->argc > 1) && ($a->argv[1] == 'system')) { + $notif_header = t('System Notifications'); $notif_tpl = get_markup_template('notifications.tpl'); $not_tpl = get_markup_template('notify.tpl'); @@ -353,15 +338,9 @@ function notifications_content(&$a) { $notif_nocontent = t('No more system notifications.'); } - $o .= replace_macros($notif_tpl, array( - '$notif_header' => t('System Notifications'), - '$tabs' => $tabs, - '$notif_content' => $notif_content, - '$notif_nocontent' => $notif_nocontent, - )); - } else if (($a->argc > 1) && ($a->argv[1] == 'personal')) { + $notif_header = t('Personal Notifications'); $notif_tpl = get_markup_template('notifications.tpl'); $myurl = $a->get_baseurl(true) . '/profile/'. $a->user['nickname']; @@ -391,8 +370,6 @@ function notifications_content(&$a) { $tpl_item_comments = get_markup_template('notifications_comments_item.tpl'); $tpl_item_posts = get_markup_template('notifications_posts_item.tpl'); - $notif_content = array(); - if (count($r) > 0) { foreach ($r as $it) { @@ -453,20 +430,9 @@ function notifications_content(&$a) { $notif_nocontent = t('No more personal notifications.'); } - $o .= replace_macros($notif_tpl, array( - '$notif_header' => t('Personal Notifications'), - '$tabs' => $tabs, - '$notif_content' => $notif_content, - '$notif_nocontent' => $notif_nocontent, - )); - - - - - - } else if (($a->argc > 1) && ($a->argv[1] == 'home')) { + $notif_header = t('Home Notifications'); $notif_tpl = get_markup_template('notifications.tpl'); $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, @@ -483,8 +449,6 @@ function notifications_content(&$a) { $tpl_item_friends = get_markup_template('notifications_friends_item.tpl'); $tpl_item_comments = get_markup_template('notifications_comments_item.tpl'); - $notif_content = array(); - if (count($r) > 0) { foreach ($r as $it) { @@ -539,14 +503,15 @@ function notifications_content(&$a) { $notif_nocontent = t('No more home notifications.'); } - $o .= replace_macros($notif_tpl, array( - '$notif_header' => t('Home Notifications'), - '$tabs' => $tabs, - '$notif_content' => $notif_content, - '$notif_nocontent' => $notif_nocontent, - )); } + $o .= replace_macros($notif_tpl, array( + '$notif_header' => $notif_header, + '$tabs' => $tabs, + '$notif_content' => $notif_content, + '$notif_nocontent' => $notif_nocontent, + '$notif_ignored_lnk' => $notif_ignored_lnk, + )); $o .= paginate($a); return $o; }