equal
deleted
inserted
replaced
3 * SimplePie |
3 * SimplePie |
4 * |
4 * |
5 * A PHP-Based RSS and Atom Feed Framework. |
5 * A PHP-Based RSS and Atom Feed Framework. |
6 * Takes the hard work out of managing a complete RSS/Atom solution. |
6 * Takes the hard work out of managing a complete RSS/Atom solution. |
7 * |
7 * |
8 * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
8 * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors |
9 * All rights reserved. |
9 * All rights reserved. |
10 * |
10 * |
11 * Redistribution and use in source and binary forms, with or without modification, are |
11 * Redistribution and use in source and binary forms, with or without modification, are |
12 * permitted provided that the following conditions are met: |
12 * permitted provided that the following conditions are met: |
13 * |
13 * |
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
32 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
32 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
33 * POSSIBILITY OF SUCH DAMAGE. |
33 * POSSIBILITY OF SUCH DAMAGE. |
34 * |
34 * |
35 * @package SimplePie |
35 * @package SimplePie |
36 * @version 1.3.1 |
36 * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue |
37 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 * @author Ryan Parman |
37 * @author Ryan Parman |
39 * @author Geoffrey Sneddon |
38 * @author Sam Sneddon |
40 * @author Ryan McCue |
39 * @author Ryan McCue |
41 * @link http://simplepie.org/ SimplePie |
40 * @link http://simplepie.org/ SimplePie |
42 * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
41 * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
43 */ |
42 */ |
44 |
43 |
52 * @license http://www.opensource.org/licenses/bsd-license.php |
51 * @license http://www.opensource.org/licenses/bsd-license.php |
53 * @link http://pear.php.net/package/Net_IPv6 |
52 * @link http://pear.php.net/package/Net_IPv6 |
54 * @author Alexander Merz <alexander.merz@web.de> |
53 * @author Alexander Merz <alexander.merz@web.de> |
55 * @author elfrink at introweb dot nl |
54 * @author elfrink at introweb dot nl |
56 * @author Josh Peck <jmp at joshpeck dot org> |
55 * @author Josh Peck <jmp at joshpeck dot org> |
57 * @author Geoffrey Sneddon <geoffers@gmail.com> |
56 * @author Sam Sneddon <geoffers@gmail.com> |
58 */ |
57 */ |
59 class SimplePie_Net_IPv6 |
58 class SimplePie_Net_IPv6 |
60 { |
59 { |
61 /** |
60 /** |
62 * Uncompresses an IPv6 address |
61 * Uncompresses an IPv6 address |
172 |
171 |
173 if ($ip_parts[1] !== '') |
172 if ($ip_parts[1] !== '') |
174 { |
173 { |
175 return implode(':', $ip_parts); |
174 return implode(':', $ip_parts); |
176 } |
175 } |
177 else |
176 |
178 { |
177 return $ip_parts[0]; |
179 return $ip_parts[0]; |
|
180 } |
|
181 } |
178 } |
182 |
179 |
183 /** |
180 /** |
184 * Splits an IPv6 address into the IPv6 and IPv4 representation parts |
181 * Splits an IPv6 address into the IPv6 and IPv4 representation parts |
185 * |
182 * |
199 $pos = strrpos($ip, ':'); |
196 $pos = strrpos($ip, ':'); |
200 $ipv6_part = substr($ip, 0, $pos); |
197 $ipv6_part = substr($ip, 0, $pos); |
201 $ipv4_part = substr($ip, $pos + 1); |
198 $ipv4_part = substr($ip, $pos + 1); |
202 return array($ipv6_part, $ipv4_part); |
199 return array($ipv6_part, $ipv4_part); |
203 } |
200 } |
204 else |
201 |
205 { |
202 return array($ip, ''); |
206 return array($ip, ''); |
|
207 } |
|
208 } |
203 } |
209 |
204 |
210 /** |
205 /** |
211 * Checks an IPv6 address |
206 * Checks an IPv6 address |
212 * |
207 * |
252 return false; |
247 return false; |
253 } |
248 } |
254 } |
249 } |
255 return true; |
250 return true; |
256 } |
251 } |
257 else |
252 |
258 { |
253 return false; |
259 return false; |
|
260 } |
|
261 } |
254 } |
262 |
255 |
263 /** |
256 /** |
264 * Checks if the given IP is a valid IPv6 address |
257 * Checks if the given IP is a valid IPv6 address |
265 * |
258 * |