Issues (1358)

build/functions.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
 * @package    CleverStyle Framework
4
 * @subpackage Builder
5
 * @author     Nazar Mokrynskyi <[email protected]>
6
 * @license    0BSD
7
 */
8
/**
9
 * @return string
10
 */
11
function form () {
12
	return h::{'form[method=post]'}(
13
		h::nav(
0 ignored issues
show
The method nav() does not exist on h. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

13
		h::/** @scrutinizer ignore-call */ 
14
     nav(
Loading history...
14
			'Build: '.
15
			h::{'radio[name=mode]'}(
16
				[
17
					'value' => ['core', 'module', 'theme'],
18
					'in'    => [h::span('Core'), h::span('Module'), h::span('Theme')]
0 ignored issues
show
The method span() does not exist on h. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
					'in'    => [h::/** @scrutinizer ignore-call */ span('Core'), h::span('Module'), h::span('Theme')]
Loading history...
19
				]
20
			)
21
		).
22
		h::{'table tr| td'}(
23
			[
24
				'Modules',
25
				'Themes'
26
			],
27
			[
28
				h::{'select[name=modules[]][size=20][multiple] option'}(
29
					get_list_for_form(DIR.'/modules', 'System')
30
				),
31
				h::{'select[name=themes[]][size=20][multiple] option'}(
32
					get_list_for_form(DIR.'/themes', 'CleverStyle')
33
				)
34
			]
35
		).
36
		h::{'input[name=suffix]'}(
37
			[
38
				'placeholder' => 'Package file suffix'
39
			]
40
		).
41
		h::{'button[type=submit]'}(
42
			'Build'
43
		)
44
	);
45
}
46
47
/**
48
 * @param string $dir
49
 * @param string $exclude_component
50
 *
51
 * @return array[]
52
 */
53
function get_list_for_form ($dir, $exclude_component = '') {
54
	$components = [];
55
	foreach (array_map('basename', glob("$dir/*", GLOB_ONLYDIR)) as $component) {
56
		if ($component != $exclude_component) {
57
			$components[] = [
58
				$component,
59
				file_exists("$dir/$component/meta.json") ? [
60
					'title' => 'Version: '.file_get_json("$dir/$component/meta.json")['version']
61
				] : [
62
					'title' => 'No meta.json file found',
63
					'disabled'
64
				]
65
			];
66
		}
67
	}
68
	return $components;
69
}
70