本文整理汇总了PHP中OC_Helper::linkTo方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Helper::linkTo方法的具体用法?PHP OC_Helper::linkTo怎么用?PHP OC_Helper::linkTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Helper
的用法示例。
在下文中一共展示了OC_Helper::linkTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
function search($query)
{
$files = OC_Filesystem::search($query);
$results = array();
foreach ($files as $file) {
if (OC_Filesystem::is_dir($file)) {
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'index.php?dir=' . $file), 'Files');
} else {
$mime = OC_Filesystem::getMimeType($file);
$mimeBase = substr($mime, 0, strpos($mime, '/'));
switch ($mimeBase) {
case 'audio':
break;
case 'text':
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php?file=' . $file), 'Text');
break;
case 'image':
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php?file=' . $file), 'Images');
break;
default:
if ($mime == 'application/xml') {
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php?file=' . $file), 'Text');
} else {
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php?file=' . $file), 'Files');
}
}
}
}
return $results;
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:30,代码来源:owncloud_lib_search_provider_file.php
示例2: search
function search($query)
{
$files = OC_FileCache::search($query, true);
$results = array();
foreach ($files as $fileData) {
$file = $fileData['path'];
$mime = $fileData['mimetype'];
if ($mime == 'httpd/unix-directory') {
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'index.php') . '?dir=' . $file, 'Files');
} else {
$mimeBase = $fileData['mimepart'];
switch ($mimeBase) {
case 'audio':
break;
case 'text':
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php') . '?file=' . $file, 'Text');
break;
case 'image':
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php') . '?file=' . $file, 'Images');
break;
default:
if ($mime == 'application/xml') {
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php') . '?file=' . $file, 'Text');
} else {
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php') . '?file=' . $file, 'Files');
}
}
}
}
return $results;
}
示例3: search
/**
* @brief Search in the activities and return search results
* @param $query
* @return search results
*/
function search($query)
{
$data = Data::search($query, 100);
$results = array();
foreach ($data as $d) {
$file = $d['file'];
$results[] = new \OC_Search_Result(basename($file), $d['subject'] . ' (' . \OCP\Util::formatDate($d['timestamp']) . ')', \OC_Helper::linkTo('activity', 'index.php'), 'Activity');
}
return $results;
}
示例4: __construct
public function __construct()
{
$baseUrl = OC_Helper::linkTo('', 'index.php');
$method = $_SERVER['REQUEST_METHOD'];
$host = OC_Request::serverHost();
$schema = OC_Request::serverProtocol();
$this->context = new RequestContext($baseUrl, $method, $host, $schema);
// TODO cache
$this->root = $this->getCollection('root');
}
示例5: do_exit
function do_exit($jobid, $pid, $message)
{
$redirect = isset($_GET["redirect"]);
$url = isset($_GET["url"]) ? $_GET["url"] : OC_Helper::linkTo("neurocloud", "index.php", array("jobid" => $jobid, "pid" => $pid, "message" => $message, "action" => "kill"));
if ($redirect) {
header("Location: " . $url);
} else {
echo $message;
exit;
}
}
示例6: search
function search($query)
{
$files = OC_FileCache::search($query, true);
$results = array();
foreach ($files as $fileData) {
$file = $fileData['path'];
$mime = $fileData['mimetype'];
if ($mime == 'application/pdf') {
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('reader', 'results.php') . '?file=' . $file, 'eBook');
}
}
return $results;
}
示例7: __construct
public function __construct()
{
$baseUrl = \OC_Helper::linkTo('', 'index.php');
if (!\OC::$CLI) {
$method = $_SERVER['REQUEST_METHOD'];
} else {
$method = 'GET';
}
$request = \OC::$server->getRequest();
$host = $request->getServerHost();
$schema = $request->getServerProtocol();
$this->context = new RequestContext($baseUrl, $method, $host, $schema);
// TODO cache
$this->root = $this->getCollection('root');
}
示例8: __construct
/**
* @param ILogger $logger
*/
public function __construct(ILogger $logger)
{
$this->logger = $logger;
$baseUrl = \OC::$WEBROOT;
if (!(getenv('front_controller_active') === 'true')) {
$baseUrl = \OC_Helper::linkTo('', 'index.php');
}
if (!\OC::$CLI) {
$method = $_SERVER['REQUEST_METHOD'];
} else {
$method = 'GET';
}
$request = \OC::$server->getRequest();
$host = $request->getServerHost();
$schema = $request->getServerProtocol();
$this->context = new RequestContext($baseUrl, $method, $host, $schema);
// TODO cache
$this->root = $this->getCollection('root');
}
示例9: search
function search($query)
{
$files = \OC\Files\Filesystem::search($query, true);
$results = array();
$l = OC_L10N::get('lib');
foreach ($files as $fileData) {
$path = $fileData['path'];
$mime = $fileData['mimetype'];
$name = basename($path);
$container = dirname($path);
$text = '';
$skip = false;
if ($mime == 'httpd/unix-directory') {
$link = OC_Helper::linkTo('files', 'index.php', array('dir' => $path));
$type = (string) $l->t('Files');
} else {
$link = OC_Helper::linkToRoute('download', array('file' => $path));
$mimeBase = $fileData['mimepart'];
switch ($mimeBase) {
case 'audio':
$skip = true;
break;
case 'text':
$type = (string) $l->t('Text');
break;
case 'image':
$type = (string) $l->t('Images');
break;
default:
if ($mime == 'application/xml') {
$type = (string) $l->t('Text');
} else {
$type = (string) $l->t('Files');
}
}
}
if (!$skip) {
$results[] = new OC_Search_Result($name, $text, $link, $type, $container);
}
}
return $results;
}
示例10: search
function search($query)
{
$files = OC_FileCache::search($query, true);
$results = array();
foreach ($files as $fileData) {
$path = $fileData['path'];
$mime = $fileData['mimetype'];
$name = basename($path);
$text = '';
$skip = false;
if ($mime == 'httpd/unix-directory') {
$link = OC_Helper::linkTo('files', 'index.php', array('dir' => $path));
$type = 'Files';
} else {
$link = OC_Helper::linkTo('files', 'download.php', array('file' => $path));
$mimeBase = $fileData['mimepart'];
switch ($mimeBase) {
case 'audio':
$skip = true;
break;
case 'text':
$type = 'Text';
break;
case 'image':
$type = 'Images';
break;
default:
if ($mime == 'application/xml') {
$type = 'Text';
} else {
$type = 'Files';
}
}
}
if (!$skip) {
$results[] = new OC_Search_Result($name, $text, $link, $type);
}
}
return $results;
}
示例11: search
function search($query)
{
require_once 'lib_collection.php';
$artists = OC_MEDIA_COLLECTION::getArtists($query);
$albums = OC_MEDIA_COLLECTION::getAlbums(0, $query);
$songs = OC_MEDIA_COLLECTION::getSongs(0, 0, $query);
$results = array();
foreach ($artists as $artist) {
$results[] = new OC_Search_Result($artist['artist_name'], '', OC_Helper::linkTo('apps/media', 'index.php#artist=' . urlencode($artist['artist_name'])), 'Music');
}
foreach ($albums as $album) {
$artist = OC_MEDIA_COLLECTION::getArtistName($album['album_artist']);
$results[] = new OC_Search_Result($album['album_name'], 'by ' . $artist, OC_Helper::linkTo('apps/media', 'index.php#artist=' . urlencode($artist) . '&album=' . urlencode($album['album_name'])), 'Music');
}
foreach ($songs as $song) {
$minutes = floor($song['song_length'] / 60);
$secconds = $song['song_length'] % 60;
$artist = OC_MEDIA_COLLECTION::getArtistName($song['song_artist']);
$album = OC_MEDIA_COLLECTION::getalbumName($song['song_album']);
$results[] = new OC_Search_Result($song['song_name'], "by {$artist}, in {$album} {$minutes}:{$secconds}", OC_Helper::linkTo('apps/media', 'index.php#artist=' . urlencode($artist) . '&album=' . urlencode($album) . '&song=' . urlencode($song['song_name'])), 'Music');
}
return $results;
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:23,代码来源:owncloud_apps_media_lib_media.php
示例12: generateAssets
public function generateAssets()
{
$assetDir = \OC::$server->getConfig()->getSystemValue('assetdirectory', \OC::$SERVERROOT);
$jsFiles = self::findJavascriptFiles(OC_Util::$scripts);
$jsHash = self::hashFileNames($jsFiles);
if (!file_exists("{$assetDir}/assets/{$jsHash}.js")) {
$jsFiles = array_map(function ($item) {
$root = $item[0];
$file = $item[2];
// no need to minifiy minified files
if (substr($file, -strlen('.min.js')) === '.min.js') {
return new FileAsset($root . '/' . $file, array(new SeparatorFilter(';')), $root, $file);
}
return new FileAsset($root . '/' . $file, array(new JSMinFilter(), new SeparatorFilter(';')), $root, $file);
}, $jsFiles);
$jsCollection = new AssetCollection($jsFiles);
$jsCollection->setTargetPath("assets/{$jsHash}.js");
$writer = new AssetWriter($assetDir);
$writer->writeAsset($jsCollection);
}
$cssFiles = self::findStylesheetFiles(OC_Util::$styles);
$cssHash = self::hashFileNames($cssFiles);
if (!file_exists("{$assetDir}/assets/{$cssHash}.css")) {
$cssFiles = array_map(function ($item) {
$root = $item[0];
$file = $item[2];
$assetPath = $root . '/' . $file;
$sourceRoot = \OC::$SERVERROOT;
$sourcePath = substr($assetPath, strlen(\OC::$SERVERROOT));
return new FileAsset($assetPath, array(new CssRewriteFilter(), new CssMinFilter(), new CssImportFilter()), $sourceRoot, $sourcePath);
}, $cssFiles);
$cssCollection = new AssetCollection($cssFiles);
$cssCollection->setTargetPath("assets/{$cssHash}.css");
$writer = new AssetWriter($assetDir);
$writer->writeAsset($cssCollection);
}
$this->append('jsfiles', OC_Helper::linkTo('assets', "{$jsHash}.js"));
$this->append('cssfiles', OC_Helper::linkTo('assets', "{$cssHash}.css"));
}
示例13: printSong
private static function printSong($song, $artistName = false, $albumName = false)
{
if (!$artistName) {
$artistName = OC_MEDIA_COLLECTION::getArtistName($song['song_artist']);
}
if (!$albumName) {
$albumName = OC_MEDIA_COLLECTION::getAlbumName($song['song_album']);
}
$artistName = utf8_decode(htmlentities($artistName));
$albumName = utf8_decode(htmlentities($albumName));
$id = $song['song_id'];
$name = utf8_decode(htmlentities($song['song_name']));
$artist = $song['song_artist'];
$album = $song['song_album'];
echo "\t<song id='{$id}'>\n";
echo "\t\t<title>{$name}</title>\n";
echo "\t\t<artist id='{$artist}'>{$artistName}</artist>\n";
echo "\t\t<album id='{$album}'>{$albumName}</album>\n";
$url = OC_Helper::linkTo('media', 'server/xml.server.php', null, true) . "?action=play&song={$id}&auth={$_GET['auth']}";
$url = htmlentities($url);
echo "\t\t<url>{$url}</url>\n";
echo "\t\t<time>{$song['song_length']}</time>\n";
echo "\t\t<track>{$song['song_track']}</track>\n";
echo "\t\t<size>{$song['song_size']}</size>\n";
echo "\t\t<art></art>\n";
echo "\t\t<rating>0</rating>\n";
echo "\t\t<preciserating>0</preciserating>\n";
echo "\t</song>\n";
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:29,代码来源:owncloud_apps_media_lib_ampache.php
示例14:
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
OC::$CLASSPATH['OCA\\News\\StatusFlag'] = 'apps/news/lib/item.php';
OC::$CLASSPATH['OCA\\News\\Item'] = 'apps/news/lib/item.php';
OC::$CLASSPATH['OCA\\News\\Collection'] = 'apps/news/lib/collection.php';
OC::$CLASSPATH['OCA\\News\\Feed'] = 'apps/news/lib/feed.php';
OC::$CLASSPATH['OCA\\News\\Folder'] = 'apps/news/lib/folder.php';
OC::$CLASSPATH['OCA\\News\\FeedType'] = 'apps/news/lib/feedtypes.php';
OC::$CLASSPATH['OCA\\News\\FeedMapper'] = 'apps/news/lib/feedmapper.php';
OC::$CLASSPATH['OCA\\News\\ItemMapper'] = 'apps/news/lib/itemmapper.php';
OC::$CLASSPATH['OCA\\News\\FolderMapper'] = 'apps/news/lib/foldermapper.php';
OC::$CLASSPATH['OCA\\News\\Utils'] = 'apps/news/lib/utils.php';
OC::$CLASSPATH['OC_Search_Provider_News'] = 'apps/news/lib/search.php';
OC::$CLASSPATH['OCA\\News\\Backgroundjob'] = 'apps/news/lib/backgroundjob.php';
OCP\Backgroundjob::addRegularTask('OCA\\News\\Backgroundjob', 'run');
OC::$CLASSPATH['OCA\\News\\Share_Backend_News_Item'] = 'apps/news/lib/share/item.php';
OCP\App::addNavigationEntry(array('id' => 'news', 'order' => 74, 'href' => OC_Helper::linkTo('news', 'index.php'), 'icon' => OC_Helper::imagePath('news', 'icon.svg'), 'name' => OC_L10N::get('news')->t('News')));
OC_Search::registerProvider('OC_Search_Provider_News');
OCP\Share::registerBackend('news_item', 'OCA\\News\\Share_Backend_News_Item');
示例15: OC_L10N
<?php
$l = new OC_L10N('calendar');
OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php';
OC::$CLASSPATH['OC_Calendar_Object'] = 'apps/calendar/lib/object.php';
OC::$CLASSPATH['OC_Calendar_Hooks'] = 'apps/calendar/lib/hooks.php';
OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre.php';
OC_HOOK::connect('OC_User', 'post_createUser', 'OC_Calendar_Hooks', 'deleteUser');
OC_Util::addScript('calendar', 'loader');
OC_App::register(array('order' => 10, 'id' => 'calendar', 'name' => 'Calendar'));
OC_App::addNavigationEntry(array('id' => 'calendar_index', 'order' => 10, 'href' => OC_Helper::linkTo('calendar', 'index.php'), 'icon' => OC_Helper::imagePath('calendar', 'icon.png'), 'name' => $l->t('Calendar')));
OC_App::registerPersonal('calendar', 'settings');
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:12,代码来源:owncloud_apps_calendar_appinfo_app.php