protected static function searchDocuments() { $documents = array(); foreach (self::getSupportedMimetypes() as $mime) { $documents = array_merge($documents, \OCP\Files::searchByMime($mime)); } return $documents; }
public static function getDocuments() { $list = array_filter(\OCP\Files::searchByMime('application/vnd.oasis.opendocument.text'), function ($item) { //filter Deleted if (strpos($item['path'], '_trashbin') === 0) { return false; } return true; }); return $list; }
public static function getPresentations() { $presentations = array(); $list = \OCP\Files::searchByMime('text/impress'); foreach ($list as $l) { $size = \OC\Files\Filesystem::filesize($l["path"]); if ($size > 0) { $info = pathinfo($l["path"]); $mtime = \OC\Files\Filesystem::filemtime($l["path"]); $entry = array('url' => $l["path"], 'name' => $info['filename'], 'size' => $size, 'mtime' => $mtime); $presentations[] = $entry; } } return $presentations; }
// The token defines the target directory (security reasons) $path = \OC\Files\Filesystem::getPath($linkItem['file_source']); $view = new \OC\Files\View(\OC\Files\Filesystem::getView()->getAbsolutePath($path)); $images = $view->searchByMime('image'); $result = array(); foreach ($images as $image) { $result[] = $token . $image['path']; } OCP\JSON::setContentTypeHeader(); echo json_encode(array('images' => $result, 'users' => array(), 'displayNames' => array())); exit; } } OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('gallery'); $images = \OCP\Files::searchByMime('image'); $user = \OCP\User::getUser(); $users = array(); $result = array(); foreach ($images as &$image) { // we show shared images another way if ($image->getStorage() instanceof \OC\Files\Storage\Shared) { $owner = $image['uid_owner']; $users[$owner] = $owner; } else { $owner = $user; } $path = $image['path']; if (strpos($path, DIRECTORY_SEPARATOR . ".")) { continue; }