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" --- 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 +- 10 files changed, 16 insertions(+), 16 deletions(-) (limited to 'core') 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