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 liên quan giao diện ​

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

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

addition_module_assets ​

php
function addition_module_assets(string $module, string $type, $direct = true, string $suffix = ''): array

Thêm js, css của module vào trang hiện tại của các module khác

Tham số

  • $module string: Biến $module_name
  • $type string
  • $direct bool, mặc định true: Nếu là true thì đưa vào luôn $my_head và $my_footer.
  • $suffix string, mặc định '': Hậu tố ghép sau tên tệp, ví dụ '.print' sẽ tìm news.print.r.css, news.print.js

Trả về: array Gồm css, js là URL; css_path, js_path là đường dẫn tệp tính từ NV_ROOTDIR

Khai báo tại src/includes/core/theme_functions.php:705

nv_captcha_form_attrs ​

php
function nv_captcha_form_attrs(string $code_ipt, string $captcha = '', bool $as_array = false): string|array

Lấy thuộc tính định nghĩa captcha cho form HTML

Tham số

  • $code_ipt string: Name của ô input captcha hình truyền thống
  • $captcha string, mặc định '': Để trống thì lấy $module_captcha
  • $as_array bool, mặc định false: Trả về mảng [tên thuộc tính => giá trị]

Trả về: string|array Chuỗi có dạng data-recaptcha3="1" data-recaptcha2="1" data-turnstile="1" data-captcha="secode"

Khai báo tại src/includes/core/theme_functions.php:1009

nv_css_setproperties ​

php
function nv_css_setproperties($tag, $property_array)

Tham số

  • $tag string
  • $property_array mixed

Trả về: mixed

Khai báo tại src/includes/core/theme_functions.php:612

nv_disable_site ​

php
function nv_disable_site()

Khai báo tại src/includes/core/theme_functions.php:672

nv_error404 ​

php
function nv_error404()

Khai báo tại src/includes/core/theme_functions.php:116

nv_error_info ​

php
function nv_error_info()

Hàm lấy thông báo lỗi

Trả về: string|void

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

nv_get_blocks ​

php
function nv_get_blocks(string $theme, bool $cache = true)

Lấy danh sách vị trí các block của giao diện trên cơ sở đọc từ ini và các vị trí tùy chỉnh

Tham số

  • $theme string
  • $cache bool, mặc định true

Trả về: array

Khai báo tại src/includes/core/theme_functions.php:954

nv_htmlOutput ​

php
function nv_htmlOutput($html, $type = 'html', $custom_headers = [])

Tham số

  • $html string
  • $type string, mặc định 'html'
  • $custom_headers array, mặc định []

Khai báo tại src/includes/core/theme_functions.php:130

nv_info_die ​

php
function nv_info_die($page_title, $info_title, $info_content, $error_code = 200, $admin_link = NV_BASE_ADMINURL, $admin_title = '', $site_link = NV_BASE_SITEURL, $site_title = '', $http_headers = [])

Tham số

  • $page_title string
  • $info_title string
  • $info_content string
  • $error_code int, mặc định 200
  • $admin_link string, mặc định NV_BASE_ADMINURL
  • $admin_title string, mặc định ''
  • $site_link string, mặc định NV_BASE_SITEURL
  • $site_title string, mặc định ''
  • $http_headers array, mặc định []

Khai báo tại src/includes/core/theme_functions.php:52

nv_jsonOutput ​

php
function nv_jsonOutput($array_data, $flags = 0)

Tham số

  • $array_data array
  • $flags int, mặc định 0

Khai báo tại src/includes/core/theme_functions.php:212

nv_purge_blocks ​

php
function nv_purge_blocks(string $module = '')

Hủy toàn bộ vị trí block tùy chỉnh đã đăng kí theo module

Tham số

  • $module string, mặc định ''

Trả về: bool

Khai báo tại src/includes/core/theme_functions.php:940

nv_register_block ​

php
function nv_register_block(string $tag, string $name = '', string $module = '')

Đăng kí vị trí block tùy chỉnh mới

Tham số

  • $tag string
  • $name string, mặc định ''
  • $module string, mặc định ''

Trả về: bool

Khai báo tại src/includes/core/theme_functions.php:840

nv_rss_generate ​

php
function nv_rss_generate($channel, $items, $atomlink = '', $timemode = '', $noindex = true)

Tham số

  • $channel array
  • $items array
  • $atomlink string, mặc định ''
  • $timemode string, mặc định ''
  • $noindex bool, mặc định true

Trả về: void

Ngoại lệ: DOMException

Khai báo tại src/includes/core/theme_functions.php:285

nv_tag2pos_block ​

php
function nv_tag2pos_block(string $tag, string $module = '')

Lấy ra position của giao diện từ tag tùy chỉnh

Tham số

  • $tag string
  • $module string, mặc định ''

Trả về: string

Khai báo tại src/includes/core/theme_functions.php:826

nv_theme_alert ​

php
function nv_theme_alert($message_title, $message_content, $type = 'info', $url_back = '', $lang_back = '', $time_back = 5)

Tham số

  • $message_title string
  • $message_content string
  • $type string, mặc định 'info'
  • $url_back string, mặc định ''
  • $lang_back string, mặc định ''
  • $time_back int, mặc định 5

Trả về: string

Khai báo tại src/includes/core/theme_functions.php:652

nv_unregister_block ​

php
function nv_unregister_block(string $tag, string $module = '', bool $all = false)

Hủy đăng kí vị trí block tùy chỉnh đã đăng kí

Tham số

  • $tag string
  • $module string, mặc định ''
  • $all bool, mặc định false

Trả về: bool

Khai báo tại src/includes/core/theme_functions.php:883

nv_xmlOutput ​

php
function nv_xmlOutput($content, $lastModified)

Tham số

  • $content string
  • $lastModified int

Khai báo tại src/includes/core/theme_functions.php:223

nv_xmlSitemap_generate ​

php
function nv_xmlSitemap_generate($url, $changefreq = 'daily', $priority = '0.8')

Tham số

  • $url array
  • $changefreq string, mặc định 'daily'
  • $priority string, mặc định '0.8'

Khai báo tại src/includes/core/theme_functions.php:425

nv_xmlSitemapCat_generate ​

php
function nv_xmlSitemapCat_generate($url)

Tham số

  • $url array

Khai báo tại src/includes/core/theme_functions.php:465

nv_xmlSitemapIndex_generate ​

php
function nv_xmlSitemapIndex_generate()

Khai báo tại src/includes/core/theme_functions.php:505