@@ 67-98 (lines=32) @@ | ||
64 | * @param boolean $withCache Do we have to use some cache ? |
|
65 | * @return mixed option's value |
|
66 | */ |
|
67 | public static function getModuleOption($option, $withCache = true) |
|
68 | { |
|
69 | global $xoopsModuleConfig, $xoopsModule; |
|
70 | $repmodule = static::MODULE_NAME; |
|
71 | static $options = array(); |
|
72 | if (is_array($options) && array_key_exists($option, $options) && $withCache) { |
|
73 | return $options[$option]; |
|
74 | } |
|
75 | ||
76 | $retval = false; |
|
77 | if (isset($xoopsModuleConfig) |
|
78 | && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule |
|
79 | && $xoopsModule->getVar('isactive'))) { |
|
80 | if (isset($xoopsModuleConfig[$option])) { |
|
81 | $retval = $xoopsModuleConfig[$option]; |
|
82 | } |
|
83 | } else { |
|
84 | /** @var XoopsModuleHandler $moduleHandler */ |
|
85 | $moduleHandler = xoops_getHandler('module'); |
|
86 | $module = $moduleHandler->getByDirname($repmodule); |
|
87 | $configHandler = xoops_getHandler('config'); |
|
88 | if ($module) { |
|
89 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
90 | if (isset($moduleConfig[$option])) { |
|
91 | $retval = $moduleConfig[$option]; |
|
92 | } |
|
93 | } |
|
94 | } |
|
95 | $options[$option] = $retval; |
|
96 | ||
97 | return $retval; |
|
98 | } |
|
99 | ||
100 | /** |
|
101 | * Is Xoops 2.3.x ? |
@@ 211-242 (lines=32) @@ | ||
208 | * @param boolean $withCache Do we have to use some cache ? |
|
209 | * @return mixed option's value |
|
210 | */ |
|
211 | public static function getModuleOption($option, $withCache = true) |
|
212 | { |
|
213 | global $xoopsModuleConfig, $xoopsModule; |
|
214 | $repmodule = self::MODULE_NAME; |
|
215 | static $options = array(); |
|
216 | if (is_array($options) && array_key_exists($option, $options) && $withCache) { |
|
217 | return $options[$option]; |
|
218 | } |
|
219 | ||
220 | $retval = false; |
|
221 | if (isset($xoopsModuleConfig) |
|
222 | && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule |
|
223 | && $xoopsModule->getVar('isactive'))) { |
|
224 | if (isset($xoopsModuleConfig[$option])) { |
|
225 | $retval = $xoopsModuleConfig[$option]; |
|
226 | } |
|
227 | } else { |
|
228 | /** @var XoopsModuleHandler $moduleHandler */ |
|
229 | $moduleHandler = xoops_getHandler('module'); |
|
230 | $module = $moduleHandler->getByDirname($repmodule); |
|
231 | $configHandler = xoops_getHandler('config'); |
|
232 | if ($module) { |
|
233 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
234 | if (isset($moduleConfig[$option])) { |
|
235 | $retval = $moduleConfig[$option]; |
|
236 | } |
|
237 | } |
|
238 | } |
|
239 | $options[$option] = $retval; |
|
240 | ||
241 | return $retval; |
|
242 | } |
|
243 | ||
244 | /** |
|
245 | * Is Xoops 2.3.x ? |