Code Duplication    Length = 29-34 lines in 2 locations

install/actions/action_options.php 2 locations

@@ 116-144 (lines=29) @@
113
    }
114
}
115
116
if( ! function_exists('getTVs')) {
117
    /**
118
     * @param array $presets
119
     * @return string
120
     */
121
    function getTVs($presets = array())
122
    {
123
        if (!count($presets)) {
124
            return '';
125
        }
126
        $selectedTvs = isset ($_POST['tv']) ? $_POST['tv'] : array();
127
        $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 />';
128
        $_ = array();
129
        $i = 0;
130
        foreach ($presets as $preset) {
131
            $ph['i'] = $i;
132
            $ph['name'] = $preset[0];
133
            $ph['alterName'] = $preset[1];
134
            $ph['desc'] = $preset[2];
135
            $ph['class'] = !in_array('sample', $preset[12]) ? 'toggle' : 'toggle demo';
136
            $ph['checked'] = in_array($i, $selectedTvs) || (!isset($_POST['options_selected'])) ? 'checked' : '';
137
            $_[] = parse($tpl, $ph);
138
            $i++;
139
        }
140
        if (0 < count($_)) {
141
            return '<h3>[%tvs%]</h3>' . join("\n", $_);
142
        }
143
    }
144
}
145
146
if( ! function_exists('getChunks')) {
147
    /**
@@ 208-241 (lines=34) @@
205
    }
206
}
207
208
if( ! function_exists('getPlugins')) {
209
    /**
210
     * display plugins
211
     *
212
     * @param array $presets
213
     * @return string
214
     */
215
    function getPlugins($presets = array())
216
    {
217
        if (!count($presets)) {
218
            return '';
219
        }
220
        $selected = isset ($_POST['plugin']) ? $_POST['plugin'] : array();
221
        $tpl = '<label><input type="checkbox" name="plugin[]" value="[+i+]" class="[+class+]" [+checked+] />[%install_update%] <span class="comname">[+name+]</span> - [+desc+]</label><hr />';
222
        $_ = array();
223
        $i = 0;
224
        foreach ($presets as $preset) {
225
            $ph['i'] = $i;
226
            $ph['name'] = $preset[0];
227
            $ph['desc'] = $preset[1];
228
            if (is_array($preset[8])) {
229
                $ph['class'] = !in_array('sample', $preset[8]) ? 'toggle' : 'toggle demo';
230
            } else {
231
                $ph['class'] = 'toggle demo';
232
            }
233
            $ph['checked'] = in_array($i, $selected) || (!isset($_POST['options_selected'])) ? 'checked' : '';
234
            $_[] = parse($tpl, $ph);
235
            $i++;
236
        }
237
        if (0 < count($_)) {
238
            return '<h3>[%plugins%]</h3>' . join("\n", $_);
239
        }
240
    }
241
}
242
243
if( ! function_exists('getSnippets')) {
244
    /**