Hook chỉ có từ NukeViet 4.6 trở đi, thay thế cho plugin
Mặc định hệ thống đã tạo các vị trí sau đây:
nv_add_hook($module_name, $sector, $priority, function () { //di chuyển code vào đây }
với $sector chính là ID của plugins, ví dụ plugins có id là 3, thì $sector = 'sector3' (Lưu ý, gán trực tiếp $sector vào function)
nv_apply_hook('', 'sector4');
(Lưu ý: gọi chỗ nào thì có quy định theo cách đặt tên, vị trí gọi tương ứng với ID của plugins)
DROP TABLE IF EXISTS `nv4_plugins`; CREATE TABLE `nv4_plugins` ( `pid` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT, `plugin_lang` VARCHAR(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'all', `plugin_file` VARCHAR(50) COLLATE utf8_unicode_ci NOT NULL, `plugin_area` VARCHAR(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `plugin_module_name` VARCHAR(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `plugin_module_file` VARCHAR(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `hook_module` VARCHAR(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `weight` tinyint(4) NOT NULL, PRIMARY KEY (`pid`), UNIQUE KEY `plugin` (`plugin_lang`,`plugin_file`,`plugin_area`,`plugin_module_name`,`hook_module`) ) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8; INSERT INTO `nv4_plugins` VALUES (1, 'all', 'qrcode.php', 'get_qr_code', '', '', '', 1), (2, 'all', 'cdn_js_css_image.php', 'change_site_buffer', '', '', '', 1), (1001, 'all', 'redirect_to_non_www.php', 'check_server', '', '', '', 1), (1002, 'all', 'enable_db_debug.php', 'sector2', '', '', '', 1),