Index: trunk/phase3/includes/IP.php |
— | — | @@ -34,16 +34,16 @@ |
35 | 35 | * @param $ip IP address. |
36 | 36 | * @return string |
37 | 37 | */ |
38 | | - public function isIPAddress( $ip ) { |
| 38 | + public static function isIPAddress( $ip ) { |
39 | 39 | if ( !$ip ) return false; |
40 | 40 | return preg_match( '/^' . IP_ADDRESS_STRING . '$/', $ip); |
41 | 41 | } |
42 | 42 | |
43 | | - public function isIPv6( $ip ) { |
| 43 | + public static function isIPv6( $ip ) { |
44 | 44 | return preg_match( '/^' . RE_IPV6_ADD . '(\/' . RE_IPV6_PREFIX . '|)$/', $ip); |
45 | 45 | } |
46 | 46 | |
47 | | - public function isIPv4( $ip ) { |
| 47 | + public static function isIPv4( $ip ) { |
48 | 48 | return preg_match( '/^' . RE_IP_ADD . '(\/' . RE_IP_PREFIX . '|)$/', $ip); |
49 | 49 | } |
50 | 50 | |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | * @param $ip quad-dotted IP address. |
56 | 56 | * @return string |
57 | 57 | */ |
58 | | - public function IPv4toIPv6( $ip ) { |
| 58 | + public static function IPv4toIPv6( $ip ) { |
59 | 59 | if ( !$ip ) return null; |
60 | 60 | // Convert only if needed |
61 | 61 | if ( self::isIPv6( $ip ) ) return $ip; |
— | — | @@ -80,7 +80,7 @@ |
81 | 81 | * @param $ip octet ipv6 IP address. |
82 | 82 | * @return string |
83 | 83 | */ |
84 | | - public function toUnsigned6( $ip ) { |
| 84 | + public static function toUnsigned6( $ip ) { |
85 | 85 | if ( !$ip ) return null; |
86 | 86 | $ip = explode(':', self::sanitizeIP( $ip ) ); |
87 | 87 | $r_ip = ''; |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | * @param $ip octet ipv6 IP address. |
97 | 97 | * @return string |
98 | 98 | */ |
99 | | - public function sanitizeIP( $ip ) { |
| 99 | + public static function sanitizeIP( $ip ) { |
100 | 100 | if ( !$ip ) return null; |
101 | 101 | // Only IPv6 addresses can be expanded |
102 | 102 | if ( !self::isIPv6( $ip ) ) return $ip; |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | * @param $ip integer IP address. |
115 | 115 | * @return string |
116 | 116 | */ |
117 | | - public function toOctet( $ip_int ) { |
| 117 | + public static function toOctet( $ip_int ) { |
118 | 118 | // Convert integer to binary |
119 | 119 | $ip_int = wfBaseConvert($ip_int, 10, 2, 128); |
120 | 120 | // Seperate into 8 octets |