lib/ImageHelper.php
private static function _get_file_path( $base, $subdir, $filename ) {
		if ( URLHelper::is_url($subdir) ) {
			$subdir = URLHelper::url_to_file_system($subdir);
		}
		$subdir = self::maybe_realpath($subdir);

		$path = '';
		if ( self::BASE_UPLOADS == $base ) {
			//it is in the Uploads directory
			$upload_dir = wp_upload_dir();
			$path = $upload_dir['basedir'];
		} else if ( self::BASE_CONTENT == $base ) {
			//it is in the content directory, somewhere else ...
			$path = WP_CONTENT_DIR;
		}
		if ( self::is_in_theme_dir(trailingslashit($subdir).$filename) ) {
			//this is for weird installs when the theme folder is outside of /wp-content
			return trailingslashit($subdir).$filename;
		}
		if ( !empty($subdir) ) {
			$path = trailingslashit($path).$subdir;
		}
		$path = trailingslashit($path).$filename;

		return URLHelper::remove_double_slashes($path);
	}
private static function _get_file_path( $base, $subdir, $filename ) {
		if ( URLHelper::is_url($subdir) ) {
			$subdir = URLHelper::url_to_file_system($subdir);
		}
		$subdir = self::maybe_realpath($subdir);

		$path = '';
		if ( self::BASE_UPLOADS == $base ) {
			//it is in the Uploads directory
			$upload_dir = wp_upload_dir();
			$path = $upload_dir['basedir'];
		} else if ( self::BASE_CONTENT == $base ) {
			//it is in the content directory, somewhere else ...
			$path = WP_CONTENT_DIR;
		}
		if ( self::is_in_theme_dir(trailingslashit($subdir).$filename) ) {
			//this is for weird installs when the theme folder is outside of /wp-content
			return trailingslashit($subdir).$filename;
		}
		if ( !empty($subdir) ) {
			$path = trailingslashit($path).$subdir;
		}
		$path = trailingslashit($path).$filename;

		return URLHelper::remove_double_slashes($path);
	}
private static function _get_file_path ( $ base , $ subdir , $ filename ) { if ( URLHelper :: is_url ( $ subdir ) ) { $ subdir = URLHelper :: url_to_file_system ( $ subdir ) ; } $ subdir = self :: maybe_realpath ( $ subdir ) ; $ path = '' ; if ( self :: BASE_UPLOADS == $ base ) { //it is in the Uploads directory $ upload_dir = wp_upload_dir ( ) ; $ path = $ upload_dir [ 'basedir' ] ; } else if ( self :: BASE_CONTENT == $ base ) { //it is in the content directory, somewhere else ... $ path = WP_CONTENT_DIR ; } if ( self :: is_in_theme_dir ( trailingslashit ( $ subdir ) . $ filename ) ) { //this is for weird installs when the theme folder is outside of /wp-content return trailingslashit ( $ subdir ) . $ filename ; } if ( ! empty ( $ subdir ) ) { $ path = trailingslashit ( $ path ) . $ subdir ; } $ path = trailingslashit ( $ path ) . $ filename ; return URLHelper :: remove_double_slashes ( $ path ) ; }
Builds the absolute file system location of a file based on its different components

@param  int    $base     one of self::BASE_UPLOADS, self::BASE_CONTENT to indicate if file is an upload or a content (theme or plugin)
@param  string $subdir   subdirectory in which file is stored, relative to $base root folder
@param  string $filename file name, including extension (but no path)
@return string           the file location
Builds the absolute file system location of a file based on its different components