You are here

public static function ServerTestForm::binaryCheck in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_servers/src/Form/ServerTestForm.php \Drupal\ldap_servers\Form\ServerTestForm::binaryCheck()

Check if binary and escape if necessary.

Parameters

string $input: Input string.

Return value

string Escaped string.

3 calls to ServerTestForm::binaryCheck()
QueryTestForm::buildForm in ldap_query/src/Form/QueryTestForm.php
Form constructor.
ServerTestForm::computeUserData in ldap_servers/src/Form/ServerTestForm.php
Compute user data.
ServerTestForm::submitForm in ldap_servers/src/Form/ServerTestForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…

File

ldap_servers/src/Form/ServerTestForm.php, line 541

Class

ServerTestForm
Use Drupal\Core\Form\FormBase;.

Namespace

Drupal\ldap_servers\Form

Code

public static function binaryCheck(string $input) : string {
  if (preg_match('~[^\\x20-\\x7E\\t\\r\\n]~', $input) > 0) {
    $truncatedString = Unicode::truncate($input, 120, FALSE, TRUE);
    return (string) t('Binary (excerpt): @excerpt', [
      '@excerpt' => $truncatedString,
    ]);
  }
  return $input;
}