src/Connections/Ldap.php
protected function escapeManual($value, $ignore = '', $flags = 0)
    {
        /*
         * If a flag was supplied, we'll send the value
         * off to be escaped using the PHP flag values
         * and return the result.
         */
        if ($flags) {
            return $this->escapeManualWithFlags($value, $ignore, $flags);
        }

        // Convert ignore string into an array
        $ignores = str_split($ignore);

        // Convert the value to a hex string
        $hex = bin2hex($value);

        /*
         * Separate the string, with the hex length of 2,
         * and place a backslash on the end of each section
         */
        $value = chunk_split($hex, 2, '\\');

        /*
         * We'll append a backslash at the front of the string
         * and remove the ending backslash of the string
         */
        $value = '\\'.substr($value, 0, -1);

        // Go through each character to ignore
        foreach ($ignores as $charToIgnore) {
            // Convert the character to ignore to a hex
            $hexed = bin2hex($charToIgnore);

            // Replace the hexed variant with the original character
            $value = str_replace('\\'.$hexed, $charToIgnore, $value);
        }

        // Finally we can return the escaped value
        return $value;
    }
protected function escapeManual($value, $ignore = '', $flags = 0)
    {
        /*
         * If a flag was supplied, we'll send the value
         * off to be escaped using the PHP flag values
         * and return the result.
         */
        if ($flags) {
            return $this->escapeManualWithFlags($value, $ignore, $flags);
        }

        // Convert ignore string into an array
        $ignores = str_split($ignore);

        // Convert the value to a hex string
        $hex = bin2hex($value);

        /*
         * Separate the string, with the hex length of 2,
         * and place a backslash on the end of each section
         */
        $value = chunk_split($hex, 2, '\\');

        /*
         * We'll append a backslash at the front of the string
         * and remove the ending backslash of the string
         */
        $value = '\\'.substr($value, 0, -1);

        // Go through each character to ignore
        foreach ($ignores as $charToIgnore) {
            // Convert the character to ignore to a hex
            $hexed = bin2hex($charToIgnore);

            // Replace the hexed variant with the original character
            $value = str_replace('\\'.$hexed, $charToIgnore, $value);
        }

        // Finally we can return the escaped value
        return $value;
    }
protected function escapeManual ( $ value , $ ignore = '' , $ flags = 0 ) { /*
         * If a flag was supplied, we'll send the value
         * off to be escaped using the PHP flag values
         * and return the result.
         */ if ( $ flags ) { return $ this -> escapeManualWithFlags ( $ value , $ ignore , $ flags ) ; } // Convert ignore string into an array $ ignores = str_split ( $ ignore ) ; // Convert the value to a hex string $ hex = bin2hex ( $ value ) ; /*
         * Separate the string, with the hex length of 2,
         * and place a backslash on the end of each section
         */ $ value = chunk_split ( $ hex , 2 , '\\' ) ; /*
         * We'll append a backslash at the front of the string
         * and remove the ending backslash of the string
         */ $ value = '\\' . substr ( $ value , 0 , - 1 ) ; // Go through each character to ignore foreach ( $ ignores as $ charToIgnore ) { // Convert the character to ignore to a hex $ hexed = bin2hex ( $ charToIgnore ) ; // Replace the hexed variant with the original character $ value = str_replace ( '\\' . $ hexed , $ charToIgnore , $ value ) ; } // Finally we can return the escaped value return $ value ; }
Escapes the inserted value for LDAP.

@param string $value
@param string $ignore
@param int    $flags

@return string
Escapes the inserted value for LDAP .