PageRenderTime 14ms CodeModel.GetById 2ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/leganto/libs/Nette/Loaders/NetteLoader.php

http://preader.googlecode.com/
PHP | 234 lines | 192 code | 14 blank | 28 comment | 2 complexity | 052cc7f3170f9c17d2cb6985f9ae2f20 MD5 | raw file
  1<?php
  2
  3/**
  4 * Nette Framework
  5 *
  6 * @copyright  Copyright (c) 2004, 2010 David Grudl
  7 * @license    http://nettephp.com/license  Nette license
  8 * @link       http://nettephp.com
  9 * @category   Nette
 10 * @package    Nette\Loaders
 11 */
 12
 13/*namespace Nette\Loaders;*/
 14
 15
 16
 17/**
 18 * Nette auto loader is responsible for loading Nette classes and interfaces.
 19 *
 20 * @copyright  Copyright (c) 2004, 2010 David Grudl
 21 * @package    Nette\Loaders
 22 */
 23class NetteLoader extends AutoLoader
 24{
 25	/** @var NetteLoader */
 26	public static $instance;
 27
 28	/** @var string  base file path */
 29	public $base;
 30
 31	/** @var array */
 32	public $list = array(
 33		'abortexception' => '/Application/Exceptions/AbortException.php',
 34		'ambiguousserviceexception' => '/ServiceLocator.php',
 35		'annotation' => '/Reflection/Annotation.php',
 36		'annotations' => '/Annotations.php',
 37		'annotationsparser' => '/Reflection/AnnotationsParser.php',
 38		'appform' => '/Application/AppForm.php',
 39		'application' => '/Application/Application.php',
 40		'applicationexception' => '/Application/Exceptions/ApplicationException.php',
 41		'argumentoutofrangeexception' => '/exceptions.php',
 42		'arraylist' => '/Collections/ArrayList.php',
 43		'arraytools' => '/ArrayTools.php',
 44		'authenticationexception' => '/Security/AuthenticationException.php',
 45		'autoloader' => '/Loaders/AutoLoader.php',
 46		'badrequestexception' => '/Application/Exceptions/BadRequestException.php',
 47		'badsignalexception' => '/Application/Exceptions/BadSignalException.php',
 48		'basetemplate' => '/Templates/BaseTemplate.php',
 49		'button' => '/Forms/Controls/Button.php',
 50		'cache' => '/Caching/Cache.php',
 51		'cachinghelper' => '/Templates/Filters/CachingHelper.php',
 52		'callback' => '/Callback.php',
 53		'checkbox' => '/Forms/Controls/Checkbox.php',
 54		'classreflection' => '/Reflection/ClassReflection.php',
 55		'clirouter' => '/Application/Routers/CliRouter.php',
 56		'collection' => '/Collections/Collection.php',
 57		'component' => '/Component.php',
 58		'componentcontainer' => '/ComponentContainer.php',
 59		'config' => '/Config/Config.php',
 60		'configadapterini' => '/Config/ConfigAdapterIni.php',
 61		'configurator' => '/Configurator.php',
 62		'control' => '/Application/Control.php',
 63		'conventionalrenderer' => '/Forms/Renderers/ConventionalRenderer.php',
 64		'curlybracketsfilter' => '/Templates/Filters/LatteFilter.php',
 65		'curlybracketsmacros' => '/Templates/Filters/LatteFilter.php',
 66		'datetime53' => '/compatibility/DateTime53.php',
 67		'debug' => '/Debug.php',
 68		'deprecatedexception' => '/exceptions.php',
 69		'directorynotfoundexception' => '/exceptions.php',
 70		'downloadresponse' => '/Application/Responses/DownloadResponse.php',
 71		'dummystorage' => '/Caching/DummyStorage.php',
 72		'environment' => '/Environment.php',
 73		'extensionreflection' => '/Reflection/ExtensionReflection.php',
 74		'fatalerrorexception' => '/exceptions.php',
 75		'filenotfoundexception' => '/exceptions.php',
 76		'filestorage' => '/Caching/FileStorage.php',
 77		'fileupload' => '/Forms/Controls/FileUpload.php',
 78		'forbiddenrequestexception' => '/Application/Exceptions/ForbiddenRequestException.php',
 79		'form' => '/Forms/Form.php',
 80		'formcontainer' => '/Forms/FormContainer.php',
 81		'formcontrol' => '/Forms/Controls/FormControl.php',
 82		'formgroup' => '/Forms/FormGroup.php',
 83		'forwardingresponse' => '/Application/Responses/ForwardingResponse.php',
 84		'framework' => '/Framework.php',
 85		'freezableobject' => '/FreezableObject.php',
 86		'ftp' => '/Web/Ftp.php',
 87		'ftpexception' => '/Web/Ftp.php',
 88		'functionreflection' => '/Reflection/FunctionReflection.php',
 89		'hashtable' => '/Collections/Hashtable.php',
 90		'hiddenfield' => '/Forms/Controls/HiddenField.php',
 91		'html' => '/Web/Html.php',
 92		'httpcontext' => '/Web/HttpContext.php',
 93		'httprequest' => '/Web/HttpRequest.php',
 94		'httpresponse' => '/Web/HttpResponse.php',
 95		'httpuploadedfile' => '/Web/HttpUploadedFile.php',
 96		'iannotation' => '/Reflection/IAnnotation.php',
 97		'iauthenticator' => '/Security/IAuthenticator.php',
 98		'iauthorizator' => '/Security/IAuthorizator.php',
 99		'icachestorage' => '/Caching/ICacheStorage.php',
100		'icollection' => '/Collections/ICollection.php',
101		'icomponent' => '/IComponent.php',
102		'icomponentcontainer' => '/IComponentContainer.php',
103		'iconfigadapter' => '/Config/IConfigAdapter.php',
104		'idebuggable' => '/IDebuggable.php',
105		'identity' => '/Security/Identity.php',
106		'ifiletemplate' => '/Templates/IFileTemplate.php',
107		'iformcontrol' => '/Forms/IFormControl.php',
108		'iformrenderer' => '/Forms/IFormRenderer.php',
109		'ihttprequest' => '/Web/IHttpRequest.php',
110		'ihttpresponse' => '/Web/IHttpResponse.php',
111		'iidentity' => '/Security/IIdentity.php',
112		'ilist' => '/Collections/IList.php',
113		'image' => '/Image.php',
114		'imagebutton' => '/Forms/Controls/ImageButton.php',
115		'imagemagick' => '/ImageMagick.php',
116		'imailer' => '/Mail/IMailer.php',
117		'imap' => '/Collections/IMap.php',
118		'inamingcontainer' => '/Forms/INamingContainer.php',
119		'instancefilteriterator' => '/InstanceFilterIterator.php',
120		'instantclientscript' => '/Forms/Renderers/InstantClientScript.php',
121		'invalidlinkexception' => '/Application/Exceptions/InvalidLinkException.php',
122		'invalidpresenterexception' => '/Application/Exceptions/InvalidPresenterException.php',
123		'invalidstateexception' => '/exceptions.php',
124		'ioexception' => '/exceptions.php',
125		'ipartiallyrenderable' => '/Application/IRenderable.php',
126		'ipermissionassertion' => '/Security/IPermissionAssertion.php',
127		'ipresenter' => '/Application/IPresenter.php',
128		'ipresenterloader' => '/Application/IPresenterLoader.php',
129		'ipresenterresponse' => '/Application/IPresenterResponse.php',
130		'irenderable' => '/Application/IRenderable.php',
131		'iresource' => '/Security/IResource.php',
132		'irole' => '/Security/IRole.php',
133		'irouter' => '/Application/IRouter.php',
134		'iservicelocator' => '/IServiceLocator.php',
135		'iset' => '/Collections/ISet.php',
136		'isignalreceiver' => '/Application/ISignalReceiver.php',
137		'istatepersistent' => '/Application/IStatePersistent.php',
138		'isubmittercontrol' => '/Forms/ISubmitterControl.php',
139		'itemplate' => '/Templates/ITemplate.php',
140		'itranslator' => '/ITranslator.php',
141		'iuser' => '/Web/IUser.php',
142		'jsonresponse' => '/Application/Responses/JsonResponse.php',
143		'keynotfoundexception' => '/Collections/Hashtable.php',
144		'lattefilter' => '/Templates/Filters/LatteFilter.php',
145		'lattemacros' => '/Templates/Filters/LatteMacros.php',
146		'limitedscope' => '/Loaders/LimitedScope.php',
147		'link' => '/Application/Link.php',
148		'mail' => '/Mail/Mail.php',
149		'mailmimepart' => '/Mail/MailMimePart.php',
150		'memberaccessexception' => '/exceptions.php',
151		'memcachedstorage' => '/Caching/MemcachedStorage.php',
152		'methodparameterreflection' => '/Reflection/MethodParameterReflection.php',
153		'methodreflection' => '/Reflection/MethodReflection.php',
154		'multirouter' => '/Application/Routers/MultiRouter.php',
155		'multiselectbox' => '/Forms/Controls/MultiSelectBox.php',
156		'netteloader' => '/Loaders/NetteLoader.php',
157		'notimplementedexception' => '/exceptions.php',
158		'notsupportedexception' => '/exceptions.php',
159		'object' => '/Object.php',
160		'objectmixin' => '/ObjectMixin.php',
161		'paginator' => '/Paginator.php',
162		'permission' => '/Security/Permission.php',
163		'presenter' => '/Application/Presenter.php',
164		'presentercomponent' => '/Application/PresenterComponent.php',
165		'presentercomponentreflection' => '/Application/PresenterComponentReflection.php',
166		'presenterloader' => '/Application/PresenterLoader.php',
167		'presenterrequest' => '/Application/PresenterRequest.php',
168		'propertyreflection' => '/Reflection/PropertyReflection.php',
169		'radiolist' => '/Forms/Controls/RadioList.php',
170		'recursivecomponentiterator' => '/ComponentContainer.php',
171		'recursivehtmliterator' => '/Web/Html.php',
172		'redirectingresponse' => '/Application/Responses/RedirectingResponse.php',
173		'renderresponse' => '/Application/Responses/RenderResponse.php',
174		'robotloader' => '/Loaders/RobotLoader.php',
175		'route' => '/Application/Routers/Route.php',
176		'rule' => '/Forms/Rule.php',
177		'rules' => '/Forms/Rules.php',
178		'safestream' => '/IO/SafeStream.php',
179		'selectbox' => '/Forms/Controls/SelectBox.php',
180		'sendmailmailer' => '/Mail/SendmailMailer.php',
181		'servicelocator' => '/ServiceLocator.php',
182		'session' => '/Web/Session.php',
183		'sessionnamespace' => '/Web/SessionNamespace.php',
184		'set' => '/Collections/Set.php',
185		'simpleauthenticator' => '/Security/SimpleAuthenticator.php',
186		'simplerouter' => '/Application/Routers/SimpleRouter.php',
187		'smartcachingiterator' => '/SmartCachingIterator.php',
188		'snippethelper' => '/Templates/Filters/SnippetHelper.php',
189		'string' => '/String.php',
190		'submitbutton' => '/Forms/Controls/SubmitButton.php',
191		'template' => '/Templates/Template.php',
192		'templatecachestorage' => '/Templates/TemplateCacheStorage.php',
193		'templatefilters' => '/Templates/Filters/TemplateFilters.php',
194		'templatehelpers' => '/Templates/Filters/TemplateHelpers.php',
195		'textarea' => '/Forms/Controls/TextArea.php',
196		'textbase' => '/Forms/Controls/TextBase.php',
197		'textinput' => '/Forms/Controls/TextInput.php',
198		'tools' => '/Tools.php',
199		'uri' => '/Web/Uri.php',
200		'uriscript' => '/Web/UriScript.php',
201		'user' => '/Web/User.php',
202	);
203
204
205
206	/**
207	 * Returns singleton instance with lazy instantiation.
208	 * @return NetteLoader
209	 */
210	public static function getInstance()
211	{
212		if (self::$instance === NULL) {
213			self::$instance = new self;
214		}
215		return self::$instance;
216	}
217
218
219
220	/**
221	 * Handles autoloading of classes or interfaces.
222	 * @param  string
223	 * @return void
224	 */
225	public function tryLoad($type)
226	{
227		$type = strtolower($type);
228		if (isset($this->list[$type])) {
229			LimitedScope::load($this->base . $this->list[$type]);
230			self::$count++;
231		}
232	}
233
234}