From 01d4727f939c0b9530fe5fc976b7accb9e078db1 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 20 Jul 2021 00:27:46 +0200 Subject: Rename and reorganize several "get count" methods --- core/include/category/main.php | 6 +++--- core/include/user/main.php | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'core/include') diff --git a/core/include/category/main.php b/core/include/category/main.php index 2e84aa1..46ffa75 100644 --- a/core/include/category/main.php +++ b/core/include/category/main.php @@ -74,7 +74,7 @@ foreach($child_categories as $ChildCategory) { $site_size = Application::get('POST.LIST_SIZE'); $site_sort = Application::get('POST.LIST_SORT'); -$count = $PostRepository->getCountByCategory($Category); +$count = $CategoryRepository->getNumberOfPosts($Category); $lastSite = ceil($count / $site_size); $currentSite = HTTP::GET('site') ?? 1; @@ -106,8 +106,8 @@ $CategoryTemplate = Template\Factory::build('category/main'); $CategoryTemplate->set('CATEGORY', $category_data); $CategoryTemplate->set('CATEGORIES', $category_list ?? []); $CategoryTemplate->set('COUNT', [ - 'POST' => $PostRepository->getCountByCategory($Category), - 'CHILDREN' => $CategoryRepository->getChildrenCount($Category) + 'POST' => $CategoryRepository->getNumberOfPosts($Category), + 'CHILDREN' => $CategoryRepository->getNumberOfChildren($Category) ]); $CategoryTemplate->set('PAGINATION', [ 'THIS' => $currentSite, diff --git a/core/include/user/main.php b/core/include/user/main.php index c0cb20d..ef27351 100644 --- a/core/include/user/main.php +++ b/core/include/user/main.php @@ -2,8 +2,6 @@ #=============================================================================== # Get repositories #=============================================================================== -$PageRepository = Application::getRepository('Page'); -$PostRepository = Application::getRepository('Post'); $UserRepository = Application::getRepository('User'); #=============================================================================== @@ -54,8 +52,8 @@ if($NextUser = $UserRepository->findNext($User)) { $UserTemplate = Template\Factory::build('user/main'); $UserTemplate->set('USER', $user_data); $UserTemplate->set('COUNT', [ - 'POST' => $PostRepository->getCountByUser($User), - 'PAGE' => $PageRepository->getCountByUser($User) + 'PAGE' => $UserRepository->getNumberOfPages($User), + 'POST' => $UserRepository->getNumberOfPosts($User) ]); $MainTemplate = Template\Factory::build('main'); -- cgit v1.2.3