Development

/branches/1.2/lib/autoload/sfCoreAutoload.class.php

You must first sign up to be able to contribute.

root/branches/1.2/lib/autoload/sfCoreAutoload.class.php

Revision 28284, 16.8 kB (checked in by FabianLange, 5 years ago)

[1.2] updated dev version number

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * The current symfony version.
13  */
14 define('SYMFONY_VERSION', '1.2.13-DEV');
15
16 /**
17  * sfCoreAutoload class.
18  *
19  * This class is a singleton as PHP seems to be unable to register 2 autoloaders that are instances
20  * of the same class (why?).
21  *
22  * @package    symfony
23  * @subpackage autoload
24  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
25  * @version    SVN: $Id$
26  */
27 class sfCoreAutoload
28 {
29   static protected
30     $registered = false,
31     $instance   = null;
32
33   protected
34     $baseDir = '';
35
36   protected function __construct()
37   {
38     $this->baseDir = realpath(dirname(__FILE__).'/..').'/';
39   }
40
41   /**
42    * Retrieves the singleton instance of this class.
43    *
44    * @return sfCoreAutoload A sfCoreAutoload implementation instance.
45    */
46   static public function getInstance()
47   {
48     if (!isset(self::$instance))
49     {
50       self::$instance = new sfCoreAutoload();
51     }
52
53     return self::$instance;
54   }
55
56   /**
57    * Register sfCoreAutoload in spl autoloader.
58    *
59    * @return void
60    */
61   static public function register()
62   {
63     if (self::$registered)
64     {
65       return;
66     }
67
68     ini_set('unserialize_callback_func', 'spl_autoload_call');
69     if (false === spl_autoload_register(array(self::getInstance(), 'autoload')))
70     {
71       throw new sfException(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance())));
72     }
73
74     self::$registered = true;
75   }
76
77   /**
78    * Unregister sfCoreAutoload from spl autoloader.
79    *
80    * @return void
81    */
82   static public function unregister()
83   {
84     spl_autoload_unregister(array(self::getInstance(), 'autoload'));
85     self::$registered = false;
86   }
87
88   /**
89    * Handles autoloading of classes.
90    *
91    * @param string $class A class name.
92    *
93    * @return boolean Returns true if the class has been loaded
94    */
95   public function autoload($class)
96   {
97     if (!isset($this->classes[$class]))
98     {
99       return false;
100     }
101
102     require $this->baseDir.$this->classes[$class].'/'.$class.'.class.php';
103
104     return true;
105   }
106
107   /**
108    * Returns the base directory this autoloader is working on.
109    *
110    * @return base directory
111    */
112   public function getBaseDir()
113   {
114     return $this->baseDir;
115   }
116
117   /**
118    * Rebuilds the association array between class names and paths.
119    *
120    * This method overrides this file (__FILE__)
121    */
122   static public function make()
123   {
124     $libDir = str_replace(DIRECTORY_SEPARATOR, '/', realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'));
125     require_once $libDir.'/util/sfFinder.class.php';
126
127     $files = sfFinder::type('file')
128       ->prune('plugins')
129       ->prune('vendor')
130       ->prune('skeleton')
131       ->prune('default')
132       ->name('*\.class\.php')
133       ->in($libDir)
134     ;
135
136     sort($files, SORT_STRING);
137
138     $classes = array();
139     foreach ($files as $file)
140     {
141       $classes[basename($file, '.class.php')] = str_replace($libDir.'/', '', str_replace(DIRECTORY_SEPARATOR, '/', dirname($file)));
142     }
143
144     $content = preg_replace('/protected \$classes = array *\(.*?\)/s', 'protected $classes = '.var_export($classes, true), file_get_contents(__FILE__));
145
146     file_put_contents(__FILE__, $content);
147   }
148
149   // Don't edit this property by hand.
150   // To update it, use sfCoreAutoload::make()
151   protected $classes = array (
152   'sfAction' => 'action',
153   'sfActionStack' => 'action',
154   'sfActionStackEntry' => 'action',
155   'sfActions' => 'action',
156   'sfComponent' => 'action',
157   'sfComponents' => 'action',
158   'sfData' => 'addon',
159   'sfPager' => 'addon',
160   'sfAutoload' => 'autoload',
161   'sfCoreAutoload' => 'autoload',
162   'sfSimpleAutoload' => 'autoload',
163   'sfAPCCache' => 'cache',
164   'sfCache' => 'cache',
165   'sfEAcceleratorCache' => 'cache',
166   'sfFileCache' => 'cache',
167   'sfFunctionCache' => 'cache',
168   'sfMemcacheCache' => 'cache',
169   'sfNoCache' => 'cache',
170   'sfSQLiteCache' => 'cache',
171   'sfXCacheCache' => 'cache',
172   'sfAnsiColorFormatter' => 'command',
173   'sfCommandApplication' => 'command',
174   'sfCommandArgument' => 'command',
175   'sfCommandArgumentSet' => 'command',
176   'sfCommandArgumentsException' => 'command',
177   'sfCommandException' => 'command',
178   'sfCommandLogger' => 'command',
179   'sfCommandManager' => 'command',
180   'sfCommandOption' => 'command',
181   'sfCommandOptionSet' => 'command',
182   'sfFormatter' => 'command',
183   'sfSymfonyCommandApplication' => 'command',
184   'sfApplicationConfiguration' => 'config',
185   'sfAutoloadConfigHandler' => 'config',
186   'sfCacheConfigHandler' => 'config',
187   'sfCompileConfigHandler' => 'config',
188   'sfConfig' => 'config',
189   'sfConfigCache' => 'config',
190   'sfConfigHandler' => 'config',
191   'sfDatabaseConfigHandler' => 'config',
192   'sfDefineEnvironmentConfigHandler' => 'config',
193   'sfFactoryConfigHandler' => 'config',
194   'sfFilterConfigHandler' => 'config',
195   'sfGeneratorConfigHandler' => 'config',
196   'sfLoader' => 'config',
197   'sfPluginConfiguration' => 'config',
198   'sfPluginConfigurationGeneric' => 'config',
199   'sfProjectConfiguration' => 'config',
200   'sfRootConfigHandler' => 'config',
201   'sfRoutingConfigHandler' => 'config',
202   'sfSecurityConfigHandler' => 'config',
203   'sfSimpleYamlConfigHandler' => 'config',
204   'sfViewConfigHandler' => 'config',
205   'sfYamlConfigHandler' => 'config',
206   'sfConsoleController' => 'controller',
207   'sfController' => 'controller',
208   'sfFrontWebController' => 'controller',
209   'sfWebController' => 'controller',
210   'sfDatabase' => 'database',
211   'sfDatabaseManager' => 'database',
212   'sfMySQLDatabase' => 'database',
213   'sfMySQLiDatabase' => 'database',
214   'sfPDODatabase' => 'database',
215   'sfPostgreSQLDatabase' => 'database',
216   'sfDebug' => 'debug',
217   'sfTimer' => 'debug',
218   'sfTimerManager' => 'debug',
219   'sfWebDebug' => 'debug',
220   'sfWebDebugPanel' => 'debug',
221   'sfWebDebugPanelCache' => 'debug',
222   'sfWebDebugPanelConfig' => 'debug',
223   'sfWebDebugPanelLogs' => 'debug',
224   'sfWebDebugPanelMemory' => 'debug',
225   'sfWebDebugPanelSymfonyVersion' => 'debug',
226   'sfWebDebugPanelTimer' => 'debug',
227   'sfEvent' => 'event',
228   'sfEventDispatcher' => 'event',
229   'sfCacheException' => 'exception',
230   'sfConfigurationException' => 'exception',
231   'sfControllerException' => 'exception',
232   'sfDatabaseException' => 'exception',
233   'sfError404Exception' => 'exception',
234   'sfException' => 'exception',
235   'sfFactoryException' => 'exception',
236   'sfFileException' => 'exception',
237   'sfFilterException' => 'exception',
238   'sfForwardException' => 'exception',
239   'sfInitializationException' => 'exception',
240   'sfParseException' => 'exception',
241   'sfRenderException' => 'exception',
242   'sfSecurityException' => 'exception',
243   'sfStopException' => 'exception',
244   'sfStorageException' => 'exception',
245   'sfViewException' => 'exception',
246   'sfBasicSecurityFilter' => 'filter',
247   'sfCacheFilter' => 'filter',
248   'sfCommonFilter' => 'filter',
249   'sfExecutionFilter' => 'filter',
250   'sfFilter' => 'filter',
251   'sfFilterChain' => 'filter',
252   'sfRenderingFilter' => 'filter',
253   'sfForm' => 'form',
254   'sfFormField' => 'form',
255   'sfFormFieldSchema' => 'form',
256   'sfFormFilter' => 'form',
257   'sfAdminGenerator' => 'generator',
258   'sfCrudGenerator' => 'generator',
259   'sfGenerator' => 'generator',
260   'sfGeneratorManager' => 'generator',
261   'sfModelGenerator' => 'generator',
262   'sfModelGeneratorConfiguration' => 'generator',
263   'sfModelGeneratorConfigurationField' => 'generator',
264   'sfModelGeneratorHelper' => 'generator',
265   'sfRichTextEditor' => 'helper',
266   'sfRichTextEditorFCK' => 'helper',
267   'sfRichTextEditorTinyMCE' => 'helper',
268   'TGettext' => 'i18n/Gettext',
269   'sfI18nApplicationExtract' => 'i18n/extract',
270   'sfI18nExtract' => 'i18n/extract',
271   'sfI18nExtractorInterface' => 'i18n/extract',
272   'sfI18nModuleExtract' => 'i18n/extract',
273   'sfI18nPhpExtractor' => 'i18n/extract',
274   'sfI18nYamlExtractor' => 'i18n/extract',
275   'sfI18nYamlGeneratorExtractor' => 'i18n/extract',
276   'sfI18nYamlValidateExtractor' => 'i18n/extract',
277   'sfChoiceFormat' => 'i18n',
278   'sfCultureInfo' => 'i18n',
279   'sfDateFormat' => 'i18n',
280   'sfDateTimeFormatInfo' => 'i18n',
281   'sfI18N' => 'i18n',
282   'sfIMessageSource' => 'i18n',
283   'sfMessageFormat' => 'i18n',
284   'sfMessageSource' => 'i18n',
285   'sfMessageSource_Aggregate' => 'i18n',
286   'sfMessageSource_Database' => 'i18n',
287   'sfMessageSource_File' => 'i18n',
288   'sfMessageSource_MySQL' => 'i18n',
289   'sfMessageSource_SQLite' => 'i18n',
290   'sfMessageSource_XLIFF' => 'i18n',
291   'sfMessageSource_gettext' => 'i18n',
292   'sfNumberFormat' => 'i18n',
293   'sfNumberFormatInfo' => 'i18n',
294   'sfAggregateLogger' => 'log',
295   'sfConsoleLogger' => 'log',
296   'sfFileLogger' => 'log',
297   'sfLogger' => 'log',
298   'sfLoggerInterface' => 'log',
299   'sfLoggerWrapper' => 'log',
300   'sfNoLogger' => 'log',
301   'sfStreamLogger' => 'log',
302   'sfVarLogger' => 'log',
303   'sfWebDebugLogger' => 'log',
304   'sfPearConfig' => 'plugin',
305   'sfPearDownloader' => 'plugin',
306   'sfPearEnvironment' => 'plugin',
307   'sfPearFrontendPlugin' => 'plugin',
308   'sfPearRest' => 'plugin',
309   'sfPearRest10' => 'plugin',
310   'sfPearRest11' => 'plugin',
311   'sfPearRestPlugin' => 'plugin',
312   'sfPluginDependencyException' => 'plugin',
313   'sfPluginException' => 'plugin',
314   'sfPluginManager' => 'plugin',
315   'sfPluginRecursiveDependencyException' => 'plugin',
316   'sfPluginRestException' => 'plugin',
317   'sfSymfonyPluginManager' => 'plugin',
318   'sfConsoleRequest' => 'request',
319   'sfRequest' => 'request',
320   'sfWebRequest' => 'request',
321   'sfConsoleResponse' => 'response',
322   'sfResponse' => 'response',
323   'sfWebResponse' => 'response',
324   'sfNoRouting' => 'routing',
325   'sfObjectRoute' => 'routing',
326   'sfObjectRouteCollection' => 'routing',
327   'sfPathInfoRouting' => 'routing',
328   'sfPatternRouting' => 'routing',
329   'sfRequestRoute' => 'routing',
330   'sfRoute' => 'routing',
331   'sfRouteCollection' => 'routing',
332   'sfRouting' => 'routing',
333   'sfCacheSessionStorage' => 'storage',
334   'sfDatabaseSessionStorage' => 'storage',
335   'sfMySQLSessionStorage' => 'storage',
336   'sfMySQLiSessionStorage' => 'storage',
337   'sfNoStorage' => 'storage',
338   'sfPDOSessionStorage' => 'storage',
339   'sfPostgreSQLSessionStorage' => 'storage',
340   'sfSessionStorage' => 'storage',
341   'sfSessionTestStorage' => 'storage',
342   'sfStorage' => 'storage',
343   'sfAppRoutesTask' => 'task/app',
344   'sfCacheClearTask' => 'task/cache',
345   'sfConfigureAuthorTask' => 'task/configure',
346   'sfConfigureDatabaseTask' => 'task/configure',
347   'sfGenerateAppTask' => 'task/generator',
348   'sfGenerateModuleTask' => 'task/generator',
349   'sfGenerateProjectTask' => 'task/generator',
350   'sfGenerateTaskTask' => 'task/generator',
351   'sfGeneratorBaseTask' => 'task/generator',
352   'sfHelpTask' => 'task/help',
353   'sfListTask' => 'task/help',
354   'sfI18nExtractTask' => 'task/i18n',
355   'sfI18nFindTask' => 'task/i18n',
356   'sfLogClearTask' => 'task/log',
357   'sfLogRotateTask' => 'task/log',
358   'sfPluginAddChannelTask' => 'task/plugin',
359   'sfPluginBaseTask' => 'task/plugin',
360   'sfPluginInstallTask' => 'task/plugin',
361   'sfPluginListTask' => 'task/plugin',
362   'sfPluginPublishAssetsTask' => 'task/plugin',
363   'sfPluginUninstallTask' => 'task/plugin',
364   'sfPluginUpgradeTask' => 'task/plugin',
365   'sfProjectClearControllersTask' => 'task/project',
366   'sfProjectDeployTask' => 'task/project',
367   'sfProjectDisableTask' => 'task/project',
368   'sfProjectEnableTask' => 'task/project',
369   'sfProjectFreezeTask' => 'task/project',
370   'sfProjectPermissionsTask' => 'task/project',
371   'sfProjectUnfreezeTask' => 'task/project',
372   'sfProjectValidateTask' => 'task/project',
373   'sfUpgradeTo11Task' => 'task/project',
374   'sfUpgradeTo12Task' => 'task/project',
375   'sfComponentUpgrade' => 'task/project/upgrade1.1',
376   'sfConfigFileUpgrade' => 'task/project/upgrade1.1',
377   'sfConfigUpgrade' => 'task/project/upgrade1.1',
378   'sfEnvironmentUpgrade' => 'task/project/upgrade1.1',
379   'sfFactoriesUpgrade' => 'task/project/upgrade1.1',
380   'sfFlashUpgrade' => 'task/project/upgrade1.1',
381   'sfLayoutUpgrade' => 'task/project/upgrade1.1',
382   'sfLoggerUpgrade' => 'task/project/upgrade1.1',
383   'sfPropelUpgrade' => 'task/project/upgrade1.1',
384   'sfSettingsUpgrade' => 'task/project/upgrade1.1',
385   'sfSingletonUpgrade' => 'task/project/upgrade1.1',
386   'sfTestUpgrade' => 'task/project/upgrade1.1',
387   'sfUpgrade' => 'task/project/upgrade1.1',
388   'sfViewCacheManagerUpgrade' => 'task/project/upgrade1.1',
389   'sfWebDebugUpgrade' => 'task/project/upgrade1.1',
390   'sfConfigurationUpgrade' => 'task/project/upgrade1.2',
391   'sfFactories12Upgrade' => 'task/project/upgrade1.2',
392   'sfPluginAssetsUpgrade' => 'task/project/upgrade1.2',
393   'sfPropel13Upgrade' => 'task/project/upgrade1.2',
394   'sfPropelIniUpgrade' => 'task/project/upgrade1.2',
395   'sfDeprecatedClassesValidation' => 'task/project/validation',
396   'sfDeprecatedConfigurationFilesValidation' => 'task/project/validation',
397   'sfDeprecatedHelpersValidation' => 'task/project/validation',
398   'sfDeprecatedMethodsValidation' => 'task/project/validation',
399   'sfDeprecatedPluginsValidation' => 'task/project/validation',
400   'sfDeprecatedSettingsValidation' => 'task/project/validation',
401   'sfParameterHolderValidation' => 'task/project/validation',
402   'sfValidation' => 'task/project/validation',
403   'sfBaseTask' => 'task',
404   'sfCommandApplicationTask' => 'task',
405   'sfFilesystem' => 'task',
406   'sfTask' => 'task',
407   'sfTestAllTask' => 'task/test',
408   'sfTestCoverageTask' => 'task/test',
409   'sfTestFunctionalTask' => 'task/test',
410   'sfTestUnitTask' => 'task/test',
411   'sfTestBrowser' => 'test',
412   'sfTestFunctional' => 'test',
413   'sfTestFunctionalBase' => 'test',
414   'sfTester' => 'test',
415   'sfTesterForm' => 'test',
416   'sfTesterRequest' => 'test',
417   'sfTesterResponse' => 'test',
418   'sfTesterUser' => 'test',
419   'sfTesterViewCache' => 'test',
420   'sfBasicSecurityUser' => 'user',
421   'sfSecurityUser' => 'user',
422   'sfUser' => 'user',
423   'sfBrowser' => 'util',
424   'sfBrowserBase' => 'util',
425   'sfCallable' => 'util',
426   'sfContext' => 'util',
427   'sfDomCssSelector' => 'util',
428   'sfFinder' => 'util',
429   'sfInflector' => 'util',
430   'sfNamespacedParameterHolder' => 'util',
431   'sfParameterHolder' => 'util',
432   'sfToolkit' => 'util',
433   'sfValidatorI18nChoiceCountry' => 'validator/i18n',
434   'sfValidatorI18nChoiceLanguage' => 'validator/i18n',
435   'sfValidatorAnd' => 'validator',
436   'sfValidatorBase' => 'validator',
437   'sfValidatorBoolean' => 'validator',
438   'sfValidatorCSRFToken' => 'validator',
439   'sfValidatorCallback' => 'validator',
440   'sfValidatorChoice' => 'validator',
441   'sfValidatorChoiceMany' => 'validator',
442   'sfValidatorDate' => 'validator',
443   'sfValidatorDateRange' => 'validator',
444   'sfValidatorDateTime' => 'validator',
445   'sfValidatorDecorator' => 'validator',
446   'sfValidatorEmail' => 'validator',
447   'sfValidatorError' => 'validator',
448   'sfValidatorErrorSchema' => 'validator',
449   'sfValidatorFile' => 'validator',
450   'sfValidatorFromDescription' => 'validator',
451   'sfValidatorInteger' => 'validator',
452   'sfValidatorNumber' => 'validator',
453   'sfValidatorOr' => 'validator',
454   'sfValidatorPass' => 'validator',
455   'sfValidatorRegex' => 'validator',
456   'sfValidatorSchema' => 'validator',
457   'sfValidatorSchemaCompare' => 'validator',
458   'sfValidatorSchemaFilter' => 'validator',
459   'sfValidatorSchemaForEach' => 'validator',
460   'sfValidatorString' => 'validator',
461   'sfValidatorTime' => 'validator',
462   'sfValidatorUrl' => 'validator',
463   'sfOutputEscaper' => 'view/escaper',
464   'sfOutputEscaperArrayDecorator' => 'view/escaper',
465   'sfOutputEscaperGetterDecorator' => 'view/escaper',
466   'sfOutputEscaperIteratorDecorator' => 'view/escaper',
467   'sfOutputEscaperObjectDecorator' => 'view/escaper',
468   'sfOutputEscaperSafe' => 'view/escaper',
469   'sfPHPView' => 'view',
470   'sfPartialView' => 'view',
471   'sfView' => 'view',
472   'sfViewCacheManager' => 'view',
473   'sfViewParameterHolder' => 'view',
474   'sfWidgetFormI18nDate' => 'widget/i18n',
475   'sfWidgetFormI18nDateTime' => 'widget/i18n',
476   'sfWidgetFormI18nSelectCountry' => 'widget/i18n',
477   'sfWidgetFormI18nSelectCurrency' => 'widget/i18n',
478   'sfWidgetFormI18nSelectLanguage' => 'widget/i18n',
479   'sfWidgetFormI18nTime' => 'widget/i18n',
480   'sfWidget' => 'widget',
481   'sfWidgetForm' => 'widget',
482   'sfWidgetFormChoice' => 'widget',
483   'sfWidgetFormChoiceMany' => 'widget',
484   'sfWidgetFormDate' => 'widget',
485   'sfWidgetFormDateRange' => 'widget',
486   'sfWidgetFormDateTime' => 'widget',
487   'sfWidgetFormFilterDate' => 'widget',
488   'sfWidgetFormFilterInput' => 'widget',
489   'sfWidgetFormInput' => 'widget',
490   'sfWidgetFormInputCheckbox' => 'widget',
491   'sfWidgetFormInputFile' => 'widget',
492   'sfWidgetFormInputFileEditable' => 'widget',
493   'sfWidgetFormInputHidden' => 'widget',
494   'sfWidgetFormInputPassword' => 'widget',
495   'sfWidgetFormSchema' => 'widget',
496   'sfWidgetFormSchemaDecorator' => 'widget',
497   'sfWidgetFormSchemaForEach' => 'widget',
498   'sfWidgetFormSchemaFormatter' => 'widget',
499   'sfWidgetFormSchemaFormatterList' => 'widget',
500   'sfWidgetFormSchemaFormatterTable' => 'widget',
501   'sfWidgetFormSelect' => 'widget',
502   'sfWidgetFormSelectCheckbox' => 'widget',
503   'sfWidgetFormSelectMany' => 'widget',
504   'sfWidgetFormSelectRadio' => 'widget',
505   'sfWidgetFormTextarea' => 'widget',
506   'sfWidgetFormTime' => 'widget',
507   'sfYaml' => 'yaml',
508   'sfYamlDumper' => 'yaml',
509   'sfYamlInline' => 'yaml',
510   'sfYamlParser' => 'yaml',
511 );
512 }
513
Note: See TracBrowser for help on using the browser.