-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLibrary.utility.php
More file actions
executable file
·157 lines (137 loc) · 5.41 KB
/
Library.utility.php
File metadata and controls
executable file
·157 lines (137 loc) · 5.41 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
/**
* File: Library.utility.php
* Author: Filip Matys
*/
class Library {
//Database version
const DB_VERSION = 7;
// Folder constants
// - utilities
const UTILITIES = "utilities";
// - api
const API = "api";
// - dao
const CORLY_DAO_BASE = "corly/dao/base";
const CORLY_DAO_SECURITY = "corly/dao/security";
const CORLY_DAO_STAT = "corly/dao/stat";
const CORLY_DAO_PLUGIN = "corly/dao/plugin";
const CORLY_DAO_SUITE = "corly/dao/suite";
const CORLY_DAO_APPLICATION = "corly/dao/application";
const CORLY_DAO_SETTINGS = "corly/dao/settings";
const CORLY_DAO_UPDATE = "corly/dao/update";
const CORLY_DAO_EXTENTION = "corly/dao/extention";
const EXTENTIONS_SUMMARIZERS = "extentions/summarization";
// - dao implementation
const CORLY_DAO_IMPLEMENTATION_BASE = "corly/daoImplementation/base";
const CORLY_DAO_IMPLEMENTATION_SECURITY = "corly/daoImplementation/security";
const CORLY_DAO_IMPLEMENTATION_PLUGIN = "corly/daoImplementation/plugin";
const CORLY_DAO_IMPLEMENTATION_SUITE = "corly/daoImplementation/suite";
const CORLY_DAO_IMPLEMENTATION_SETTINGS = "corly/daoImplementation/settings";
const CORLY_DAO_IMPLEMENTATION_UPDATE = "corly/daoImplementation/update";
const CORLY_DAO_IMPLEMENTATION_EXTENTION = "corly/daoImplementation/extention";
// db create
const CORLY_DBCREATE = "corly/dbCreator";
// installation
const CORLY_INSTALLATION = "corly/installation";
// repositories
const CORLY_REPOSITORIES = "repositories";
// - service
const CORLY_SERVICE_SECURITY = "corly/service/security";
const CORLY_SERVICE_IMPORT = "corly/service/import";
const CORLY_SERVICE_PLUGIN = "corly/service/plugin";
const CORLY_SERVICE_SUITE = "corly/service/suite";
const CORLY_SERVICE_INSTALLATION = "corly/service/installation";
const CORLY_SERVICE_APPLICATION = "corly/service/application";
const CORLY_SERVICE_SESSION = "corly/service/session";
const CORLY_SERVICE_UTILITIES = "corly/service/utilities";
const CORLY_SERVICE_SETTINGS = "corly/service/settings";
const CORLY_SERVICE_FACTORY = "corly/service/factory";
const CORLY_SERVICE_VISUALIZATION = "corly/service/visualization";
const CORLY_SERVICE_UPDATE = "corly/service/update";
const CORLY_SERVICE_EXTENTION = "corly/service/extention";
// - visualization
const VISUALIZATION = "visualization";
const VISUALIZATION_DIFFERENCE = "visualization/difference";
const VISUALIZATION_PROJECT = "visualization/project";
const VISUALIZATION_SUBMISSION = "visualization/submission";
const VISUALIZATION_COMPONENTS = "visualization/components";
// - visualization tools
const VISUALIZATION_TOOLS = "visualization/tools";
const VISUALIZATION_TOOLS_GCHART = "visualization/tools/googleChart";
const VISUALIZATION_TOOLS_SUBLIST = "visualization/tools/submissionOverviewList";
// - entities
const CORLY_ENTITIES = "corly/entities";
// Plugins
const PLUGINS = "plugins";
const EXTENTIONS_ANALYZERS = "extentions/analyzing";
const EXTENTIONS_NOTIFICATION = "extentions/notification";
/**
* Include files of given folder
*/
public static function using($folder, $files = array()) {
$folder = dirname(__FILE__).DIRECTORY_SEPARATOR . $folder;
// For each file in given folder
if (empty($files)) {
$files = glob("{$folder}/*.php");
}
else {
// Only selected files
array_walk($files, array('Library', 'AddFolder'), $folder);
}
foreach ($files as $filename) {
if (is_file($filename))
include_once($filename);
}
}
public static function AddFolder(&$item, $key, $folder) {
$item = $folder."/".$item;
}
/**
* Include file of given project folder
* @param mixed $projectDirectoryName
*/
public static function usingProject($projectDirectoryName) {
Library::usingAll($projectDirectoryName);
}
/**
* Include all files in all subfolders
* @param mixed $path
*/
private static function usingAll($path) {
// Create recursive iterator
$directory = new RecursiveDirectoryIterator($path);
$iterator = new RecursiveIteratorIterator($directory);
$regex = new RegexIterator($iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
// Include all php files
foreach ($regex as $file) {
include_once(array_values($file)[0]);
}
}
/**
* Include component of given root
* @param $componentRoot
*/
public static function usingComponent($componentRoot) {
Library::usingAll(dirname(__FILE__).DIRECTORY_SEPARATOR . Library::VISUALIZATION_COMPONENTS . DIRECTORY_SEPARATOR . $componentRoot);
}
/**
* Include all vizualization components
*/
public static function usingVisualization() {
Library::using(Library::VISUALIZATION);
Library::usingAll(dirname(__FILE__).DIRECTORY_SEPARATOR . Library::VISUALIZATION);
}
/**
* Include all visualization tools
*/
public static function usingTools() {
Library::usingAll(dirname(__FILE__).DIRECTORY_SEPARATOR . Library::VISUALIZATION_TOOLS);
}
/**
* Get chosen path
*/
public static function path($folder, $file) {
return dirname(__FILE__). DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . $file;
}
}