本文整理匯總了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;
}