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


PHP Util::linkTo方法代码示例

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


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

示例1: show

 /**
  * Get the template for a specific activity-event in the activities
  *
  * @param array $activity An array with all the activity data in it
  * @param return string
  */
 public static function show($activity)
 {
     $tmpl = new \OCP\Template('activity', 'activity.box');
     $tmpl->assign('formattedDate', \OCP\Util::formatDate($activity['timestamp']));
     $tmpl->assign('formattedTimestamp', \OCP\relative_modified_date($activity['timestamp']));
     $tmpl->assign('user', $activity['user']);
     $tmpl->assign('displayName', \OCP\User::getDisplayName($activity['user']));
     if ($activity['app'] === 'files') {
         // We do not link the subject as we create links for the parameters instead
         $activity['link'] = '';
     }
     $tmpl->assign('event', $activity);
     if ($activity['file']) {
         $rootView = new \OC\Files\View('');
         $exist = $rootView->file_exists('/' . $activity['user'] . '/files' . $activity['file']);
         $is_dir = $rootView->is_dir('/' . $activity['user'] . '/files' . $activity['file']);
         unset($rootView);
         // show a preview image if the file still exists
         if (!$is_dir && $exist) {
             $tmpl->assign('previewLink', \OCP\Util::linkTo('files', 'index.php', array('dir' => dirname($activity['file']))));
             $tmpl->assign('previewImageLink', \OCP\Util::linkToRoute('core_ajax_preview', array('file' => $activity['file'], 'x' => 150, 'y' => 150)));
         } else {
             if ($exist) {
                 $tmpl->assign('previewLink', \OCP\Util::linkTo('files', 'index.php', array('dir' => $activity['file'])));
                 $tmpl->assign('previewImageLink', \OC_Helper::mimetypeIcon('dir'));
                 $tmpl->assign('previewLinkIsDir', true);
             }
         }
     }
     return $tmpl->fetchPage();
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:37,代码来源:display.php

示例2: show

 /**
  * Get the template for a specific activity-event in the activities
  *
  * @param array $activity An array with all the activity data in it
  * @return string
  */
 public static function show($activity)
 {
     $tmpl = new Template('activity', 'activity.box');
     $tmpl->assign('formattedDate', Util::formatDate($activity['timestamp']));
     $tmpl->assign('formattedTimestamp', \OCP\relative_modified_date($activity['timestamp']));
     $tmpl->assign('user', $activity['user']);
     $tmpl->assign('displayName', User::getDisplayName($activity['user']));
     if (strpos($activity['subjectformatted']['markup']['trimmed'], '<a ') !== false) {
         // We do not link the subject as we create links for the parameters instead
         $activity['link'] = '';
     }
     $tmpl->assign('event', $activity);
     if ($activity['file']) {
         $rootView = new View('/' . $activity['affecteduser'] . '/files');
         $exist = $rootView->file_exists($activity['file']);
         $is_dir = $rootView->is_dir($activity['file']);
         unset($rootView);
         // show a preview image if the file still exists
         $mimetype = \OC_Helper::getFileNameMimeType($activity['file']);
         if (!$is_dir && \OC::$server->getPreviewManager()->isMimeSupported($mimetype) && $exist) {
             $tmpl->assign('previewLink', Util::linkTo('files', 'index.php', array('dir' => dirname($activity['file']))));
             $tmpl->assign('previewImageLink', Util::linkToRoute('core_ajax_preview', array('file' => $activity['file'], 'x' => 150, 'y' => 150)));
         } else {
             $tmpl->assign('previewLink', Util::linkTo('files', 'index.php', array('dir' => $activity['file'])));
             $tmpl->assign('previewImageLink', \OC_Helper::mimetypeIcon($is_dir ? 'dir' : $mimetype));
             $tmpl->assign('previewLinkIsDir', true);
         }
     }
     return $tmpl->fetchPage();
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:36,代码来源:display.php

示例3: getCalenderSources

 public static function getCalenderSources($parameters)
 {
     $base_url = \OCP\Util::linkTo('calendar', 'ajax/events.php') . '?calendar_id=';
     foreach (Addressbook::all(\OCP\USER::getUser()) as $addressbook) {
         $parameters['sources'][] = array('url' => $base_url . 'birthday_' . $addressbook['id'], 'backgroundColor' => '#cccccc', 'borderColor' => '#888', 'textColor' => 'black', 'cache' => true, 'editable' => false);
     }
 }
开发者ID:netcon-source,项目名称:apps,代码行数:7,代码来源:hooks.php

示例4: __construct

 /**
  * Create a new content search result
  * @param QueryHit $hit file data given by provider
  */
 public function __construct(QueryHit $hit)
 {
     $this->id = (string) $hit->fileId;
     $this->path = $this->getRelativePath($hit->path);
     $this->name = basename($this->path);
     $this->size = (int) $hit->size;
     $this->score = $hit->score;
     $this->link = \OCP\Util::linkTo('files', 'index.php', array('dir' => dirname($this->path), 'scrollto' => $this->name));
     $this->permissions = $this->getPermissions($this->path);
     $this->modified = (int) $hit->mtime;
     $this->mime_type = $hit->mimetype;
 }
开发者ID:amin-hedayati,项目名称:search_lucene,代码行数:16,代码来源:luceneresult.php

示例5: __construct

 /**
  * Create a new file search result
  * @param FileInfo $data file data given by provider
  */
 public function __construct(FileInfo $data)
 {
     $path = $this->getRelativePath($data->getPath());
     $info = pathinfo($path);
     $this->id = $data->getId();
     $this->name = $info['basename'];
     $this->link = \OCP\Util::linkTo('files', 'index.php', array('dir' => $info['dirname'], 'file' => $info['basename']));
     $this->permissions = $data->getPermissions();
     $this->path = $path;
     $this->size = $data->getSize();
     $this->modified = $data->getMtime();
     $this->mime_type = $data->getMimetype();
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:17,代码来源:file.php

示例6: display_sub_dirs

function display_sub_dirs($current_dir, $sub_dirs)
{
    $results = explore($current_dir, $sub_dirs, 1);
    foreach ($results as $r) {
        echo '<tr id = "row" data-file="' . $r[0] . '" data-type="dir">
				<td id = "thumbnail_container" width = "14%"><div id = "thumbs">';
        $is_dir = check_dir_exists($current_dir, $r[0]);
        $margin = 10;
        $img_id = 1;
        foreach ($r[1] as $thumbs) {
            $thumb_exists = false;
            $thumb_exists = check_thumb_exists($current_dir . $r[0] . '/' . $thumbs);
            $img_path = \OCP\Util::linkTo('reader', 'ajax/thumbnail.php') . '&filepath=' . urlencode($current_dir . $r[0] . '/' . rtrim($thumbs, 'pdf') . 'png');
            $counter = 3;
            for ($i = 1; $i <= $counter; $i++) {
                echo '<img id = "' . $current_dir . $r[0] . '/' . $thumbs . '" src = "' . $img_path . '" value = "' . $thumb_exists . '" style = "position:absolute;top:-55px;left:10px;margin-left:' . $margin . 'px; z-index:' . (50 - $margin) . ';"/>';
                $margin = $margin + 5;
                $img_id = $img_id + 1;
            }
        }
        echo '</div></td>';
        echo '<td class = "filename svg" width = "86%">
					<a class = "dirs" id = "' . $r[0] . '" href = "' . OCP\Util::linkTo('reader', 'index.php') . '&dir=' . $current_dir . $r[0] . '/' . '">
						<span class = "nametext">' . htmlspecialchars($r[0]) . '</span>
					</a>
					<div id = "more_info" style = "color:#666;margin-left:15px;margin-top:35px; vertical-align:bottom">';
        echo "Browse in for";
        echo '<br>';
        $dir_browse_results = explore($current_dir, array($r[0]), 5);
        foreach ($dir_browse_results as $browse_result) {
            foreach ($browse_result[1] as $each) {
                $each_sub_dir = explode("/", $each);
                if (count($each_sub_dir) > 1) {
                    foreach ($each_sub_dir as $element) {
                        echo '<span style = "color:#DDD;">>></span>' . $element;
                    }
                } else {
                    echo '<span style = "color:#DDD;"> >></span>' . $each;
                }
                echo '<br>';
            }
        }
        echo '</div> 
			</td>
		</tr>';
    }
}
开发者ID:DOM-Digital-Online-Media,项目名称:apps,代码行数:47,代码来源:library_display.php

示例7: getFileList

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  * @SSOCORS
  */
 public function getFileList($dir = null, $sortby = 'name', $sort = false)
 {
     \OCP\JSON::checkLoggedIn();
     \OC::$server->getSession()->close();
     // Load the files
     $dir = $dir ? (string) $dir : '';
     $dir = \OC\Files\Filesystem::normalizePath($dir);
     try {
         $dirInfo = \OC\Files\Filesystem::getFileInfo($dir);
         if (!$dirInfo || !$dirInfo->getType() === 'dir') {
             header('HTTP/1.0 404 Not Found');
             exit;
         }
         $data = array();
         $baseUrl = \OCP\Util::linkTo('files', 'index.php') . '?dir=';
         $permissions = $dirInfo->getPermissions();
         $sortDirection = $sort === 'desc';
         $mimetypeFilters = '';
         $files = [];
         if (is_array($mimetypeFilters) && count($mimetypeFilters)) {
             $mimetypeFilters = array_unique($mimetypeFilters);
             if (!in_array('httpd/unix-directory', $mimetypeFilters)) {
                 $mimetypeFilters[] = 'httpd/unix-directory';
             }
             foreach ($mimetypeFilters as $mimetypeFilter) {
                 $files = array_merge($files, \OCA\Files\Helper::getFiles($dir, $sortby, $sortDirection, $mimetypeFilter));
             }
             $files = \OCA\Files\Helper::sortFiles($files, $sortby, $sortDirection);
         } else {
             $files = \OCA\Files\Helper::getFiles($dir, $sortby, $sortDirection);
         }
         $files = \OCA\Files\Helper::populateTags($files);
         $data['directory'] = $dir;
         $data['files'] = \OCA\Files\Helper::formatFileInfos($files);
         $data['permissions'] = $permissions;
         return new DataResponse(array('data' => $data, 'status' => 'success'));
     } catch (\OCP\Files\StorageNotAvailableException $e) {
         \OCP\Util::logException('files', $e);
         return new DataResponse(array('data' => array('exception' => '\\OCP\\Files\\StorageNotAvailableException', 'message' => 'Storage not available'), 'status' => 'error'));
     } catch (\OCP\Files\StorageInvalidException $e) {
         \OCP\Util::logException('files', $e);
         return new DataResponse(array('data' => array('exception' => '\\OCP\\Files\\StorageInvalidException', 'message' => 'Storage invalid'), 'status' => 'error'));
     } catch (\Exception $e) {
         \OCP\Util::logException('files', $e);
         return new DataResponse(array('data' => array('exception' => '\\Exception', 'message' => 'Unknown error'), 'status' => 'error'));
     }
 }
开发者ID:inwinstack,项目名称:owncloud-singlesignon,代码行数:52,代码来源:collaborationapicontroller.php

示例8: search

 function search($query)
 {
     $unescape = function ($value) {
         return strtr($value, array('\\,' => ',', '\\;' => ';'));
     };
     $app = new App();
     $searchresults = array();
     $results = \OCP\Contacts::search($query, array('N', 'FN', 'EMAIL', 'NICKNAME', 'ORG'));
     $l = new \OC_l10n('contacts');
     foreach ($results as $result) {
         $link = \OCP\Util::linkTo('contacts', 'index.php') . '/#' . $result['id'];
         $props = array();
         foreach (array('EMAIL', 'NICKNAME', 'ORG') as $searchvar) {
             if (isset($result[$searchvar]) && count($result[$searchvar]) > 0 && strlen($result[$searchvar][0]) > 3) {
                 $props = array_merge($props, $result[$searchvar]);
             }
         }
         $props = array_map($unescape, $props);
         $searchresults[] = new \OC_Search_Result($result['FN'], implode(', ', $props), $link, (string) $l->t('Contact'));
         //$name,$text,$link,$type
     }
     return $searchresults;
 }
开发者ID:varun2013,项目名称:owncloud-contacts,代码行数:23,代码来源:searchprovider.php

示例9: __construct

 /**
  * Constructor
  *
  * @param array $data
  * @return \OCA\Calendar\Search\Event
  */
 public function __construct(array $data = null)
 {
     // set default properties
     $this->id = $data['id'];
     $this->name = $data['summary'];
     $this->link = \OCP\Util::linkTo('calendar', 'index.php') . '?showevent=' . urlencode($data['id']);
     // do calendar-specific setup
     $l = new \OC_l10n('calendar');
     $calendar_data = \Sabre\VObject\Reader::read($data['calendardata']);
     $vevent = $calendar_data->VEVENT;
     // get start time
     $dtstart = $vevent->DTSTART;
     $start_dt = $dtstart->getDateTime();
     $start_dt->setTimezone($this->getUserTimezone());
     $this->start_time = $start_dt->format('r');
     // get end time
     $dtend = \OC_Calendar_Object::getDTEndFromVEvent($vevent);
     $end_dt = $dtend->getDateTime();
     $end_dt->setTimezone($this->getUserTimezone());
     $this->end_time = $end_dt->format('r');
     // create text description
     if (!$dtstart->hasTime()) {
         $end_dt->modify('-1 sec');
         if ($start_dt->format('d.m.Y') != $end_dt->format('d.m.Y')) {
             $this->text = $l->t('Date') . ': ' . $start_dt->format('d.m.Y') . ' - ' . $end_dt->format('d.m.Y');
         } else {
             $this->text = $l->t('Date') . ': ' . $start_dt->format('d.m.Y');
         }
     } else {
         $this->text = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i');
     }
     // set last modified time
     $this->modified = date('r', $data['lastmodified']);
     // set repeating property
     $this->repeating = (bool) $data['repeating'];
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:42,代码来源:event.php

示例10: preg_replace

/**
 * ownCloud - gsync plugin
 * 
 * @author Victor Dubiniuk
 * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com
 * 
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 */
namespace OCA_Gsync;

App::initController();
//Check if we are redirected here with permanent sync request
if (isset($_GET['code'])) {
    $code = preg_replace('/[^0-9a-zA-Z\\.\\-_\\/]*/i', '', $_GET['code']);
    $response = Request::getTokenByCode($code);
    $respData = json_decode($response, true);
    App::log('Goglesaid.' . $response, \OCP\Util::DEBUG);
    if (@$respData[App::GOOGLE_REFRESH_TOKEN]) {
        App::setRefreshToken($respData[App::GOOGLE_REFRESH_TOKEN]);
    }
    //Dirty hack.
    //It's not possible to redirect with server headers at this point
    echo '<script>window.location="' . \OCP\Util::linkTo('settings', 'personal.php') . '";</script>';
    exit;
} else {
    \OCP\Util::addScript(App::APP_ID, 'sync');
    $tmpl = new \OCP\Template(App::APP_ID, 'index', 'user');
    $tmpl->printPage();
}
开发者ID:seanbradley28,项目名称:gsync,代码行数:30,代码来源:index.php

示例11: asOCSearchResult

 /**
  * converts a zend lucene search object to a OC_SearchResult
  *
  * Example:
  * 
  * Text | Some Document.txt
  *      | /path/to/file, 148kb, Score: 0.55
  * 
  * @author Jörn Dreyer <jfd@butonic.de>
  *
  * @param Zend_Search_Lucene_Search_QueryHit $hit The Lucene Search Result
  * @return OC_Search_Result an OC_Search_Result
  */
 private static function asOCSearchResult(\Zend_Search_Lucene_Search_QueryHit $hit)
 {
     $mimeBase = self::baseTypeOf($hit->mimetype);
     switch ($mimeBase) {
         case 'audio':
             $type = 'Music';
             break;
         case 'text':
             $type = 'Text';
             break;
         case 'image':
             $type = 'Images';
             break;
         default:
             if ($hit->mimetype == 'application/xml') {
                 $type = 'Text';
             } else {
                 $type = 'Files';
             }
     }
     switch ($hit->mimetype) {
         case 'httpd/unix-directory':
             $url = Util::linkTo('files', 'index.php') . '?dir=' . $hit->path;
             break;
         default:
             $url = \OC::getRouter()->generate('download', array('file' => $hit->path));
     }
     return new \OC_Search_Result(basename($hit->path), dirname($hit->path) . ', ' . \OC_Helper::humanFileSize($hit->size) . ', Score: ' . number_format($hit->score, 2), $url, $type);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:42,代码来源:lucene.php

示例12: getMiniatureSrc

 public function getMiniatureSrc()
 {
     return \OCP\Util::linkTo('gallery', 'ajax/thumbnail.php') . '?filepath=' . urlencode($this->getPath());
 }
开发者ID:netcon-source,项目名称:apps,代码行数:4,代码来源:tiles.php

示例13: p

<?php

/**
 * ownCloud - Updater plugin
 *
 * @author Victor Dubiniuk
 * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 */
?>

<div class="section">
	<h2><?php 
p($l->t('Updater'));
?>
</h2>
	<a class="button" target="_blank" href="<?php 
p(\OCP\Util::linkTo('updater', 'update.php'));
?>
"><?php 
p($l->t('Open Update Center'));
?>
</a>
</div>
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:26,代码来源:admin.php

示例14: search

 function search($query)
 {
     $collection = new Collection(\OCP\User::getUser());
     $l = \OC_L10N::get('media');
     $app_name = (string) $l->t('Music');
     $artists = $collection->getArtists($query);
     $albums = $collection->getAlbums(0, $query);
     $songs = $collection->getSongs(0, 0, $query);
     $results = array();
     foreach ($artists as $artist) {
         $results[] = new \OC_Search_Result($artist['artist_name'], '', \OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist['artist_name']), $app_name);
     }
     foreach ($albums as $album) {
         $artist = $collection->getArtistName($album['album_artist']);
         $results[] = new \OC_Search_Result($album['album_name'], 'by ' . $artist, \OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist) . '&album=' . urlencode($album['album_name']), $app_name);
     }
     foreach ($songs as $song) {
         $minutes = floor($song['song_length'] / 60);
         $seconds = $song['song_length'] % 60;
         $artist = $collection->getArtistName($song['song_artist']);
         $album = $collection->getalbumName($song['song_album']);
         $results[] = new \OC_Search_Result($song['song_name'], "by {$artist}, in {$album} {$minutes}:{$seconds}", \OCP\Util::linkTo('media', 'index.php') . '#artist=' . urlencode($artist) . '&album=' . urlencode($album) . '&song=' . urlencode($song['song_name']), $app_name);
     }
     return $results;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:25,代码来源:media.php

示例15: p

* License along with this library.
* If not, see <http://www.gnu.org/licenses/>.
*
*/
?>

<?php 
/**
 * @file templates/tmpl_content.php
 * Visualizes the configured imprint content.
 * @access public
 * @author Christian Reiner
 */
?>

<html>
	<head>
		<link rel="stylesheet" href="<?php 
p(\OCP\Util::linkTo('imprint', 'css/content.css'));
?>
" type="text/css" media="screen" />
	</head>
	<body id="imprint-body">
		<div id="imprint-content">
			<?php 
print_unescaped($_['content']);
?>
		</div>
	</body>
</html>
开发者ID:DOM-Digital-Online-Media,项目名称:apps,代码行数:30,代码来源:tmpl_content.php


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