You are here

public function ServiceAuditFilesNotInDatabase::auditfilesEscapePreg in Audit Files 4.x

Same name and namespace in other branches
  1. 8.3 src/ServiceAuditFilesNotInDatabase.php \Drupal\auditfiles\ServiceAuditFilesNotInDatabase::auditfilesEscapePreg()

Escapes any possible regular expression characters in the specified string.

Parameters

string $element: The string to escape.

bool $makefilepath: Set to TRUE to change elements to file paths at the same time.

File

src/ServiceAuditFilesNotInDatabase.php, line 547

Class

ServiceAuditFilesNotInDatabase
Define all methods that are used on Files not in database functionality.

Namespace

Drupal\auditfiles

Code

public function auditfilesEscapePreg($element, $makefilepath = FALSE) {
  if ($makefilepath && $this->fileSystem
    ->realpath(file_build_uri($element))) {
    $element = $this->fileSystem
      ->realpath(file_build_uri($element));
  }
  return preg_quote($element);
}