|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Ubiquity\core |
|
5
|
|
|
* This class is part of Ubiquity |
|
6
|
|
|
* @author jc |
|
7
|
|
|
* @version 1.0.0 |
|
8
|
|
|
* |
|
9
|
|
|
*/ |
|
10
|
|
|
namespace Ubiquity\core; |
|
11
|
|
|
|
|
12
|
|
|
use Ubiquity\assets\AssetsManager; |
|
13
|
|
|
use Ubiquity\contents\normalizers\NormalizersManager; |
|
14
|
|
|
use Ubiquity\controllers\Router; |
|
15
|
|
|
use Ubiquity\controllers\Startup; |
|
16
|
|
|
use Ubiquity\orm\OrmUtils; |
|
17
|
|
|
use Ubiquity\translation\TranslatorManager; |
|
18
|
|
|
use Ubiquity\utils\http\UCookie; |
|
19
|
|
|
use Ubiquity\utils\http\URequest; |
|
20
|
|
|
use Ubiquity\utils\http\USession; |
|
21
|
|
|
use Ubiquity\cache\CacheManager; |
|
22
|
|
|
|
|
23
|
|
|
class Framework { |
|
24
|
|
|
public const version = '~2.4.0'; |
|
25
|
|
|
|
|
26
|
4 |
|
public static function getVersion() { |
|
27
|
4 |
|
return self::version; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
4 |
|
public static function getController() { |
|
31
|
4 |
|
return Startup::getController (); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
5 |
|
public static function getAction() { |
|
35
|
5 |
|
return Startup::getAction (); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
4 |
|
public static function getUrl() { |
|
39
|
4 |
|
return \implode ( "/", Startup::$urlParts ); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
1 |
|
public static function getRouter() { |
|
43
|
1 |
|
return new Router (); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
1 |
|
public static function getORM() { |
|
47
|
1 |
|
return new OrmUtils (); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
1 |
|
public static function getRequest() { |
|
51
|
1 |
|
return new URequest (); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
1 |
|
public static function getSession() { |
|
55
|
1 |
|
return new USession (); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
1 |
|
public static function getCookies() { |
|
59
|
1 |
|
return new UCookie (); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
1 |
|
public static function getTranslator() { |
|
63
|
1 |
|
return new TranslatorManager (); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
1 |
|
public static function getNormalizer() { |
|
67
|
1 |
|
return new NormalizersManager (); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
4 |
|
public static function hasAdmin() { |
|
71
|
4 |
|
return \class_exists ( "controllers\Admin" ); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
1 |
|
public static function getAssets() { |
|
75
|
1 |
|
return new AssetsManager (); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
3 |
|
public static function getCacheSystem(){ |
|
79
|
3 |
|
return \get_class(CacheManager::$cache); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
3 |
|
public static function getAnnotationsEngine(){ |
|
83
|
3 |
|
return \get_class(CacheManager::getAnnotationsEngineInstance()); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* Returns an instance of JsUtils initialized with Semantic (for di injection) |
|
88
|
|
|
* |
|
89
|
|
|
* @param \Ubiquity\controllers\Controller $controller |
|
90
|
|
|
* @param array $options |
|
91
|
|
|
* @return \Ajax\php\ubiquity\JsUtils |
|
92
|
|
|
*/ |
|
93
|
43 |
|
public static function diSemantic($controller, $options = [ 'defer' => true,'gc' => true ]) { |
|
94
|
43 |
|
$jquery = new \Ajax\php\ubiquity\JsUtils ( $options, $controller ); |
|
95
|
43 |
|
$jquery->semantic ( new \Ajax\Semantic () ); |
|
96
|
43 |
|
$jquery->setAjaxLoader ( "<div class=\"ui active centered inline text loader\">Loading</div>" ); |
|
97
|
43 |
|
return $jquery; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Returns an instance of JsUtils initialized with Bootstrap (for di injection) |
|
102
|
|
|
* |
|
103
|
|
|
* @param \Ubiquity\controllers\Controller $controller |
|
104
|
|
|
* @param array $options |
|
105
|
|
|
* @return \Ajax\php\ubiquity\JsUtils |
|
106
|
|
|
*/ |
|
107
|
1 |
|
public static function diBootstrap($controller, $options = [ 'defer' => true,'gc' => true ]) { |
|
108
|
1 |
|
$jquery = new \Ajax\php\ubiquity\JsUtils ( $options, $controller ); |
|
109
|
1 |
|
$jquery->bootstrap ( new \Ajax\Bootstrap () ); |
|
110
|
1 |
|
$jquery->setAjaxLoader ( "<div class=\"ui active centered inline text loader\">Loading</div>" ); |
|
111
|
1 |
|
return $jquery; |
|
112
|
|
|
} |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
|