/** * get a list of all music files of the user * * @return array */ public function getMusic() { $music = \OC\Files\Filesystem::searchByMime('audio'); $ogg = \OC\Files\Filesystem::searchByMime('application/ogg'); $music = array_merge($music, $ogg); foreach ($music as &$file) { $file = $file['path']; } return $music; }
public static function getPresentations() { $presentations = array(); $list = \OC\Files\Filesystem::searchByMime('text/impress'); foreach ($list as $l) { $info = pathinfo($l); $size = \OC\Files\Filesystem::filesize($l); $mtime = \OC\Files\Filesystem::filemtime($l); $entry = array('url' => $l, 'name' => $info['filename'], 'size' => $size, 'mtime' => $mtime); $presentations[] = $entry; } return $presentations; }
<?php /** * Copyright (c) 2012 Robin Appelman <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('gallery'); $images = \OC\Files\Filesystem::searchByMime('image'); $user = \OC_User::getUser(); foreach ($images as &$image) { $image['path'] = $user . $image['path']; } $shared = array(); $sharedSources = OCP\Share::getItemsSharedWith('gallery'); $users = array(); foreach ($sharedSources as $sharedSource) { $owner = $sharedSource['uid_owner']; if (array_search($owner, $users) === false) { $users[] = $owner; } \OC\Files\Filesystem::initMountPoints($owner); $ownerView = new \OC\Files\View('/' . $owner . '/files'); $path = $ownerView->getPath($sharedSource['item_source']); if ($path) { $shareName = basename($path); $shareView = new \OC\Files\View('/' . $owner . '/files' . $path); $sharedImages = $shareView->searchByMime('image'); foreach ($sharedImages as $sharedImage) {
/** * Search for files by mimetype * @param string $mimetype * @return array * @since 6.0.0 */ public static function searchByMime($mimetype) { return \OC\Files\Filesystem::searchByMime($mimetype); }