lib/Skeleton/Core/Web/Media.php
protected static function fetch($type, $path, $extension) {
		$packages = \Skeleton\Core\Package::get_all();

		foreach (self::$filetypes as $filetype => $extensions) {
			$filepaths = [
				\Skeleton\Core\Config::$asset_dir . '/' . $path, // Global asset directory
				Application::get()->media_path . '/' . $filetype . '/' . $path, // Application asset directory
			];
			foreach ($packages as $package) {
				$path_parts = explode('/', $path);
				if (!isset($path_parts[0]) or $path_parts[0] != $package->name) {
					continue;
				}
				unset($path_parts[0]);
				$package_path = $package->asset_path . '/' . $filetype . '/' . implode('/', $path_parts);
				$filepaths[] = $package_path;
			}

			if (in_array($extension, $extensions)) {
				foreach ($filepaths as $filepath) {
					if (file_exists($filepath)) {
						if ($type == 'mtime') {
							return filemtime($filepath);
						} else {
							return file_get_contents($filepath);
						}
					}
				}

				return false;
			}
		}

		return null;
	}
protected static function fetch($type, $path, $extension) {
		$packages = \Skeleton\Core\Package::get_all();

		foreach (self::$filetypes as $filetype => $extensions) {
			$filepaths = [
				\Skeleton\Core\Config::$asset_dir . '/' . $path, // Global asset directory
				Application::get()->media_path . '/' . $filetype . '/' . $path, // Application asset directory
			];
			foreach ($packages as $package) {
				$path_parts = explode('/', $path);
				if (!isset($path_parts[0]) or $path_parts[0] != $package->name) {
					continue;
				}
				unset($path_parts[0]);
				$package_path = $package->asset_path . '/' . $filetype . '/' . implode('/', $path_parts);
				$filepaths[] = $package_path;
			}

			if (in_array($extension, $extensions)) {
				foreach ($filepaths as $filepath) {
					if (file_exists($filepath)) {
						if ($type == 'mtime') {
							return filemtime($filepath);
						} else {
							return file_get_contents($filepath);
						}
					}
				}

				return false;
			}
		}

		return null;
	}
protected static function fetch ( $ type , $ path , $ extension ) { $ packages = \ Skeleton \ Core \ Package :: get_all ( ) ; foreach ( self :: $ filetypes as $ filetype => $ extensions ) { $ filepaths = [ \ Skeleton \ Core \ Config :: $ asset_dir . '/' . $ path , // Global asset directory Application :: get ( ) -> media_path . '/' . $ filetype . '/' . $ path , // Application asset directory ] ; foreach ( $ packages as $ package ) { $ path_parts = explode ( '/' , $ path ) ; if ( ! isset ( $ path_parts [ 0 ] ) or $ path_parts [ 0 ] != $ package -> name ) { continue ; } unset ( $ path_parts [ 0 ] ) ; $ package_path = $ package -> asset_path . '/' . $ filetype . '/' . implode ( '/' , $ path_parts ) ; $ filepaths [ ] = $ package_path ; } if ( in_array ( $ extension , $ extensions ) ) { foreach ( $ filepaths as $ filepath ) { if ( file_exists ( $ filepath ) ) { if ( $ type == 'mtime' ) { return filemtime ( $ filepath ) ; } else { return file_get_contents ( $ filepath ) ; } } } return false ; } } return null ; }
Fetch the contents and mtime of a file

@access protected
@param string $type
@param string $path
@param string $extension
@return mixed $content Returns a string with the content, false if it
couldn't be found or null if it shouldn't be handled by us anyway
Fetch the contents and mtime of a file