Changeset View
Changeset View
Standalone View
Standalone View
core.php
<?php | <?php | ||||
namespace Keruald; | namespace Keruald; | ||||
use Keruald\OmniTools\Network\IP; | |||||
use Keruald\OmniTools\Strings\Multibyte\StringUtilities; | use Keruald\OmniTools\Strings\Multibyte\StringUtilities; | ||||
/** | /** | ||||
* Keruald, core libraries for Pluton and Xen engines. | * Keruald, core libraries for Pluton and Xen engines. | ||||
* | * | ||||
* Global functions | * Global functions | ||||
*/ | */ | ||||
Show All 17 Lines | function mb_str_pad($input, $pad_length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT, $encoding = null) { | ||||
return StringUtilities::pad($input, $pad_length, $pad_string, $pad_type, $encoding); | return StringUtilities::pad($input, $pad_length, $pad_string, $pad_type, $encoding); | ||||
} | } | ||||
/** | /** | ||||
* Determines whether the specified is a valid IP address | * Determines whether the specified is a valid IP address | ||||
* | * | ||||
* @param string $string the string to validate as an IP | * @param string $string the string to validate as an IP | ||||
* @return bool true if the specified string is a valid IP address; otherwise, false | * @return bool true if the specified string is a valid IP address; otherwise, false | ||||
* @deprecated Use Keruald\OmniTools\Network\IP::isIP | |||||
*/ | */ | ||||
function is_ip ($string) { | function is_ip ($string) { | ||||
return is_ipv4($string) || is_ipv6($string); | return IP::isIP($string); | ||||
} | } | ||||
/** | /** | ||||
* Determines whether the specified is a valid IPv4 address | * Determines whether the specified is a valid IPv4 address | ||||
* | * | ||||
* @param string $string the string to validate as an IP | * @param string $string the string to validate as an IP | ||||
* @return bool true if the specified string is a valid IPv4 address; otherwise, false | * @return bool true if the specified string is a valid IPv4 address; otherwise, false | ||||
* @deprecated Use Keruald\OmniTools\Network\IP::isIPv4 | |||||
*/ | */ | ||||
function is_ipv4 ($string) { | function is_ipv4 ($string) { | ||||
return filter_var($string, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false; | return IP::isIPv4($string); | ||||
} | } | ||||
/** | /** | ||||
* Determines whether the specified is a valid IPv6 address | * Determines whether the specified is a valid IPv6 address | ||||
* | * | ||||
* @param string $string the string to validate as an IP | * @param string $string the string to validate as an IP | ||||
* @return bool true if the specified string is a valid IPv6 address; otherwise, false | * @return bool true if the specified string is a valid IPv6 address; otherwise, false | ||||
* @deprecated Use Keruald\OmniTools\Network\IP::isIPv6 | |||||
*/ | */ | ||||
function is_ipv6 ($string) { | function is_ipv6 ($string) { | ||||
return filter_var($string, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false; | return IP::isIPv6($string); | ||||
} | } | ||||
/// | /// | ||||
/// Identifiers | /// Identifiers | ||||
/// | /// | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |
Nasqueron DevCentral · If it had been much bigger the moon would have had a core of ice. · Powered by Phabricator