예제 #1
0
 /**
  * Returns the hostname given the IP address string
  *
  * @param string $ip IP Address
  * @return string hostname (or human-readable IP address)
  */
 private function getHost($ip)
 {
     return trim(strtolower(@Piwik_IP::getHostByAddr($ip)));
 }
예제 #2
0
파일: IPTest.php 프로젝트: nnnnathann/piwik
 /**
  * @group Core
  * @group IP
  */
 public function testGetHostByAddr()
 {
     $hosts = array('localhost', strtolower(@php_uname('n')), '127.0.0.1');
     $this->assertTrue(in_array(strtolower(Piwik_IP::getHostByAddr('127.0.0.1')), $hosts), '127.0.0.1 -> localhost');
     if (!Piwik_Common::isWindows() || PHP_VERSION >= '5.3') {
         $hosts = array('ip6-localhost', strtolower(@php_uname('n')), '::1');
         $this->assertTrue(in_array(strtolower(Piwik_IP::getHostByAddr('::1')), $hosts), '::1 -> ip6-localhost');
     }
 }