getName(); $entry['type'] = $i['type']; if ($i['type'] === 'file') { $entry['mimetype'] = $i['mimetype']; $entry['humansize'] = \OC_Helper::humanFileSize($i['size']); $entry['meta'] = Meta::get($i['fileid']); } return $entry; } /** * Format file info for OPDS feed * @param \OCP\Files\FileInfo[] $fileInfos file infos */ public static function formatFileInfos($fileInfos) { $files = array(); /* if set, add only files with given extensions */ $fileTypes = array_filter(explode(',', strtolower(Config::get('file_types', '')))); $skipList = array_filter(explode(',', strtolower(Config::get('skip_list', 'metadata.opf,cover.jpg')))); foreach ($fileInfos as $i) { if((!empty($fileTypes)) && (!in_array(strtolower(substr(strrchr($i->getName(), "."), 1)), $fileTypes))) { continue; } if((!empty($skipList)) && (in_array($i->getName(),$skipList))) { continue; } $files[] = self::formatFileInfo($i); } return $files; } /* * @brief check if $child is a subdirectory of $parent * * @param string $parent a directory * @param string $child a directory * @return bool true if $child is a subdirectory of $parent */ public static function isChild($parent, $child) { return strpos($child, $parent . '/') === 0; } }