From 3eaf909b1fa8b07c6d8b23aa2c2ed3ec4e1932b7 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 21 Jun 2021 19:18:35 +0200 Subject: Rename "attr" method of Item class to "get" --- admin/index.php | 4 ++-- admin/page/index.php | 2 +- admin/page/insert.php | 6 +++--- admin/page/search.php | 2 +- admin/page/update.php | 6 +++--- admin/post/index.php | 2 +- admin/post/insert.php | 6 +++--- admin/post/search.php | 2 +- admin/post/update.php | 6 +++--- core/functions.php | 8 ++++---- core/include/feed/main.php | 4 ++-- core/include/home.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/search/main.php | 2 +- core/namespace/Application.php | 6 +++--- core/namespace/Item.php | 2 +- 19 files changed, 34 insertions(+), 34 deletions(-) diff --git a/admin/index.php b/admin/index.php index 788cee4..b3508b5 100644 --- a/admin/index.php +++ b/admin/index.php @@ -25,7 +25,7 @@ $UserCountStatement = $Database->query(sprintf($execute, User\Attribute::TABLE)) try { $LastPage = Page\Factory::build($LastPageStatement->fetchColumn()); - $LastPageUser = User\Factory::build($LastPage->attr('user')); + $LastPageUser = User\Factory::build($LastPage->get('user')); $PageItemTemplate = generatePageItemTemplate($LastPage, $LastPageUser); } @@ -35,7 +35,7 @@ catch(User\Exception $Exception){} try { $LastPost = Post\Factory::build($LastPostStatement->fetchColumn()); - $LastPostUser = User\Factory::build($LastPost->attr('user')); + $LastPostUser = User\Factory::build($LastPost->get('user')); $PostItemTemplate = generatePostItemTemplate($LastPost, $LastPostUser); } diff --git a/admin/page/index.php b/admin/page/index.php index 7c8b1a6..2fde136 100644 --- a/admin/page/index.php +++ b/admin/page/index.php @@ -34,7 +34,7 @@ $pageIDs = $Database->query(sprintf($execSQL, Page\Attribute::TABLE))->fetchAll( foreach($pageIDs as $pageID) { try { $Page = Page\Factory::build($pageID); - $User = User\Factory::build($Page->attr('user')); + $User = User\Factory::build($Page->get('user')); $ItemTemplate = generatePageItemTemplate($Page, $User); diff --git a/admin/page/insert.php b/admin/page/insert.php index 979dbd9..1f9d391 100644 --- a/admin/page/insert.php +++ b/admin/page/insert.php @@ -41,9 +41,9 @@ $userIDs = $Database->query(sprintf('SELECT id FROM %s ORDER BY fullname ASC', U foreach($userIDs->fetchAll($Database::FETCH_COLUMN) as $userID) { $User = User\Factory::build($userID); $userAttributes[] = [ - 'ID' => $User->attr('id'), - 'FULLNAME' => $User->attr('fullname'), - 'USERNAME' => $User->attr('username'), + 'ID' => $User->get('id'), + 'FULLNAME' => $User->get('fullname'), + 'USERNAME' => $User->get('username'), ]; } diff --git a/admin/page/search.php b/admin/page/search.php index eb57a7c..ba7f49a 100644 --- a/admin/page/search.php +++ b/admin/page/search.php @@ -18,7 +18,7 @@ if($search = HTTP::GET('q')) { foreach($pageIDs as $pageID) { try { $Page = Page\Factory::build($pageID); - $User = User\Factory::build($Page->attr('user')); + $User = User\Factory::build($Page->get('user')); $pages[] = generatePageItemTemplate($Page, $User); } diff --git a/admin/page/update.php b/admin/page/update.php index 8cbef7f..5e54b03 100644 --- a/admin/page/update.php +++ b/admin/page/update.php @@ -44,9 +44,9 @@ try { foreach($userIDs->fetchAll($Database::FETCH_COLUMN) as $userID) { $User = User\Factory::build($userID); $userAttributes[] = [ - 'ID' => $User->attr('id'), - 'FULLNAME' => $User->attr('fullname'), - 'USERNAME' => $User->attr('username'), + 'ID' => $User->get('id'), + 'FULLNAME' => $User->get('fullname'), + 'USERNAME' => $User->get('username'), ]; } diff --git a/admin/post/index.php b/admin/post/index.php index e18a634..bb38676 100644 --- a/admin/post/index.php +++ b/admin/post/index.php @@ -34,7 +34,7 @@ $postIDs = $Database->query(sprintf($execSQL, Post\Attribute::TABLE))->fetchAll( foreach($postIDs as $postID) { try { $Post = Post\Factory::build($postID); - $User = User\Factory::build($Post->attr('user')); + $User = User\Factory::build($Post->get('user')); $ItemTemplate = generatePostItemTemplate($Post, $User); diff --git a/admin/post/insert.php b/admin/post/insert.php index 6b1876e..b4e2542 100644 --- a/admin/post/insert.php +++ b/admin/post/insert.php @@ -41,9 +41,9 @@ $userIDs = $Database->query(sprintf('SELECT id FROM %s ORDER BY fullname ASC', U foreach($userIDs->fetchAll($Database::FETCH_COLUMN) as $userID) { $User = User\Factory::build($userID); $userAttributes[] = [ - 'ID' => $User->attr('id'), - 'FULLNAME' => $User->attr('fullname'), - 'USERNAME' => $User->attr('username'), + 'ID' => $User->get('id'), + 'FULLNAME' => $User->get('fullname'), + 'USERNAME' => $User->get('username'), ]; } diff --git a/admin/post/search.php b/admin/post/search.php index 8fe6a51..ec2391c 100644 --- a/admin/post/search.php +++ b/admin/post/search.php @@ -18,7 +18,7 @@ if($search = HTTP::GET('q')) { foreach($postIDs as $postID) { try { $Post = Post\Factory::build($postID); - $User = User\Factory::build($Post->attr('user')); + $User = User\Factory::build($Post->get('user')); $posts[] = generatePostItemTemplate($Post, $User); } diff --git a/admin/post/update.php b/admin/post/update.php index 6fb621d..e22a54a 100644 --- a/admin/post/update.php +++ b/admin/post/update.php @@ -44,9 +44,9 @@ try { foreach($userIDs->fetchAll($Database::FETCH_COLUMN) as $userID) { $User = User\Factory::build($userID); $userAttributes[] = [ - 'ID' => $User->attr('id'), - 'FULLNAME' => $User->attr('fullname'), - 'USERNAME' => $User->attr('username'), + 'ID' => $User->get('id'), + 'FULLNAME' => $User->get('fullname'), + 'USERNAME' => $User->get('username'), ]; } diff --git a/core/functions.php b/core/functions.php index f674244..31a295b 100644 --- a/core/functions.php +++ b/core/functions.php @@ -78,12 +78,12 @@ function generateItemTemplateData(Item $Item): array { $ATTR = $Item->getAttribute()->getAll(['password']); $ATTR = array_change_key_case($ATTR, CASE_UPPER); - $preparsed = parseContentTags($Item->attr('body')); + $preparsed = parseContentTags($Item->get('body')); return [ 'URL' => Application::getEntityURL($Item), 'GUID' => generatePseudoGUID($Item), - 'ARGV' => parseArguments($Item->attr('argv')), + 'ARGV' => parseArguments($Item->get('argv')), 'ATTR' => $ATTR, @@ -121,7 +121,7 @@ function generatePseudoGUID(Item $Entity) { } foreach($attr as $attribute) { - $attributes[] = $Entity->attr($attribute); + $attributes[] = $Entity->get($attribute); } return sha1(implode('', $attributes)); @@ -175,7 +175,7 @@ function parseEntityContent(Item $Item): string { $Parsedown = new Parsedown(); $Parsedown->setUrlsLinked(FALSE); - $text = parseContentTags($Item->attr('body')); + $text = parseContentTags($Item->get('body')); if(Application::get("$prefix.EMOTICONS")) { $text = parseUnicodeEmoticons($text); diff --git a/core/include/feed/main.php b/core/include/feed/main.php index 765f296..76bf23e 100644 --- a/core/include/feed/main.php +++ b/core/include/feed/main.php @@ -23,7 +23,7 @@ if(!isset($param) OR $param !== 'page') { foreach($postIDs as $postID) { try { $Post = Post\Factory::build($postID); - $User = User\Factory::build($Post->attr('user')); + $User = User\Factory::build($Post->get('user')); $ItemTemplate = Template\Factory::build('feed/item_post'); $ItemTemplate->set('POST', generateItemTemplateData($Post)); @@ -50,7 +50,7 @@ if(!isset($param) OR $param !== 'post') { foreach($pageIDs as $pageID) { try { $Page = Page\Factory::build($pageID); - $User = User\Factory::build($Page->attr('user')); + $User = User\Factory::build($Page->get('user')); $ItemTemplate = Template\Factory::build('feed/item_page'); $ItemTemplate->set('PAGE', generateItemTemplateData($Page)); diff --git a/core/include/home.php b/core/include/home.php index dfa2a36..507db7a 100644 --- a/core/include/home.php +++ b/core/include/home.php @@ -13,7 +13,7 @@ $postIDs = $Statement->fetchAll($Database::FETCH_COLUMN); foreach($postIDs as $postID) { try { $Post = Post\Factory::build($postID); - $User = User\Factory::build($Post->attr('user')); + $User = User\Factory::build($Post->get('user')); $ItemTemplate = generatePostItemTemplate($Post, $User); diff --git a/core/include/page/list.php b/core/include/page/list.php index 42e887f..ec2cd00 100644 --- a/core/include/page/list.php +++ b/core/include/page/list.php @@ -36,7 +36,7 @@ $pageIDs = $Database->query(sprintf($execSQL, Page\Attribute::TABLE))->fetchAll( foreach($pageIDs as $pageID) { try { $Page = Page\Factory::build($pageID); - $User = User\Factory::build($Page->attr('user')); + $User = User\Factory::build($Page->get('user')); $ItemTemplate = generatePageItemTemplate($Page, $User); diff --git a/core/include/page/main.php b/core/include/page/main.php index 32a2ec4..01ef40d 100644 --- a/core/include/page/main.php +++ b/core/include/page/main.php @@ -17,7 +17,7 @@ try { $Page = Page\Factory::build($param); } - $User = User\Factory::build($Page->attr('user')); + $User = User\Factory::build($Page->get('user')); $page_data = generateItemTemplateData($Page); $user_data = generateItemTemplateData($User); diff --git a/core/include/post/list.php b/core/include/post/list.php index 3fd9a44..9b2eec9 100644 --- a/core/include/post/list.php +++ b/core/include/post/list.php @@ -36,7 +36,7 @@ $postIDs = $Database->query(sprintf($execSQL, Post\Attribute::TABLE))->fetchAll( foreach($postIDs as $postID) { try { $Post = Post\Factory::build($postID); - $User = User\Factory::build($Post->attr('user')); + $User = User\Factory::build($Post->get('user')); $ItemTemplate = generatePostItemTemplate($Post, $User); diff --git a/core/include/post/main.php b/core/include/post/main.php index 537873c..57cc402 100644 --- a/core/include/post/main.php +++ b/core/include/post/main.php @@ -17,7 +17,7 @@ try { $Post = Post\Factory::build($param); } - $User = User\Factory::build($Post->attr('user')); + $User = User\Factory::build($Post->get('user')); $post_data = generateItemTemplateData($Post); $user_data = generateItemTemplateData($User); diff --git a/core/include/search/main.php b/core/include/search/main.php index 95cffda..8a02790 100644 --- a/core/include/search/main.php +++ b/core/include/search/main.php @@ -40,7 +40,7 @@ if(isset($postIDs) AND !empty($postIDs)) { foreach($postIDs as $postID) { try { $Post = Post\Factory::build($postID); - $User = User\Factory::build($Post->attr('user')); + $User = User\Factory::build($Post->get('user')); $posts[] = generatePostItemTemplate($Post, $User); } diff --git a/core/namespace/Application.php b/core/namespace/Application.php index 4414665..f9a8196 100644 --- a/core/namespace/Application.php +++ b/core/namespace/Application.php @@ -146,13 +146,13 @@ class Application { switch($class = get_class($Entity)) { case 'Page\Item': $attr = self::get('PAGE.SLUG_URLS') ? 'slug' : 'id'; - return self::getPageURL($Entity->attr($attr).'/'); + return self::getPageURL($Entity->get($attr).'/'); case 'Post\Item': $attr = self::get('POST.SLUG_URLS') ? 'slug' : 'id'; - return self::getPostURL($Entity->attr($attr).'/'); + return self::getPostURL($Entity->get($attr).'/'); case 'User\Item': $attr = self::get('USER.SLUG_URLS') ? 'slug' : 'id'; - return self::getUserURL($Entity->attr($attr).'/'); + return self::getUserURL($Entity->get($attr).'/'); default: $error = 'Unknown URL handler for %s entities.'; throw new Exception(sprintf($error, $class)); diff --git a/core/namespace/Item.php b/core/namespace/Item.php index 74b5688..453a3e6 100644 --- a/core/namespace/Item.php +++ b/core/namespace/Item.php @@ -32,7 +32,7 @@ abstract class Item implements ItemInterface { #=============================================================================== # Return attribute by name (short hand wrapper) #=============================================================================== - public function attr($attribute) { + public function get($attribute) { return $this->Attribute->get($attribute); } -- cgit v1.2.3