You are here

public function VisibilityChecker::isValidFilename in Image Lazyloader 8

Asserts if the uri is a valid filename.

Parameters

string $uri: The uri.

Return value

bool Whether or not the uri is a valid filename.

File

src/VisibilityChecker.php, line 87

Class

VisibilityChecker
Class VisibilityChecker.

Namespace

Drupal\lazyloader

Code

public function isValidFilename($uri) {
  $excluded_files = $this->configFactory
    ->get('lazyloader.exclude')
    ->get('filenames');
  $parts = explode('/', $uri);
  $parts = explode('?', array_pop($parts));
  $filename = array_shift($parts);
  return !(bool) preg_match('/^' . $filename . '$/m', $excluded_files);
}