-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathred.php
More file actions
190 lines (175 loc) · 9.3 KB
/
red.php
File metadata and controls
190 lines (175 loc) · 9.3 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
/**
* file:red.php
* author:Toruneko@outlook.com
* date:2014-7-12
* desc: Red
*/
defined('RED_PATH') or define('RED_PATH', dirname(__FILE__));
require(YII_PATH . '/YiiBase.php');
class Yii extends YiiBase
{
public static function createRedWebApplication($config = null)
{
return self::createApplication('RedWebApplication', $config);
}
public static function createSaeWebApplication($config = null)
{
return self::createApplication('SaeWebApplication', $config);
}
public static function createAceWebApplication($config = null)
{
return self::createApplication("AceWebApplication", $config);
}
public static function createBaeWebApplication($config = null)
{
return self::createApplication("BaeWebApplication",$config);
}
public static function createThriftApplication($config = null)
{
return self::createApplication('TApplication', $config);
}
public static function registerAutoloader($callback, $append = false)
{
if ($append) {
self::$enableIncludePath = false;
spl_autoload_register($callback);
} else {
spl_autoload_unregister(array('Yii', 'autoload'));
spl_autoload_register($callback);
spl_autoload_register(array('Yii', 'autoload'));
}
}
public static function autoload($className, $classMapOnly = false)
{
if (isset(self::$_redClasses[$className])) {
include(RED_PATH . self::$_redClasses[$className]);
} elseif ($pos = strrpos($className, '\\')) { // thrift autoload
switch (TRUE) {
// service
case preg_match('#(.+)(if|client|processor|rest)$#i', $className, $ns):
case preg_match('#(.+)_[a-z0-9]+_(args|result)$#i', $className, $ns):
$file = self::getPathOfAlias('ext') . '/' . str_replace('\\', '/', $ns[1]) . '.php';
break;
// type
default:
$dir = substr($className, 0, $pos);
$file = self::getPathOfAlias('ext') . '/' . str_replace('\\', '/', $dir) . '/Types.php';
break;
}
if (is_file($file)) {
include($file);
} else {
parent::autoload($className, $classMapOnly);
}
} else {
parent::autoload($className, $classMapOnly);
}
}
private static $_redClasses = array(
'RedSecurityManager' => '/base/RedSecurityManager.php',
'RedActiveRecord' => '/db/ar/RedActiveRecord.php',
'RedDbCommand' => '/db/RedDbCommand.php',
'RedAction' => '/web/actions/RedAction.php',
'RedAuthAssignment' => '/web/auth/RedAuthAssignment.php',
'RedAuthGroup' => '/web/auth/RedAuthGroup.php',
'RedAuthItem' => '/web/auth/RedAuthItem.php',
'RedAuthManager' => '/web/auth/RedAuthManager.php',
'RedAuthOperation' => '/web/auth/RedAuthOperation.php',
'RedAuthRole' => '/web/auth/RedAuthRole.php',
'RedDbAuthManager' => '/web/auth/RedDbAuthManager.php',
'RedUserIdentity' => '/web/auth/RedUserIdentity.php',
'RedWebUser' => '/web/auth/RedWebUser.php',
'IsAjaxRequest' => '/web/filters/IsAjaxRequest.php',
'IsGuest' => '/web/filters/IsGuest.php',
'AccessControl' => '/web/filters/AccessControl.php',
'RedLoginForm' => '/web/form/RedLoginForm.php',
'RedLinkPager' => '/web/widget/pagers/RedLinkPager.php',
'RedArrayDataProvider' => '/web/RedArrayDataProvider.php',
'RedClientScript' => '/web/RedClientScript.php',
'RedController' => '/web/RedController.php',
'RedHttpRequest' => '/web/RedHttpRequest.php',
'RedWebApplication' => '/web/RedWebApplication.php',
'RedWebModule' => '/web/RedWebModule.php',
'RedUploadedFile' => '/web/RedUploadedFile.php',
'RedSearchEngine' => '/search/RedSearchEngine.php',
'RedSearchSegment' => '/search/RedSearchSegment.php',
'RedSearchQuery' => '/search/RedSearchQuery.php',
'IRedSegment' => '/search/segment/IRedSegment.php',
'RedDNASegment' => '/search/segment/RedDNASegment.php',
'SaeStatePersister' => '/sae/base/SaeStatePersister.php',
'SaeMemCache' => '/sae/caching/SaeMemCache.php',
'SaeRedisCache' => '/sae/caching/SaeRedisCache.php',
'SaeDbCommand' => '/sae/db/SaeDbCommand.php',
'SaeDbConnection' => '/sae/db/SaeDbConnection.php',
'SaeLogRoute' => '/sae/logging/SaeLogRoute.php',
'SaeAssetManager' => '/sae/web/SaeAssetManager.php',
'SaeHttpSession' => '/sae/web/SaeHttpSession.php',
'SaeUploadedFile' => '/sae/web/SaeUploadedFile.php',
'SaeWebApplication' => '/sae/web/SaeWebApplication.php',
'SaeSearchEngine' => '/sae/search/SaeSearchEngine.php',
'SaeQueue' => '/sae/queue/SaeQueue.php',
'SaeEmail' => '/sae/utils/SaeEmail.php',
'SaeTimer' => '/sae/utils/SaeTimer.php',
'AceMemCache' => '/ace/caching/AceMemCache.php',
'AceRedisCache' => '/ace/caching/AceRedisCache.php',
'AceHttpSession' => '/ace/web/AceHttpSession.php',
'AceWebApplication' => '/ace/web/AceWebApplication.php',
'AceUploadedFile' => '/ace/web/AceUploadedFile.php',
'BaeStatePersister' => '/bae/base/BaeStatePersister.php',
'BaeMemCache' => '/bae/caching/BaeMemCache.php',
'BaeRedisCache' => '/bae/caching/BaeRedisCache.php',
'BaeEmptyCache' => '/bae/caching/BaeEmptyCache.php',
'BaeLog' => '/bae/logging/BaeLog.php',
'NetLog' => '/bae/logging/NetLog.php',
'BaeLogRoute' => '/bae/logging/BaeLogRoute.php',
'BaeWebApplication' => '/bae/web/BaeWebApplication.php',
'TApplication' => '/thrift/TApplication.php',
'TController' => '/thrift/TController.php',
'ThriftService' => '/thrift/ThriftService.php',
'ThriftClient' => '/thrift/ThriftClient.php',
'Thrift\Base\TBase' => '/thrift/base/TBase.php',
'Thrift\Exception\TException' => '/thrift/exception/TException.php',
'Thrift\Exception\TProtocolException' => '/thrift/exception/TProtocolException.php',
'Thrift\Exception\TTransportException' => '/thrift/exception/TTransportException.php',
'Thrift\Exception\TApplicationException' => '/thrift/exception/TApplicationException.php',
'Thrift\Factory\TBinaryProtocolFactory' => '/thrift/factory/TBinaryProtocolFactory.php',
'Thrift\Factory\TCompactProtocolFactory' => '/thrift/factory/TCompactProtocolFactory.php',
'Thrift\Factory\TJSONProtocolFactory' => '/thrift/factory/TJSONProtocolFactory.php',
'Thrift\Factory\TProtocolFactory' => '/thrift/factory/TProtocolFactory.php',
'Thrift\Factory\TStringFuncFactory' => '/thrift/factory/TStringFuncFactory.php',
'Thrift\Factory\TTransportFactory' => '/thrift/factory/TTransportFactory.php',
'Thrift\Protocol\JSON\BaseContext' => '/thrift/protocol/JSON/BaseContext.php',
'Thrift\Protocol\JSON\ListContext' => '/thrift/protocol/JSON/ListContext.php',
'Thrift\Protocol\JSON\LookaheadReader' => '/thrift/protocol/JSON/LookaheadReader.php',
'Thrift\Protocol\JSON\PairContext' => '/thrift/protocol/JSON/PairContext.php',
'Thrift\Protocol\TBinaryProtocol' => '/thrift/protocol/TBinaryProtocol.php',
'Thrift\Protocol\TBinaryProtocolAccelerated' => '/thrift/protocol/TBinaryProtocolAccelerated.php',
'Thrift\Protocol\TCompactProtocol' => '/thrift/protocol/TCompactProtocol.php',
'Thrift\Protocol\TJSONProtocol' => '/thrift/protocol/TJSONProtocol.php',
'Thrift\Protocol\TProtocol' => '/thrift/protocol/TProtocol.php',
'Thrift\Serializer\TBinarySerializer' => '/thrift/serializer/TBinarySerializer.php',
'Thrift\Server\TForkingServer' => '/thrift/server/TForkingServer.php',
'Thrift\Server\TServer' => '/thrift/server/TServer.php',
'Thrift\Server\TServerSocket' => '/thrift/server/TServerSocket.php',
'Thrift\Server\TServerTransport' => '/thrift/server/TServerTransport.php',
'Thrift\Server\TSimpleServer' => '/thrift/server/TSimpleServer.php',
'Thrift\StringFunc\Core' => '/thrift/stringfunc/Core.php',
'Thrift\StringFunc\Mbstring' => '/thrift/stringfunc/Mbstring.php',
'Thrift\StringFunc\TStringFunc' => '/thrift/stringfunc/TStringFunc.php',
'Thrift\Transport\TBufferedTransport' => '/thrift/transport/TBufferedTransport.php',
'Thrift\Transport\TFramedTransport' => '/thrift/transport/TFramedTransport.php',
'Thrift\Transport\THttpClient' => '/thrift/transport/THttpClient.php',
'Thrift\Transport\TMemoryBuffer' => '/thrift/transport/TMemoryBuffer.php',
'Thrift\Transport\TNullTransport' => '/thrift/transport/TNullTransport.php',
'Thrift\Transport\TPhpStream' => '/thrift/transport/TPhpStream.php',
'Thrift\Transport\TSocket' => '/thrift/transport/TSocket.php',
'Thrift\Transport\TSocketPool' => '/thrift/transport/TSocketPool.php',
'Thrift\Transport\TTransport' => '/thrift/transport/TTransport.php',
'Thrift\Type\TType' => '/thrift/type/TType.php',
'Thrift\Type\TMessageType' => '/thrift/type/TMessageType.php',
);
}
spl_autoload_unregister(array('YiiBase', 'autoload'));
spl_autoload_register(array('Yii', 'autoload'));
?>