Code Duplication    Length = 28-29 lines in 2 locations

install/actions/action_options.php 1 location

@@ 32-59 (lines=28) @@
29
    }
30
}
31
32
if( ! function_exists('getTVs')) {
33
    /**
34
     * @param array $presets
35
     * @return string
36
     */
37
    function getTVs($presets = array())
38
    {
39
        if (empty($presets)) {
40
            return '';
41
        }
42
        $selectedTvs = isset ($_POST['tv']) ? $_POST['tv'] : array();
43
        $tpl = '<label><input type="checkbox" name="tv[]" value="[+i+]" class="[+class+]" [+checked+] />[%install_update%] <span class="comname">[+name+]</span> - [+alterName+] <span class="description">([+desc+])</span></label><hr />';
44
        $_ = array();
45
        $i = 0;
46
        $ph = array();
47
        foreach ($presets as $preset) {
48
            $ph['i'] = $i;
49
            $ph['name'] = $preset[0];
50
            $ph['alterName'] = $preset[1];
51
            $ph['desc'] = $preset[2];
52
            $ph['class'] = !in_array('sample', $preset[12]) ? 'toggle' : 'toggle demo';
53
            $ph['checked'] = in_array($i, $selectedTvs) || (!isset($_POST['options_selected'])) ? 'checked' : '';
54
            $_[] = parse($tpl, $ph);
55
            $i++;
56
        }
57
        return (0 < count($_)) ? '<h3>[%tvs%]</h3>' . implode("\n", $_) : '';
58
    }
59
}
60
61
if( ! function_exists('getChunks')) {
62
    /**

install/src/functions.php 1 location

@@ 257-285 (lines=29) @@
254
    }
255
}
256
257
if (!function_exists('getTVs')) {
258
    /**
259
     * @param array $presets
260
     * @return string
261
     */
262
    function getTVs($presets = array())
263
    {
264
        if (empty($presets)) {
265
            return '';
266
        }
267
        $selectedTvs = isset ($_POST['tv']) ? $_POST['tv'] : array();
268
        $tpl = '<label><input type="checkbox" name="tv[]" value="[+i+]" class="[+class+]" [+checked+] />[%install_update%] <span class="comname">[+name+]</span> - [+alterName+] <span class="description">([+desc+])</span></label><hr />';
269
        $_ = array();
270
        $i = 0;
271
        $ph = array();
272
        foreach ($presets as $preset) {
273
            $ph['i'] = $i;
274
            $ph['name'] = $preset[0];
275
            $ph['alterName'] = $preset[1];
276
            $ph['desc'] = $preset[2];
277
            $ph['class'] = !in_array('sample', $preset[12]) ? 'toggle' : 'toggle demo';
278
            $ph['checked'] = in_array($i, $selectedTvs) || (!isset($_POST['options_selected'])) ? 'checked' : '';
279
            $_[] = parse($tpl, $ph);
280
            $i++;
281
        }
282
283
        return (0 < count($_)) ? '<h3>[%tvs%]</h3>' . implode("\n", $_) : '';
284
    }
285
}
286
287
if (!function_exists('getChunks')) {
288
    /**