-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApps.php
More file actions
36 lines (31 loc) · 855 Bytes
/
Apps.php
File metadata and controls
36 lines (31 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
require_once('common.php');
/**
* Description of Apps
*
* @author god
*/
class Apps {
private $apps = [];
/*
you should hookup the DAO here
*/
public function __construct() {
$rawdata = Common::readDirectory(BASE_PATH);
$server_name = \filter_input( INPUT_SERVER,"SERVER_NAME");
foreach ($rawdata as $value){
if ($value[0] !== '.') {
$this->apps += [$value => \sprintf("http://%s.%s", $value , $server_name ) ];
}
}
}
public function getAllApps(){
return $this->apps;
}
public function getApp($name){
if (\array_key_exists($name, $this->apps)) {
$app = array($name => $this->apps[$name]);
}
return \is_set($app) ? $app : null;
}
}