本文整理汇总了PHP中OCP\Share::getBackend方法的典型用法代码示例。如果您正苦于以下问题:PHP Share::getBackend方法的具体用法?PHP Share::getBackend怎么用?PHP Share::getBackend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Share
的用法示例。
在下文中一共展示了Share::getBackend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
}
}
}
$count = 0;
// enable l10n support
$l = \OC::$server->getL10N('core');
foreach ($groups as $group) {
if ($count < 15) {
if (!isset($_GET['itemShares']) || !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !is_array((string) $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !in_array($group, (string) $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) {
$shareWith[] = array('label' => $group, 'value' => array('shareType' => OCP\Share::SHARE_TYPE_GROUP, 'shareWith' => $group));
$count++;
}
} else {
break;
}
}
// allow user to add unknown remote addresses for server-to-server share
$backend = \OCP\Share::getBackend((string) $_GET['itemType']);
if ($backend->isShareTypeAllowed(\OCP\Share::SHARE_TYPE_REMOTE)) {
if (substr_count((string) $_GET['search'], '@') === 1) {
$shareWith[] = array('label' => (string) $_GET['search'], 'value' => array('shareType' => \OCP\Share::SHARE_TYPE_REMOTE, 'shareWith' => (string) $_GET['search']));
}
}
$sorter = new \OC\Share\SearchResultSorter((string) $_GET['search'], 'label', new \OC\Log());
usort($shareWith, array($sorter, 'sort'));
OC_JSON::success(array('data' => $shareWith));
}
break;
}
}
}
示例2: isRemoteSharingAllowed
/**
* Method to get out the static call for better testing
*
* @param string $itemType
* @return bool
*/
protected function isRemoteSharingAllowed($itemType)
{
try {
$backend = Share::getBackend($itemType);
return $backend->isShareTypeAllowed(Share::SHARE_TYPE_REMOTE);
} catch (\Exception $e) {
return false;
}
}
示例3: getAll
/**
* get all file ids on the files on the storage
*
* @return int[]
*/
public function getAll()
{
$ids = \OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_File::FORMAT_GET_ALL);
$folderBackend = \OCP\Share::getBackend('folder');
if ($folderBackend instanceof Share_Backend_Collection) {
foreach ($ids as $file) {
/** @var $folderBackend Share_Backend_Collection */
$children = $folderBackend->getChildren($file);
foreach ($children as $child) {
$ids[] = (int) $child['source'];
}
}
}
return $ids;
}
示例4: foreach
}
}
}
$count = 0;
// enable l10n support
$l = \OC::$server->getL10N('core');
foreach ($groups as $group) {
if ($count < 15) {
if (!isset($_GET['itemShares']) || !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) {
$shareWith[] = array('label' => $group, 'value' => array('shareType' => OCP\Share::SHARE_TYPE_GROUP, 'shareWith' => $group));
$count++;
}
} else {
break;
}
}
// allow user to add unknown remote addresses for server-to-server share
$backend = \OCP\Share::getBackend($_GET['itemType']);
if ($backend->isShareTypeAllowed(\OCP\Share::SHARE_TYPE_REMOTE)) {
if (substr_count($_GET['search'], '@') === 1) {
$shareWith[] = array('label' => $_GET['search'], 'value' => array('shareType' => \OCP\Share::SHARE_TYPE_REMOTE, 'shareWith' => $_GET['search']));
}
}
$sorter = new \OC\Share\SearchResultSorter($_GET['search'], 'label', new \OC\Log());
usort($shareWith, array($sorter, 'sort'));
OC_JSON::success(array('data' => $shareWith));
}
break;
}
}
}