Skip to content

Lưu ý: Đây là bộ tài liệu chưa hoàn thiện, đang trong quá trình cập nhật nên nội dung có thể không đúng hoặc chưa đủ. Nếu phát hiện sai lệch, xin báo lại qua GitHub Issues hoặc gửi Pull Request để sửa.

Hàm thao tác file, thư mục ​

Dùng được ở mọi khu vực.

Nguồn: src/includes/core/filesystem_functions.php

get_block_tpl_dir ​

php
function get_block_tpl_dir(string $filename, bool $array = false, string $module = '')

Lấy thư mục chứa tệp tpl $filename của block module ngoài site bất kì. Thứ tự ưu tiên như sau

  • Thư mục module_theme của giao diện module hiện đang xem
  • Thư mục module_theme của giao diện module chứa block
  • Thư mục module_theme của giao diện site
  • Thư mục module_theme của giao diện mặc định
  • Thư mục module_file của giao diện module hiện đang xem
  • Thư mục module_file của giao diện module chứa block
  • Thư mục module_file của giao diện site
  • Thư mục module_file của giao diện mặc định

Tham số

  • $filename string
  • $array bool, mặc định false
  • $module string, mặc định ''

Trả về: array|string

Khai báo tại src/includes/core/filesystem_functions.php:1273

get_module_filelist ​

php
function get_module_filelist()

Trả về: mixed

Khai báo tại src/includes/core/filesystem_functions.php:1101

get_module_tpl_dir ​

php
function get_module_tpl_dir($filename, $array = false, string $module = '')

Lấy thư mục chứa tệp tpl $filename của module hiện tại đang xem. Thứ tự ưu tiên như sau

  • Thư mục module_theme của giao diện module
  • Thư mục module_theme của giao diện site
  • Thư mục module_theme của giao diện mặc định
  • Thư mục module_file của giao diện module
  • Thư mục module_file của giao diện site
  • Thư mục module_file của giao diện mặc định

Tham số

  • $filename string
  • $array bool, mặc định false
  • $module string, mặc định '': Module name (nếu muốn lấy thư mục của module khác với module đang xem)

Trả về: array|string|void

Khai báo tại src/includes/core/filesystem_functions.php:1202

get_theme_filelist ​

php
function get_theme_filelist()

Trả về: mixed

Khai báo tại src/includes/core/filesystem_functions.php:1075

get_tpl_dir ​

php
function get_tpl_dir($dir_basenames, $default_dir_basename, $file = '')

Tham số

  • $dir_basenames array|string
  • $default_dir_basename string
  • $file string, mặc định ''

Trả về: string

Khai báo tại src/includes/core/filesystem_functions.php:1049

module_file_exists ​

php
function module_file_exists($file)

Tham số

  • $file string

Trả về: bool

Khai báo tại src/includes/core/filesystem_functions.php:1161

nv_chmod_dir ​

php
function nv_chmod_dir($conn_id, $dir, $subdir = false)

Tham số

  • $conn_id mixed
  • $dir mixed
  • $subdir bool, mặc định false

Khai báo tại src/includes/core/filesystem_functions.php:687

nv_copyfile ​

php
function nv_copyfile($file, $newfile)

Tham số

  • $file string
  • $newfile string

Trả về: bool

Khai báo tại src/includes/core/filesystem_functions.php:619

nv_deletefile ​

php
function nv_deletefile($file, $delsub = false)

Tham số

  • $file string
  • $delsub bool, mặc định false

Trả về: array

Khai báo tại src/includes/core/filesystem_functions.php:467

nv_editable_imgexts ​

php
function nv_editable_imgexts(): array

Danh sách các phần mở rộng ảnh được hỗ trợ bởi GD.

Trả về: array

Khai báo tại src/includes/core/filesystem_functions.php:763

nv_ftp_del_dir ​

php
function nv_ftp_del_dir($ftp, $dst_dir, $delsub)

Tham số

  • $ftp mixed
  • $dst_dir string
  • $delsub bool

Trả về: mixed

Khai báo tại src/includes/core/filesystem_functions.php:561

nv_get_allowed_ext ​

php
function nv_get_allowed_ext($allowed_filetypes, $forbid_extensions, $forbid_mimes)

