1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11:
12:
13:
14:
15: 16: 17: 18: 19: 20:
21: class NNetteLoader extends NAutoLoader
22: {
23:
24: private static $instance;
25:
26:
27: public $list = array(
28: 'ArgumentOutOfRangeException' => '/Utils/exceptions',
29: 'DeprecatedException' => '/Utils/exceptions',
30: 'DirectoryNotFoundException' => '/Utils/exceptions',
31: 'FatalErrorException' => '/Utils/exceptions',
32: 'FileNotFoundException' => '/Utils/exceptions',
33: 'IAnnotation' => '/Reflection/IAnnotation',
34: 'IAuthenticator' => '/Security/IAuthenticator',
35: 'IAuthorizator' => '/Security/IAuthorizator',
36: 'ICacheStorage' => '/Caching/ICacheStorage',
37: 'ICollection' => '/Collections/ICollection',
38: 'IComponent' => '/ComponentModel/IComponent',
39: 'IComponentContainer' => '/ComponentModel/IComponentContainer',
40: 'IConfigAdapter' => '/Config/IConfigAdapter',
41: 'IDebuggable' => '/Debug/IDebuggable',
42: 'IFileTemplate' => '/Templates/IFileTemplate',
43: 'IFormControl' => '/Forms/IFormControl',
44: 'IFormRenderer' => '/Forms/IFormRenderer',
45: 'IHttpRequest' => '/Web/IHttpRequest',
46: 'IHttpResponse' => '/Web/IHttpResponse',
47: 'IIdentity' => '/Security/IIdentity',
48: 'IList' => '/Collections/IList',
49: 'IMailer' => '/Mail/IMailer',
50: 'IMap' => '/Collections/IMap',
51: 'INamingContainer' => '/Forms/INamingContainer',
52: 'IOException' => '/Utils/exceptions',
53: 'IPartiallyRenderable' => '/Application/IRenderable',
54: 'IPermissionAssertion' => '/Security/IPermissionAssertion',
55: 'IPresenter' => '/Application/IPresenter',
56: 'IPresenterLoader' => '/Application/IPresenterLoader',
57: 'IPresenterResponse' => '/Application/IPresenterResponse',
58: 'IRenderable' => '/Application/IRenderable',
59: 'IResource' => '/Security/IResource',
60: 'IRole' => '/Security/IRole',
61: 'IRouter' => '/Application/IRouter',
62: 'IServiceLocator' => '/Environment/IServiceLocator',
63: 'ISet' => '/Collections/ISet',
64: 'ISignalReceiver' => '/Application/ISignalReceiver',
65: 'IStatePersistent' => '/Application/IStatePersistent',
66: 'ISubmitterControl' => '/Forms/ISubmitterControl',
67: 'ITemplate' => '/Templates/ITemplate',
68: 'ITranslator' => '/Utils/ITranslator',
69: 'IUser' => '/Web/IUser',
70: 'InvalidStateException' => '/Utils/exceptions',
71: 'MemberAccessException' => '/Utils/exceptions',
72: 'NAbortException' => '/Application/Exceptions/AbortException',
73: 'NAmbiguousServiceException' => '/Environment/ServiceLocator',
74: 'NAnnotation' => '/Reflection/Annotation',
75: 'NAnnotations' => '/Reflection/Annotations',
76: 'NAnnotationsParser' => '/Reflection/AnnotationsParser',
77: 'NAppForm' => '/Application/AppForm',
78: 'NApplication' => '/Application/Application',
79: 'NApplicationException' => '/Application/Exceptions/ApplicationException',
80: 'NArrayList' => '/Collections/ArrayList',
81: 'NArrayTools' => '/Utils/ArrayTools',
82: 'NAuthenticationException' => '/Security/AuthenticationException',
83: 'NAutoLoader' => '/Loaders/AutoLoader',
84: 'NBadRequestException' => '/Application/Exceptions/BadRequestException',
85: 'NBadSignalException' => '/Application/Exceptions/BadSignalException',
86: 'NBaseTemplate' => '/Templates/BaseTemplate',
87: 'NButton' => '/Forms/Controls/Button',
88: 'NCFix' => '/loader',
89: 'NCache' => '/Caching/Cache',
90: 'NCachingHelper' => '/Templates/Filters/CachingHelper',
91: 'NCallback' => '/Utils/Callback',
92: 'NCheckbox' => '/Forms/Controls/Checkbox',
93: 'NClassReflection' => '/Reflection/ClassReflection',
94: 'NCliRouter' => '/Application/Routers/CliRouter',
95: 'NCollection' => '/Collections/Collection',
96: 'NComponent' => '/ComponentModel/Component',
97: 'NComponentContainer' => '/ComponentModel/ComponentContainer',
98: 'NConfig' => '/Config/Config',
99: 'NConfigAdapterIni' => '/Config/ConfigAdapterIni',
100: 'NConfigurator' => '/Environment/Configurator',
101: 'NControl' => '/Application/Control',
102: 'NConventionalRenderer' => '/Forms/Renderers/ConventionalRenderer',
103: 'NCurlyBracketsFilter' => '/Templates/Filters/LatteFilter',
104: 'NCurlyBracketsMacros' => '/Templates/Filters/LatteFilter',
105: 'NDateTime53' => '/Utils/DateTime',
106: 'NDebug' => '/Debug/Debug',
107: 'NDownloadResponse' => '/Application/Responses/DownloadResponse',
108: 'NDummyStorage' => '/Caching/DummyStorage',
109: 'NEnvironment' => '/Environment/Environment',
110: 'NExtensionReflection' => '/Reflection/ExtensionReflection',
111: 'NFileStorage' => '/Caching/FileStorage',
112: 'NFileUpload' => '/Forms/Controls/FileUpload',
113: 'NForbiddenRequestException' => '/Application/Exceptions/ForbiddenRequestException',
114: 'NForm' => '/Forms/Form',
115: 'NFormContainer' => '/Forms/FormContainer',
116: 'NFormControl' => '/Forms/Controls/FormControl',
117: 'NFormGroup' => '/Forms/FormGroup',
118: 'NForwardingResponse' => '/Application/Responses/ForwardingResponse',
119: 'NFramework' => '/Utils/Framework',
120: 'NFreezableObject' => '/Utils/FreezableObject',
121: 'NFtp' => '/Web/Ftp',
122: 'NFtpException' => '/Web/Ftp',
123: 'NFunctionReflection' => '/Reflection/FunctionReflection',
124: 'NGenericRecursiveIterator' => '/Utils/Iterators/GenericRecursiveIterator',
125: 'NHashtable' => '/Collections/Hashtable',
126: 'NHiddenField' => '/Forms/Controls/HiddenField',
127: 'NHtml' => '/Web/Html',
128: 'NHttpContext' => '/Web/HttpContext',
129: 'NHttpRequest' => '/Web/HttpRequest',
130: 'NHttpResponse' => '/Web/HttpResponse',
131: 'NHttpUploadedFile' => '/Web/HttpUploadedFile',
132: 'NIdentity' => '/Security/Identity',
133: 'NImage' => '/Utils/Image',
134: 'NImageButton' => '/Forms/Controls/ImageButton',
135: 'NImageMagick' => '/Utils/ImageMagick',
136: 'NInstanceFilterIterator' => '/Utils/Iterators/InstanceFilterIterator',
137: 'NInstantClientScript' => '/Forms/Renderers/InstantClientScript',
138: 'NInvalidLinkException' => '/Application/Exceptions/InvalidLinkException',
139: 'NInvalidPresenterException' => '/Application/Exceptions/InvalidPresenterException',
140: 'NJsonResponse' => '/Application/Responses/JsonResponse',
141: 'NKeyNotFoundException' => '/Collections/Hashtable',
142: 'NLatteFilter' => '/Templates/Filters/LatteFilter',
143: 'NLatteMacros' => '/Templates/Filters/LatteMacros',
144: 'NLimitedScope' => '/Loaders/LimitedScope',
145: 'NLink' => '/Application/Link',
146: 'NMail' => '/Mail/Mail',
147: 'NMailMimePart' => '/Mail/MailMimePart',
148: 'NMemcachedStorage' => '/Caching/MemcachedStorage',
149: 'NMethodReflection' => '/Reflection/MethodReflection',
150: 'NMultiRouter' => '/Application/Routers/MultiRouter',
151: 'NMultiSelectBox' => '/Forms/Controls/MultiSelectBox',
152: 'NNetteLoader' => '/Loaders/NetteLoader',
153: 'NObject' => '/Utils/Object',
154: 'NObjectMixin' => '/Utils/ObjectMixin',
155: 'NPaginator' => '/Utils/Paginator',
156: 'NParameterReflection' => '/Reflection/ParameterReflection',
157: 'NPermission' => '/Security/Permission',
158: 'NPresenter' => '/Application/Presenter',
159: 'NPresenterComponent' => '/Application/PresenterComponent',
160: 'NPresenterComponentReflection' => '/Application/PresenterComponentReflection',
161: 'NPresenterLoader' => '/Application/PresenterLoader',
162: 'NPresenterRequest' => '/Application/PresenterRequest',
163: 'NPropertyReflection' => '/Reflection/PropertyReflection',
164: 'NRadioList' => '/Forms/Controls/RadioList',
165: 'NRecursiveComponentIterator' => '/ComponentModel/ComponentContainer',
166: 'NRedirectingResponse' => '/Application/Responses/RedirectingResponse',
167: 'NRenderResponse' => '/Application/Responses/RenderResponse',
168: 'NRobotLoader' => '/Loaders/RobotLoader',
169: 'NRoute' => '/Application/Routers/Route',
170: 'NRule' => '/Forms/Rule',
171: 'NRules' => '/Forms/Rules',
172: 'NSafeStream' => '/Utils/SafeStream',
173: 'NSelectBox' => '/Forms/Controls/SelectBox',
174: 'NSendmailMailer' => '/Mail/SendmailMailer',
175: 'NServiceLocator' => '/Environment/ServiceLocator',
176: 'NSession' => '/Web/Session',
177: 'NSessionNamespace' => '/Web/SessionNamespace',
178: 'NSet' => '/Collections/Set',
179: 'NSimpleAuthenticator' => '/Security/SimpleAuthenticator',
180: 'NSimpleRouter' => '/Application/Routers/SimpleRouter',
181: 'NSmartCachingIterator' => '/Utils/Iterators/SmartCachingIterator',
182: 'NSnippetHelper' => '/Templates/Filters/SnippetHelper',
183: 'NString' => '/Utils/String',
184: 'NSubmitButton' => '/Forms/Controls/SubmitButton',
185: 'NTemplate' => '/Templates/Template',
186: 'NTemplateCacheStorage' => '/Templates/TemplateCacheStorage',
187: 'NTemplateFilters' => '/Templates/Filters/TemplateFilters',
188: 'NTemplateHelpers' => '/Templates/Filters/TemplateHelpers',
189: 'NTextArea' => '/Forms/Controls/TextArea',
190: 'NTextBase' => '/Forms/Controls/TextBase',
191: 'NTextInput' => '/Forms/Controls/TextInput',
192: 'NTools' => '/Utils/Tools',
193: 'NUri' => '/Web/Uri',
194: 'NUriScript' => '/Web/UriScript',
195: 'NUser' => '/Web/User',
196: 'NotImplementedException' => '/Utils/exceptions',
197: 'NotSupportedException' => '/Utils/exceptions',
198: );
199:
200:
201:
202: 203: 204: 205:
206: public static function getInstance()
207: {
208: if (self::$instance === NULL) {
209: self::$instance = new self;
210: }
211: return self::$instance;
212: }
213:
214:
215:
216: 217: 218: 219: 220:
221: public function tryLoad($type)
222: {
223: $type = ltrim($type, '\\');
224: if (isset($this->list[$type])) {
225: NLimitedScope::load(NETTE_DIR . $this->list[$type] . '.php', TRUE);
226: self::$count++;
227:
228: } elseif (substr($type, 0, 6) === 'Nette\\' && is_file($file = NETTE_DIR . strtr(substr($type, 5), '\\', '/') . '.php')) {
229: NLimitedScope::load($file, TRUE);
230: self::$count++;
231: }
232: }
233:
234: }
235: