Code Duplication    Length = 26-26 lines in 2 locations

install/cli-install.php 1 location

@@ 585-610 (lines=26) @@
582
583
// setup Template Variable template files
584
$mtv = &$moduleTVs;
585
if(is_dir($tvPath) && is_readable($tvPath)) {
586
    $d = dir($tvPath);
587
    while (false !== ($tplfile = $d->read())) {
588
        if(substr($tplfile, -4) != '.tpl') continue;
589
        $params = parse_docblock($tvPath, $tplfile);
590
        if(is_array($params) && (count($params)>0)) {
591
            $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
592
            $mtv[] = array(
593
                $params['name'],
594
                $params['caption'],
595
                $description,
596
                $params['input_type'],
597
                $params['input_options'],
598
                $params['input_default'],
599
                $params['output_widget'],
600
                $params['output_widget_params'],
601
                "$templatePath/{$params['filename']}", /* not currently used */
602
                $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */
603
                $params['modx_category'],
604
                $params['lock_tv'],  /* value should be 1 or 0 */
605
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
606
            );
607
        }
608
    }
609
    $d->close();
610
}
611
612
// setup chunks template files - array : name, description, type - 0:file or 1:content, file or content
613
$mc = &$moduleChunks;

install/setup.info.php 1 location

@@ 48-73 (lines=26) @@
45
46
// setup Template Variable template files
47
$mtv = &$moduleTVs;
48
if(is_dir($tvPath) && is_readable($tvPath)) {
49
    $d = dir($tvPath);
50
    while (false !== ($tplfile = $d->read())) {
51
        if(substr($tplfile, -4) != '.tpl') continue;
52
        $params = parse_docblock($tvPath, $tplfile);
53
        if(is_array($params) && (count($params)>0)) {
54
            $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
55
            $mtv[] = array(
56
                $params['name'],
57
                $params['caption'],
58
                $description,
59
                $params['input_type'],
60
                $params['input_options'],
61
                $params['input_default'],
62
                $params['output_widget'],
63
                $params['output_widget_params'],
64
                "$templatePath/{$params['filename']}", /* not currently used */
65
                $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */
66
                $params['modx_category'],
67
                $params['lock_tv'],  /* value should be 1 or 0 */
68
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
69
            );
70
        }
71
    }
72
    $d->close();
73
}
74
75
// setup chunks template files - array : name, description, type - 0:file or 1:content, file or content
76
$mc = &$moduleChunks;