本文整理汇总了PHP中OCP\Files::searchByMime方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::searchByMime方法的具体用法?PHP Files::searchByMime怎么用?PHP Files::searchByMime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Files
的用法示例。
在下文中一共展示了Files::searchByMime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchDocuments
protected static function searchDocuments()
{
$documents = array();
foreach (self::getSupportedMimetypes() as $mime) {
$documents = array_merge($documents, \OCP\Files::searchByMime($mime));
}
return $documents;
}
示例2: getDocuments
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;
}
示例3: getPresentations
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;
}
示例4: array
// 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;
}