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


PHP backslashToSlash函数代码示例

本文整理汇总了PHP中backslashToSlash函数的典型用法代码示例。如果您正苦于以下问题:PHP backslashToSlash函数的具体用法?PHP backslashToSlash怎么用?PHP backslashToSlash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

    /**
     * constructor
     *
     */
    function __construct()
    {
    	//check if the session folder read and writable
    		$dir = new file();
	        if(!file_exists(CONFIG_SYS_DIR_SESSION_PATH))
	        {
	           if(!$dir->mkdir(CONFIG_SYS_DIR_SESSION_PATH))
	           {
	              die('Unable to create session folder.');
	           }
	        }
    		if(!$dir->isReadable(CONFIG_SYS_DIR_SESSION_PATH))
    		{
    			die('Permission denied: ' . CONFIG_SYS_DIR_SESSION_PATH . " is not readable.");
    		}    		
    		if(!$dir->isWritable(CONFIG_SYS_DIR_SESSION_PATH))
    		{
    			die('Permission denied: ' . CONFIG_SYS_DIR_SESSION_PATH . " is not writable.");
    		}
    	$this->dir = backslashToSlash(addTrailingSlash(CONFIG_SYS_DIR_SESSION_PATH));
        $this->lifeTime = get_cfg_var("session.gc_maxlifetime");  
        $this->gcCounterFile = $this->dir . $this->gcCounterFileName; 
        $this->gcLogFile = $this->dir  . $this->gcLogFileName;
       	$this->sessionDir = backslashToSlash($this->dir.session_id().DIRECTORY_SEPARATOR);
        $this->init();    	
    }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:30,代码来源:class.session.php

示例2: file

							$obj = new file($path);
							$tem = $obj->getFileInfo();							
							if(sizeof($tem))
							{	
								include_once(CLASS_MANAGER);
							
								$manager = new manager($upload->getFilePath(), false);			
															
								$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);		
开发者ID:hungnv0789,项目名称:vhtm,代码行数:30,代码来源:ajax_file_upload.php

