本文整理汇总了PHP中OC\Files\Filesystem::searchByMime方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::searchByMime方法的具体用法?PHP Filesystem::searchByMime怎么用?PHP Filesystem::searchByMime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC\Files\Filesystem
的用法示例。
在下文中一共展示了Filesystem::searchByMime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMusic
/**
* 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;
}
示例2: getPresentations
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;
}
示例3: array
<?php
/**
* Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
* 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) {
示例4: searchByMime
/**
* 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);
}