本文整理汇总了PHP中Piwik_Common::long2ip方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Common::long2ip方法的具体用法?PHP Piwik_Common::long2ip怎么用?PHP Piwik_Common::long2ip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Common
的用法示例。
在下文中一共展示了Piwik_Common::long2ip方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIp
function getIp()
{
if (isset($this->details['location_ip'])) {
return Piwik_Common::long2ip($this->details['location_ip']);
}
return false;
}
示例2: testLong2ip
/**
* @dataProvider getLong2IPTestData
* @group Core
* @group IP
*/
public function testLong2ip($N, $P)
{
$this->assertEquals($P, Piwik_IP::long2ip($N), bin2hex($N));
// this is our compatibility function
$this->assertEquals($P, Piwik_Common::long2ip($N), bin2hex($N));
}
示例3: getHost
/**
* Returns the hostname given the string IP in the format ip2long
* php.net/ip2long
*
* @param string $ip
*
* @return string hostname
*/
private function getHost($ip)
{
return trim(strtolower(@gethostbyaddr(Piwik_Common::long2ip($ip))));
}
示例4: test_long2ip
function test_long2ip()
{
// a valid network address is either 4 or 16 bytes; those lines are intentionally left blank ;)
$tests = array(null => '0.0.0.0', "" => '0.0.0.0', "" => '127.0.0.1', "��" => '192.168.1.1', "����" => '192.168.1.2', "���" => '0.0.0.0', "��" => '0.0.0.0', "��" => '0.0.0.0', '-1062731520' => '0.0.0.0', '3232235776' => '0.0.0.0', '168430090' => '0.0.0.0', '9999' => '57.57.57.57', "9999" => '57.57.57.57', '999' => '0.0.0.0', "999" => '0.0.0.0');
foreach ($tests as $N => $P) {
$this->assertEqual(Piwik_IP::long2ip($N), $P, bin2hex($N));
// this is our compatibility function
$this->assertEqual(Piwik_Common::long2ip($N), $P, bin2hex($N));
}
}
示例5: isVisitorIpExcluded
/**
* Checks if the visitor ip is in the excluded list
*
* @param string $ip Long IP
* @return bool
*/
protected function isVisitorIpExcluded($ip)
{
$websiteAttributes = Piwik_Common::getCacheWebsiteAttributes($this->idsite);
if (!empty($websiteAttributes['excluded_ips'])) {
foreach ($websiteAttributes['excluded_ips'] as $ipRange) {
if ($ip >= $ipRange[0] && $ip <= $ipRange[1]) {
printDebug('Visitor IP ' . Piwik_Common::long2ip($ip) . ' is excluded from being tracked');
return true;
}
}
}
return false;
}