From c0dfe40d1b5aac8c9747661b65a89713e2f4847b Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Wed, 11 Sep 2019 19:12:19 +0200 Subject: [PATCH] Methods for API --- bl-kernel/user.class.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/bl-kernel/user.class.php b/bl-kernel/user.class.php index 275abab7..75a6b746 100644 --- a/bl-kernel/user.class.php +++ b/bl-kernel/user.class.php @@ -49,6 +49,11 @@ class User { return $this->getValue('username'); } + public function description() + { + return $this->getValue('description'); + } + public function nickname() { return $this->getValue('nickname'); @@ -149,4 +154,28 @@ class User { return DOMAIN_UPLOADS_PROFILES.$filename; } + public function json($returnsArray=false) + { + $tmp['username'] = $this->username(); + $tmp['firstName'] = $this->firstName(); + $tmp['lastName'] = $this->lastName(); + $tmp['nickname'] = $this->nickname(); + $tmp['description'] = $this->description(); + $tmp['twitter'] = $this->twitter(); + $tmp['facebook'] = $this->facebook(); + $tmp['codepen'] = $this->codepen(); + $tmp['instagram'] = $this->instagram(); + $tmp['github'] = $this->github(); + $tmp['gitlab'] = $this->gitlab(); + $tmp['linkedin'] = $this->linkedin(); + $tmp['mastodon'] = $this->mastodon(); + $tmp['profilePicture'] = $this->profilePicture(); + + if ($returnsArray) { + return $tmp; + } + + return json_encode($tmp); + } + } \ No newline at end of file