public static
|
|
public static
|
#
moveUploadedFile( string $source, string $destination, integer $mode = CHMOD_FILE )
Moves an uploaded file to a new location
Moves an uploaded file to a new location
Parameters
- $source
- Path to the source file.
- $destination
- The destination path.
- $mode
- The mode parameter consists of three octal number components specifying access, e.g. 0644
|
public static
boolean
|
#
copy( string $source, string $destination, integer $mode = CHMOD_FILE )
Copies file
Parameters
- $source
- The source path.
- $destination
- The destination path.
- $mode
- The mode parameter consists of three octal number components specifying access, e.g. 0644
Returns
boolean
|
public static
boolean
|
#
copyDir( string $source, string $target )
Copies directory
Parameters
- $source
- The source directory.
- $target
- The destination directory.
Returns
boolean
|
public static
|
#
upload( string $source, string $destination, integer $mode = CHMOD_FILE )
Copy or move uploaded file
Copy or move uploaded file
Parameters
- $source
- The source path.
- $destination
- The destination path.
- $mode
- The mode parameter consists of three octal number components specifying access, e.g. 0644
See
|
public static
|
#
rename( string $oldname, string $newname )
Renames a file or directory
Renames a file or directory
Parameters
- $oldname
- The old name.
- $newname
- The new name.
|
public static
|
#
delete( string $fileName )
Deletes a file
Parameters
- $fileName
- Path to the file.
|
public static
|
#
deleteDir( string $dirname )
Deletes a directory with files and subdirectories
Deletes a directory with files and subdirectories
Parameters
- $dirname
- Path to the directory.
|
public static
|
#
deleteEmptyDirs( string $dirname )
Deletes empty directories
Deletes empty directories
Parameters
- $dirname
- Path to the directory.
|
public static
|
#
write( string $fileName, string $content, integer $mode = CHMOD_FILE )
Binary-safe file write
Parameters
- $fileName
- Path to the file.
- $content
- The string that is to be written.
- $mode
- The mode parameter consists of three octal number components specifying access, e.g. 0644
|
public static
string
|
#
read( string $fileName )
Read all file content
Parameters
Returns
string
|
public static
mixed
|
#
filesize( string $fileName )
Get filesize
Parameters
Returns
mixed filesize or NULL
|
public static
|
#
mkdir( string $pathname, integer $mode = CHMOD, integer $recursive = FALSE )
Makes directory
Parameters
- $pathname
- The directory path.
- $mode
- The mode parameter consists of three octal number components specifying access, e.g. 0644
- $recursive
- Allows the creation of nested directories specified in the pathname. Defaults to FALSE.
|
public static
string
|
#
filenameCorrection( string $fileName )
File name corretion
Parameters
Returns
string
|
public static
string
|
#
pathCorrection( string $path )
Path correction
Parameters
Returns
string
|
public static
string
|
#
getExtension( string $path )
Get extension from path
Parameters
Returns
string
|
public static
boolean
|
#
isValidExtension( string $path, array $aExtensions, boolean $case = FALSE )
Checks if the extension is valid
Checks if the extension is valid
Parameters
- $path
- file path
- $aExtensions
- array of valid extensions
- $case
- case sensitivity
Returns
boolean
|
public static
mixed
|
#
getNestingDirPath( $id, $level = 3, $type = 0 )
Получение пути к директории определенного уровня вложенности по идентификатору сущности.
Например, для сущности с кодом 17 и уровнем вложенности 3 вернется строка 0/1/7 или массив из 3-х элементов - 0,1,7
Для сущности с кодом 23987 и уровнем вложенности 3 возвращается строка 2/3/9 или массив из 3-х элементов - 2,3,9.
Получение пути к директории определенного уровня вложенности по идентификатору сущности.
Например, для сущности с кодом 17 и уровнем вложенности 3 вернется строка 0/1/7 или массив из 3-х элементов - 0,1,7
Для сущности с кодом 23987 и уровнем вложенности 3 возвращается строка 2/3/9 или массив из 3-х элементов - 2,3,9.
Parameters
- $id
- сущности
- $level
- вложенности, по умолчанию 3
- $type
- возвращаемого результата, 0 (по умолчанию) - строка, 1 - массив
Returns
mixed строка или массив названий групп
|
public static
string
|
#
convertfileNameToLocalEncoding( string $fileName )
Convert file name to local encoding
Convert file name to local encoding
Parameters
Returns
string
|
public static
string
|
#
convertfileNameFromLocalEncoding( string $fileName )
Convert file name from local encoding
Convert file name from local encoding
Parameters
Returns
string
|
public static
|
|
public static
|
#
download( string $file, string $fileName, array $param = array() )
Вывод содержимого файла
Parameters
- $file
- путь к файлу
- $fileName
- имя файла
- $param
массив дополнительных параметров
- $param['content_disposition'] заголовок, определяющий вывод файла
(inline - открывается в браузере (по умолчанию), attachment - скачивается)
<?php
$file = CMS_FOLDER . 'file.dat';
$fileName = 'Пользовательское_имя_файла.dat';
Core_File::download($file, $fileName);
exit();
?>
|
public static
string
|
#
getFilePerms( string $filename, integer $octalValue = FALSE )
Получение строки прав доступа к файлу
Получение строки прав доступа к файлу
Parameters
- $filename
- имя файла
- $octalValue
тип строки (TRUE - "-rw-rw-rw-"; FALSE - "0755")
<?php
$filename = CMS_FOLDER . 'index.php';
$type = 1;
$fileperms = Core_File::getFilePerms($filename, TRUE);
echo $fileperms;
?>
Returns
string строка прав доступа к файлу
|
public static
string
|
#
getFileOwners( string $filename )
Получение строки владельцев к файлу
Получение строки владельцев к файлу
Parameters
Returns
string строка владельцев к файлу
|
public static
array
|
#
adminUpload( array $param )
Загрузка файлов в центре администрирования
Загрузка файлов в центре администрирования
Parameters
- $param
массив параметров
- $param['large_image_source'] путь к файлу-источнику большого изображения
- $param['small_image_source'] путь к файлу-источнику малого изображения
- $param['large_image_name'] оригинальное имя файла большого изображения
- $param['small_image_name'] оригинальное имя файла малого изображения
- $param['large_image_target'] путь к создаваемому файлу большого изображения
- $param['small_image_target'] путь к создаваемому файлу малого изображения
- $param['create_small_image_from_large'] использовать большое изображение для создания малого (TRUE - использовать (по умолчанию), FALSE - не использовать)
- $param['large_image_max_width'] значение максимальной ширины большого изображения
- $param['large_image_max_height'] значение максимальной высоты большого изображения
- $param['small_image_max_width'] значение максимальной ширины малого изображения
- $param['small_image_max_height'] значение максимальной высоты малого изображения
- $param['watermark_file_path'] путь к файлу с "водяным знаком", если водяной знак не должен накладываться, не передавайте этот параметр
- $param['watermark_position_x'] позиция "водяного знака" по оси X
- $param['watermark_position_y'] позиция "водяного знака" по оси Y
- $param['large_image_watermark'] наложить "водяной знак" на большое изображение (TRUE - наложить (по умолчанию), FALSE - не наложить)
- $param['small_image_watermark'] наложить "водяной знак" на малое изображение (TRUE - наложить (по умолчанию), FALSE - не наложить)
- $param['large_image_preserve_aspect_ratio'] сохранять пропорции изображения для большого изображения (TRUE - по умолчанию)
- $param['small_image_preserve_aspect_ratio'] сохранять пропорции изображения для большого изображения (TRUE - по умолчанию)
Returns
array $result
- $result['large_image'] = TRUE в случае успешного создания большого изображения, FALSE - в противном случае
- $result['small_image'] = TRUE в случае успешного создания малого изображения, FALSE - в противном случае
Hostcms-event
Core_File.onBeforeAdminUpload
Core_File.onAfterAdminUpload
|