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


PHP HHtml::getMimeIconClassByExtension方法代码示例

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


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

示例1: run

 /**
  * Executes the widget.
  */
 public function run()
 {
     if ($this->item->href != '') {
         $this->render('libraryLink', array('item' => $this->item, 'category' => $this->category, 'editable' => $this->editable));
     } else {
         $files = File::getFilesOfObject($this->item);
         $file = array_pop($files);
         // If there is no file attached, deliver a dummy object. That's better than completely breaking the rendering.
         if (!is_object($file)) {
             $file = new File();
         }
         $mime = HHtml::getMimeIconClassByExtension($file->getExtension());
         $this->render('libraryDocument', array('file' => $file, 'mime' => $mime, 'item' => $this->item, 'category' => $this->category, 'editable' => $this->editable));
     }
 }
开发者ID:tejrajs,项目名称:humhub-modules-library,代码行数:18,代码来源:LibraryItemWidget.php

示例2: handleFileUpload

 /**
  * Handles a single upload by given CUploadedFile and returns an array
  * of informations.
  *
  * The 'error' attribute of the array, indicates there was an error.
  *
  * Informations on error:
  *       - error: true
  *       - errorMessage: some message
  *       - name: name of the file
  *       - size: file size
  *
  * Informations on success:
  *      - error: false
  *      - name: name of the uploaded file
  *      - size: file size
  *      - guid: of the file
  *      - url: url to the file
  *      - thumbnailUrl: url to the thumbnail if exists
  *
  * @param type $cFile
  * @return Array Informations about the uploaded file
  */
 protected function handleFileUpload($cFile, $object = null)
 {
     $output = [];
     $file = new PublicFile();
     $file->setUploadedFile($cFile);
     if ($object != null) {
         $file->object_id = $object->getPrimaryKey();
         $file->object_model = get_class($object);
     }
     if ($file->validate() && $file->save()) {
         $output['error'] = false;
         $output['guid'] = $file->guid;
         $output['name'] = $file->file_name;
         $output['title'] = $file->title;
         $output['size'] = $file->size;
         $output['mimeIcon'] = HHtml::getMimeIconClassByExtension($file->getExtension());
     } else {
         $output['error'] = true;
         $output['errors'] = $file->getErrors();
     }
     $output['name'] = $file->file_name;
     $output['size'] = $file->size;
     $output['deleteUrl'] = "";
     $output['deleteType'] = "";
     $output['url'] = "";
     $output['thumbnailUrl'] = "";
     return $output;
 }
开发者ID:rafapaul,项目名称:humhub-modules-album,代码行数:51,代码来源:ImageController.php

示例3: foreach

<br><br>
	    </div>
	    <br><br>
	    <hr>
	    <?php 
if (count($files) != 0) {
    ?>
	    	<ul class="files" style="list-style: none; margin: 0;" id="files-<?php 
    echo $document->getPrimaryKey();
    ?>
">
	    	<?php 
    foreach ($files as $file) {
        ?>
	    		<li class="mime <?php 
        echo HHtml::getMimeIconClassByExtension($file->getExtension());
        ?>
">
	    			<a href="<?php 
        echo $file->getUrl();
        ?>
" target="_blank"><?php 
        echo Helpers::trimText($file->file_name, 40);
        ?>
 
	    				<span class="tome"> - <?php 
        echo Yii::app()->format->formatSize($file->size);
        ?>
</span></a>
	    		</li>
	    	<?php 
开发者ID:nilBora,项目名称:MVC_documents_Yii,代码行数:31,代码来源:entry.php


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