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


PHP OC_Helper::mimetypeIcon方法代码示例

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


在下文中一共展示了OC_Helper::mimetypeIcon方法的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: determineIcon

 public static function determineIcon($file)
 {
     if ($file['type'] === 'dir') {
         $dir = $file['directory'];
         $absPath = \OC\Files\Filesystem::getView()->getAbsolutePath($dir . '/' . $file['name']);
         $mount = \OC\Files\Filesystem::getMountManager()->find($absPath);
         if (!is_null($mount)) {
             $sid = $mount->getStorageId();
             if (!is_null($sid)) {
                 $sid = explode(':', $sid);
                 if ($sid[0] === 'shared') {
                     return \OC_Helper::mimetypeIcon('dir-shared');
                 }
                 if ($sid[0] !== 'local' and $sid[0] !== 'home') {
                     return \OC_Helper::mimetypeIcon('dir-external');
                 }
             }
         }
         return \OC_Helper::mimetypeIcon('dir');
     }
     if ($file['isPreviewAvailable']) {
         $pathForPreview = $file['directory'] . '/' . $file['name'];
         return \OC_Helper::previewIcon($pathForPreview) . '&c=' . $file['etag'];
     }
     return \OC_Helper::mimetypeIcon($file['mimetype']);
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:26,代码来源:helper.php

示例3: getThumbnail

 public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
 {
     $mimetype = $fileview->getMimeType($path);
     $path = \OC_Helper::mimetypeIcon($mimetype);
     $path = \OC::$SERVERROOT . substr($path, strlen(\OC::$WEBROOT));
     $svgPath = substr_replace($path, 'svg', -3);
     if (extension_loaded('imagick') && file_exists($svgPath) && count(@\Imagick::queryFormats("SVG")) === 1) {
         // http://www.php.net/manual/de/imagick.setresolution.php#85284
         $svg = new \Imagick();
         $svg->readImage($svgPath);
         $res = $svg->getImageResolution();
         $x_ratio = $res['x'] / $svg->getImageWidth();
         $y_ratio = $res['y'] / $svg->getImageHeight();
         $svg->removeImage();
         $svg->setResolution($maxX * $x_ratio, $maxY * $y_ratio);
         $svg->setBackgroundColor(new \ImagickPixel('transparent'));
         $svg->readImage($svgPath);
         $svg->setImageFormat('png32');
         $image = new \OC_Image();
         $image->loadFromData($svg);
     } else {
         $image = new \OC_Image($path);
     }
     return $image;
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:25,代码来源:unknown.php

示例4: listAll

 /**
  * lists the documents the user has access to (including shared files, once the code in core has been fixed)
  * also adds session and member info for these files
  */
 public static function listAll()
 {
     self::preDispatch();
     $found = Storage::getDocuments();
     $fileIds = array();
     $documents = array();
     foreach ($found as $key => $document) {
         if (is_object($document)) {
             $documents[] = $document->getData();
         } else {
             $documents[$key] = $document;
         }
         $documents[$key]['icon'] = preg_replace('/\\.png$/', '.svg', \OC_Helper::mimetypeIcon($document['mimetype']));
         $fileIds[] = $document['fileid'];
     }
     usort($documents, function ($a, $b) {
         return @$b['mtime'] - @$a['mtime'];
     });
     $session = new Db\Session();
     $sessions = $session->getCollectionBy('file_id', $fileIds);
     $members = array();
     $member = new Db\Member();
     foreach ($sessions as $session) {
         $members[$session['es_id']] = $member->getActiveCollection($session['es_id']);
     }
     \OCP\JSON::success(array('documents' => $documents, 'sessions' => $sessions, 'members' => $members));
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:31,代码来源:documentController.php

示例5: 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

示例6: determineIcon

 /**
  * Determine icon for a given file
  *
  * @param \OCP\Files\FileInfo $file file info
  * @return string icon URL
  */
 public static function determineIcon($file)
 {
     if ($file['type'] === 'dir') {
         $icon = \OC_Helper::mimetypeIcon('dir');
         // TODO: move this part to the client side, using mountType
         if ($file->isShared()) {
             $icon = \OC_Helper::mimetypeIcon('dir-shared');
         } elseif ($file->isMounted()) {
             $icon = \OC_Helper::mimetypeIcon('dir-external');
         }
     } else {
         $icon = \OC_Helper::mimetypeIcon($file->getMimetype());
     }
     return substr($icon, 0, -3) . 'svg';
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:21,代码来源:helper.php

示例7: testRenameFolder

 /**
  * test rename of file/folder
  */
 function testRenameFolder()
 {
     $dir = '/';
     $oldname = 'oldname';
     $newname = 'newname';
     $this->viewMock->expects($this->any())->method('file_exists')->with($this->anything())->will($this->returnValueMap(array(array('/', true), array('/oldname', true))));
     $this->viewMock->expects($this->any())->method('getFileInfo')->will($this->returnValue(new \OC\Files\FileInfo('/new_name', new \OC\Files\Storage\Local(array('datadir' => '/')), '/', array('fileid' => 123, 'type' => 'dir', 'mimetype' => 'httpd/unix-directory', 'mtime' => 0, 'permissions' => 31, 'size' => 18, 'etag' => 'abcdef', 'directory' => '/', 'name' => 'new_name'), null)));
     $result = $this->files->rename($dir, $oldname, $newname);
     $this->assertTrue($result['success']);
     $this->assertEquals(123, $result['data']['id']);
     $this->assertEquals('new_name', $result['data']['name']);
     $this->assertEquals(18, $result['data']['size']);
     $this->assertEquals('httpd/unix-directory', $result['data']['mimetype']);
     $this->assertEquals('abcdef', $result['data']['etag']);
     $icon = \OC_Helper::mimetypeIcon('dir');
     $icon = substr($icon, 0, -3) . 'svg';
     $this->assertEquals($icon, $result['data']['icon']);
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:21,代码来源:ajax_rename.php

示例8: getAllShares

 /**
  * get all shares
  *
  * @param array $params option 'file' to limit the result to a specific file/folder
  * @return \OC_OCS_Result share information
  */
 public static function getAllShares($params)
 {
     if (isset($_GET['shared_with_me']) && $_GET['shared_with_me'] !== 'false') {
         return self::getFilesSharedWithMe();
     }
     // if a file is specified, get the share for this file
     if (isset($_GET['path'])) {
         $params['itemSource'] = self::getFileId($_GET['path']);
         $params['path'] = $_GET['path'];
         $params['itemType'] = self::getItemType($_GET['path']);
         if (isset($_GET['reshares']) && $_GET['reshares'] !== 'false') {
             $params['reshares'] = true;
         } else {
             $params['reshares'] = false;
         }
         if (isset($_GET['subfiles']) && $_GET['subfiles'] !== 'false') {
             return self::getSharesFromFolder($params);
         }
         return self::collectShares($params);
     }
     $shares = \OCP\Share::getItemShared('file', null);
     if ($shares === false) {
         return new \OC_OCS_Result(null, 404, 'could not get shares');
     } else {
         foreach ($shares as &$share) {
             if ($share['item_type'] === 'file' && isset($share['path'])) {
                 $share['mimetype'] = \OC_Helper::getFileNameMimeType($share['path']);
                 if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) {
                     $share['isPreviewAvailable'] = true;
                 }
                 $share['icon'] = substr(\OC_Helper::mimetypeIcon($share['mimetype']), 0, -3) . 'svg';
             }
             if (!is_null($share['token'])) {
                 $share['url'] = \OC::$server->getURLGenerator()->linkToRouteAbsolute('files_sharing.sharecontroller.showShare', ['token' => $share['token']]);
             }
         }
         return new \OC_OCS_Result($shares);
     }
 }
开发者ID:nougad,项目名称:core,代码行数:45,代码来源:local.php

示例9: listAll

 /**
  * lists the documents the user has access to (including shared files, once the code in core has been fixed)
  * also adds session and member info for these files
  */
 public static function listAll()
 {
     self::preDispatch();
     $documents = Storage::getDocuments();
     $fileIds = array();
     //$previewAvailable = \OCP\Preview::show($file);
     foreach ($documents as $key => $document) {
         //\OCP\Preview::show($document['path']);
         $documents[$key]['icon'] = preg_replace('/\\.png$/', '.svg', \OC_Helper::mimetypeIcon($document['mimetype']));
         $fileIds[] = $document['fileid'];
     }
     usort($documents, function ($a, $b) {
         return @$b['mtime'] - @$a['mtime'];
     });
     $session = new Db_Session();
     $sessions = $session->getCollectionBy('file_id', $fileIds);
     $members = array();
     $member = new Db_Member();
     foreach ($sessions as $session) {
         $members[$session['es_id']] = $member->getActiveCollection($session['es_id']);
     }
     \OCP\JSON::success(array('documents' => $documents, 'sessions' => $sessions, 'members' => $members));
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:27,代码来源:documentController.php

示例10: p

            <?php 
p($l->t('Save SVG'));
?>
        </a></li>
		<li><a href="#pngExport">
            <img src="<?php 
print_unescaped(OC_Helper::mimetypeIcon("image/png"));
?>
" class="mimetypeTab" />
            <?php 
p($l->t('Export PNG'));
?>
        </a></li>
		<li><a href="#pdfExport">
            <img src="<?php 
print_unescaped(OC_Helper::mimetypeIcon("application/pdf"));
?>
" class="mimetypeTab" />
            <?php 
p($l->t('Export PDF'));
?>
        </a></li>
	</ul>
	<div id="svgSave">
		<input type="text" id="svgSavePath" value="" />
		<input type="button" id="svgSaveBtn" value="<?php 
p($l->t('Save'));
?>
" />
        <div class="separator"></div>
		<input type="button" id="svgDownloadBtn" value="<?php 
开发者ID:DOM-Digital-Online-Media,项目名称:apps,代码行数:31,代码来源:editor.php

示例11: unset

         $files[$key]['type'] = 'file';
         $files[$key]['date'] = \OCP\Util::formatDate($file['storage_mtime']);
         unset($files[$key]['storage_mtime']);
         $files[$key]['mtime'] = $file['mtime'] * 1000;
         $files[$key]['parentId'] = $file['parent'];
         unset($files[$key]['parent']);
         $files[$key]['permissions'] = (int) $file['permissions'];
         $files[$key]['isPreviewAvailable'] = true;
     }
 } else {
     //将mimetype转换为字符串
     foreach ($files as $key => $file) {
         foreach ($mimetypesrow as $mime) {
             if ($file['mimetype'] == $mime['id']) {
                 $files[$key]['mimetype'] = $mime['mimetype'];
                 $files[$key]['icon'] = \OC_Helper::mimetypeIcon($mime['mimetype']);
             }
         }
         $files[$key]['id'] = $file['fileid'];
         unset($files[$key]['path_hash']);
         //重组path
         if ($file['storage'] == $locastorage) {
             $files[$key]['path'] = "/";
         } else {
             foreach ($mounts as $mountkey => $mount) {
                 if ($file['storage'] == $mount['storage_id']) {
                     $newdir = substr($mountkey, strrpos($mountkey, '/'));
                     if (substr($file['path'], 0, strrpos($file['path'], '/')) != "") {
                         $files[$key]['path'] = $newdir . '/' . substr($file['path'], 0, strrpos($file['path'], '/'));
                     } else {
                         $files[$key]['path'] = $newdir;
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:31,代码来源:list.php

示例12: testRenameFileWithTag

 /**
  * test rename of file with tag
  */
 function testRenameFileWithTag()
 {
     $taggerMock = $this->getMock('\\OCP\\ITags');
     $taggerMock->expects($this->any())->method('getTagsForObjects')->with(array(123))->will($this->returnValue(array(123 => array('tag1', 'tag2'))));
     $tagManagerMock = $this->getMock('\\OCP\\ITagManager');
     $tagManagerMock->expects($this->any())->method('load')->with('files')->will($this->returnValue($taggerMock));
     $oldTagManager = \OC::$server->query('TagManager');
     \OC::$server->registerService('TagManager', function ($c) use($tagManagerMock) {
         return $tagManagerMock;
     });
     $dir = '/';
     $oldname = 'oldname.txt';
     $newname = 'newname.txt';
     $this->viewMock->expects($this->any())->method('file_exists')->with($this->anything())->will($this->returnValueMap(array(array('/', true), array('/oldname.txt', true))));
     $this->viewMock->expects($this->any())->method('getFileInfo')->will($this->returnValue(new \OC\Files\FileInfo('/new_name.txt', new \OC\Files\Storage\Local(array('datadir' => '/')), '/', array('fileid' => 123, 'type' => 'file', 'mimetype' => 'text/plain', 'mtime' => 0, 'permissions' => 31, 'size' => 18, 'etag' => 'abcdef', 'directory' => '/', 'name' => 'new_name.txt'), null)));
     $result = $this->files->rename($dir, $oldname, $newname);
     $this->assertTrue($result['success']);
     $this->assertEquals(123, $result['data']['id']);
     $this->assertEquals('new_name.txt', $result['data']['name']);
     $this->assertEquals(18, $result['data']['size']);
     $this->assertEquals('text/plain', $result['data']['mimetype']);
     $this->assertEquals('abcdef', $result['data']['etag']);
     $this->assertEquals(array('tag1', 'tag2'), $result['data']['tags']);
     $this->assertEquals('/', $result['data']['path']);
     $icon = \OC_Helper::mimetypeIcon('text');
     $icon = substr($icon, 0, -3) . 'svg';
     $this->assertEquals($icon, $result['data']['icon']);
     \OC::$server->registerService('TagManager', function ($c) use($oldTagManager) {
         return $oldTagManager;
     });
 }
开发者ID:rosarion,项目名称:core,代码行数:34,代码来源:ajax_rename.php

示例13: getMimeIcon

 /**
  * Defines the media icon, for the media type of the original file, as the preview
  */
 private function getMimeIcon()
 {
     $image = new \OC_Image();
     $mimeIconWebPath = \OC_Helper::mimetypeIcon($this->mimeType);
     if (empty(\OC::$WEBROOT)) {
         $mimeIconServerPath = \OC::$SERVERROOT . $mimeIconWebPath;
     } else {
         $mimeIconServerPath = str_replace(\OC::$WEBROOT, \OC::$SERVERROOT, $mimeIconWebPath);
     }
     $image->loadFromFile($mimeIconServerPath);
     $this->preview = $image;
 }
开发者ID:unrealbato,项目名称:core,代码行数:15,代码来源:preview.php

示例14: enrichDownloadUrl

 /**
  * @param string $messageId
  * @param $accountId
  * @param $folderId
  * @return callable
  */
 private function enrichDownloadUrl($accountId, $folderId, $messageId, $attachment)
 {
     $downloadUrl = \OCP\Util::linkToRoute('mail.messages.downloadAttachment', ['accountId' => $accountId, 'folderId' => $folderId, 'messageId' => $messageId, 'attachmentId' => $attachment['id']]);
     $downloadUrl = \OC::$server->getURLGenerator()->getAbsoluteURL($downloadUrl);
     $attachment['downloadUrl'] = $downloadUrl;
     $attachment['mimeUrl'] = \OC_Helper::mimetypeIcon($attachment['mime']);
     return $attachment;
 }
开发者ID:jakobsack,项目名称:mail,代码行数:14,代码来源:messagescontroller.php

示例15: p

?>
" id="sharingToken">
<input type="hidden" name="filename" value="<?php 
p($_['filename']);
?>
" id="filename">
<input type="hidden" name="mimetype" value="<?php 
p($_['mimetype']);
?>
" id="mimetype">
<input type="hidden" name="previewSupported" value="<?php 
p($previewSupported);
?>
" id="previewSupported">
<input type="hidden" name="mimetypeIcon" value="<?php 
p(OC_Helper::mimetypeIcon($_['mimetype']));
?>
" id="mimetypeIcon">
<input type="hidden" name="filesize" value="<?php 
p($_['nonHumanFileSize']);
?>
" id="filesize">
<input type="hidden" name="maxSizeAnimateGif" value="<?php 
p($_['maxSizeAnimateGif']);
?>
" id="maxSizeAnimateGif">


<header><div id="header" class="<?php 
p(isset($_['folder']) ? 'share-folder' : 'share-file');
?>
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:31,代码来源:public.php


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