当前位置: 首页>>代码示例>>PHP>>正文


PHP Util::encodePath方法代码示例

本文整理汇总了PHP中OCP\Util::encodePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::encodePath方法的具体用法?PHP Util::encodePath怎么用?PHP Util::encodePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\Util的用法示例。


在下文中一共展示了Util::encodePath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isset

<?php

OCP\JSON::checkLoggedIn();
\OC::$server->getSession()->close();
// Load the files
$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
$sortAttribute = isset($_GET['sort']) ? $_GET['sort'] : 'name';
$sortDirection = isset($_GET['sortdirection']) ? $_GET['sortdirection'] === 'desc' : false;
$data = array();
// make filelist
try {
    $files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir, \OCP\User::getUser(), $sortAttribute, $sortDirection);
} catch (Exception $e) {
    header("HTTP/1.0 404 Not Found");
    exit;
}
$encodedDir = \OCP\Util::encodePath($dir);
$data['permissions'] = 0;
$data['directory'] = $dir;
$data['files'] = \OCA\Files_Trashbin\Helper::formatFileInfos($files);
OCP\JSON::success(array('data' => $data));
开发者ID:Romua1d,项目名称:core,代码行数:21,代码来源:list.php

示例2: preg_match

\OCP\Util::addScript('files', 'detailsview');
\OCP\Util::addStyle('files', 'detailsView');
\OC_Util::addVendorScript('core', 'handlebars/handlebars');
OCP\App::setActiveNavigationEntry('files_index');
$l = \OC::$server->getL10N('files');
$isIE8 = false;
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
if (count($matches) > 0 && $matches[1] <= 9) {
    $isIE8 = true;
}
// if IE8 and "?dir=path&view=someview" was specified, reformat the URL to use a hash like "#?dir=path&view=someview"
if ($isIE8 && (isset($_GET['dir']) || isset($_GET['view']))) {
    $hash = '#?';
    $dir = isset($_GET['dir']) ? $_GET['dir'] : '/';
    $view = isset($_GET['view']) ? $_GET['view'] : 'files';
    $hash = '#?dir=' . \OCP\Util::encodePath($dir);
    if ($view !== 'files') {
        $hash .= '&view=' . urlencode($view);
    }
    header('Location: ' . OCP\Util::linkTo('files', 'index.php') . $hash);
    exit;
}
$user = OC_User::getUser();
$config = \OC::$server->getConfig();
// mostly for the home storage's free space
$dirInfo = \OC\Files\Filesystem::getFileInfo('/', false);
$storageInfo = OC_Helper::getStorageInfo('/', $dirInfo);
$nav = new OCP\Template('files', 'appnavigation', '');
function sortNavigationItems($item1, $item2)
{
    return $item1['order'] - $item2['order'];
开发者ID:rosarion,项目名称:core,代码行数:31,代码来源:index.php

示例3: header

// Redirect if directory does not exist
if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
    header('Location: ' . OCP\Util::getScriptName() . '');
    exit;
}
$isIE8 = false;
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
if (count($matches) > 0 && $matches[1] <= 8) {
    $isIE8 = true;
}
// if IE8 and "?dir=path" was specified, reformat the URL to use a hash like "#?dir=path"
if ($isIE8 && isset($_GET['dir'])) {
    if ($dir === '') {
        $dir = '/';
    }
    header('Location: ' . OCP\Util::linkTo('files', 'index.php') . '#?dir=' . \OCP\Util::encodePath($dir));
    exit;
}
$ajaxLoad = false;
$files = array();
$user = OC_User::getUser();
if (\OC\Files\Cache\Upgrade::needUpgrade($user)) {
    //dont load anything if we need to upgrade the cache
    $needUpgrade = true;
    $freeSpace = 0;
} else {
    if ($isIE8) {
        // after the redirect above, the URL will have a format
        // like "files#?dir=path" which means that no path was given
        // (dir is not set). In that specific case, we don't return any
        // files because the client will take care of switching the dir
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:index.php

示例4: index

 /**
  * @NoCSRFRequired
  * @NoAdminRequired
  *
  * @param string $dir
  * @param string $view
  * @return TemplateResponse
  * @throws \OCP\Files\NotFoundException
  */
 public function index($dir = '', $view = '')
 {
     $nav = new \OCP\Template('files', 'appnavigation', '');
     // Load the files we need
     \OCP\Util::addStyle('files', 'files');
     \OCP\Util::addStyle('files', 'upload');
     \OCP\Util::addStyle('files', 'mobile');
     \OCP\Util::addscript('files', 'app');
     \OCP\Util::addscript('files', 'file-upload');
     \OCP\Util::addscript('files', 'newfilemenu');
     \OCP\Util::addscript('files', 'jquery.iframe-transport');
     \OCP\Util::addscript('files', 'jquery.fileupload');
     \OCP\Util::addscript('files', 'jquery-visibility');
     \OCP\Util::addscript('files', 'fileinfomodel');
     \OCP\Util::addscript('files', 'filesummary');
     \OCP\Util::addscript('files', 'breadcrumb');
     \OCP\Util::addscript('files', 'filelist');
     \OCP\Util::addscript('files', 'search');
     \OCP\Util::addScript('files', 'favoritesfilelist');
     \OCP\Util::addScript('files', 'tagsplugin');
     \OCP\Util::addScript('files', 'favoritesplugin');
     \OCP\Util::addScript('files', 'detailfileinfoview');
     \OCP\Util::addScript('files', 'detailtabview');
     \OCP\Util::addScript('files', 'mainfileinfodetailview');
     \OCP\Util::addScript('files', 'detailsview');
     \OCP\Util::addStyle('files', 'detailsView');
     \OC_Util::addVendorScript('core', 'handlebars/handlebars');
     \OCP\Util::addscript('files', 'fileactions');
     \OCP\Util::addscript('files', 'fileactionsmenu');
     \OCP\Util::addscript('files', 'files');
     \OCP\Util::addscript('files', 'keyboardshortcuts');
     \OCP\Util::addscript('files', 'navigation');
     // if IE8 and "?dir=path&view=someview" was specified, reformat the URL to use a hash like "#?dir=path&view=someview"
     $isIE8 = $this->request->isUserAgent([Request::USER_AGENT_IE_8]);
     if ($isIE8 && ($dir !== '' || $view !== '')) {
         $dir = !empty($dir) ? $dir : '/';
         $view = !empty($view) ? $view : 'files';
         $hash = '#?dir=' . \OCP\Util::encodePath($dir);
         if ($view !== 'files') {
             $hash .= '&view=' . urlencode($view);
         }
         return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index') . $hash);
     }
     // mostly for the home storage's free space
     // FIXME: Make non static
     $storageInfo = $this->getStorageInfo();
     \OCA\Files\App::getNavigationManager()->add(['id' => 'favorites', 'appname' => 'files', 'script' => 'simplelist.php', 'order' => 5, 'name' => $this->l10n->t('Favorites')]);
     $navItems = \OCA\Files\App::getNavigationManager()->getAll();
     usort($navItems, function ($item1, $item2) {
         return $item1['order'] - $item2['order'];
     });
     $nav->assign('navigationItems', $navItems);
     $contentItems = [];
     // render the container content for every navigation item
     foreach ($navItems as $item) {
         $content = '';
         if (isset($item['script'])) {
             $content = $this->renderScript($item['appname'], $item['script']);
         }
         $contentItem = [];
         $contentItem['id'] = $item['id'];
         $contentItem['content'] = $content;
         $contentItems[] = $contentItem;
     }
     $this->eventDispatcher->dispatch('OCA\\Files::loadAdditionalScripts');
     $params = [];
     $params['usedSpacePercent'] = (int) $storageInfo['relative'];
     $params['owner'] = $storageInfo['owner'];
     $params['ownerDisplayName'] = $storageInfo['ownerDisplayName'];
     $params['isPublic'] = false;
     $params['mailNotificationEnabled'] = $this->config->getAppValue('core', 'shareapi_allow_mail_notification', 'no');
     $params['mailPublicNotificationEnabled'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no');
     $params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
     $params['appNavigation'] = $nav;
     $params['appContents'] = $contentItems;
     $this->navigationManager->setActiveEntry('files_index');
     $response = new TemplateResponse($this->appName, 'index', $params);
     $policy = new ContentSecurityPolicy();
     $policy->addAllowedFrameDomain('\'self\'');
     $response->setContentSecurityPolicy($policy);
     return $response;
 }
开发者ID:kenwi,项目名称:core,代码行数:91,代码来源:viewcontroller.php

示例5: p

<div class="crumb svg"
	 data-dir='/'>
	<a href="<?php 
p($_['baseURL']);
?>
"><?php 
p($l->t("Deleted Files"));
?>
</a>
</div>
<?php 
if (count($_["breadcrumb"])) {
}
for ($i = 0; $i < count($_["breadcrumb"]); $i++) {
    $crumb = $_["breadcrumb"][$i];
    $dir = \OCP\Util::encodePath($crumb["dir"]);
    ?>
	<div class="crumb <?php 
    if ($i === count($_["breadcrumb"]) - 1) {
        p('last');
    }
    ?>
 svg"
		 data-dir='<?php 
    p($dir);
    ?>
'>
	<a href="<?php 
    p($_['baseURL'] . $dir);
    ?>
"><?php 
开发者ID:hjimmy,项目名称:owncloud,代码行数:31,代码来源:part.breadcrumb.php

示例6: foreach

$totaldirs = 0;
$totalsize = 0;
foreach ($_['files'] as $file) {
    // the bigger the file, the darker the shade of grey; megabytes*2
    $simple_size_color = intval(160 - $file['size'] / (1024 * 1024) * 2);
    if ($simple_size_color < 0) {
        $simple_size_color = 0;
    }
    $relative_modified_date = OCP\relative_modified_date($file['mtime']);
    // the older the file, the brighter the shade of grey; days*14
    $relative_date_color = round((time() - $file['mtime']) / 60 / 60 / 24 * 14);
    if ($relative_date_color > 160) {
        $relative_date_color = 160;
    }
    $name = \OCP\Util::encodePath($file['name']);
    $directory = \OCP\Util::encodePath($file['directory']);
    ?>
	<tr data-id="<?php 
    p($file['fileid']);
    ?>
"
		data-file="<?php 
    p($name);
    ?>
"
		data-type="<?php 
    $file['type'] == 'dir' ? p('dir') : p('file');
    ?>
"
		data-mime="<?php 
    p($file['mimetype']);
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:part.list.php


注:本文中的OCP\Util::encodePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。