Skip to content
Permalink
Browse files

Merge pull request #111 from kaldor/fix-deprecated-use-of-each

Replacing use of deprecated `each()` with `array_keys()` and `reset()`, props @oppiansteve
  • Loading branch information
radgeek committed Dec 30, 2019
2 parents 67b6c5a + e3a7081 commit 90f994f8dc9a8ac74a3892bf5bada30b8f7a0df2
Showing with 12 additions and 10 deletions.
  1. +5 −4 feedwordpresssyndicationpage.class.php
  2. +7 −6 syndicatedpost.class.php
@@ -146,10 +146,11 @@ function updates_requested () {
if (!is_array($targets)) :
$targets = array($targets);
endif;

$first = each($targets);
if (!is_numeric($first['key'])) : // URLs in keys
$targets = array_keys($targets);

$targets_keys = array_keys($targets);
$first_key = reset($targets_keys);
if (!is_numeric($first_key)) : // URLs in keys
$targets = $targets_keys;
endif;
$update_set = $targets;
endif;
@@ -2199,13 +2199,14 @@ function author_id ($unfamiliar_author = 'create') {
// or forbidden names.

$author = NULL;
while (is_null($author) and ($candidate = each($candidates))) :
if (!is_null($candidate['value'])
and (strlen(trim($candidate['value'])) > 0)
and !in_array(strtolower(trim($candidate['value'])), $forbidden)) :
$author = $candidate['value'];
foreach ($candidates as $candidate) {
if (!is_null($candidate)
and (strlen(trim($candidate)) > 0)
and !in_array(strtolower(trim($candidate)), $forbidden)) :
$author = $candidate;
break;
endif;
endwhile;
}

$email = (isset($a['email']) ? $a['email'] : NULL);
$authorUrl = (isset($a['uri']) ? $a['uri'] : NULL);

0 comments on commit 90f994f

Please sign in to comment.
You can’t perform that action at this time.