private static _get_file_path ( integer $base, string $subdir, string $filename ) : string | ||
$base | integer | one of self::BASE_UPLOADS, self::BASE_CONTENT to indicate if file is an upload or a content (theme or plugin) |
$subdir | string | subdirectory in which file is stored, relative to $base root folder |
$filename | string | file name, including extension (but no path) |
return | string | the file location |
private static function _get_file_path($base, $subdir, $filename)
{
$path = '';
if (self::BASE_UPLOADS == $base) {
$upload_dir = wp_upload_dir();
$path = $upload_dir['basedir'];
}
if (self::BASE_CONTENT == $base) {
$path = WP_CONTENT_DIR;
}
if (!empty($subdir)) {
$path .= $subdir;
}
$path .= '/' . $filename;
return $path;
}