Tham số

  • $allowed_filetypes mixed
  • $forbid_extensions array
  • $forbid_mimes array

Trả về: array|string

Khai báo tại src/includes/core/filesystem_functions.php:310

nv_get_mime_from_ini ​

php
function nv_get_mime_from_ini($ext)

Tham số

  • $ext string

Trả về: string

Khai báo tại src/includes/core/filesystem_functions.php:121

nv_get_mime_type ​

php
function nv_get_mime_type($filename, $magic_path = '', $default_mime = 'application/octet-stream')

Tham số

  • $filename string
  • $magic_path string, mặc định ''
  • $default_mime string, mặc định 'application/octet-stream'

Trả về: mixed

Khai báo tại src/includes/core/filesystem_functions.php:144

nv_getextension ​

php
function nv_getextension($filename)

Tham số

  • $filename string

Trả về: string

Khai báo tại src/includes/core/filesystem_functions.php:291

nv_ImageInfo ​

php
function nv_ImageInfo($original_name, $width = 0, $is_create_thumb = false, $thumb_path = '')

Xuất ra các thông tin về ảnh để đưa vào HTML (src, width, height).

Tham số

  • $original_name string: Duong dan tuyet doi den file goc (bat buoc)
  • $width int, mặc định 0: Chieu rong xuat ra HTML (neu bang 0 se xuat ra kich thuoc thuc)
  • $is_create_thumb bool, mặc định false: Neu chieu rong cua hinh lon hon $width, co the tao thumbnail
  • $thumb_path string, mặc định '': Neu tao thumbnail thi chi ra thu muc chua file thumbnail nay

Trả về: array|false

Khai báo tại src/includes/core/filesystem_functions.php:797

nv_imageResize ​

php
function nv_imageResize($origX, $origY, $maxX, $maxY)

Tham số

  • $origX int
  • $origY int
  • $maxX int
  • $maxY int

Trả về: array

Khai báo tại src/includes/core/filesystem_functions.php:927

nv_is_file ​

php
function nv_is_file($filepath, $folders = [])

Tham số

  • $filepath string
  • $folders string|array, mặc định []

Trả về: bool

Khai báo tại src/includes/core/filesystem_functions.php:960

nv_is_image ​

php
function nv_is_image($img)

Tham số

  • $img string

Trả về: array

Khai báo tại src/includes/core/filesystem_functions.php:719

nv_mkdir ​

php
function nv_mkdir($path, $dir_name)

Tham số

  • $path string
  • $dir_name string

Trả về: array

Khai báo tại src/includes/core/filesystem_functions.php:391

nv_parse_ini_file ​

php
function nv_parse_ini_file($filename, $process_sections = false)

Tham số

  • $filename string
  • $process_sections bool, mặc định false

Trả về: array|false

Khai báo tại src/includes/core/filesystem_functions.php:23

nv_pathinfo_filename ​

php
function nv_pathinfo_filename($file)

Tham số

  • $file string

Trả về: string|string[]|void

Khai báo tại src/includes/core/filesystem_functions.php:374

nv_renamefile ​

php
function nv_renamefile($file, $newname)

Tham số

  • $file mixed
  • $newname mixed

Trả về: array

Khai báo tại src/includes/core/filesystem_functions.php:642

nv_scandir ​

php
function nv_scandir($directory, $pattern, $sorting_order = 0)

Tham số

  • $directory string
  • $pattern string|array
  • $sorting_order int, mặc định 0

Trả về: array

Khai báo tại src/includes/core/filesystem_functions.php:77

nv_scandirfile ​

php
function nv_scandirfile($directory, $pattern, &$files, $cut = '')

Lấy danh sách các dir và file theo $pattern trong một thư mục nhất định

Tham số

  • $directory mixed
  • $pattern mixed
  • &$files mixed
  • $cut string, mặc định ''

Khai báo tại src/includes/core/filesystem_functions.php:999

nv_string_to_filename ​

php
function nv_string_to_filename($word, $keep_dots = true)

Tham số

  • $word string
  • $keep_dots bool, mặc định true

Trả về: string

Khai báo tại src/includes/core/filesystem_functions.php:357

theme_file_exists ​

php
function theme_file_exists($file)

Tham số

  • $file string

Trả về: bool

Khai báo tại src/includes/core/filesystem_functions.php:1128