protected static 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 static::escapeManualWithFlags($value, $ignore, $flags);
}
// Convert ignore string into an array.
$ignores = static::ignoreStrToArray($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;
}