From 70f366ce1d102e4712af2408e6dcf5432b1926c2 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 21 Jun 2021 02:03:17 +0200 Subject: Use getEntityURL method of Application class This commit replaces all calls to "$Item->getURL()" with calls to the previously added "getEntityURL" method of the "Application" class. --- core/functions.php | 2 +- core/include/page/list.php | 2 +- core/include/page/main.php | 2 +- core/include/post/list.php | 2 +- core/include/post/main.php | 2 +- core/include/user/list.php | 2 +- core/include/user/main.php | 4 ++-- core/namespace/Item.php | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/functions.php b/core/functions.php index 517be51..519e5f1 100644 --- a/core/functions.php +++ b/core/functions.php @@ -79,7 +79,7 @@ function generateItemTemplateData(Item $Item): array { $ATTR = array_change_key_case($ATTR, CASE_UPPER); return [ - 'URL' => $Item->getURL(), + 'URL' => Application::getEntityURL($Item), 'GUID' => $Item->getGUID(), 'ARGV' => $Item->getArguments(), diff --git a/core/include/page/list.php b/core/include/page/list.php index 0165116..42e887f 100644 --- a/core/include/page/list.php +++ b/core/include/page/list.php @@ -27,7 +27,7 @@ if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { if(Application::get('PAGE.SINGLE_REDIRECT') === TRUE AND $count === '1') { $Statement = $Database->query(sprintf('SELECT id FROM %s LIMIT 1', Page\Attribute::TABLE)); $Page = Page\Factory::build($Statement->fetchColumn()); - HTTP::redirect($Page->getURL()); + HTTP::redirect(Application::getEntityURL($Page)); } $execSQL = "SELECT id FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}"; diff --git a/core/include/page/main.php b/core/include/page/main.php index 955bb35..32a2ec4 100644 --- a/core/include/page/main.php +++ b/core/include/page/main.php @@ -70,7 +70,7 @@ catch(Page\Exception $Exception) { $Page = Page\Factory::build($param); } - HTTP::redirect($Page->getURL()); + HTTP::redirect(Application::getEntityURL($Page)); } catch(Page\Exception $Exception) { diff --git a/core/include/post/list.php b/core/include/post/list.php index 0f5ef1f..3fd9a44 100644 --- a/core/include/post/list.php +++ b/core/include/post/list.php @@ -27,7 +27,7 @@ if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { if(Application::get('POST.SINGLE_REDIRECT') === TRUE AND $count === '1') { $Statement = $Database->query(sprintf('SELECT id FROM %s LIMIT 1', Post\Attribute::TABLE)); $Post = Post\Factory::build($Statement->fetchColumn()); - HTTP::redirect($Post->getURL()); + HTTP::redirect(Application::getEntityURL($Post)); } $execSQL = "SELECT id FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}"; diff --git a/core/include/post/main.php b/core/include/post/main.php index 8c65740..537873c 100644 --- a/core/include/post/main.php +++ b/core/include/post/main.php @@ -70,7 +70,7 @@ catch(Post\Exception $Exception) { $Post = Post\Factory::build($param); } - HTTP::redirect($Post->getURL()); + HTTP::redirect(Application::getEntityURL($Post)); } catch(Post\Exception $Exception) { diff --git a/core/include/user/list.php b/core/include/user/list.php index afc8179..4cba8f0 100644 --- a/core/include/user/list.php +++ b/core/include/user/list.php @@ -27,7 +27,7 @@ if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { if(Application::get('USER.SINGLE_REDIRECT') === TRUE AND $count === '1') { $Statement = $Database->query(sprintf('SELECT id FROM %s LIMIT 1', User\Attribute::TABLE)); $User = User\Factory::build($Statement->fetchColumn()); - HTTP::redirect($User->getURL()); + HTTP::redirect(Application::getEntityURL($User)); } $execSQL = "SELECT id FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}"; diff --git a/core/include/user/main.php b/core/include/user/main.php index 80969da..3b8b25a 100644 --- a/core/include/user/main.php +++ b/core/include/user/main.php @@ -50,7 +50,7 @@ try { $MainTemplate->set('HEAD', [ 'NAME' => $user_data['ATTR']['FULLNAME'], 'DESC' => description($user_data['BODY']['HTML'](), Application::get('USER.DESCRIPTION_SIZE')), - 'PERM' => $User->getURL(), + 'PERM' => $user_data['URL'], 'OG_IMAGES' => $User->getFiles() ]); @@ -72,7 +72,7 @@ catch(User\Exception $Exception) { $User = User\Factory::build($param); } - HTTP::redirect($User->getURL()); + HTTP::redirect(Application::getEntityURL($User)); } catch(User\Exception $Exception) { diff --git a/core/namespace/Item.php b/core/namespace/Item.php index 02de382..f674a60 100644 --- a/core/namespace/Item.php +++ b/core/namespace/Item.php @@ -62,7 +62,7 @@ abstract class Item implements ItemInterface { try { $Item = $namespace::build($matches[2]); - return $Item->getURL(); + return Application::getEntityURL($Item); } catch(Exception $Exception) { return '{undefined}'; } -- cgit v1.2.3