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


PHP IURLGenerator::linkTo方法代码示例

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


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

示例1: getPreviewLink

 /**
  * @param string $path
  * @param bool $isDir
  * @return string
  */
 protected function getPreviewLink($path, $isDir)
 {
     if ($isDir) {
         return $this->urlGenerator->linkTo('files', 'index.php', array('dir' => $path));
     } else {
         $parentDir = substr_count($path, '/') === 1 ? '/' : dirname($path);
         $fileName = basename($path);
         return $this->urlGenerator->linkTo('files', 'index.php', array('dir' => $parentDir, 'scrollto' => $fileName));
     }
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:15,代码来源:display.php

示例2: prepareFileParam

 /**
  * Prepares a file parameter for usage
  *
  * Removes the path from filenames and adds highlights
  *
  * @param string $param
  * @param bool $stripPath Shall we remove the path from the filename
  * @param bool $highlightParams
  * @return string
  */
 protected function prepareFileParam($param, $stripPath, $highlightParams)
 {
     $param = $this->fixLegacyFilename($param);
     $is_dir = $this->rootView->is_dir('/' . $this->user . '/files' . $param);
     if ($is_dir) {
         $linkData = ['dir' => $param];
     } else {
         $parentDir = substr_count($param, '/') === 1 ? '/' : dirname($param);
         $fileName = basename($param);
         $linkData = ['dir' => $parentDir, 'scrollto' => $fileName];
     }
     $fileLink = $this->urlGenerator->linkTo('files', 'index.php', $linkData);
     $param = trim($param, '/');
     list($path, $name) = $this->splitPathFromFilename($param);
     if (!$stripPath || $path === '') {
         if (!$highlightParams) {
             return $param;
         }
         return '<a class="filename" href="' . $fileLink . '">' . Util::sanitizeHTML($param) . '</a>';
     }
     if (!$highlightParams) {
         return $name;
     }
     $title = ' title="' . $this->l->t('in %s', array(Util::sanitizeHTML($path))) . '"';
     return '<a class="filename has-tooltip" href="' . $fileLink . '"' . $title . '>' . Util::sanitizeHTML($name) . '</a>';
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:36,代码来源:parameterhelper.php

示例3: format

 /**
  * @param IEvent $event
  * @param string $parameter The parameter to be formatted
  * @param bool $allowHtml   Should HTML be used to format the parameter?
  * @param bool $verbose     Should paths, names, etc be shortened or full length
  * @return string The formatted parameter
  */
 public function format(IEvent $event, $parameter, $allowHtml, $verbose = false)
 {
     $param = $this->fixLegacyFilename($parameter);
     // If the activity is about the very same file, we use the current path
     // for the link generation instead of the one that was saved.
     $fileId = '';
     if ($event->getObjectType() === 'files' && $event->getObjectName() === $param) {
         $fileId = $event->getObjectId();
         $info = $this->infoCache->getInfoById($this->user, $fileId, $param);
     } else {
         $info = $this->infoCache->getInfoByPath($this->user, $param);
     }
     if ($info['is_dir']) {
         $linkData = ['dir' => $info['path']];
     } else {
         $parentDir = substr_count($info['path'], '/') === 1 ? '/' : dirname($info['path']);
         $fileName = basename($info['path']);
         $linkData = ['dir' => $parentDir, 'scrollto' => $fileName];
     }
     if ($info['view'] !== '') {
         $linkData['view'] = $info['view'];
     }
     $param = trim($param, '/');
     list($path, $name) = $this->splitPathFromFilename($param);
     $fileLink = $this->urlGenerator->linkTo('files', 'index.php', $linkData);
     if ($allowHtml === null) {
         return '<file link="' . $fileLink . '" id="' . Util::sanitizeHTML($fileId) . '">' . Util::sanitizeHTML($param) . '</file>';
     }
     if ($verbose || $path === '') {
         if (!$allowHtml) {
             return $param;
         }
         return '<a class="filename" href="' . $fileLink . '">' . Util::sanitizeHTML($param) . '</a>';
     }
     if (!$allowHtml) {
         return $name;
     }
     $title = ' title="' . $this->l->t('in %s', array(Util::sanitizeHTML($path))) . '"';
     return '<a class="filename has-tooltip" href="' . $fileLink . '"' . $title . '>' . Util::sanitizeHTML($name) . '</a>';
 }
开发者ID:ynott,项目名称:activity,代码行数:47,代码来源:fileformatter.php

示例4: vCard2Array

 /**
  * create array with all vCard properties
  *
  * @param string $uri
  * @param VCard $vCard
  * @return array
  */
 protected function vCard2Array($uri, VCard $vCard)
 {
     $result = ['URI' => $uri];
     foreach ($vCard->children as $property) {
         $result[$property->name] = $property->getValue();
         if ($property->name === 'PHOTO' && $property->getValueType() === 'BINARY') {
             $url = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'remote.php') . '/dav/');
             $url .= implode('/', ['addressbooks', substr($this->addressBookInfo['principaluri'], 11), $this->addressBookInfo['uri'], $uri]) . '?photo';
             $result['PHOTO'] = 'VALUE=uri:' . $url;
         } else {
             $result[$property->name] = $property->getValue();
         }
     }
     if ($this->addressBookInfo['principaluri'] === 'principals/system/system' && $this->addressBookInfo['uri'] === 'system') {
         $result['isLocalSystemBook'] = true;
     }
     return $result;
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:25,代码来源:AddressBookImpl.php

示例5: getIndexParameters

 /**
  * Returns the parameters to be used in the index function
  *
  * @param $appName
  *
  * @return array<string,string>
  */
 private function getIndexParameters($appName)
 {
     // Parameters sent to the index function
     $params = ['appName' => $appName, 'uploadUrl' => $this->urlGenerator->linkTo('files', 'ajax/upload.php'), 'publicUploadEnabled' => $this->appConfig->getAppValue('core', 'shareapi_allow_public_upload', 'yes'), 'mailNotificationEnabled' => $this->appConfig->getAppValue('core', 'shareapi_allow_mail_notification', 'no'), 'mailPublicNotificationEnabled' => $this->appConfig->getAppValue('core', 'shareapi_allow_public_notification', 'no')];
     return $params;
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:13,代码来源:pagecontroller.php


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