Skip to content

Commit 01bf026

Browse files
committed
Adds initial package manager class
1 parent d55275d commit 01bf026

File tree

1 file changed

+36
-26
lines changed

1 file changed

+36
-26
lines changed

system/core/package.php

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,58 +32,48 @@ public function __construct()
3232
),
3333
'jquery' => array(
3434
'js' => array(
35-
'file1'
36-
),
37-
'css' => array(
38-
'file1'
39-
)
35+
'public/components/jquery/dist/jquery.min.js'
36+
),
4037
),
4138
'jquery-ui' => array(
4239
'js' => array(
43-
'file1'
40+
'public/components/jquery-ui/jquery-ui.min.js'
4441
),
4542
'css' => array(
46-
'file1'
43+
'public/components/jquery-ui/themes/base/theme.css'
4744
)
4845
),
4946
'jquery-file-upload' => array(
5047
'js' => array(
51-
'file1'
52-
),
53-
'css' => array(
54-
'file1'
55-
)
56-
),
48+
'public/components/jquery-file-upload/jquery.fileupload.js'
49+
)
50+
),
5751
'fontawesome' => array(
58-
'js' => array(
59-
'file1'
60-
),
6152
'css' => array(
62-
'file1'
53+
'public/components/font-awesome/css/font-awesome.min.css'
6354
)
6455
),
6556
'chartjs' => array(
6657
'js' => array(
67-
'file1'
68-
),
69-
'css' => array(
70-
'file1'
71-
)
58+
'public/components/chartjs/Chart.min.js'
59+
),
7260
),
7361
'select2' => array(
7462
'js' => array(
75-
'file1'
63+
'public/components/select2/select2.min.js'
7664
),
7765
'css' => array(
78-
'file1'
66+
'public/components/select2/select2.css',
67+
'public/components/select2/select2-bootstrap.css'
7968
)
8069
),
8170
'tinymce' => array(
8271
'js' => array(
83-
'file1'
72+
'public/components/tinymce-dist/jquery.tinymce.min.js',
73+
'public/components/tinymce-dist/tinymce.min.js'
8474
),
8575
'css' => array(
86-
'file1'
76+
'public/components/tinymce-dist/themes/modern/theme.min.js'
8777
)
8878
),
8979
);
@@ -100,6 +90,26 @@ public function getPackage($name)
10090
return false;
10191
}
10292

93+
/**
94+
* Gets a set of packages from the package system
95+
* @param array $packageList The list of packages to be retrieved
96+
* @return array|bool Returns an array if the packages are found, false if nothing is found or invalid input.
97+
*/
98+
public function getPackages(array $packageList)
99+
{
100+
$css = array(); $js = array();
101+
foreach($packageList as $package)
102+
{
103+
$item = $this->getPackage[$package];
104+
if ($item != false)
105+
{
106+
if (is_array($item['css'])) array_merge($css, $item['css']);
107+
if (is_array($item['js'])) array_merge($js, $item['js']);
108+
}
109+
}
110+
return array('css' => $css, 'js' => $js);
111+
}
112+
103113
/**
104114
* Adds a package to the package system
105115
* @param string $name The name for the package

0 commit comments

Comments
 (0)