Development

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

You must first sign up to be able to contribute.

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

Revision 20062, 14.2 kB (checked in by anonymous, 5 years ago)

[1.1] updated CHANGELOG and version for version 1.1.9

  • 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.1.10-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    * Rebuilds the association array between class names and paths.
109    *
110    * This method overrides this file (__FILE__)
111    */
112   static public function make()
113   {
114     $libDir = str_replace(DIRECTORY_SEPARATOR, '/', realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'));
115     require_once $libDir.'/util/sfFinder.class.php';
116
117     $files = sfFinder::type('file')
118       ->prune('plugins')
119       ->prune('vendor')
120       ->prune('skeleton')
121       ->prune('default')
122       ->name('*\.class\.php')
123       ->in($libDir)
124     ;
125
126     sort($files, SORT_STRING);
127
128     $classes = array();
129     foreach ($files as $file)
130     {
131       $classes[basename($file, '.class.php')] = str_replace($libDir.'/', '', str_replace(DIRECTORY_SEPARATOR, '/', dirname($file)));
132     }
133
134     $content = preg_replace('/protected \$classes = array *\(.*?\)/s', 'protected $classes = '.var_export($classes, true), file_get_contents(__FILE__));
135
136     file_put_contents(__FILE__, $content);
137   }
138
139   // Don't edit this property by hand.
140   // To update it, use sfCoreAutoload::make()
141   protected $classes = array (
142   'sfAction' => 'action',
143   'sfActionStack' => 'action',
144   'sfActionStackEntry' => 'action',
145   'sfActions' => 'action',
146   'sfComponent' => 'action',
147   'sfComponents' => 'action',
148   'sfData' => 'addon',
149   'sfPager' => 'addon',
150   'sfAutoload' => 'autoload',
151   'sfCoreAutoload' => 'autoload',
152   'sfSimpleAutoload' => 'autoload',
153   'sfAPCCache' => 'cache',
154   'sfCache' => 'cache',
155   'sfEAcceleratorCache' => 'cache',
156   'sfFileCache' => 'cache',
157   'sfFunctionCache' => 'cache',
158   'sfMemcacheCache' => 'cache',
159   'sfNoCache' => 'cache',
160   'sfSQLiteCache' => 'cache',
161   'sfXCacheCache' => 'cache',
162   'sfAnsiColorFormatter' => 'command',
163   'sfCommandApplication' => 'command',
164   'sfCommandArgument' => 'command',
165   'sfCommandArgumentSet' => 'command',
166   'sfCommandArgumentsException' => 'command',
167   'sfCommandException' => 'command',
168   'sfCommandLogger' => 'command',
169   'sfCommandManager' => 'command',
170   'sfCommandOption' => 'command',
171   'sfCommandOptionSet' => 'command',
172   'sfFormatter' => 'command',
173   'sfSymfonyCommandApplication' => 'command',
174   'sfApplicationConfiguration' => 'config',
175   'sfAutoloadConfigHandler' => 'config',
176   'sfCacheConfigHandler' => 'config',
177   'sfCompileConfigHandler' => 'config',
178   'sfConfig' => 'config',
179   'sfConfigCache' => 'config',
180   'sfConfigHandler' => 'config',
181   'sfDatabaseConfigHandler' => 'config',
182   'sfDefineEnvironmentConfigHandler' => 'config',
183   'sfFactoryConfigHandler' => 'config',
184   'sfFilterConfigHandler' => 'config',
185   'sfGeneratorConfigHandler' => 'config',
186   'sfLoader' => 'config',
187   'sfProjectConfiguration' => 'config',
188   'sfRootConfigHandler' => 'config',
189   'sfRoutingConfigHandler' => 'config',
190   'sfSecurityConfigHandler' => 'config',
191   'sfSimpleYamlConfigHandler' => 'config',
192   'sfViewConfigHandler' => 'config',
193   'sfYamlConfigHandler' => 'config',
194   'sfConsoleController' => 'controller',
195   'sfController' => 'controller',
196   'sfFrontWebController' => 'controller',
197   'sfWebController' => 'controller',
198   'sfDatabase' => 'database',
199   'sfDatabaseManager' => 'database',
200   'sfMySQLDatabase' => 'database',
201   'sfMySQLiDatabase' => 'database',
202   'sfPDODatabase' => 'database',
203   'sfPostgreSQLDatabase' => 'database',
204   'sfDebug' => 'debug',
205   'sfTimer' => 'debug',
206   'sfTimerManager' => 'debug',
207   'sfWebDebug' => 'debug',
208   'sfEvent' => 'event',
209   'sfEventDispatcher' => 'event',
210   'sfCacheException' => 'exception',
211   'sfConfigurationException' => 'exception',
212   'sfControllerException' => 'exception',
213   'sfDatabaseException' => 'exception',
214   'sfError404Exception' => 'exception',
215   'sfException' => 'exception',
216   'sfFactoryException' => 'exception',
217   'sfFileException' => 'exception',
218   'sfFilterException' => 'exception',
219   'sfForwardException' => 'exception',
220   'sfInitializationException' => 'exception',
221   'sfParseException' => 'exception',
222   'sfRenderException' => 'exception',
223   'sfSecurityException' => 'exception',
224   'sfStopException' => 'exception',
225   'sfStorageException' => 'exception',
226   'sfViewException' => 'exception',
227   'sfBasicSecurityFilter' => 'filter',
228   'sfCacheFilter' => 'filter',
229   'sfCommonFilter' => 'filter',
230   'sfExecutionFilter' => 'filter',
231   'sfFilter' => 'filter',
232   'sfFilterChain' => 'filter',
233   'sfRenderingFilter' => 'filter',
234   'sfForm' => 'form',
235   'sfFormField' => 'form',
236   'sfFormFieldSchema' => 'form',
237   'sfAdminGenerator' => 'generator',
238   'sfCrudGenerator' => 'generator',
239   'sfGenerator' => 'generator',
240   'sfGeneratorManager' => 'generator',
241   'sfRichTextEditor' => 'helper',
242   'sfRichTextEditorFCK' => 'helper',
243   'sfRichTextEditorTinyMCE' => 'helper',
244   'TGettext' => 'i18n/Gettext',
245   'sfI18nApplicationExtract' => 'i18n/extract',
246   'sfI18nExtract' => 'i18n/extract',
247   'sfI18nExtractorInterface' => 'i18n/extract',
248   'sfI18nModuleExtract' => 'i18n/extract',
249   'sfI18nPhpExtractor' => 'i18n/extract',
250   'sfI18nYamlExtractor' => 'i18n/extract',
251   'sfI18nYamlGeneratorExtractor' => 'i18n/extract',
252   'sfI18nYamlValidateExtractor' => 'i18n/extract',
253   'sfChoiceFormat' => 'i18n',
254   'sfCultureInfo' => 'i18n',
255   'sfDateFormat' => 'i18n',
256   'sfDateTimeFormatInfo' => 'i18n',
257   'sfI18N' => 'i18n',
258   'sfIMessageSource' => 'i18n',
259   'sfMessageFormat' => 'i18n',
260   'sfMessageSource' => 'i18n',
261   'sfMessageSource_Aggregate' => 'i18n',
262   'sfMessageSource_Database' => 'i18n',
263   'sfMessageSource_File' => 'i18n',
264   'sfMessageSource_MySQL' => 'i18n',
265   'sfMessageSource_SQLite' => 'i18n',
266   'sfMessageSource_XLIFF' => 'i18n',
267   'sfMessageSource_gettext' => 'i18n',
268   'sfNumberFormat' => 'i18n',
269   'sfNumberFormatInfo' => 'i18n',
270   'sfAggregateLogger' => 'log',
271   'sfConsoleLogger' => 'log',
272   'sfFileLogger' => 'log',
273   'sfLogger' => 'log',
274   'sfLoggerInterface' => 'log',
275   'sfLoggerWrapper' => 'log',
276   'sfNoLogger' => 'log',
277   'sfStreamLogger' => 'log',
278   'sfWebDebugLogger' => 'log',
279   'sfPearDownloader' => 'plugin',
280   'sfPearEnvironment' => 'plugin',
281   'sfPearFrontendPlugin' => 'plugin',
282   'sfPearRest' => 'plugin',
283   'sfPearRest10' => 'plugin',
284   'sfPearRest11' => 'plugin',
285   'sfPearRestPlugin' => 'plugin',
286   'sfPluginDependencyException' => 'plugin',
287   'sfPluginException' => 'plugin',
288   'sfPluginManager' => 'plugin',
289   'sfPluginRecursiveDependencyException' => 'plugin',
290   'sfPluginRestException' => 'plugin',
291   'sfSymfonyPluginManager' => 'plugin',
292   'sfConsoleRequest' => 'request',
293   'sfRequest' => 'request',
294   'sfWebRequest' => 'request',
295   'sfConsoleResponse' => 'response',
296   'sfResponse' => 'response',
297   'sfWebResponse' => 'response',
298   'sfNoRouting' => 'routing',
299   'sfPathInfoRouting' => 'routing',
300   'sfPatternRouting' => 'routing',
301   'sfRouting' => 'routing',
302   'sfDatabaseSessionStorage' => 'storage',
303   'sfMySQLSessionStorage' => 'storage',
304   'sfMySQLiSessionStorage' => 'storage',
305   'sfNoStorage' => 'storage',
306   'sfPDOSessionStorage' => 'storage',
307   'sfPostgreSQLSessionStorage' => 'storage',
308   'sfSessionStorage' => 'storage',
309   'sfSessionTestStorage' => 'storage',
310   'sfStorage' => 'storage',
311   'sfCacheClearTask' => 'task/cache',
312   'sfConfigureAuthorTask' => 'task/configure',
313   'sfConfigureDatabaseTask' => 'task/configure',
314   'sfGenerateAppTask' => 'task/generator',
315   'sfGenerateModuleTask' => 'task/generator',
316   'sfGenerateProjectTask' => 'task/generator',
317   'sfGenerateTaskTask' => 'task/generator',
318   'sfGeneratorBaseTask' => 'task/generator',
319   'sfHelpTask' => 'task/help',
320   'sfListTask' => 'task/help',
321   'sfI18nExtractTask' => 'task/i18n',
322   'sfI18nFindTask' => 'task/i18n',
323   'sfLogClearTask' => 'task/log',
324   'sfLogRotateTask' => 'task/log',
325   'sfPluginAddChannelTask' => 'task/plugin',
326   'sfPluginBaseTask' => 'task/plugin',
327   'sfPluginInstallTask' => 'task/plugin',
328   'sfPluginListTask' => 'task/plugin',
329   'sfPluginUninstallTask' => 'task/plugin',
330   'sfPluginUpgradeTask' => 'task/plugin',
331   'sfProjectClearControllersTask' => 'task/project',
332   'sfProjectDeployTask' => 'task/project',
333   'sfProjectDisableTask' => 'task/project',
334   'sfProjectEnableTask' => 'task/project',
335   'sfProjectFreezeTask' => 'task/project',
336   'sfProjectPermissionsTask' => 'task/project',
337   'sfProjectUnfreezeTask' => 'task/project',
338   'sfUpgradeTo11Task' => 'task/project',
339   'sfComponentUpgrade' => 'task/project/upgrade1.1',
340   'sfConfigFileUpgrade' => 'task/project/upgrade1.1',
341   'sfConfigUpgrade' => 'task/project/upgrade1.1',
342   'sfEnvironmentUpgrade' => 'task/project/upgrade1.1',
343   'sfFactoriesUpgrade' => 'task/project/upgrade1.1',
344   'sfFlashUpgrade' => 'task/project/upgrade1.1',
345   'sfLayoutUpgrade' => 'task/project/upgrade1.1',
346   'sfLoggerUpgrade' => 'task/project/upgrade1.1',
347   'sfPropelUpgrade' => 'task/project/upgrade1.1',
348   'sfSettingsUpgrade' => 'task/project/upgrade1.1',
349   'sfSingletonUpgrade' => 'task/project/upgrade1.1',
350   'sfTestUpgrade' => 'task/project/upgrade1.1',
351   'sfUpgrade' => 'task/project/upgrade1.1',
352   'sfViewCacheManagerUpgrade' => 'task/project/upgrade1.1',
353   'sfWebDebugUpgrade' => 'task/project/upgrade1.1',
354   'sfBaseTask' => 'task',
355   'sfCommandApplicationTask' => 'task',
356   'sfFilesystem' => 'task',
357   'sfTask' => 'task',
358   'sfTestAllTask' => 'task/test',
359   'sfTestFunctionalTask' => 'task/test',
360   'sfTestUnitTask' => 'task/test',
361   'sfTestBrowser' => 'test',
362   'sfBasicSecurityUser' => 'user',
363   'sfSecurityUser' => 'user',
364   'sfUser' => 'user',
365   'sfBrowser' => 'util',
366   'sfCallable' => 'util',
367   'sfContext' => 'util',
368   'sfDomCssSelector' => 'util',
369   'sfFinder' => 'util',
370   'sfInflector' => 'util',
371   'sfNamespacedParameterHolder' => 'util',
372   'sfParameterHolder' => 'util',
373   'sfToolkit' => 'util',
374   'sfValidatorI18nChoiceCountry' => 'validator/i18n',
375   'sfValidatorI18nChoiceLanguage' => 'validator/i18n',
376   'sfValidatorAnd' => 'validator',
377   'sfValidatorBase' => 'validator',
378   'sfValidatorBoolean' => 'validator',
379   'sfValidatorCSRFToken' => 'validator',
380   'sfValidatorCallback' => 'validator',
381   'sfValidatorChoice' => 'validator',
382   'sfValidatorChoiceMany' => 'validator',
383   'sfValidatorDate' => 'validator',
384   'sfValidatorDateTime' => 'validator',
385   'sfValidatorDecorator' => 'validator',
386   'sfValidatorEmail' => 'validator',
387   'sfValidatorError' => 'validator',
388   'sfValidatorErrorSchema' => 'validator',
389   'sfValidatorFile' => 'validator',
390   'sfValidatorFromDescription' => 'validator',
391   'sfValidatorInteger' => 'validator',
392   'sfValidatorNumber' => 'validator',
393   'sfValidatorOr' => 'validator',
394   'sfValidatorPass' => 'validator',
395   'sfValidatorRegex' => 'validator',
396   'sfValidatorSchema' => 'validator',
397   'sfValidatorSchemaCompare' => 'validator',
398   'sfValidatorSchemaFilter' => 'validator',
399   'sfValidatorSchemaForEach' => 'validator',
400   'sfValidatorString' => 'validator',
401   'sfValidatorTime' => 'validator',
402   'sfValidatorUrl' => 'validator',
403   'sfOutputEscaper' => 'view/escaper',
404   'sfOutputEscaperArrayDecorator' => 'view/escaper',
405   'sfOutputEscaperGetterDecorator' => 'view/escaper',
406   'sfOutputEscaperIteratorDecorator' => 'view/escaper',
407   'sfOutputEscaperObjectDecorator' => 'view/escaper',
408   'sfOutputEscaperSafe' => 'view/escaper',
409   'sfPHPView' => 'view',
410   'sfPartialView' => 'view',
411   'sfView' => 'view',
412   'sfViewCacheManager' => 'view',
413   'sfViewParameterHolder' => 'view',
414   'sfWidgetFormI18nDate' => 'widget/i18n',
415   'sfWidgetFormI18nDateTime' => 'widget/i18n',
416   'sfWidgetFormI18nSelectCountry' => 'widget/i18n',
417   'sfWidgetFormI18nSelectLanguage' => 'widget/i18n',
418   'sfWidgetFormI18nTime' => 'widget/i18n',
419   'sfWidget' => 'widget',
420   'sfWidgetForm' => 'widget',
421   'sfWidgetFormDate' => 'widget',
422   'sfWidgetFormDateTime' => 'widget',
423   'sfWidgetFormInput' => 'widget',
424   'sfWidgetFormInputCheckbox' => 'widget',
425   'sfWidgetFormInputFile' => 'widget',
426   'sfWidgetFormInputHidden' => 'widget',
427   'sfWidgetFormInputPassword' => 'widget',
428   'sfWidgetFormSchema' => 'widget',
429   'sfWidgetFormSchemaDecorator' => 'widget',
430   'sfWidgetFormSchemaForEach' => 'widget',
431   'sfWidgetFormSchemaFormatter' => 'widget',
432   'sfWidgetFormSchemaFormatterList' => 'widget',
433   'sfWidgetFormSchemaFormatterTable' => 'widget',
434   'sfWidgetFormSelect' => 'widget',
435   'sfWidgetFormSelectMany' => 'widget',
436   'sfWidgetFormSelectRadio' => 'widget',
437   'sfWidgetFormTextarea' => 'widget',
438   'sfWidgetFormTime' => 'widget',
439   'sfYaml' => 'yaml',
440   'sfYamlDumper' => 'yaml',
441   'sfYamlInline' => 'yaml',
442   'sfYamlParser' => 'yaml',
443 );
444 }
445
Note: See TracBrowser for help on using the browser.