original_string: public static function getNonProxyIpFromHeader($default, $proxyHeaders)
      {
          $proxyIps = array();
          $config = Config::getInstance()->General;
          if (isset($config['proxy_ips'])) {
              $proxyIps = $config['proxy_ips'];
          }
          if (!is_array($proxyIps)) {
              $proxyIps = array();
          }
  
          $proxyIps[] = $default;
  
          // examine proxy headers
          foreach ($proxyHeaders as $proxyHeader) {
              if (!empty($_SERVER[$proxyHeader])) {
                  // this may be buggy if someone has proxy IPs and proxy host headers configured as
                  // `$_SERVER[$proxyHeader]` could be eg $_SERVER['HTTP_X_FORWARDED_HOST'] and
                  // include an actual host name, not an IP
                  $proxyIp = self::getFirstIpFromList($_SERVER[$proxyHeader], $proxyIps);
                  if (strlen($proxyIp) && stripos($proxyIp, 'unknown') === false) {
                      return $proxyIp;
                  }
              }
          }
  
          return $default;
      }
code: public static function getNonProxyIpFromHeader($default, $proxyHeaders)
      {
          $proxyIps = array();
          $config = Config::getInstance()->General;
          if (isset($config['proxy_ips'])) {
              $proxyIps = $config['proxy_ips'];
          }
          if (!is_array($proxyIps)) {
              $proxyIps = array();
          }
  
          $proxyIps[] = $default;
  
          // examine proxy headers
          foreach ($proxyHeaders as $proxyHeader) {
              if (!empty($_SERVER[$proxyHeader])) {
                  // this may be buggy if someone has proxy IPs and proxy host headers configured as
                  // `$_SERVER[$proxyHeader]` could be eg $_SERVER['HTTP_X_FORWARDED_HOST'] and
                  // include an actual host name, not an IP
                  $proxyIp = self::getFirstIpFromList($_SERVER[$proxyHeader], $proxyIps);
                  if (strlen($proxyIp) && stripos($proxyIp, 'unknown') === false) {
                      return $proxyIp;
                  }
              }
          }
  
          return $default;
      }
code_tokens: public static function getNonProxyIpFromHeader ( $ default , $ proxyHeaders ) { $ proxyIps = array ( ) ; $ config = Config :: getInstance ( ) -> General ; if ( isset ( $ config [ 'proxy_ips' ] ) ) { $ proxyIps = $ config [ 'proxy_ips' ] ; } if ( ! is_array ( $ proxyIps ) ) { $ proxyIps = array ( ) ; } $ proxyIps [ ] = $ default ; // examine proxy headers foreach ( $ proxyHeaders as $ proxyHeader ) { if ( ! empty ( $ _SERVER [ $ proxyHeader ] ) ) { // this may be buggy if someone has proxy IPs and proxy host headers configured as // `$_SERVER[$proxyHeader]` could be eg $_SERVER['HTTP_X_FORWARDED_HOST'] and // include an actual host name, not an IP $ proxyIp = self :: getFirstIpFromList ( $ _SERVER [ $ proxyHeader ] , $ proxyIps ) ; if ( strlen ( $ proxyIp ) && stripos ( $ proxyIp , 'unknown' ) === false ) { return $ proxyIp ; } } } return $ default ; }
docstring: Returns a non-proxy IP address from header.
  
  @param string $default Default value to return if there no matching proxy header.
  @param array $proxyHeaders List of proxy headers.
  @return string
docstring_tokens: Returns a non - proxy IP address from header .