getName(); $entry['mimetype'] = $i['mimetype']; $entry['size'] = $i['size']; $entry['type'] = $i['type']; 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', '')))); foreach ($fileInfos as $i) { if((!empty($fileTypes)) && (!in_array(strtolower(substr(strrchr($i->getName(), "."), 1)), $fileTypes))) { 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; } }