public function ServiceAuditFilesNotInDatabase::auditfilesEscapePreg in Audit Files 8.3
Same name and namespace in other branches
- 4.x 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 549
Class
- ServiceAuditFilesNotInDatabase
- Define all methods that are used on Files not in database functionality.
Namespace
Drupal\auditfilesCode
public function auditfilesEscapePreg($element, $makefilepath = FALSE) {
if ($makefilepath) {
$config = $this->configFactory
->get('auditfiles.settings');
$file_system_stream = $config
->get('auditfiles_file_system_path');
if ($this->fileSystem
->realpath("{$file_system_stream}://{$element}")) {
return preg_quote($this->fileSystem
->realpath("{$file_system_stream}://{$element}"));
}
}
return preg_quote($element);
}