Static Public Member Functions | |
static | isIPAddress ($ip) |
Given a string, determine if it as valid IP Unlike isValid(), this looks for networks too. | |
static | isIPv6 ($ip) |
static | isIPv4 ($ip) |
static | IPv4toIPv6 ($ip) |
Given an IP address in dotted-quad notation, returns an IPv6 octet. | |
static | toUnsigned6 ($ip) |
Given an IPv6 address in octet notation, returns an unsigned integer. | |
static | sanitizeIP ($ip) |
Given an IPv6 address in octet notation, returns the expanded octet. | |
static | toOctet ($ip_int) |
Given an unsigned integer, returns an IPv6 address in octet notation. | |
static | HextoOctet ($ip_hex) |
Given a hexadecimal number, returns to an IPv6 address in octet notation. | |
static | hexToQuad ($ip) |
Converts a hexadecimal number to an IPv4 address in octet notation. | |
static | parseCIDR6 ($range) |
Convert a network specification in IPv6 CIDR notation to an integer network and a number of bits. | |
static | parseRange6 ($range) |
Given a string range in a number of formats, return the start and end of the range in hexadecimal. | |
static | isValid ($ip) |
Validate an IP address. | |
static | isValidBlock ($ipblock) |
Validate an IP Block. | |
static | isPublic ($ip) |
Determine if an IP address really is an IP address, and if it is public, i.e. | |
static | toArray ($ipblock) |
Split out an IP block as an array of 4 bytes and a mask, return false if it can't be determined. | |
static | toHex ($ip) |
Return a zero-padded hexadecimal representation of an IP address. | |
static | toUnsigned ($ip) |
Given an IP address in dotted-quad/octet notation, returns an unsigned integer. | |
static | toSigned ($ip) |
Convert a dotted-quad IP to a signed integer Returns false on failure. | |
static | parseCIDR ($range) |
Convert a network specification in CIDR notation to an integer network and a number of bits. | |
static | parseRange ($range) |
Given a string range in a number of formats, return the start and end of the range in hexadecimal. | |
static | isInRange ($addr, $range) |
Determine if a given IPv4/IPv6 address is in a given CIDR network. | |
static | canonicalize ($addr) |
Convert some unusual representations of IPv4 addresses to their canonical dotted quad representation. |
Definition at line 35 of file IP.php.
static IP::canonicalize | ( | $ | addr | ) | [static] |
Convert some unusual representations of IPv4 addresses to their canonical dotted quad representation.
This currently only checks a few IPV4-to-IPv6 related cases. More unusual representations may be added later.
$addr | something that might be an IP address |
Definition at line 508 of file IP.php.
Referenced by wfGetIP().
static IP::HextoOctet | ( | $ | ip_hex | ) | [static] |
static IP::hexToQuad | ( | $ | ip | ) | [static] |
Converts a hexadecimal number to an IPv4 address in octet notation.
$ip | string Hex IP |
Definition at line 176 of file IP.php.
Referenced by ApiQueryBlocks::execute().
static IP::IPv4toIPv6 | ( | $ | ip | ) | [static] |
Given an IP address in dotted-quad notation, returns an IPv6 octet.
See http://www.answers.com/topic/ipv4-compatible-address IPs with the first 92 bits as zeros are reserved from IPv6
$ip | quad-dotted IP address. |
static IP::isInRange | ( | $ | addr, | |
$ | range | |||
) | [static] |
Determine if a given IPv4/IPv6 address is in a given CIDR network.
$addr | The address to check against the given range. | |
$range | The range to check the given address against. |
Definition at line 491 of file IP.php.
Referenced by Autopromote::checkCondition(), and Block::isWhitelistedFromAutoblocks().
static IP::isIPAddress | ( | $ | ip | ) | [static] |
Given a string, determine if it as valid IP Unlike isValid(), this looks for networks too.
$ip | IP address. |
Definition at line 42 of file IP.php.
Referenced by IPBlockForm::blockLogFlags(), SpecialContributions::contributionsSub(), IPBlockForm::doMassUserBlock(), DeletedContributionsPage::execute(), SpecialContributions::execute(), User::isBlockedGlobally(), and IPUnblockForm::showList().
static IP::isIPv4 | ( | $ | ip | ) | [static] |
Definition at line 60 of file IP.php.
Referenced by User::inDnsBlacklist(), and Block::normaliseRange().
static IP::isIPv6 | ( | $ | ip | ) | [static] |
static IP::isPublic | ( | $ | ip | ) | [static] |
static IP::isValid | ( | $ | ip | ) | [static] |
Validate an IP address.
Definition at line 275 of file IP.php.
Referenced by Article::view().
static IP::isValidBlock | ( | $ | ipblock | ) | [static] |
static IP::parseCIDR | ( | $ | range | ) | [static] |
Convert a network specification in CIDR notation to an integer network and a number of bits.
Definition at line 408 of file IP.php.
Referenced by ApiQueryBlocks::execute(), and wfParseCIDR().
static IP::parseCIDR6 | ( | $ | range | ) | [static] |
static IP::parseRange | ( | $ | range | ) | [static] |
Given a string range in a number of formats, return the start and end of the range in hexadecimal.
Formats are: 1.2.3.4/24 CIDR 1.2.3.4 - 1.2.3.5 Explicit range 1.2.3.4 Single IP
2001:0db8:85a3::7344/96 CIDR 2001:0db8:85a3::7344 - 2001:0db8:85a3::7344 Explicit range 2001:0db8:85a3::7344 Single IP
Definition at line 446 of file IP.php.
Referenced by Block::initialiseRange().
static IP::parseRange6 | ( | $ | range | ) | [static] |
Given a string range in a number of formats, return the start and end of the range in hexadecimal.
For IPv6.
Formats are: 2001:0db8:85a3::7344/96 CIDR 2001:0db8:85a3::7344 - 2001:0db8:85a3::7344 Explicit range 2001:0db8:85a3::7344/96 Single IP
static IP::sanitizeIP | ( | $ | ip | ) | [static] |
Given an IPv6 address in octet notation, returns the expanded octet.
IPv4 IPs will be trimmed, thats it...
$ip | octet ipv6 IP address. |
Definition at line 115 of file IP.php.
Referenced by Block::__construct(), User::getName(), Title::secureAndSplit(), and IPUnblockForm::showList().
static IP::toArray | ( | $ | ipblock | ) | [static] |
static IP::toHex | ( | $ | ip | ) | [static] |
Return a zero-padded hexadecimal representation of an IP address.
Hexadecimal addresses are used because they can easily be extended to IPv6 support. To separate the ranges, the return value from this function for an IPv6 address will be prefixed with "v6-", a non- hexadecimal string which sorts after the IPv4 addresses.
$ip | Quad dotted/octet IP address. |
Definition at line 354 of file IP.php.
Referenced by ApiQueryBlocks::execute(), Block::loadRange(), and IPUnblockForm::showList().
static IP::toOctet | ( | $ | ip_int | ) | [static] |
Given an unsigned integer, returns an IPv6 address in octet notation.
$ip | integer IP address. |
Definition at line 140 of file IP.php.
Referenced by Block::normaliseRange().
static IP::toSigned | ( | $ | ip | ) | [static] |
static IP::toUnsigned | ( | $ | ip | ) | [static] |
Given an IP address in dotted-quad/octet notation, returns an unsigned integer.
Like ip2long() except that it actually works and has a consistent error return value. Comes from ProxyTools.php
$ip | Quad dotted IP address. |
Definition at line 369 of file IP.php.
Referenced by Block::normaliseRange().
static IP::toUnsigned6 | ( | $ | ip | ) | [static] |
Given an IPv6 address in octet notation, returns an unsigned integer.
$ip | octet ipv6 IP address. |
Definition at line 98 of file IP.php.
Referenced by Block::normaliseRange().