Skip to content

Commit fbc7c3c

Browse files
committed
fix: php warnings
1 parent a74e977 commit fbc7c3c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/index.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,10 @@ function downloadBatch(array $urls) {
663663
}
664664
$[end]$
665665

666+
$max_pages = 1;
667+
$page_start_offset = 0;
668+
$pages = [];
669+
666670
// local path exists
667671
if ($path_is_dir) {
668672
$[if `process.env.DOWNLOAD_COUNTER === "true"`]$
@@ -766,7 +770,7 @@ function downloadBatch(array $urls) {
766770
if (isset($meta->description)) { // escape meta->description
767771
$meta->description = htmlspecialchars($meta->description, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
768772
}
769-
if ($meta?->hidden === true) {
773+
if (isset($meta->hidden) && $meta->hidden === true) {
770774
continue;
771775
}
772776
}
@@ -848,6 +852,7 @@ function downloadBatch(array $urls) {
848852

849853
// readme
850854
$[if `process.env.README_RENDER === "true"`]$
855+
$readme = null;
851856
// check if readme exists
852857
foreach (explode(';', "${{`process.env.README_NAME`}}$") as $readme_name) {
853858
foreach ($sorted_files as $file) {
@@ -1414,7 +1419,7 @@ function toggletheme() {
14141419
14151420
<?php
14161421
$now = new DateTime();
1417-
foreach ($sorted as $file) {
1422+
foreach ($sorted ?? [] as $file) {
14181423
$fileDate = new DateTime($file->modified_date);
14191424
$diff = $now->diff($fileDate)->days;
14201425
?>
@@ -1452,16 +1457,18 @@ function toggletheme() {
14521457
<?php } ?>
14531458
<?php
14541459
if ($file->meta !== null) {
1455-
if ($file->meta->description !== null) {
1460+
if (isset($file->meta->description)) {
14561461
?>
14571462
<span class="text-body-secondary"><?= $file->meta->description ?></span>
14581463
<?php
14591464
}
1460-
foreach ($file->meta->labels as $lbl) {
1461-
$l = explode(":", $lbl, 2);
1465+
if (isset($file->meta->labels) && is_array($file->meta->labels)) {
1466+
foreach ($file->meta->labels as $lbl) {
1467+
$l = explode(":", $lbl, 2);
14621468
?>
1463-
<span class="badge bg-<?= $l[0] ?>"><?= $l[1] ?></span>
1469+
<span class="badge bg-<?= $l[0] ?>"><?= $l[1] ?></span>
14641470
<?php
1471+
}
14651472
}
14661473
// per-file password protection via .dbmeta.json was removed in favor of folder-level .access.json
14671474
}

0 commit comments

Comments
 (0)