private function MediaFile::getPath in MediaFront 7.2
Gets the filpath provided a file object.
Parameters
type $file:
Return value
type
1 call to MediaFile::getPath()
File
- ./
MediaFile.php, line 63
Class
Code
private function getPath($file) {
// If the url is set, then just return it.
if (!empty($file->url)) {
return $file->url;
}
// If the path is set, then just return it.
if (!empty($file->path)) {
// Check to see if this is a URI.
if (file_valid_uri($file->path)) {
return file_create_url($file->path);
}
else {
return $file->path;
}
}
// If the uri is set, then just return it.
if (!empty($file->uri)) {
if (preg_match('/^http(s)?\\:\\/\\//', $file->uri)) {
return $file->uri;
}
else {
return file_create_url($file->uri);
}
}
// If the value is set, then just return it.
if (!empty($file->value)) {
return $file->value;
}
// If the value is input, then just return it.
if (!empty($file->input)) {
return $file->input;
}
// Return nothing.
return '';
}