1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: use Xoops\Core\PreloadItem;
13: use Xoops\Core\Kernel\Handlers\XoopsModule;
14: use Xoops\Module\Plugin;
15: use Xoops\Module\Plugin\ConfigCollector;
16:
17:
18: 19: 20: 21: 22: 23: 24:
25: class CommentsPreload extends PreloadItem
26: {
27: 28: 29: 30: 31: 32: 33: 34:
35: public static function eventCoreIncludeCommonClassmaps($args)
36: {
37: $path = dirname(__DIR__);
38: XoopsLoad::addMap(array(
39: 'comments' => $path . '/class/helper.php',
40: 'commentscommentrenderer' => $path . '/class/commentrenderer.php'
41: ));
42: }
43:
44: public static function eventCoreFooterStart($args)
45: {
46: $helper = \Xoops::getModuleHelper('comments');
47: $helper->renderView();
48: }
49:
50: public static function eventSystemModuleUpdateConfigs(ConfigCollector $collector)
51: {
52: $helper = \Xoops::getModuleHelper('comments');
53: if ($plugin = Plugin::getPlugin(
54: $collector->module()->getVar('dirname'),
55: 'comments',
56: true
57: )) {
58: $pluginConfigs = $helper->getPluginableConfigs();
59: $collector->add($pluginConfigs);
60: }
61: }
62:
63: public static function eventSystemModuleInstall(XoopsModule $module)
64: {
65: $helper = \Xoops::getModuleHelper('comments');
66: if ($plugin = Plugin::getPlugin($module->getVar('dirname'), 'comments', true)) {
67: $helper::getInstance()->insertModuleRelations($module);
68: }
69: }
70:
71: 72: 73: 74: 75: 76: 77:
78: public static function eventSystemModuleUninstall(XoopsModule $module)
79: {
80: $helper = \Xoops::getModuleHelper('comments');
81: if ($plugin = Plugin::getPlugin($module->getVar('dirname'), 'comments')) {
82: $helper->deleteModuleRelations($module);
83: }
84: }
85:
86: public static function eventSystemPreferencesForm(XoopsModule $module)
87: {
88: $helper = \Xoops::getModuleHelper('comments');
89:
90: if ($plugin = Plugin::getPlugin($module->getVar('dirname'), 'comments')) {
91: $helper->loadLanguage('main');
92: }
93: }
94: }
95: