Auth_OpenID_SQLStore::_octify PHP Method

_octify() public method

"Octifies" a binary string by returning a string with escaped octal bytes. This is used for preparing binary data for PostgreSQL BYTEA fields.
public _octify ( $str )
    function _octify($str)
    {
        $result = "";
        for ($i = 0; $i < Auth_OpenID::bytes($str); $i++) {
            $ch = substr($str, $i, 1);
            if ($ch == "\\") {
                $result .= "\\\\\\\\";
            } else {
                if (ord($ch) == 0) {
                    $result .= "\\\\000";
                } else {
                    $result .= "\\" . strval(decoct(ord($ch)));
                }
            }
        }
        return $result;
    }