Code Duplication    Length = 33-34 lines in 2 locations

install/actions/action_options.php 1 location

@@ 121-153 (lines=33) @@
118
    }
119
}
120
121
if( ! function_exists('getPlugins')) {
122
    /**
123
     * display plugins
124
     *
125
     * @param array $presets
126
     * @return string
127
     */
128
    function getPlugins($presets = array())
129
    {
130
        if (!count($presets)) {
131
            return '';
132
        }
133
        $selected = isset ($_POST['plugin']) ? $_POST['plugin'] : array();
134
        $tpl = '<label><input type="checkbox" name="plugin[]" value="[+i+]" class="[+class+]" [+checked+] />[%install_update%] <span class="comname">[+name+]</span> - [+desc+]</label><hr />';
135
        $_ = array();
136
        $i = 0;
137
        $ph = array();
138
        foreach ($presets as $preset) {
139
            $ph['i'] = $i;
140
            $ph['name'] = $preset[0];
141
            $ph['desc'] = $preset[1];
142
            if (is_array($preset[8])) {
143
                $ph['class'] = !in_array('sample', $preset[8]) ? 'toggle' : 'toggle demo';
144
            } else {
145
                $ph['class'] = 'toggle demo';
146
            }
147
            $ph['checked'] = in_array($i, $selected) || (!isset($_POST['options_selected'])) ? 'checked' : '';
148
            $_[] = parse($tpl, $ph);
149
            $i++;
150
        }
151
        return (0 < count($_)) ? '<h3>[%plugins%]</h3>' . implode("\n", $_) : '';
152
    }
153
}
154
155
if( ! function_exists('getSnippets')) {
156
    /**

install/src/functions.php 1 location

@@ 349-382 (lines=34) @@
346
    }
347
}
348
349
if (!function_exists('getPlugins')) {
350
    /**
351
     * display plugins
352
     *
353
     * @param array $presets
354
     * @return string
355
     */
356
    function getPlugins($presets = array())
357
    {
358
        if (!count($presets)) {
359
            return '';
360
        }
361
        $selected = isset ($_POST['plugin']) ? $_POST['plugin'] : array();
362
        $tpl = '<label><input type="checkbox" name="plugin[]" value="[+i+]" class="[+class+]" [+checked+] />[%install_update%] <span class="comname">[+name+]</span> - [+desc+]</label><hr />';
363
        $_ = array();
364
        $i = 0;
365
        $ph = array();
366
        foreach ($presets as $preset) {
367
            $ph['i'] = $i;
368
            $ph['name'] = $preset[0];
369
            $ph['desc'] = $preset[1];
370
            if (is_array($preset[8])) {
371
                $ph['class'] = !in_array('sample', $preset[8]) ? 'toggle' : 'toggle demo';
372
            } else {
373
                $ph['class'] = 'toggle demo';
374
            }
375
            $ph['checked'] = in_array($i, $selected) || (!isset($_POST['options_selected'])) ? 'checked' : '';
376
            $_[] = parse($tpl, $ph);
377
            $i++;
378
        }
379
380
        return (0 < count($_)) ? '<h3>[%plugins%]</h3>' . implode("\n", $_) : '';
381
    }
382
}
383
384
if (!function_exists('getSnippets')) {
385
    /**