示例3: manager

         $tem = $objFile->getFileInfo();
         $obj = new manager($finalPath, false);
         $fileType = $obj->getFileType($finalPath, is_dir($finalPath) ? true : false);
         foreach ($fileType as $k => $v) {
             $tem[$k] = $v;
         }
         /*								foreach ($folderInfo as $k=>$v)
         								{
         									$tem['i_' . $k] = $v;
         								}
         								if($folderInfo['type'] == 'folder' && empty($folderInfo['subdir']) &&  empty($folderInfo['file']))
         								{
         									$tem['cssClass'] = 'folderEmpty';
         								}*/
         $tem['final_path'] = $finalPath;
         $tem['path'] = backslashToSlash($finalPath);
         $tem['type'] = is_dir($finalPath) ? 'folder' : 'file';
         $tem['size'] = @transformFileSize($tem['size']);
         $tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
         $tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
         $tem['flag'] = 'noFlag';
         $tem['url'] = getFileUrl($doc);
         $manager = null;
         if ($sessionAction->getAction() == "cut") {
             $file->delete($doc);
         }
         $fileMoved[sizeof($fileMoved)] = $tem;
         $tem = null;
     }
 } else {
     $unmovedDocDueToSamePath[] = $doc;
开发者ID:oanav,项目名称:closetshare,代码行数:31,代码来源:ajax_file_paste.php

示例4: doSearch

		/**
		 * get the file according to the search keywords
		 *
		 */
		function doSearch($baseFolderPath = null)
		{
			
			$baseFolderPath = addTrailingSlash(backslashToSlash((is_null($baseFolderPath)?$this->rootFolder:$baseFolderPath)));
			
			$dirHandler = @opendir($baseFolderPath);
			if($dirHandler)
			{
				while(false !== ($file = readdir($dirHandler)))
				{
					if($file != '.' && $file != '..')
					{
						$path = $baseFolderPath . $file;
						if(is_file($path))
						{
							$isValid = true;

							$fileTime = @filemtime($path);
							$fileSize = @filesize($path);	
							if($this->searchkeywords['name'] !== ''  && @eregi($this->searchkeywords['name'], $file) === false)
							{
								$isValid = false;
							}
							if($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from']))
							{
								$isValid = false;
							}
							if($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to']))
							{
								$isValid = false;
							}							
							if($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from']))
							{
								$isValid = false;
							}
							if($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to']))
							{
								$isValid = false;
							}			
							if($isValid && isListingDocument($path))
							{
								$finalPath = $path;
								$objFile = new file($finalPath);
								$tem = $objFile->getFileInfo();
								$obj = new manager($finalPath, false);			
								$obj->setSessionAction($this->sessionAction);
								$selectedDocuments = $this->sessionAction->get();													
								$fileType = $obj->getFileType($finalPath);
								
								foreach($fileType as $k=>$v)
								{
									$tem[$k] = $v;
								}
								
								$tem['path'] = backslashToSlash($finalPath);		
								$tem['type'] = (is_dir($finalPath)?'folder':'file');
/*								$tem['size'] = transformFileSize($tem['size']);
								$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
								$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);*/
								$tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag');
								$tem['url'] = getFileUrl($tem['path']);
								$this->rootFolderInfo['file']++;
								$manager = null;
								$this->files[] = $tem;
								$tem = null;								
							}
						}elseif(is_dir($path) && $this->searchkeywords['recursive'])
						{
							$this->Search($baseFolderPath);
						}
					}
				}
			}
			 
		}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:79,代码来源:class.search.php

示例5: getParentFolderPath

  /**
   * get the parent path of the specified path
   *
   * @param string $path
   * @return string 
   */
  function getParentFolderPath($path)
  {
  	$realPath = addTrailingSlash(backslashToSlash(getRealPath($path)));
  	$parentRealPath =  addTrailingSlash(backslashToSlash(dirname($realPath)));
  	$differentPath = addTrailingSlash(substr($realPath, strlen($parentRealPath)));
  	$parentPath = substr($path, 0, strlen(addTrailingSlash(backslashToSlash($path))) - strlen($differentPath));
/*  	echo $realPath . "<br>";
  	echo $parentRealPath . "<br>";
  	echo $differentPath . "<br>";
  	echo $parentPath . "<br>";*/
  	if(isUnderRoot($parentPath))
  	{
  		return $parentPath;
  	}else 
  	{
  		return CONFIG_SYS_DEFAULT_PATH;
  	}
  }
开发者ID:Ting-Article,项目名称:Interview,代码行数:24,代码来源:function.base.php

示例6: echo

	          						ajaxStart('#searchFolderContainer');		
	          						$('#searchFolderContainer').load('<?php echo CONFIG_URL_LOAD_FOLDERS; ?>');
	          					}
	          				);
	          			</script>
	          			<?php
	          		}else 
	          		{
	          	?>
		            <select class="input inputSearch" name="search_folder" id="search_folder">
		            	<?php 
		            		
										foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
										{
											?>
		                  <option value="<?php echo $v; ?>" <?php echo (removeTrailingSlash(backslashToSlash(($folderInfo['path']))) == removeTrailingSlash(backslashToSlash(($v)))?' selected="selected"':''); ?>><?php echo shortenFileName($k, 30); ?></option>
		                  <?php 
										}
		            		
									?>            	
		            </select>
		      <?php
	          		}
		      ?></span>
	          </td>
	         </tr>  
        		<tr>
        			<td>
        		<b><?php echo LBL_SEARCH_MTIME; ?></b><br />
        		<input type="text" class="input inputMtime" name="search_mtime_from" id="search_mtime_from" value="<?php echo (!empty($_GET['search_mtime_from'])?$_GET['search_mtime_from']:''); ?>" /> 
        		<span class="leftToRightArrow">&nbsp;</span>
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:ajaxfilemanager.php

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

示例8: getCurrentFolderPath

  function getCurrentFolderPath()
  {
  		$folderPathIndex = 'path';
  		$lastVisitedFolderPathIndex = 'ajax_last_visited_folder';
		if(isset($_GET[$folderPathIndex]) && file_exists($_GET[$folderPathIndex]) && !is_file($_GET[$folderPathIndex]) )
		{
			$currentFolderPath = $_GET[$folderPathIndex];
		}
		elseif(isset($_SESSION[$lastVisitedFolderPathIndex]) && file_exists($_SESSION[$lastVisitedFolderPathIndex]) && !is_file($_SESSION[$lastVisitedFolderPathIndex]))
		{
			$currentFolderPath = $_SESSION[$lastVisitedFolderPathIndex];
		}else
		{
			$currentFolderPath = CONFIG_SYS_DEFAULT_PATH;
		}
		
		$currentFolderPath = (isUnderRoot($currentFolderPath)?backslashToSlash((addTrailingSlash($currentFolderPath))):CONFIG_SYS_DEFAULT_PATH);
		
		//keep track of this folder path in session 
		$_SESSION[$lastVisitedFolderPathIndex] = $currentFolderPath;
		

		if(!file_exists($currentFolderPath))
		{
			die(ERR_FOLDER_NOT_FOUND . $currentFolderPath);
		}  	
  }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:27,代码来源:function.base.php

示例9: removeTrailingSlash

<script type="text/javascript" src="js/jqModal.js"></script>
<script type="text/javascript" src="js/rotate.js"></script>
<script type="text/javascript" src="js/interface.js"></script>-->


<script type="text/javascript" src="js/ajaximageeditor.js"></script>






<script type="text/javascript">
	var imageHistory = false;
	var currentFolder =  '<?php 
echo removeTrailingSlash(backslashToSlash(dirname($path)));
?>
';
	var warningLostChanges = '<?php 
echo IMG_WARNING_LOST_CHANAGES;
?>
';
	var warningReset = '<?php 
echo IMG_WARNING_REST;
?>
';
	var warningResetEmpty = '<?php 
echo IMG_WARNING_EMPTY_RESET;
?>
';
	var warningEditorClose = '<?php 
开发者ID:rip-projects,项目名称:judge,代码行数:31,代码来源:ajax_image_editor.php

示例10: foreach

                <?php 
} else {
    ?>

                    <select class="input inputSearchSelect" name="search_folder" id="search_folder">
                        <!-- Chamilo integrating, modify name class for disable by css -->
                        <?php 
    foreach (getFolderListing(CONFIG_SYS_ROOT_PATH) as $k => $v) {
        if (hideFolderName($k)) {
            //show only those permitted by Chamilo
            ?>
                                <option value="<?php 
            echo $v;
            ?>
" <?php 
            echo removeTrailingSlash(backslashToSlash($folderInfo['path'])) == removeTrailingSlash(backslashToSlash($v)) ? ' selected="selected"' : '';
            ?>
><?php 
            echo hideFolderName(shortenFileName($k, 30));
            ?>
                                </option>
                            <?php 
        }
    }
    ?>
                    </select>
                <?php 
}
?>
</span>
                    <b><?php 
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:ajaxfilemanager.php

示例11: removeTrailingSlash

<script type="text/javascript" src="jscripts/select.js"></script>
<script type="text/javascript" src="jscripts/jqModal.js"></script>
<script type="text/javascript" src="jscripts/rotate.js"></script>
<script type="text/javascript" src="jscripts/interface.js"></script>-->


<script type="text/javascript" src="jscripts/ajaximageeditor.js"></script>






<script type="text/javascript">
	var imageHistory = false;
	var currentFolder =  '<?php echo removeTrailingSlash(backslashToSlash(dirname($path))); ?>';
	var warningLostChanges = '<?php echo IMG_WARNING_LOST_CHANAGES; ?>';
	var warningReset = '<?php echo IMG_WARNING_REST; ?>';
	var warningResetEmpty = '<?php echo IMG_WARNING_EMPTY_RESET; ?>';
	var warningEditorClose = '<?php echo IMG_WARING_WIN_CLOSE; ?>';
	var warningUndoImage = '<?php echo IMG_WARNING_UNDO; ?>';
	var warningFlipHorizotal = '<?php echo IMG_WARING_FLIP_H; ?>';
	var warningFlipVertical = '<?php echo IMG_WARING_FLIP_V; ?>';
	var numSessionHistory = <?php echo $history->getNumRestorable(); ?>;
	var noChangeMadeBeforeSave = '<?php echo IMG_WARNING_NO_CHANGE_BEFORE_SAVE; ?>';
	var warningInvalidNewName = '<?php echo IMG_SAVE_AS_ERR_NAME_INVALID; ?>';
	var wordCloseWindow = '<?php echo LBL_ACTION_CLOSE; ?>';
	var warningNoFolderSelected = '<?php echo IMG_SAVE_AS_NOT_FOLDER_SELECTED; ?>';
	var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>';
	$(document).ready(
		function()
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:ajax_image_editor.php

示例12: get_lang

             if (!$is_allowed_to_edit && DocumentManager::check_readonly($_course, api_get_user_id(), $chamiloPath)) {
                 $error = get_lang('CantDeleteReadonlyFiles');
                 //From Chamilo to Ajaxfilemanager
             } else {
                 $deleted = DocumentManager::delete_document($_course, $chamiloPath, $base_work_dir);
                 //deleted by Chamilo
                 //$file->delete(addTrailingSlash(backslashToSlash($doc))); // disabled deleted by ajaxfilemanager
             }
         } else {
             $error = get_lang('ProtectFolder');
             //From Chamilo to Ajaxfilemanager
         }
     } else {
         $file->delete(addTrailingSlash(backslashToSlash($doc)));
         //deleted by ajaxfilemanager
         event_system(LOG_USER_PERSONAL_DOC_DELETED, 'document_path', addTrailingSlash(backslashToSlash($doc)));
         event_system(LOG_MY_FOLDER_DELETE, LOG_MY_FOLDER_PATH, $doc);
     }
     //////end bridge to Chamilo
 } elseif (is_file($doc) && isValidPattern(CONFIG_SYS_INC_FILE_PATTERN, $doc) && !isInvalidPattern(CONFIG_SYS_EXC_FILE_PATTERN, $doc)) {
     /////////////bridge to Chamilo by Juan Carlos Ra�a Trabado
     if (!empty($_course['path'])) {
         //find path
         $mainPath = '../../../../../../../courses/' . $_course['path'] . '/document/';
         //get Chamilo
         $fullPath = $doc;
         //get Ajaxfilemanager
         $chamiloPath = substr($fullPath, strlen($mainPath) - strlen($fullPath) - 1);
         //find base_work_dir
         $course_dir = $_course['path'] . "/document";
         //get Chamilo
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:ajax_delete_file.php

示例13: basename

							if($file->copyTo($doc, $_GET['current_folder_path']))
							{
								
								$finalPath = $destFolderPath . basename($doc);
								$objFile = new file($finalPath);
								$tem = $objFile->getFileInfo();
								$obj = new manager($finalPath, false);			
														
								$fileType = $obj->getFileType($finalPath);
								
								foreach($fileType as $k=>$v)
								{
									$tem[$k] = $v;
								}
								
								$tem['path'] = backslashToSlash($doc);		
								$tem['type'] = (is_dir($finalPath)?'folder':'file');
								$tem['size'] = @transformFileSize($tem['size']);
								$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
								$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
								$tem['flag'] = 'noFlag';
								$tem['url'] = getFileUrl($doc);
		
								$manager = null;
								if($sessionAction->getAction() == "cut")
								{
									$file->delete($doc);
								}
								$fileMoved[sizeof($fileMoved)] = $tem;
								$tem = null;
							}							
开发者ID:Ting-Article,项目名称:Interview,代码行数:31,代码来源:ajax_file_paste.php

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

示例15: getNextAvailableFileName

 /**
  * get next available file name
  *
  * @param string $fileToMove the path of the file will be moved to
  * @param string $destFolder the path of destination folder
  * @return string
  */
 function getNextAvailableFileName($fileToMove, $destFolder)
 {
     $folderPath = addslashes(backslashToSlash(getParentPath($fileToMove)));
     $destFolder = addslashes(backslashToSlash(getParentPath($destFolder)));
     $finalPath = $destFolder . basename($fileToMove);
     if (file_exists($fileToMove)) {
         if (is_file()) {
             $fileExt = getFileExt($fileToMove);
             $fileBaseName = basename($fileToMove, '.' . $fileExt);
             $count = 1;
             while (file_exists($destFolder . $fileBaseName . $count . "." . $fileExt)) {
                 $count++;
             }
             $filePath = $destFolder . $fileBaseName . $count . "." . $fileExt;
         } elseif (is_dir()) {
             $folderName = basename($fileToMove);
             $count = 1;
             while (file_exists($destFolder . $folderName . $count)) {
                 $count++;
             }
             $filePath = $destFolder . $fileBaseName . $count;
         }
     }
     return $finalPath;
 }
开发者ID:rip-projects,项目名称:judge,代码行数:32,代码来源:class.file.php


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