PHP Класс Piwik\IP

As of Piwik 1.3, IP addresses are stored in the DB has VARBINARY(16), and passed around in network address format which has the advantage of being in big-endian byte order. This allows for binary-safe string comparison of addresses (of the same length), even on Intel x86. As a matter of naming convention, we use $ip for the network address format and $ipString for the presentation format (i.e., human-readable form). We're not using the network address format (in_addr) for socket functions, so we don't have to worry about incompatibility with Windows UNICODE and inetPtonW().
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
getFirstIpFromList ( string $csv, array $excludedIps = null ) : string Returns the last IP address in a comma separated list, subject to an optional exclusion list.
getIpFromHeader ( ) : string Returns the most accurate IP address available for the current user, in IPv4 format. This could be the proxy client's IP address.
getNonProxyIpFromHeader ( string $default, array $proxyHeaders ) : string Returns a non-proxy IP address from header.

Описание методов

getFirstIpFromList() публичный статический Метод

Returns the last IP address in a comma separated list, subject to an optional exclusion list.
public static getFirstIpFromList ( string $csv, array $excludedIps = null ) : string
$csv string Comma separated list of elements.
$excludedIps array Optional list of excluded IP addresses (or IP address ranges).
Результат string Last (non-excluded) IP address in the list or an empty string if all given IPs are excluded.

getIpFromHeader() публичный статический Метод

Returns the most accurate IP address available for the current user, in IPv4 format. This could be the proxy client's IP address.
public static getIpFromHeader ( ) : string
Результат string IP address in presentation format.

getNonProxyIpFromHeader() публичный статический Метод

Returns a non-proxy IP address from header.
public static getNonProxyIpFromHeader ( string $default, array $proxyHeaders ) : string
$default string Default value to return if there no matching proxy header.
$proxyHeaders array List of proxy headers.
Результат string