Skip to content

Commit

Permalink
Patch array objects for PHP 8.1 (#999)
Browse files Browse the repository at this point in the history
* Patch array objects for PHP 8

* Reswitch getting counts

* Update WallPresenter.php

* Update WallPresenter.php

* Fix
  • Loading branch information
tretdm authored Oct 25, 2023
1 parent e3b9fb9 commit 49a7047
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions Web/Presenters/WallPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function renderWall(int $user, bool $embedded = false): void
$this->template->paginatorConf = (object) [
"count" => $this->template->count,
"page" => (int) ($_GET["p"] ?? 1),
"amount" => sizeof($this->template->posts),
"amount" => $this->template->posts->getRowCount(),
"perPage" => OPENVK_DEFAULT_PER_PAGE,
];

Expand Down Expand Up @@ -152,9 +152,9 @@ function renderFeed(): void
->where("deleted", 0)
->order("created DESC");
$this->template->paginatorConf = (object) [
"count" => sizeof($posts),
"count" => $posts->getRowCount(),
"page" => (int) ($_GET["p"] ?? 1),
"amount" => sizeof($posts->page((int) ($_GET["p"] ?? 1), $perPage)),
"amount" => $posts->page((int) ($_GET["p"] ?? 1), $perPage)->getRowCount(),
"perPage" => $perPage,
];
$this->template->posts = [];
Expand Down Expand Up @@ -182,7 +182,7 @@ function renderGlobalFeed(): void
$this->template->paginatorConf = (object) [
"count" => $count,
"page" => (int) ($_GET["p"] ?? 1),
"amount" => sizeof($posts),
"amount" => $posts->getRowCount(),
"perPage" => $pPage,
];
foreach($posts as $post)
Expand Down Expand Up @@ -332,7 +332,7 @@ function renderMakePost(int $wall): void
foreach($photos as $photo)
$post->attach($photo);

if(sizeof($videos) > 0)
if($videos->count() > 0)
foreach($videos as $vid)
$post->attach($vid);

Expand Down
2 changes: 1 addition & 1 deletion Web/Presenters/templates/Admin/Logs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{/block}

{block content}
{var $amount = sizeof($logs)}
{var $amount = $logs->getRowCount()}

<style>
del, ins { text-decoration: none; color: #000; }
Expand Down
4 changes: 2 additions & 2 deletions Web/Presenters/templates/Search/Index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
{include "../components/paginator.xml", conf => (object) [
"page" => $page,
"count" => $count,
"amount" => sizeof($data),
"amount" => $data->getRowCount(),
"perPage" => $perPage ?? OPENVK_DEFAULT_PER_PAGE,
"atBottom" => false,
]}
Expand Down Expand Up @@ -356,4 +356,4 @@
<input class="button" type="button" id="dnt" value="{_reset}" onclick="resetSearch()">
</div>

{/block}
{/block}

0 comments on commit 49a7047

Please sign in to comment.