本文整理汇总了PHP中Piwik\IP::P2N方法的典型用法代码示例。如果您正苦于以下问题:PHP IP::P2N方法的具体用法?PHP IP::P2N怎么用?PHP IP::P2N使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\IP
的用法示例。
在下文中一共展示了IP::P2N方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testApplyIPMask6
/**
* @dataProvider getipv6Addresses
* @group Plugins
*/
public function testApplyIPMask6($ip, $expected)
{
// each IP is tested with 0 to 4 octets masked
for ($maskLength = 0; $maskLength < 4; $maskLength++) {
$res = IPAnonymizer::applyIPMask(IP::P2N($ip), $maskLength);
$this->assertEquals($expected[$maskLength], $res, "Got " . bin2hex($res) . ", Expected " . bin2hex($expected[$maskLength]) . ", Mask Level " . $maskLength);
}
}
示例2: getIp
public function getIp()
{
if (!empty($this->enforcedIp)) {
$ipString = $this->enforcedIp;
} else {
$ipString = IP::getIpFromHeader();
}
$ip = IP::P2N($ipString);
return $ip;
}
示例3: testIsVisitor_ipIsKnownBot
/**
* @group Core
* @group IpIsKnownBot
*/
public function testIsVisitor_ipIsKnownBot()
{
$isIpBot = array('66.249.85.36' => true, '66.249.91.150' => true, '64.233.172.1' => true, '1.202.218.8' => true, '66.248.91.150' => false, '66.250.91.150' => false);
$idsite = API::getInstance()->addSite("name", "http://piwik.net/");
$request = new Request(array('idsite' => $idsite, 'bots' => 0));
foreach ($isIpBot as $ip => $isBot) {
$excluded = new VisitExcluded_public($request, IP::P2N($ip));
$this->assertSame($isBot, $excluded->public_isNonHumanBot(), $ip);
}
}
示例4: getIp
public function getIp()
{
$ipString = $this->getIpString();
$ip = IP::P2N($ipString);
return $ip;
}