Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

(no description)

File Size: 420 lines (12 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 0 files

Defines 16 functions


Functions that are not part of a class:

fullPath($path,$dirsep=DIRECTORY_SEPARATOR)   X-Ref
Function expands all relative parts of supplied path string thus
removing things like ../../ or ./../.

param: string $path
param: string $dirsep Character that represents directory separator should be
return: string

stripUrl($path, $rootDir='')   X-Ref
Function strips url part from css link

param: string $path
param: string $rootDir
return: string

toNativePath(&$path)   X-Ref
Converts direcotry separator in given path to / to validate in CC
Value is passed byref hence variable itself is changed

param: string $path

toNativePath2(&$path)   X-Ref
Converts direcotry separator in given path to the one on the server platform
Value is passed byref hence variable itself is changed

param: string $path

toUrlPath(&$path)   X-Ref
Converts \ Directory separator to the / more suitable for URL

param: string $path

pathDiff($path1, $path2)   X-Ref
Returns relative path from two directories with full path

param: string $path1
param: string $path2
return: string

copyr($source, $dest)   X-Ref
Copy a file, or recursively copy a folder and its contents

param: string   $source    Source path
param: string   $dest      Destination path
author: Aidan Lister <aidan@php.net>
return: bool     Returns TRUE on success, FALSE on failure

getDirectories($rootDir, $contains, $excludeitems = null, $startswith = true)   X-Ref
Function returns array with directories contained in folder (only first level)

param: string $rootDir  directory to look into
param: string $contains which string to look for
param: array  $excludeitems array of names to be excluded
param: bool   $startswith should the $contains value be searched only from
return: array  Returns array of sub-directories. In case $rootDir path is

getFilesOnly($rootDir, $contains, $excludeitems = null, $startswith = true,$extension=null)   X-Ref
No description

search_ident_by_name($array,$name)   X-Ref
Search an identifier in array

param: array $array
param: string $name

getRawFiles($startDir, &$fhandle, $rootDir='', $excludedirs = null, $excludefileext = null)   X-Ref
Function returns files recursivly with appeneded relative path

param: string $startDir
param: string $rootDir
param: array $excludedirs
param: array $excludefileext
return: array

getRawFiles2($startDir,&$arr, $rootDir='', $excludedirs = null, $excludefileext = null)   X-Ref
No description

GetFiles($startDir, $outfile, $rootDir='', $excludedirs = null, $excludefileext = null)   X-Ref
No description

GetFilesArray($startDir, $rootDir='', $excludedirs = null, $excludefileext = null)   X-Ref
Function to get an array with all files in a directory and subdirectories

param: string $startDir
param: string $rootDir
param: string $excludedirs
param: string $excludefileext
return: array

getCourseDirs($rootDir, $contains, $excludeitems=null, $startswith=true)   X-Ref
Function returns array with directories contained in folder (only first level)
simmilar to getDirectories but returned items are naturally sorted.

param: string $rootDir
param: string $contains
param: array $excludeitems
param: bool $startswith
return: array

rmdirr($dirname)   X-Ref
Delete a directory recursive with files inside

param: string $dirname
return: bool