Fix.
[lhc/web/wiklou.git] / includes / IP.php
index 9218676..e8b5b2e 100644 (file)
@@ -22,7 +22,7 @@ class IP {
         * Validate an IP address.
         * @return boolean True if it is valid.
         */
-       public static function IsValid( $ip ) {
+       public static function isValid( $ip ) {
                return preg_match( '/^' . RE_IP_ADD . '$/', $ip, $matches) ;
        }
 
@@ -30,8 +30,8 @@ class IP {
         * Validate an IP Block.
         * @return boolean True if it is valid.
         */
-       public static function IsValidBlock( $ipblock ) {
-               return ( count(self::ToArray($ipblock)) == 1 + 5 );
+       public static function isValidBlock( $ipblock ) {
+               return ( count(self::toArray($ipblock)) == 1 + 5 );
        }
 
        /**
@@ -39,8 +39,8 @@ class IP {
         * i.e. not RFC 1918 or similar
         * Comes from ProxyTools.php
         */
-       function IsPublic( $ip ) {
-               $n = IP::ToUnsigned( $ip );
+       public static function isPublic( $ip ) {
+               $n = IP::toUnsigned( $ip );
                if ( !$n ) {
                        return false;
                }
@@ -63,8 +63,8 @@ class IP {
                }
 
                foreach ( $privateRanges as $r ) {
-                       $start = IP::ToUnsigned( $r[0] );
-                       $end = IP::ToUnsigned( $r[1] );
+                       $start = IP::toUnsigned( $r[0] );
+                       $end = IP::toUnsigned( $r[1] );
                        if ( $n >= $start && $n <= $end ) {
                                return false;
                        }
@@ -79,7 +79,7 @@ class IP {
         * @parameter $ip string A quad dotted IP address
         * @return array
         */
-       public static function ToArray( $ipblock ) {
+       public static function toArray( $ipblock ) {
                if(! preg_match( '/^' . RE_IP_ADD . '(?:\/(?:'.RE_IP_PREFIX.'))?' . '$/', $ipblock, $matches ) ) {
                        return false;
                } else {
@@ -92,8 +92,8 @@ class IP {
         * Comes from ProxyTools.php
         * @param $ip Quad dotted IP address.
         */
-       public static function ToHex( $ip ) {
-               $n = self::ToUnsigned( $ip );
+       public static function toHex( $ip ) {
+               $n = self::toUnsigned( $ip );
                if ( $n !== false ) {
                        $n = sprintf( '%08X', $n );
                }
@@ -106,7 +106,7 @@ class IP {
         * Comes from ProxyTools.php
         * @param $ip Quad dotted IP address.
         */
-       public static function ToUnsigned( $ip ) {
+       public static function toUnsigned( $ip ) {
                $n = ip2long( $ip );
                if ( $n == -1 || $n === false ) { # Return value on error depends on PHP version
                        $n = false;