aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-02-29 17:09:44 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-02-29 17:09:44 +0100
commitd344da59fdd2f818f53c6b4aab4ded4a9336851c (patch)
tree09f2183665f652f196fc094892c44bf17d881a73 /lib
parent9711f02db75006d622d75142d46c3c8d714c957f (diff)
HTTPS search tree: simplify code
https://github.com/FreshRSS/FreshRSS/issues/1083
Diffstat (limited to 'lib')
-rw-r--r--lib/SimplePie/SimplePie/Sanitize.php58
1 files changed, 26 insertions, 32 deletions
diff --git a/lib/SimplePie/SimplePie/Sanitize.php b/lib/SimplePie/SimplePie/Sanitize.php
index b37aeec3d..f656909a0 100644
--- a/lib/SimplePie/SimplePie/Sanitize.php
+++ b/lib/SimplePie/SimplePie/Sanitize.php
@@ -263,23 +263,20 @@ class SimplePie_Sanitize
{
$domain = trim($domain, ". \t\n\r\0\x0B");
$segments = array_reverse(explode('.', $domain));
- if (count($segments) > 0)
- {
- $node =& $this->https_domains;
- foreach ($segments as $segment)
- {//Build a tree
- if ($node === true)
- {
- break;
- }
- if (!isset($node[$segment]))
- {
- $node[$segment] = array();
- }
- $node =& $node[$segment];
+ $node =& $this->https_domains;
+ foreach ($segments as $segment)
+ {//Build a tree
+ if ($node === true)
+ {
+ break;
+ }
+ if (!isset($node[$segment]))
+ {
+ $node[$segment] = array();
}
- $node = true;
+ $node =& $node[$segment];
}
+ $node = true;
}
}
@@ -291,23 +288,20 @@ class SimplePie_Sanitize
{
$domain = trim($domain, '. ');
$segments = array_reverse(explode('.', $domain));
- if (count($segments) > 0)
- {
- $node =& $this->https_domains;
- foreach ($segments as $segment)
- {//Explore the tree
- if ($node === true)
- {
- return true;
- }
- if (isset($node[$segment]))
- {
- $node =& $node[$segment];
- }
- else
- {
- break;
- }
+ $node =& $this->https_domains;
+ foreach ($segments as $segment)
+ {//Explore the tree
+ if ($node === true)
+ {
+ return true;
+ }
+ if (isset($node[$segment]))
+ {
+ $node =& $node[$segment];
+ }
+ else
+ {
+ break;
}
}
return false;