Code Duplication    Length = 34-34 lines in 2 locations

htdocs/modules/extgallery/include/functions.php 1 location

@@ 20-53 (lines=34) @@
17
 * @return bool
18
 */
19
20
function gal_getmoduleoption($option)
21
{
22
    global $xoopsModuleConfig, $xoopsModule;
23
    static $tbloptions = array();
24
    if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) {
25
        return $tbloptions[$option];
26
    }
27
28
    $retval = false;
29
    if (isset($xoopsModuleConfig)
30
        && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') === 'extgallery'
31
            && $xoopsModule->getVar('isactive'))
32
    ) {
33
        if (isset($xoopsModuleConfig[$option])) {
34
            $retval = $xoopsModuleConfig[$option];
35
        }
36
    } else {
37
        /** @var XoopsModuleHandler $moduleHandler */
38
        $moduleHandler = xoops_getHandler('module');
39
        $module        = $moduleHandler->getByDirname('extgallery');
40
41
        /** @var XoopsConfigHandler $configHandler */
42
        $configHandler = xoops_getHandler('config');
43
        if ($module) {
44
            $moduleConfig =& $configHandler->getConfigsByCat(0, $module->getVar('mid'));
45
            if (isset($moduleConfig[$option])) {
46
                $retval = $moduleConfig[$option];
47
            }
48
        }
49
    }
50
    $tbloptions[$option] = $retval;
51
52
    return $retval;
53
}
54
55
/**
56
 * @param $caption

htdocs/modules/extgallery/class/utility.php 1 location

@@ 143-176 (lines=34) @@
140
     * @param $option
141
     * @return bool|mixed
142
     */
143
    public static function getModuleOption($option)
144
    {
145
        global $xoopsModuleConfig, $xoopsModule;
146
        static $tbloptions = array();
147
        if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) {
148
            return $tbloptions[$option];
149
        }
150
151
        $retval = false;
152
        if (isset($xoopsModuleConfig)
153
            && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') === 'extgallery'
154
                && $xoopsModule->getVar('isactive'))
155
        ) {
156
            if (isset($xoopsModuleConfig[$option])) {
157
                $retval = $xoopsModuleConfig[$option];
158
            }
159
        } else {
160
            /** @var XoopsModuleHandler $moduleHandler */
161
            $moduleHandler = xoops_getHandler('module');
162
            $module        = $moduleHandler->getByDirname('extgallery');
163
164
            /** @var XoopsConfigHandler $configHandler */
165
            $configHandler = xoops_getHandler('config');
166
            if ($module) {
167
                $configurator =& $configHandler->getConfigsByCat(0, $module->getVar('mid'));
168
                if (isset($configurator[$option])) {
169
                    $retval = $configurator[$option];
170
                }
171
            }
172
        }
173
        $tbloptions[$option] = $retval;
174
175
        return $retval;
176
    }
177
178
    /**
179
     * @param $caption