mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
VKAPI: Make code match the code style
This commit is contained in:
parent
a578dca41f
commit
771595ef9c
10 changed files with 312 additions and 366 deletions
|
@ -1,6 +1,5 @@
|
|||
<?php declare(strict_types=1);
|
||||
namespace openvk\VKAPI\Handlers;
|
||||
use openvk\Web\Models\Entities\User;
|
||||
use openvk\Web\Models\Repositories\Users as UsersRepo;
|
||||
|
||||
final class Friends extends VKAPIRequestHandler
|
||||
|
@ -70,7 +69,6 @@ final class Friends extends VKAPIRequestHandler
|
|||
$this->requireUser();
|
||||
|
||||
$users = new UsersRepo;
|
||||
|
||||
$user = $users->get(intval($user_id));
|
||||
|
||||
if(is_null($user)) {
|
||||
|
@ -83,20 +81,16 @@ final class Friends extends VKAPIRequestHandler
|
|||
case 0:
|
||||
$user->toggleSubscription($this->getUser());
|
||||
return 1;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$user->toggleSubscription($this->getUser());
|
||||
return 2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
return 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,11 +106,9 @@ final class Friends extends VKAPIRequestHandler
|
|||
case 3:
|
||||
$user->toggleSubscription($this->getUser());
|
||||
return 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
fail(15, "Access denied: No friend or friend request found.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,22 +125,6 @@ final class Friends extends VKAPIRequestHandler
|
|||
for($i=0; $i < sizeof($friends); $i++) {
|
||||
$friend = $users->get(intval($friends[$i]));
|
||||
|
||||
$status = 0;
|
||||
switch ($friend->getSubscriptionStatus($this->getUser())) {
|
||||
case 3:
|
||||
case 0:
|
||||
$status = $friend->getSubscriptionStatus($this->getUser());
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$status = 2;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$status = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
$response[] = (object)[
|
||||
"friend_status" => $friend->getSubscriptionStatus($this->getUser()),
|
||||
"user_id" => $friend->getId()
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
<?php declare(strict_types=1);
|
||||
namespace openvk\VKAPI\Handlers;
|
||||
use openvk\Web\Models\Entities\User;
|
||||
use openvk\Web\Models\Entities\Clubs;
|
||||
use openvk\Web\Models\Repositories\Clubs as ClubsRepo;
|
||||
use openvk\Web\Models\Repositories\Users as UsersRepo;
|
||||
use openvk\Web\Models\Entities\Post;
|
||||
use openvk\Web\Models\Entities\Postable;
|
||||
use openvk\Web\Models\Repositories\Posts as PostsRepo;
|
||||
|
||||
final class Groups extends VKAPIRequestHandler
|
||||
{
|
||||
|
@ -15,35 +10,34 @@ final class Groups extends VKAPIRequestHandler
|
|||
$this->requireUser();
|
||||
|
||||
if($user_id == 0) {
|
||||
foreach($this->getUser()->getClubs($offset+1) as $club) {
|
||||
foreach($this->getUser()->getClubs($offset+1) as $club)
|
||||
$clbs[] = $club;
|
||||
}
|
||||
$clbsCount = $this->getUser()->getClubCount();
|
||||
} else {
|
||||
$users = new UsersRepo;
|
||||
$user = $users->get($user_id);
|
||||
if (is_null($user)) {
|
||||
|
||||
if(is_null($user))
|
||||
$this->fail(15, "Access denied");
|
||||
}
|
||||
foreach($user->getClubs($offset+1) as $club) {
|
||||
|
||||
foreach($user->getClubs($offset+1) as $club)
|
||||
$clbs[] = $club;
|
||||
}
|
||||
|
||||
$clbsCount = $user->getClubCount();
|
||||
}
|
||||
|
||||
$rClubs;
|
||||
|
||||
$ic = sizeof($clbs);
|
||||
|
||||
if(sizeof($clbs) > $count) $ic = $count;
|
||||
if(sizeof($clbs) > $count)
|
||||
$ic = $count;
|
||||
|
||||
if(!empty($clbs)) {
|
||||
$clbs = array_slice($clbs, $offset * $count);
|
||||
|
||||
for($i=0; $i < $ic; $i++) {
|
||||
$usr = $clbs[$i];
|
||||
if(is_null($usr))
|
||||
{
|
||||
if(is_null($usr)) {
|
||||
$rClubs[$i] = (object)[
|
||||
"id" => $clbs[$i],
|
||||
"name" => "DELETED",
|
||||
|
@ -64,34 +58,34 @@ final class Groups extends VKAPIRequestHandler
|
|||
|
||||
foreach($flds as $field) {
|
||||
switch($field) {
|
||||
case 'verified':
|
||||
case "verified":
|
||||
$rClubs[$i]->verified = intval($usr->isVerified());
|
||||
break;
|
||||
case 'has_photo':
|
||||
case "has_photo":
|
||||
$rClubs[$i]->has_photo = is_null($usr->getAvatarPhoto()) ? 0 : 1;
|
||||
break;
|
||||
case 'photo_max_orig':
|
||||
case "photo_max_orig":
|
||||
$rClubs[$i]->photo_max_orig = $usr->getAvatarURL();
|
||||
break;
|
||||
case 'photo_max':
|
||||
case "photo_max":
|
||||
$rClubs[$i]->photo_max = $usr->getAvatarURL("original"); // ORIGINAL ANDREI CHINITEL 🥵🥵🥵🥵
|
||||
break;
|
||||
case 'photo_50':
|
||||
case "photo_50":
|
||||
$rClubs[$i]->photo_50 = $usr->getAvatarURL();
|
||||
break;
|
||||
case 'photo_100':
|
||||
case "photo_100":
|
||||
$rClubs[$i]->photo_100 = $usr->getAvatarURL("tiny");
|
||||
break;
|
||||
case 'photo_200':
|
||||
case "photo_200":
|
||||
$rClubs[$i]->photo_200 = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
case 'photo_200_orig':
|
||||
case "photo_200_orig":
|
||||
$rClubs[$i]->photo_200_orig = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
case 'photo_400_orig':
|
||||
case "photo_400_orig":
|
||||
$rClubs[$i]->photo_400_orig = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
case 'members_count':
|
||||
case "members_count":
|
||||
$rClubs[$i]->members_count = $usr->getFollowersCount();
|
||||
break;
|
||||
}
|
||||
|
@ -131,8 +125,7 @@ final class Groups extends VKAPIRequestHandler
|
|||
$this->fail(100, "ты ошибся чутка, у айди группы убери минус");
|
||||
|
||||
$clb = $clubs->get((int) $clbs[$i]);
|
||||
if(is_null($clb))
|
||||
{
|
||||
if(is_null($clb)) {
|
||||
$response[$i] = (object)[
|
||||
"id" => intval($clbs[$i]),
|
||||
"name" => "DELETED",
|
||||
|
@ -156,39 +149,40 @@ final class Groups extends VKAPIRequestHandler
|
|||
|
||||
foreach($flds as $field) {
|
||||
switch($field) {
|
||||
case 'verified':
|
||||
case "verified":
|
||||
$response[$i]->verified = intval($clb->isVerified());
|
||||
break;
|
||||
case 'has_photo':
|
||||
case "has_photo":
|
||||
$response[$i]->has_photo = is_null($clb->getAvatarPhoto()) ? 0 : 1;
|
||||
break;
|
||||
case 'photo_max_orig':
|
||||
case "photo_max_orig":
|
||||
$response[$i]->photo_max_orig = $clb->getAvatarURL();
|
||||
break;
|
||||
case 'photo_max':
|
||||
case "photo_max":
|
||||
$response[$i]->photo_max = $clb->getAvatarURL();
|
||||
break;
|
||||
case 'members_count':
|
||||
case "members_count":
|
||||
$response[$i]->members_count = $clb->getFollowersCount();
|
||||
break;
|
||||
case 'site':
|
||||
case "site":
|
||||
$response[$i]->site = $clb->getWebsite();
|
||||
break;
|
||||
case 'description':
|
||||
case "description":
|
||||
$response[$i]->desctiption = $clb->getDescription();
|
||||
break;
|
||||
case 'contacts':
|
||||
case "contacts":
|
||||
$contacts;
|
||||
$contactTmp = $clb->getManagers(1, true);
|
||||
foreach($contactTmp as $contact) {
|
||||
|
||||
foreach($contactTmp as $contact)
|
||||
$contacts[] = array(
|
||||
'user_id' => $contact->getUser()->getId(),
|
||||
'desc' => $contact->getComment()
|
||||
"user_id" => $contact->getUser()->getId(),
|
||||
"desc" => $contact->getComment()
|
||||
);
|
||||
}
|
||||
|
||||
$response[$i]->contacts = $contacts;
|
||||
break;
|
||||
case 'can_post':
|
||||
case "can_post":
|
||||
if(!is_null($this->getUser()))
|
||||
if($clb->canBeModifiedBy($this->getUser()))
|
||||
$response[$i]->can_post = true;
|
||||
|
|
|
@ -10,18 +10,18 @@ final class Likes extends VKAPIRequestHandler
|
|||
$this->requireUser();
|
||||
|
||||
switch($type) {
|
||||
case 'post':
|
||||
case "post":
|
||||
$post = (new PostsRepo)->getPostById($owner_id, $item_id);
|
||||
if (is_null($post)) $this->fail(100, 'One of the parameters specified was missing or invalid: object not found');
|
||||
if(is_null($post))
|
||||
$this->fail(100, "One of the parameters specified was missing or invalid: object not found");
|
||||
|
||||
$post->setLike(true, $this->getUser());
|
||||
|
||||
return (object) [
|
||||
"likes" => $post->getLikesCount()
|
||||
];
|
||||
break;
|
||||
default:
|
||||
$this->fail(100, 'One of the parameters specified was missing or invalid: incorrect type');
|
||||
break;
|
||||
$this->fail(100, "One of the parameters specified was missing or invalid: incorrect type");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,18 +30,17 @@ final class Likes extends VKAPIRequestHandler
|
|||
$this->requireUser();
|
||||
|
||||
switch($type) {
|
||||
case 'post':
|
||||
case "post":
|
||||
$post = (new PostsRepo)->getPostById($owner_id, $item_id);
|
||||
if (is_null($post)) $this->fail(100, 'One of the parameters specified was missing or invalid: object not found');
|
||||
if (is_null($post))
|
||||
$this->fail(100, "One of the parameters specified was missing or invalid: object not found");
|
||||
|
||||
$post->setLike(false, $this->getUser());
|
||||
return (object) [
|
||||
"likes" => $post->getLikesCount()
|
||||
];
|
||||
break;
|
||||
default:
|
||||
$this->fail(100, 'One of the parameters specified was missing or invalid: incorrect type');
|
||||
break;
|
||||
$this->fail(100, "One of the parameters specified was missing or invalid: incorrect type");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,25 +49,25 @@ final class Likes extends VKAPIRequestHandler
|
|||
$this->requireUser();
|
||||
|
||||
switch($type) {
|
||||
case 'post':
|
||||
case "post":
|
||||
$user = (new UsersRepo)->get($user_id);
|
||||
if (is_null($user)) return (object)[
|
||||
if (is_null($user))
|
||||
return (object) [
|
||||
"liked" => 0,
|
||||
"copied" => 0,
|
||||
"sex" => 0
|
||||
];
|
||||
|
||||
$post = (new PostsRepo)->getPostById($owner_id, $item_id);
|
||||
if (is_null($post)) $this->fail(100, 'One of the parameters specified was missing or invalid: object not found');
|
||||
if (is_null($post))
|
||||
$this->fail(100, "One of the parameters specified was missing or invalid: object not found");
|
||||
|
||||
return (object) [
|
||||
"liked" => (int) $post->hasLikeFrom($user),
|
||||
"copied" => 0 # TODO: handle this
|
||||
];
|
||||
break;
|
||||
default:
|
||||
$this->fail(100, 'One of the parameters specified was missing or invalid: incorrect type');
|
||||
break;
|
||||
$this->fail(100, "One of the parameters specified was missing or invalid: incorrect type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,9 +123,8 @@ final class Messages extends VKAPIRequestHandler
|
|||
$items = [];
|
||||
foreach($ids as $id) {
|
||||
$message = $msgs->get((int) $id);
|
||||
if(!$message || $message->getSender()->getId() !== $this->getUser()->getId() && $message->getRecipient()->getId() !== $this->getUser()->getId()) {
|
||||
if(!$message || $message->getSender()->getId() !== $this->getUser()->getId() && $message->getRecipient()->getId() !== $this->getUser()->getId())
|
||||
$items[$id] = 0;
|
||||
}
|
||||
|
||||
$message->delete();
|
||||
$items[$id] = 1;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
<?php declare(strict_types=1);
|
||||
namespace openvk\VKAPI\Handlers;
|
||||
use openvk\Web\Models\Entities\User;
|
||||
use openvk\Web\Models\Entities\Post;
|
||||
use openvk\Web\Models\Entities\Postable;
|
||||
use Chandler\Database\DatabaseConnection;
|
||||
use openvk\Web\Models\Repositories\Posts as PostsRepo;
|
||||
use openvk\VKAPI\Handlers\Wall;
|
||||
|
@ -13,7 +10,8 @@ final class Newsfeed extends VKAPIRequestHandler
|
|||
{
|
||||
$this->requireUser();
|
||||
|
||||
if($offset != 0) $start_from = $offset;
|
||||
if($offset != 0)
|
||||
$start_from = $offset;
|
||||
|
||||
$id = $this->getUser()->getId();
|
||||
$subs = DatabaseConnection::i()
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
namespace openvk\VKAPI\Handlers;
|
||||
use openvk\Web\Models\Repositories\{Users as UsersRepo, Clubs as ClubsRepo, Posts as PostsRepo};
|
||||
|
||||
|
||||
final class Ovk extends VKAPIRequestHandler
|
||||
{
|
||||
function version(): string
|
||||
|
|
|
@ -7,27 +7,25 @@ final class Users extends VKAPIRequestHandler
|
|||
{
|
||||
function get(string $user_ids = "0", string $fields = "", int $offset = 0, int $count = 100, User $authuser = null /* костыль(( */): array
|
||||
{
|
||||
# $this->requireUser();
|
||||
|
||||
if($authuser == NULL) $authuser = $this->getUser();
|
||||
|
||||
$users = new UsersRepo;
|
||||
if($user_ids == "0")
|
||||
$user_ids = (string) $authuser->getId();
|
||||
|
||||
$usrs = explode(',', $user_ids);
|
||||
$usrs = explode(',', $user_ids);','
|
||||
$response;
|
||||
|
||||
$ic = sizeof($usrs);
|
||||
|
||||
if(sizeof($usrs) > $count) $ic = $count;
|
||||
if(sizeof($usrs) > $count)
|
||||
$ic = $count;
|
||||
|
||||
$usrs = array_slice($usrs, $offset * $count);
|
||||
|
||||
for($i=0; $i < $ic; $i++) {
|
||||
$usr = $users->get((int) $usrs[$i]);
|
||||
if(is_null($usr))
|
||||
{
|
||||
if(is_null($usr)) {
|
||||
$response[$i] = (object)[
|
||||
"id" => $usrs[$i],
|
||||
"first_name" => "DELETED",
|
||||
|
@ -49,50 +47,51 @@ final class Users extends VKAPIRequestHandler
|
|||
|
||||
foreach($flds as $field) {
|
||||
switch($field) {
|
||||
case 'verified':
|
||||
case "verified":
|
||||
$response[$i]->verified = intval($usr->isVerified());
|
||||
break;
|
||||
case 'sex':
|
||||
case "sex":
|
||||
$response[$i]->sex = $usr->isFemale() ? 1 : 2;
|
||||
break;
|
||||
case 'has_photo':
|
||||
case "has_photo":
|
||||
$response[$i]->has_photo = is_null($usr->getAvatarPhoto()) ? 0 : 1;
|
||||
break;
|
||||
case 'photo_max_orig':
|
||||
case "photo_max_orig":
|
||||
$response[$i]->photo_max_orig = $usr->getAvatarURL();
|
||||
break;
|
||||
case 'photo_max':
|
||||
case "photo_max":
|
||||
$response[$i]->photo_max = $usr->getAvatarURL("original");
|
||||
break;
|
||||
case 'photo_50':
|
||||
case "photo_50":
|
||||
$response[$i]->photo_50 = $usr->getAvatarURL();
|
||||
break;
|
||||
case 'photo_100':
|
||||
case "photo_100":
|
||||
$response[$i]->photo_100 = $usr->getAvatarURL("tiny");
|
||||
break;
|
||||
case 'photo_200':
|
||||
case "photo_200":
|
||||
$response[$i]->photo_200 = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
case 'photo_200_orig': # вообще не ебу к чему эта строка ну пусть будет кек
|
||||
case "photo_200_orig": # вообще не ебу к чему эта строка ну пусть будет кек
|
||||
$response[$i]->photo_200_orig = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
case 'photo_400_orig':
|
||||
case "photo_400_orig":
|
||||
$response[$i]->photo_400_orig = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
|
||||
# Она хочет быть выебанной видя матан
|
||||
# Покайфу когда ты Виет а вокруг лишь дискриминант
|
||||
case 'status':
|
||||
case "status":
|
||||
if($usr->getStatus() != NULL)
|
||||
$response[$i]->status = $usr->getStatus();
|
||||
break;
|
||||
case 'screen_name':
|
||||
case "screen_name":
|
||||
if($usr->getShortCode() != NULL)
|
||||
$response[$i]->screen_name = $usr->getShortCode();
|
||||
break;
|
||||
case 'friend_status':
|
||||
case "friend_status":
|
||||
switch($usr->getSubscriptionStatus($authuser)) {
|
||||
case 3:
|
||||
# NOTICE falling through
|
||||
case 0:
|
||||
$response[$i]->friend_status = $usr->getSubscriptionStatus($authuser);
|
||||
break;
|
||||
|
@ -104,50 +103,43 @@ final class Users extends VKAPIRequestHandler
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case 'last_seen':
|
||||
if ($usr->onlineStatus() == 0) {
|
||||
case "last_seen":
|
||||
if ($usr->onlineStatus() == 0)
|
||||
$response[$i]->last_seen = (object) [
|
||||
"platform" => 1,
|
||||
"time" => $usr->getOnline()->timestamp()
|
||||
];
|
||||
}
|
||||
case 'music':
|
||||
case "music":
|
||||
$response[$i]->music = $usr->getFavoriteMusic();
|
||||
break;
|
||||
case 'movies':
|
||||
case "movies":
|
||||
$response[$i]->movies = $usr->getFavoriteFilms();
|
||||
break;
|
||||
case 'tv':
|
||||
case "tv":
|
||||
$response[$i]->tv = $usr->getFavoriteShows();
|
||||
break;
|
||||
case 'books':
|
||||
case "books":
|
||||
$response[$i]->books = $usr->getFavoriteBooks();
|
||||
break;
|
||||
case 'city':
|
||||
case "city":
|
||||
$response[$i]->city = $usr->getCity();
|
||||
break;
|
||||
case 'interests':
|
||||
case "interests":
|
||||
$response[$i]->interests = $usr->getInterests();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($usr->getOnline()->timestamp() + 300 > time()) {
|
||||
if($usr->getOnline()->timestamp() + 300 > time())
|
||||
$response[$i]->online = 1;
|
||||
}else{
|
||||
else
|
||||
$response[$i]->online = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/* private function getUsersById(string $user_ids, string $fields = "", int $offset = 0, int $count = PHP_INT_MAX){
|
||||
|
||||
} */
|
||||
|
||||
function getFollowers(int $user_id, string $fields = "", int $offset = 0, int $count = 100): object
|
||||
{
|
||||
$offset++;
|
||||
|
@ -157,15 +149,13 @@ final class Users extends VKAPIRequestHandler
|
|||
|
||||
$this->requireUser();
|
||||
|
||||
foreach ($users->get($user_id)->getFollowers($offset, $count) as $follower) {
|
||||
foreach($users->get($user_id)->getFollowers($offset, $count) as $follower)
|
||||
$followers[] = $follower->getId();
|
||||
}
|
||||
|
||||
$response = $followers;
|
||||
|
||||
if (!is_null($fields)) {
|
||||
if(!is_null($fields))
|
||||
$response = $this->get(implode(',', $followers), $fields, 0, $count);
|
||||
}
|
||||
|
||||
return (object) [
|
||||
"count" => $users->get($user_id)->getFollowersCount(),
|
||||
|
@ -173,16 +163,15 @@ final class Users extends VKAPIRequestHandler
|
|||
];
|
||||
}
|
||||
|
||||
function search(string $q, string $fields = '', int $offset = 0, int $count = 100)
|
||||
function search(string $q, string $fields = "", int $offset = 0, int $count = 100)
|
||||
{
|
||||
$users = new UsersRepo;
|
||||
|
||||
$array = [];
|
||||
$find = $users->find($q);
|
||||
|
||||
foreach ($find as $user) {
|
||||
foreach ($find as $user)
|
||||
$array[] = $user->getId();
|
||||
}
|
||||
|
||||
return (object) [
|
||||
"count" => $find->size(),
|
||||
|
|
|
@ -6,7 +6,6 @@ use openvk\Web\Models\Repositories\Users as UsersRepo;
|
|||
use openvk\Web\Models\Entities\Club;
|
||||
use openvk\Web\Models\Repositories\Clubs as ClubsRepo;
|
||||
use openvk\Web\Models\Entities\Post;
|
||||
use openvk\Web\Models\Entities\Postable;
|
||||
use openvk\Web\Models\Repositories\Posts as PostsRepo;
|
||||
|
||||
final class Wall extends VKAPIRequestHandler
|
||||
|
@ -83,8 +82,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
$attachments = NULL; # free attachments so it will not clone everythingg
|
||||
}
|
||||
|
||||
if($extended == 1)
|
||||
{
|
||||
if($extended == 1) {
|
||||
$profiles = array_unique($profiles);
|
||||
$groups = array_unique($groups);
|
||||
|
||||
|
@ -127,8 +125,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
"profiles" => (array)$profilesFormatted,
|
||||
"groups" => (array)$groupsFormatted
|
||||
];
|
||||
}
|
||||
else
|
||||
} else
|
||||
return (object) [
|
||||
"count" => $count,
|
||||
"items" => (array)$items
|
||||
|
@ -137,26 +134,23 @@ final class Wall extends VKAPIRequestHandler
|
|||
|
||||
function getById(string $posts, int $extended = 0, string $fields = "", User $user = NULL)
|
||||
{
|
||||
if($user == NULL) $user = $this->getUser(); # костыли костыли крылышки
|
||||
if($user == NULL)
|
||||
$user = $this->getUser(); # костыли костыли крылышки
|
||||
|
||||
$items = [];
|
||||
$profiles = [];
|
||||
$groups = [];
|
||||
# $count = $posts->getPostCountOnUserWall((int) $owner_id);
|
||||
|
||||
$psts = explode(",", $posts);
|
||||
$psts = explode(',', $posts);
|
||||
|
||||
foreach($psts as $pst)
|
||||
{
|
||||
foreach($psts as $pst) {
|
||||
$id = explode("_", $pst);
|
||||
$post = (new PostsRepo)->getPostById(intval($id[0]), intval($id[1]));
|
||||
if($post) {
|
||||
$from_id = get_class($post->getOwner()) == "openvk\Web\Models\Entities\Club" ? $post->getOwner()->getId() * (-1) : $post->getOwner()->getId();
|
||||
$attachments;
|
||||
foreach($post->getChildren() as $attachment)
|
||||
{
|
||||
if($attachment instanceof \openvk\Web\Models\Entities\Photo)
|
||||
{
|
||||
foreach($post->getChildren() as $attachment) {
|
||||
if($attachment instanceof \openvk\Web\Models\Entities\Photo) {
|
||||
$attachments[] = [
|
||||
"type" => "photo",
|
||||
"photo" => [
|
||||
|
@ -248,8 +242,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
}
|
||||
}
|
||||
|
||||
if($extended == 1)
|
||||
{
|
||||
if($extended == 1) {
|
||||
$profiles = array_unique($profiles);
|
||||
$groups = array_unique($groups);
|
||||
|
||||
|
@ -291,8 +284,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
"profiles" => (array)$profilesFormatted,
|
||||
"groups" => (array)$groupsFormatted
|
||||
];
|
||||
}
|
||||
else
|
||||
} else
|
||||
return (object) [
|
||||
"items" => (array)$items
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue