original_string: public static function getFilesInDir($path, $extensionList = '', $prependPath = FALSE, $order = '', $excludePattern = '') {
  
  			// Initialize variables:
  		$filearray = array();
  		$sortarray = array();
  		$path = rtrim($path, '/');
  
  			// Find files+directories:
  		if (@is_dir($path)) {
  			$extensionList = strtolower($extensionList);
  			$d = dir($path);
  			if (is_object($d)) {
  				while ($entry = $d->read()) {
  					if (@is_file($path . '/' . $entry)) {
  						$fI = pathinfo($entry);
  						$key = md5($path . '/' . $entry); // Don't change this ever - extensions may depend on the fact that the hash is an md5 of the path! (import/export extension)
  						if ((!strlen($extensionList) || self::inList($extensionList, strtolower($fI['extension']))) && (!strlen($excludePattern) || !preg_match('/^' . $excludePattern . '$/', $entry))) {
  							$filearray[$key] = ($prependPath ? $path . '/' : '') . $entry;
  							if ($order == 'mtime') {
  								$sortarray[$key] = filemtime($path . '/' . $entry);
  							}
  							elseif ($order) {
  								$sortarray[$key] = strtolower($entry);
  							}
  						}
  					}
  				}
  				$d->close();
  			} else {
  				return 'error opening path: "' . $path . '"';
  			}
  		}
  
  			// Sort them:
  		if ($order) {
  			asort($sortarray);
  			$newArr = array();
  			foreach ($sortarray as $k => $v) {
  				$newArr[$k] = $filearray[$k];
  			}
  			$filearray = $newArr;
  		}
  
  			// Return result
  		reset($filearray);
  		return $filearray;
  	}
code: public static function getFilesInDir($path, $extensionList = '', $prependPath = FALSE, $order = '', $excludePattern = '') {
  
  			// Initialize variables:
  		$filearray = array();
  		$sortarray = array();
  		$path = rtrim($path, '/');
  
  			// Find files+directories:
  		if (@is_dir($path)) {
  			$extensionList = strtolower($extensionList);
  			$d = dir($path);
  			if (is_object($d)) {
  				while ($entry = $d->read()) {
  					if (@is_file($path . '/' . $entry)) {
  						$fI = pathinfo($entry);
  						$key = md5($path . '/' . $entry); // Don't change this ever - extensions may depend on the fact that the hash is an md5 of the path! (import/export extension)
  						if ((!strlen($extensionList) || self::inList($extensionList, strtolower($fI['extension']))) && (!strlen($excludePattern) || !preg_match('/^' . $excludePattern . '$/', $entry))) {
  							$filearray[$key] = ($prependPath ? $path . '/' : '') . $entry;
  							if ($order == 'mtime') {
  								$sortarray[$key] = filemtime($path . '/' . $entry);
  							}
  							elseif ($order) {
  								$sortarray[$key] = strtolower($entry);
  							}
  						}
  					}
  				}
  				$d->close();
  			} else {
  				return 'error opening path: "' . $path . '"';
  			}
  		}
  
  			// Sort them:
  		if ($order) {
  			asort($sortarray);
  			$newArr = array();
  			foreach ($sortarray as $k => $v) {
  				$newArr[$k] = $filearray[$k];
  			}
  			$filearray = $newArr;
  		}
  
  			// Return result
  		reset($filearray);
  		return $filearray;
  	}
code_tokens: public static function getFilesInDir ( $ path , $ extensionList = '' , $ prependPath = FALSE , $ order = '' , $ excludePattern = '' ) { // Initialize variables: $ filearray = array ( ) ; $ sortarray = array ( ) ; $ path = rtrim ( $ path , '/' ) ; // Find files+directories: if ( @ is_dir ( $ path ) ) { $ extensionList = strtolower ( $ extensionList ) ; $ d = dir ( $ path ) ; if ( is_object ( $ d ) ) { while ( $ entry = $ d -> read ( ) ) { if ( @ is_file ( $ path . '/' . $ entry ) ) { $ fI = pathinfo ( $ entry ) ; $ key = md5 ( $ path . '/' . $ entry ) ; // Don't change this ever - extensions may depend on the fact that the hash is an md5 of the path! (import/export extension) if ( ( ! strlen ( $ extensionList ) || self :: inList ( $ extensionList , strtolower ( $ fI [ 'extension' ] ) ) ) && ( ! strlen ( $ excludePattern ) || ! preg_match ( '/^' . $ excludePattern . '$/' , $ entry ) ) ) { $ filearray [ $ key ] = ( $ prependPath ? $ path . '/' : '' ) . $ entry ; if ( $ order == 'mtime' ) { $ sortarray [ $ key ] = filemtime ( $ path . '/' . $ entry ) ; } elseif ( $ order ) { $ sortarray [ $ key ] = strtolower ( $ entry ) ; } } } } $ d -> close ( ) ; } else { return 'error opening path: "' . $ path . '"' ; } } // Sort them: if ( $ order ) { asort ( $ sortarray ) ; $ newArr = array ( ) ; foreach ( $ sortarray as $ k => $ v ) { $ newArr [ $ k ] = $ filearray [ $ k ] ; } $ filearray = $ newArr ; } // Return result reset ( $ filearray ) ; return $ filearray ; }
docstring: Returns an array with the names of files in a specific path
  
  @param string $path Is the path to the file
  @param string $extensionList is the comma list of extensions to read only (blank = all)
  @param boolean $prependPath If set, then the path is prepended the file names. Otherwise only the file names are returned in the array
  @param string $order is sorting: 1= sort alphabetically, 'mtime' = sort by modification time.
  
  @param string $excludePattern A comma separated list of file names to exclude, no wildcards
  @return array Array of the files found
docstring_tokens: Returns an array with the names of files in a specific path