function _pathologic_is_file_directory in Pathologic 7.3
Checks whether the path belongs to one of the stream wrapper directories.
Parameters
string $path: The path to check.
Return value
bool TRUE if the path is in the public or private directory. FALSE otherwise.
1 call to _pathologic_is_file_directory()
- _pathologic_replace in ./
pathologic.module - Process and replace paths. preg_replace_callback() callback.
File
- ./
pathologic.module, line 543 - Pathologic text filter for Drupal.
Code
function _pathologic_is_file_directory($path) {
// Public stream wrapper: look up the path to which the stream wrapper points
// to and compare with the start of the given path.
/** @var DrupalLocalStreamWrapper $stream */
if ($stream = file_stream_wrapper_get_instance_by_scheme('public')) {
$dir = $stream
->getDirectoryPath();
if (strpos($path, $dir) === 0) {
return TRUE;
}
}
// @todo Check other stream wrappers too?
// Private: use the url, not the real path
if (strpos($path, 'system/files') === 0) {
return TRUE;
}
return FALSE;
}