Ob der uebergebene String eine syntaktisch gueltige IP-Adresse eines externen Netzwerks ist.

@param  string $string - der zu ueberpruefende String

@return bool
177762
public static function isIPWanAddress($string) {
        $bytes = self::isIPAddress($string, true);

        // Die Logik entspricht dem Gegenteil von self:: isIPLanAdress() + zusaetzlicher Tests.
        if ($bytes) {
            if ($bytes[0] == 10)                   // 10.0.0.0 - 10.255.255.255
                return false;

            if ($bytes[0] == 127)                  // 127.0.0.0 - 127.255.255.255
                return false;

            if ($bytes[0]==169)                    // 169.0.0.0 - 169.255.255.255 !!! wem zugewiesen? niemandem?
                return false;

            if ($bytes[0] == 172)                  // 172.16.0.0 - 172.31.255.255
                return !(15 < $bytes[1] && $bytes[1] < 32);

            if ($bytes[0]==192)                    // 192.168.0.0 - 192.168.255.255
                return ($bytes[1]!=168);
        }

        // dieses TRUE ist eher spekulativ
        return true;
    }
976643
private function sendString ($string) {
    $bytes_sent = fwrite($this->pop_conn, $string, strlen($string));

    return $bytes_sent;
  }
737717
static public function isUTF8($string)
    {
        for ($idx = 0, $strlen = strlen($string); $idx < $strlen; $idx++) {
            $byte = ord($string[$idx]);

            if ($byte & 0x80) {
                if (($byte & 0xE0) == 0xC0) {
                    $bytes_remaining = 1;
                } else if (($byte & 0xF0) == 0xE0) {
                    $bytes_remaining = 2;
                } else if (($byte & 0xF8) == 0xF0) {
                    $bytes_remaining = 3;
                } else {
                    return false;
                }

                if ($idx + $bytes_remaining >= $strlen) {
                    return false;
                }

                while ($bytes_remaining--) {
                    if ((ord($string[++$idx]) & 0xC0) != 0x80) {
                        return false;
                    }
                }
            }
        }

        return true;
    }
243908
public static function isPair($string)
    {
        $pair = explode("\x20", $string);

        if (count($pair) == 2) {
            if (self::isIdentifier(self::toLowerTrim($pair[0])) && self::isIdentifier(self::toLowerTrim($pair[1]))) {
                return true;
            }
        }

        return false;
    }
820933
public static function strlen( $string )
    {
        if ( false === ( $_encoding = static::mbSupported( $string ) ) )
        {
            return strlen( $string );
        }

        return mb_strwidth( $string, $_encoding );
    }
34852
public static function stringToBoolean($string)
    {
        $flag = filter_var($string, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);

        if ($flag) {
            return true;
        } elseif (is_null($flag)) {
            return $string;
        }

        return false;
    }
103198
public static function isTimestamp($string)
    {
        if (substr($string, 0, 5) == "/Date") {
            return true;
        }

        try {
            new DateTime('@' . $string);
        } catch (Exception $e) {
            return false;
        }
        return true;
    }
321879
protected function parseConnectionString($string)
    {
        // preg_match('%^([^/]+?)://(?:([^/@:]*?)(?::([^/@:]+?))?@([^/@:]+?)(?::([^/@:]+?))?)?/(.+)$%'
        $matches = [];
        preg_match('%^([^/]+?)://(?:([^/@]*?)(?::([^/@:]+?)@)?([^/@:]+?)(?::([^/@:]+?))?)?/(.+)$%',
                   $string, $matches);
        return [
            'dbtype'   => $matches[1],
            'username' => $matches[2],
            'password' => $matches[3],
            'host'     => $matches[4],
            'port'     => $matches[5],
            'database' => $matches[6]
        ];
    }
1068252
public function write($string)
    {
        $length = strlen($string);

        $start = substr($this->resource, 0, $this->pointer);
        $end = substr($this->resource, $this->pointer + $length);

        $this->resource = $start . $string . $end;

        $this->pointer = strlen($start . $string);

        return $string;
    }
1335498
public static function isExitNode($ip) {
        self::init();
        if (!is_string($ip)) throw new IllegalTypeException('Illegal type of parameter $ip: '.gettype($ip));

        // TODO: mit Filter-Extension lokale Netze abfangen
        if ($ip == '127.0.0.1')
            return false;

        $nodes = self::getExitNodes();
        return isset($nodes[$ip]);
    }
889566
public static function isMaybeOpenWallPasswordHash($string) : bool
    {
        if (!is_string($string)
            || ! in_array(($length = strlen($string)), [20, 34, 60])
            || preg_match('/[^a-zA-Z0-9\.\/\$\_]/', $string)
        ) {
            return false;
        }

        switch ((string) $length) {
            case '20':
                return !($string[0] != '_'
                         || strpos($string, '$') !== false
                         || strpos($string, '.') === false
                );
            case '34':
                return !(substr_count($string, '$') <> 2
                         || !in_array(substr($string, 0, 3), ['$P$', '$H$'])
                );
        }

        return !(
            substr($string, 0, 4) != '$2a$'
            || substr($string, 6, 1) != '$'
            || ! is_numeric(substr($string, 4, 2))
            || substr_count($string, '$') <> 3
        );
    }
1141305
protected function translate($string)
    {
        $translated = $this->app['translator']->get($string);

        return is_string($translated) ? $translated : $string;
    }
751030
protected function sendString($string)
    {
        if ($this->pop_conn) {
            if ($this->do_debug >= 2) { //Show client messages when debug >= 2
                echo 'Client -> Server: ', $string;
            }

            return fwrite($this->pop_conn, $string, strlen($string));
        }

        return 0;
    }
1042392
protected function _isParseable($string) {
        return (
            mb_strpos($string, $this->getConfig('open')) !== false &&
            mb_strpos($string, $this->getConfig('close')) !== false &&
            !$this->getConfig('disabled')
        );
    }
377280
public function isSerialized($string)
    {
        if (!is_string($string)) {
            return false;
        }

        if ($string === 'N;') {
            return true;
        }

        if (strlen($string) < 4) {
            return false;
        }

        if ($string[1] !== ':') {
            return false;
        }

        if (!in_array($string[0], ['s', 'a', 'O', 'b', 'i', 'd'])) {
            return false;
        }

        return @unserialize($string) !== false;
    }
679699
public static function ip(string $value):bool
    {
        $value = (string)$value;
        $valid = filter_var($value, FILTER_VALIDATE_IP);
        return $valid !== false;
    }
1218092
public static function isIPLanAddress($string) {
        $bytes = self::isIPAddress($string, true);

        if ($bytes) {
            if ($bytes[0] == 10)                   // 10.0.0.0 - 10.255.255.255
                return true;

            if ($bytes[0] == 172)                  // 172.16.0.0 - 172.31.255.255
                return (15 < $bytes[1] && $bytes[1] < 32);

            if ($bytes[0]==192 && $bytes[1]==168)  // 192.168.0.0 - 192.168.255.255
                return true;
        }

        return false;
    }