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


PHP file::close方法代码示例

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


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

示例1: getFileList

 /**
  * get the list of files and folders under this current fold
  *	@return array
  */
 function getFileList()
 {
     $outputs = array();
     $files = array();
     $folders = array();
     $tem = array();
     $dirHandler = @opendir($this->currentFolderPath);
     if ($dirHandler) {
         while (false !== ($file = readdir($dirHandler))) {
             if ($file != '.' && $file != '..') {
                 $flag = $this->flags['no'];
                 if ($this->sessionAction->getFolder() == $this->currentFolderPath) {
                     //check if any flag associated with this folder or file
                     $folder = addTrailingSlash(backslashToSlash($this->currentFolderPath));
                     if (in_array($folder . $file, $this->sessionAction->get())) {
                         if ($this->sessionAction->getAction() == "copy") {
                             $flag = $this->flags['copy'];
                         } else {
                             $flag = $this->flags['cut'];
                         }
                     }
                 }
                 $path = $this->currentFolderPath . $file;
                 if (is_dir($path) && isListingDocument($path)) {
                     $this->currentFolderInfo['subdir']++;
                     if (!$this->calculateSubdir) {
                     } else {
                         $folder = $this->getFolderInfo($path);
                         $folder['flag'] = $flag;
                         $folders[$file] = $folder;
                         $outputs[$file] = $folders[$file];
                     }
                 } elseif (is_file($path) && isListingDocument($path)) {
                     $obj = new file($path);
                     $tem = $obj->getFileInfo();
                     if (sizeof($tem)) {
                         $fileType = $this->getFileType($file);
                         foreach ($fileType as $k => $v) {
                             $tem[$k] = $v;
                         }
                         $this->currentFolderInfo['size'] += $tem['size'];
                         $this->currentFolderInfo['file']++;
                         $tem['path'] = backslashToSlash($path);
                         $tem['type'] = "file";
                         $tem['flag'] = $flag;
                         $files[$file] = $tem;
                         $outputs[$file] = $tem;
                         $tem = array();
                         $obj->close();
                     }
                 }
             }
         }
         if ($this->forceFolderOnTop) {
             uksort($folders, "strnatcasecmp");
             uksort($files, "strnatcasecmp");
             $outputs = array();
             foreach ($folders as $v) {
                 $outputs[] = $v;
             }
             foreach ($files as $v) {
                 $outputs[] = $v;
             }
         } else {
             uksort($outputs, "strnatcasecmp");
         }
         @closedir($dirHandler);
     } else {
         trigger_error('Unable to locate the folder ' . $this->currentFolderPath, E_NOTICE);
     }
     return $outputs;
 }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:76,代码来源:class.manager.php

