diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2018-05-12 13:35:11 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2018-05-12 13:35:11 +0200 |
commit | 4b8b2e3eb139518ea1abd5875135bb39a9f0c187 (patch) | |
tree | a522f7fc813dcb628be43518776ae96439f070e6 | |
parent | 8838490665c1bc7f682a4853be18c2b758328fb0 (diff) | |
download | aur-4b8b2e3eb139518ea1abd5875135bb39a9f0c187.tar.gz aur-4b8b2e3eb139518ea1abd5875135bb39a9f0c187.tar.xz |
Stop using each()
The each() function has been deprecated as of PHP 7.2.0. Use foreach
loops instead.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rw-r--r-- | web/html/rss.php | 2 | ||||
-rw-r--r-- | web/html/voters.php | 4 | ||||
-rw-r--r-- | web/template/account_edit_form.php | 4 | ||||
-rw-r--r-- | web/template/account_search_results.php | 12 | ||||
-rw-r--r-- | web/template/pkg_comments.php | 4 | ||||
-rw-r--r-- | web/template/pkg_details.php | 12 | ||||
-rw-r--r-- | web/template/pkg_search_results.php | 4 | ||||
-rw-r--r-- | web/template/pkgbase_details.php | 4 | ||||
-rw-r--r-- | web/template/pkgreq_results.php | 4 | ||||
-rw-r--r-- | web/template/tu_last_votes_list.php | 4 | ||||
-rw-r--r-- | web/template/tu_list.php | 4 |
11 files changed, 29 insertions, 29 deletions
diff --git a/web/html/rss.php b/web/html/rss.php index 8585d81d..d6e7825a 100644 --- a/web/html/rss.php +++ b/web/html/rss.php @@ -40,7 +40,7 @@ $rss->image = $image; #Get the latest packages and add items for them $packages = latest_pkgs(20); -while (list($indx, $row) = each($packages)) { +foreach ($packages as $indx => $row) { $item = new FeedItem(); $item->title = $row["Name"]; $item->link = "{$protocol}://{$host}" . get_pkg_uri($row["Name"]); diff --git a/web/html/voters.php b/web/html/voters.php index 997186d8..bacbcfc8 100644 --- a/web/html/voters.php +++ b/web/html/voters.php @@ -16,14 +16,14 @@ if (has_credential(CRED_PKGBASE_LIST_VOTERS)): <h2>Votes for <a href="<?= get_pkgbase_uri($pkgbase_name); ?>"><?= $pkgbase_name ?></a></h2> <div class="boxbody"> <ul> - <?php while (list($indx, $row) = each($votes)): ?> + <?php foreach ($votes as $indx => $row): ?> <li> <a href="<?= get_user_uri($row['Username']); ?>"><?= htmlspecialchars($row['Username']) ?></a> <?php if ($row["VoteTS"] > 0): ?> (<?= date("Y-m-d H:i", intval($row["VoteTS"])) ?>) <?php endif; ?> </li> - <?php endwhile; ?> + <?php endforeach; ?> </ul> </div> </div> diff --git a/web/template/account_edit_form.php b/web/template/account_edit_form.php index 833e74a8..6eff81bd 100644 --- a/web/template/account_edit_form.php +++ b/web/template/account_edit_form.php @@ -122,7 +122,7 @@ <select name="L" id="id_language"> <?php reset($SUPPORTED_LANGS); - while (list($code, $lang) = each($SUPPORTED_LANGS)) { + foreach ($SUPPORTED_LANGS as $code => $lang) { if ($L == $code) { print "<option value=\"".$code."\" selected=\"selected\"> ".$lang."</option>"."\n"; } else { @@ -137,7 +137,7 @@ <select name="TZ" id="id_timezone"> <?php $timezones = generate_timezone_list(); - while (list($key, $val) = each($timezones)) { + foreach ($timezones as $key => $val) { if ($TZ == $key) { print "<option value=\"".$key."\" selected=\"selected\"> ".$val."</option>\n"; } else { diff --git a/web/template/account_search_results.php b/web/template/account_search_results.php index 43f2d1d6..81cd8185 100644 --- a/web/template/account_search_results.php +++ b/web/template/account_search_results.php @@ -18,7 +18,7 @@ else: </thead> <?php $i = 0; - while (list($indx, $row) = each($userinfo)): + foreach ($userinfo as $indx => $row): if ($i % 2): $c = "even"; else: @@ -51,7 +51,7 @@ else: </tr> <?php $i++; - endwhile; + endforeach; ?> </table> @@ -64,10 +64,10 @@ else: <input type="hidden" name="O" value="<?= ($OFFSET-$HITS_PER_PAGE) ?>" /> <?php reset($search_vars); - while (list($k, $ind) = each($search_vars)): + foreach ($search_vars as $k => $ind): ?> <input type="hidden" name="<?= $ind ?>" value="<?= ${$ind} ?>" /> - <?php endwhile; ?> + <?php endforeach; ?> <input type="submit" class="button" value="<-- <?= __("Less") ?>" /> </fieldset> </form> @@ -79,10 +79,10 @@ else: <input type="hidden" name="O" value="<?= ($OFFSET+$HITS_PER_PAGE) ?>" /> <?php reset($search_vars); - while (list($k, $ind) = each($search_vars)): + foreach ($search_vars as $k => $ind): ?> <input type="hidden" name="<?= $ind ?>" value="<?= ${$ind} ?>" /> - <?php endwhile; ?> + <?php endforeach; ?> <input type="submit" class="button" value="<?= __("More") ?> -->" /> </fieldset> </form> diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php index 7d9bedcc..3e5e5cc5 100644 --- a/web/template/pkg_comments.php +++ b/web/template/pkg_comments.php @@ -15,7 +15,7 @@ if (!isset($count)) { <?php endif; ?> </h3> - <?php while (list($indx, $row) = each($comments)): ?> + <?php foreach ($comments as $indx => $row): ?> <?php $date_fmtd = date('Y-m-d H:i', $row['CommentTS']); if ($row['UserName']) { @@ -113,7 +113,7 @@ if (!isset($count)) { <?php endif; ?> </div> </div> - <?php endwhile; ?> + <?php endforeach; ?> <?php if ($count > 10 && !isset($_GET['comments']) && !isset($pinned)): ?> <h3> diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index 8a934173..650c245c 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -276,9 +276,9 @@ endif; <h3><?= __('Dependencies') . " (" . count($deps) . ")"?></h3> <?php if (count($deps) > 0): ?> <ul id="pkgdepslist"> -<?php while (list($k, $darr) = each($deps)): ?> +<?php foreach ($deps as $k => $darr): ?> <li><?= pkg_depend_link($darr[0], $darr[1], $darr[2], $darr[3], $darr[4], $darr[5]); ?></li> -<?php endwhile; ?> +<?php endforeach; ?> </ul> <?php endif; ?> </div> @@ -286,9 +286,9 @@ endif; <h3><?= __('Required by') . " (" . count($requiredby) . ")"?></h3> <?php if (count($requiredby) > 0): ?> <ul id="pkgreqslist"> - <?php while (list($k, $darr) = each($requiredby)): ?> + <?php foreach ($requiredby as $k => $darr): ?> <li><?= pkg_requiredby_link($darr[0], $darr[1], $darr[2], $darr[3], $row['Name']); ?></li> - <?php endwhile; ?> + <?php endforeach; ?> </ul> <?php endif; ?> </div> @@ -298,9 +298,9 @@ endif; <?php if (count($sources) > 0): ?> <div> <ul id="pkgsrcslist"> - <?php while (list($k, $src) = each($sources)): ?> + <?php foreach ($sources as $k => $src): ?> <li><?= pkg_source_link($src[0], $src[1], urlencode($row['BaseName'])) ?></li> - <?php endwhile; ?> + <?php endforeach; ?> </ul> </div> <?php endif; ?> diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index d7512b1e..7c5ad03b 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -66,7 +66,7 @@ if (!$result): ?> </thead> <tbody> - <?php while (list($indx, $row) = each($searchresults)): ?> + <?php foreach ($searchresults as $indx => $row): ?> <tr class="<?= ($indx % 2 == 0) ? 'odd' : 'even' ?>"> <?php if ($SID && $show_headers): ?> <td><input type="checkbox" name="IDs[<?= $row["PackageBaseID"] ?>]" value="1" /></td> @@ -100,7 +100,7 @@ if (!$result): ?> <?php endif; ?> </td> </tr> - <?php endwhile; ?> + <?php endforeach; ?> </tbody> </table> diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php index de55da03..8a6e2b44 100644 --- a/web/template/pkgbase_details.php +++ b/web/template/pkgbase_details.php @@ -126,10 +126,10 @@ endif; <?php if (count($pkgs) > 0): ?> <ul> <?php - while (list($k, $pkg) = each($pkgs)): + foreach ($pkgs as $k => $pkg): ?> <li><a href="<?= htmlspecialchars(get_pkg_uri($pkg), ENT_QUOTES); ?>" title="<?= __('View packages details for').' '. htmlspecialchars($pkg) ?>"><?= htmlspecialchars($pkg) ?></a></li> - <?php endwhile; ?> + <?php endforeach; ?> </ul> <?php endif; ?> </div> diff --git a/web/template/pkgreq_results.php b/web/template/pkgreq_results.php index e02cff3e..1a565c3e 100644 --- a/web/template/pkgreq_results.php +++ b/web/template/pkgreq_results.php @@ -36,7 +36,7 @@ </thead> <tbody> - <?php while (list($indx, $row) = each($results)): ?> + <?php foreach ($results as $indx => $row): ?> <?php $idle_time = config_get_int('options', 'request_idle_time'); $due = ($row['Open'] && time() - intval($row['RequestTS']) > $idle_time); @@ -100,7 +100,7 @@ <td><?= __("unknown") ?></td> <?php endif; ?> </tr> - <?php endwhile; ?> + <?php endforeach; ?> </tbody> </table> diff --git a/web/template/tu_last_votes_list.php b/web/template/tu_last_votes_list.php index 5cff248c..6e852581 100644 --- a/web/template/tu_last_votes_list.php +++ b/web/template/tu_last_votes_list.php @@ -11,7 +11,7 @@ <tbody> <?php if (empty($result)): ?> <tr><td align="center" colspan="0"><?= __("No results found.") ?></td></tr> - <?php else: while (list($indx, $row) = each($result)): + <?php else: foreach ($result as $indx => $row): if ($indx % 2): $c = "even"; else: @@ -28,7 +28,7 @@ </td> </tr> <?php - endwhile; + endforeach; endif; ?> </tbody> diff --git a/web/template/tu_list.php b/web/template/tu_list.php index b7253f98..204c89ea 100644 --- a/web/template/tu_list.php +++ b/web/template/tu_list.php @@ -26,7 +26,7 @@ </thead> <tbody> - <?php while (list($indx, $row) = each($result)): ?> + <?php foreach ($result as $indx => $row): ?> <?php if ($indx % 2) { $c = "even"; @@ -60,7 +60,7 @@ <?php endif; ?> </td> </tr> - <?php endwhile; ?> + <?php endforeach; ?> </tbody> </table> |