You are here

protected function Local::pathIsPublic in Flysystem 7

Determines if the path is inside the public path.

Parameters

string $public_filepath: The path to the public files directory.

string $root: The root path.

Return value

string|false The public path, or false.

1 call to Local::pathIsPublic()
Local::__construct in src/Flysystem/Local.php
Constructs a Local object.

File

src/Flysystem/Local.php, line 224
Contains \Drupal\flysystem\Flysystem\Local.

Class

Local
Drupal plugin for the "Local" Flysystem adapter.

Namespace

Drupal\flysystem\Flysystem

Code

protected function pathIsPublic($public_filepath, $root) {
  $root = realpath($root);
  if (!($public = realpath($public_filepath))) {
    return FALSE;
  }
  if (strpos($root . DIRECTORY_SEPARATOR, $public . DIRECTORY_SEPARATOR) === 0) {
    return $public_filepath . substr($root, strlen($public));
  }
  return FALSE;
}