Adldap\Utilities::escape PHP Method

escape() public static method

Returns an escaped string for use in an LDAP filter.
public static escape ( string $value, string $ignore = '', $flags ) : string
$value string
$ignore string
$flags
return string
    public static function escape($value, $ignore = '', $flags = 0)
    {
        if (!static::isEscapingSupported()) {
            return static::escapeManual($value, $ignore, $flags);
        }
        return ldap_escape($value, $ignore, $flags);
    }

Usage Example

Example #1
0
 /**
  * Constructor.
  *
  * @param string $field
  * @param string $operator
  * @param string $value
  *
  * @throws InvalidQueryOperatorException
  */
 public function __construct($field, $operator, $value)
 {
     // We'll escape the field to avoid allowing unsafe characters inside.
     $this->field = Utilities::escape($field, null, 3);
     // Validate and retrieve the operator.
     $this->operator = $this->validateOperator($operator);
     // Completely escape the value.
     $this->value = Utilities::escape($value);
 }
All Usage Examples Of Adldap\Utilities::escape