aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/simplepie/simplepie/library/SimplePie/IRI.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/simplepie/simplepie/library/SimplePie/IRI.php')
-rw-r--r--vendor/simplepie/simplepie/library/SimplePie/IRI.php151
1 files changed, 65 insertions, 86 deletions
diff --git a/vendor/simplepie/simplepie/library/SimplePie/IRI.php b/vendor/simplepie/simplepie/library/SimplePie/IRI.php
index 2b3fbaf07..ffba232b1 100644
--- a/vendor/simplepie/simplepie/library/SimplePie/IRI.php
+++ b/vendor/simplepie/simplepie/library/SimplePie/IRI.php
@@ -211,10 +211,8 @@ class SimplePie_IRI
{
return $this->normalization[$this->scheme][$name];
}
- else
- {
- return $return;
- }
+
+ return $return;
}
/**
@@ -225,14 +223,7 @@ class SimplePie_IRI
*/
public function __isset($name)
{
- if (method_exists($this, 'get_' . $name) || isset($this->$name))
- {
- return true;
- }
- else
- {
- return false;
- }
+ return method_exists($this, 'get_' . $name) || isset($this->$name);
}
/**
@@ -356,10 +347,8 @@ class SimplePie_IRI
$target->scheme_normalization();
return $target;
}
- else
- {
- return false;
- }
+
+ return false;
}
}
@@ -396,11 +385,9 @@ class SimplePie_IRI
}
return $match;
}
- else
- {
- // This can occur when a paragraph is accidentally parsed as a URI
- return false;
- }
+
+ // This can occur when a paragraph is accidentally parsed as a URI
+ return false;
}
/**
@@ -804,7 +791,7 @@ class SimplePie_IRI
public function set_iri($iri, $clear_cache = false)
{
static $cache;
- if ($clear_cache)
+ if ($clear_cache)
{
$cache = null;
return;
@@ -830,30 +817,28 @@ class SimplePie_IRI
$return) = $cache[$iri];
return $return;
}
- else
- {
- $parsed = $this->parse_iri((string) $iri);
- if (!$parsed)
- {
- return false;
- }
- $return = $this->set_scheme($parsed['scheme'])
- && $this->set_authority($parsed['authority'])
- && $this->set_path($parsed['path'])
- && $this->set_query($parsed['query'])
- && $this->set_fragment($parsed['fragment']);
-
- $cache[$iri] = array($this->scheme,
- $this->iuserinfo,
- $this->ihost,
- $this->port,
- $this->ipath,
- $this->iquery,
- $this->ifragment,
- $return);
- return $return;
+ $parsed = $this->parse_iri((string) $iri);
+ if (!$parsed)
+ {
+ return false;
}
+
+ $return = $this->set_scheme($parsed['scheme'])
+ && $this->set_authority($parsed['authority'])
+ && $this->set_path($parsed['path'])
+ && $this->set_query($parsed['query'])
+ && $this->set_fragment($parsed['fragment']);
+
+ $cache[$iri] = array($this->scheme,
+ $this->iuserinfo,
+ $this->ihost,
+ $this->port,
+ $this->ipath,
+ $this->iquery,
+ $this->ifragment,
+ $return);
+ return $return;
}
/**
@@ -915,42 +900,40 @@ class SimplePie_IRI
return $return;
}
+
+ $remaining = $authority;
+ if (($iuserinfo_end = strrpos($remaining, '@')) !== false)
+ {
+ $iuserinfo = substr($remaining, 0, $iuserinfo_end);
+ $remaining = substr($remaining, $iuserinfo_end + 1);
+ }
else
{
- $remaining = $authority;
- if (($iuserinfo_end = strrpos($remaining, '@')) !== false)
- {
- $iuserinfo = substr($remaining, 0, $iuserinfo_end);
- $remaining = substr($remaining, $iuserinfo_end + 1);
- }
- else
- {
- $iuserinfo = null;
- }
- if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false)
- {
- if (($port = substr($remaining, $port_start + 1)) === false)
- {
- $port = null;
- }
- $remaining = substr($remaining, 0, $port_start);
- }
- else
+ $iuserinfo = null;
+ }
+ if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false)
+ {
+ if (($port = substr($remaining, $port_start + 1)) === false)
{
$port = null;
}
+ $remaining = substr($remaining, 0, $port_start);
+ }
+ else
+ {
+ $port = null;
+ }
- $return = $this->set_userinfo($iuserinfo) &&
- $this->set_host($remaining) &&
- $this->set_port($port);
+ $return = $this->set_userinfo($iuserinfo) &&
+ $this->set_host($remaining) &&
+ $this->set_port($port);
- $cache[$authority] = array($this->iuserinfo,
- $this->ihost,
- $this->port,
- $return);
+ $cache[$authority] = array($this->iuserinfo,
+ $this->ihost,
+ $this->port,
+ $return);
- return $return;
- }
+ return $return;
}
/**
@@ -1050,11 +1033,9 @@ class SimplePie_IRI
$this->scheme_normalization();
return true;
}
- else
- {
- $this->port = null;
- return false;
- }
+
+ $this->port = null;
+ return false;
}
/**
@@ -1066,7 +1047,7 @@ class SimplePie_IRI
public function set_path($ipath, $clear_cache = false)
{
static $cache;
- if ($clear_cache)
+ if ($clear_cache)
{
$cache = null;
return;
@@ -1185,7 +1166,7 @@ class SimplePie_IRI
{
$iri .= $this->ipath;
}
- elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
+ elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
{
$iri .= $this->normalization[$this->scheme]['ipath'];
}
@@ -1229,16 +1210,14 @@ class SimplePie_IRI
{
$iauthority .= $this->ihost;
}
- if ($this->port !== null)
+ if ($this->port !== null && $this->port !== 0)
{
$iauthority .= ':' . $this->port;
}
return $iauthority;
}
- else
- {
- return null;
- }
+
+ return null;
}
/**
@@ -1251,7 +1230,7 @@ class SimplePie_IRI
$iauthority = $this->get_iauthority();
if (is_string($iauthority))
return $this->to_uri($iauthority);
- else
- return $iauthority;
+
+ return $iauthority;
}
}