示例2: getFileList

 /**
  * get the list of files and folders under this current fold
  * 	@return array
  */
 function getFileList()
 {
     $outputs = array();
     $files = array();
     $folders = array();
     $tem = array();
     $to_group_id = api_get_group_id();
     global $is_user_in_group;
     $dirHandler = @opendir($this->getCurrentFolderPath());
     if ($dirHandler) {
         while (false !== ($file = readdir($dirHandler))) {
             if ($file != '.' && $file != '..') {
                 $flag = $this->flags['no'];
                 if ($this->sessionAction->getFolder() == $this->getCurrentFolderPath()) {
                     //check if any flag associated with this folder or file
                     $folder = addTrailingSlash(backslashToSlash($this->getCurrentFolderPath()));
                     if (in_array($folder . $file, $this->sessionAction->get())) {
                         if ($this->sessionAction->getAction() == "copy") {
                             $flag = $this->flags['copy'];
                         } else {
                             $flag = $this->flags['cut'];
                         }
                     }
                 }
                 $path = $this->getCurrentFolderPath() . $file;
                 if (is_dir($path) && isListingDocument($path)) {
                     $this->currentFolderInfo['subdir']++;
                     //fix count left folders for Chamilo
                     $deleted_by_Chamilo_folder = '_DELETED_';
                     $css_folder_Chamilo = 'css';
                     $hotpotatoes_folder_Chamilo = 'HotPotatoes_files';
                     $chat_files_Chamilo = 'chat_files';
                     $certificates_Chamilo = 'certificates';
                     //show group's directory only if I'm member. Or if I'm a teacher.
                     //@todo: check groups not necessary because the student dont have access to main folder documents (only to document/group or document/shared_folder).
                     //Teachers can access to all groups ?
                     $group_folder = '_groupdocs';
                     $hide_doc_group = false;
                     if (preg_match("/{$group_folder}/", $path)) {
                         $hide_doc_group = true;
                         if ($is_user_in_group || $to_group_id != 0 && api_is_allowed_to_edit()) {
                             $hide_doc_group = false;
                         }
                     }
                     if (preg_match("/{$deleted_by_Chamilo_folder}/", $path) || preg_match("/{$css_folder_Chamilo}/", $path) || preg_match("/{$hotpotatoes_folder_Chamilo}/", $path) || preg_match("/{$chat_files_Chamilo}/", $path) || preg_match("/{$certificates_Chamilo}/", $path) || $hide_doc_group || $file[0] == '.') {
                         $this->currentFolderInfo['subdir'] = $this->currentFolderInfo['subdir'] - 1;
                     }
                     //end fix for Chamilo
                     if (!$this->calculateSubdir) {
                     } else {
                         $folder = $this->getFolderInfo($path);
                         $folder['flag'] = $flag;
                         $folders[$file] = $folder;
                         $outputs[$file] = $folders[$file];
                     }
                 } elseif (is_file($path) && isListingDocument($path)) {
                     $obj = new file($path);
                     $tem = $obj->getFileInfo();
                     if (sizeof($tem)) {
                         $fileType = $this->getFileType($file);
                         foreach ($fileType as $k => $v) {
                             $tem[$k] = $v;
                         }
                         $this->currentFolderInfo['size'] += $tem['size'];
                         $this->currentFolderInfo['file']++;
                         //fix count left files for Chamilo
                         $deleted_by_Chamilo_file = ' DELETED ';
                         // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
                         if (preg_match("/{$deleted_by_Chamilo_file}/", $tem['name']) || $tem['name'][0] == '.') {
                             $this->currentFolderInfo['file'] = $this->currentFolderInfo['file'] - 1;
                         }
                         ///end fix for Chamilo
                         //Try a course file
                         $tem['path'] = backslashToSlash($path);
                         $pos = strpos($this->getCurrentFolderPath(), 'courses/');
                         if ($pos === false) {
                             //try my_files
                             $pos = strpos($this->getCurrentFolderPath(), 'main/');
                             $tem['public_path'] = api_get_path(WEB_PATH) . substr($this->getCurrentFolderPath(), $pos, strlen($this->getCurrentFolderPath())) . $file;
                         } else {
                             $tem['public_path'] = api_get_path(WEB_PATH) . substr($this->getCurrentFolderPath(), $pos, strlen($this->getCurrentFolderPath())) . $file;
                         }
                         $tem['type'] = "file";
                         $tem['flag'] = $flag;
                         $files[$file] = $tem;
                         $outputs[$file] = $tem;
                         $tem = array();
                         $obj->close();
                     }
                 }
             }
         }
         if ($this->forceFolderOnTop) {
             uksort($folders, "strnatcasecmp");
             uksort($files, "strnatcasecmp");
             $outputs = array();
//.........这里部分代码省略.........
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:class.manager.php

示例3: backslashToSlash

															
								$fileType = $manager->getFileType($upload->getFileName());

								foreach($fileType as $k=>$v)
								{
									$tem[$k] = $v;
								}
								
								$tem['path'] = backslashToSlash($path);		
								$tem['type'] = "file";
								$tem['size'] = transformFileSize($tem['size']);
								$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
								$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
								$tem['short_name'] = shortenFileName($tem['name']);						
								$tem['flag'] = 'noFlag';
								$obj->close();
								foreach($tem as $k=>$v)
								{
										$info .= sprintf(", %s:'%s'", $k, $v);									
								}

								$info .= sprintf(", url:'%s'",  getFileUrl($path));
								$info .= sprintf(", tipedit:'%s'",  TIP_DOC_RENAME);		

																				
							}else 
							{
								$error = ERR_FILE_NOT_AVAILABLE;
							}

开发者ID:hungnv0789,项目名称:vhtm,代码行数:28,代码来源:ajax_file_upload.php

示例4: generateFiles

 /**
  * Generate an XML files and save them to the root directory
  * @param array
  */
 protected function generateFiles($arrArchive)
 {
     $this->import('Database');
     $time = time();
     $strType = $arrArchive['format'] == 'atom' ? 'generateAtom' : 'generateRss';
     $strLink = $arrArchive['feedBase'] != '' ? $arrArchive['feedBase'] : $this->Environment->base;
     $strFile = $arrArchive['feedName'];
     $objFeed = new \Feed($strFile);
     $objFeed->link = $strLink;
     $objFeed->title = $arrArchive['title'];
     $objFeed->description = $arrArchive['description'];
     $objFeed->language = $arrArchive['language'];
     $objFeed->published = $arrArchive['tstamp'];
     // Get items
     $objArticleStmt = $this->Database->prepare("SELECT *, (SELECT name FROM tl_user u WHERE u.id=p.author) AS authorName FROM tl_photoalbums2_album p WHERE pid=? AND (start='' OR start<{$time}) AND (stop='' OR stop>{$time}) AND published=1 ORDER BY sorting ASC");
     if ($arrArchive['maxItems'] > 0) {
         $objArticleStmt->limit($arrArchive['maxItems']);
     }
     $objArticle = $objArticleStmt->execute($arrArchive['id']);
     // Get the default URL
     $objParent = \PageModel::findByPk($arrArchive['modulePage']);
     if ($objParent == null) {
         return;
     }
     $objParent = $this->getPageDetails($objParent->id);
     $strUrl = $this->generateFrontendUrl($objParent->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/album/%s', $objParent->language);
     // Parse items
     if ($objArticle !== null) {
         while ($objArticle->next()) {
             // Deserialize image arrays
             $objArticle->images = deserialize($objArticle->images);
             $objArticle->imageSort = deserialize($objArticle->imageSort);
             // Sort images
             $objPa2ImageSorter = new \Pa2ImageSorter($objArticle->imageSortType, $objArticle->images, $objArticle->imageSort);
             $this->arrImages = $objPa2ImageSorter->getSortedUuids();
             $objItem = new \FeedItem();
             $objItem->title = $objArticle->title;
             $objItem->link = sprintf($strLink . $strUrl, $objArticle->alias != '' && !$GLOBALS['TL_CONFIG']['disableAlias'] ? $objArticle->alias : $objArticle->id);
             $objItem->published = $objArticle->startdate;
             $objItem->author = $objArticle->authorName;
             if (is_array($objArticle->arrImages) && count($objArticle->arrImages) > 0) {
                 foreach ($objArticle->arrImages as $image) {
                     if (is_file(TL_ROOT . '/' . $image)) {
                         $objItem->addEnclosure($image);
                     }
                 }
             }
             $objItem->description = $this->replaceInsertTags($objArticle->description);
             $objFeed->addItem($objItem);
         }
     }
     // Create file
     $objRss = new \file($strFile . '.xml');
     $objRss->write($this->replaceInsertTags($objFeed->{$strType}()));
     $objRss->close();
 }
开发者ID:craffft,项目名称:contao-photoalbums2,代码行数:60,代码来源:Pa2.php


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