Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
import.legacy.php
Aller à la documentation de ce fichier.
1 <?php
2 /**
3  * Bootstrap file for the Joomla Platform [with legacy libraries]. Including this file into your application
4  * will make Joomla Platform libraries [including legacy libraries] available for use.
5  *
6  * @package Joomla.Platform
7  *
8  * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
9  * @license GNU General Public License version 2 or later; see LICENSE
10  */
11 
12 // Set the platform root path as a constant if necessary.
13 if (!defined('JPATH_PLATFORM'))
14 {
15  define('JPATH_PLATFORM', __DIR__);
16 }
17 
18 // Detect the native operating system type.
19 $os = strtoupper(substr(PHP_OS, 0, 3));
20 
21 if (!defined('IS_WIN'))
22 {
23  define('IS_WIN', ($os === 'WIN') ? true : false);
24 }
25 if (!defined('IS_UNIX'))
26 {
27  define('IS_UNIX', (($os !== 'MAC') && ($os !== 'WIN')) ? true : false);
28 }
29 
30 /**
31  * @deprecated 13.3 Use IS_UNIX instead
32  */
33 if (!defined('IS_MAC'))
34 {
35  define('IS_MAC', (IS_UNIX === true && ($os === 'DAR' || $os === 'MAC')) ? true : false);
36 }
37 
38 // Import the platform version library if necessary.
39 if (!class_exists('JPlatform'))
40 {
41  require_once JPATH_PLATFORM . '/platform.php';
42 }
43 
44 // Import the library loader if necessary.
45 if (!class_exists('JLoader'))
46 {
47  require_once JPATH_PLATFORM . '/loader.php';
48 }
49 
50 // Make sure that the Joomla Platform has been successfully loaded.
51 if (!class_exists('JLoader'))
52 {
53  throw new RuntimeException('Joomla Platform not loaded.');
54 }
55 
56 // Setup the autoloaders.
58 
59 JLoader::registerPrefix('J', JPATH_PLATFORM . '/legacy');
60 
61 // Import the Joomla Factory.
62 JLoader::import('joomla.factory');
63 
64 // Register classes that don't follow one file per class naming conventions.
65 JLoader::register('JText', JPATH_PLATFORM . '/joomla/language/text.php');
66 JLoader::register('JRoute', JPATH_PLATFORM . '/joomla/application/route.php');
67 
68 // Register classes for compatability with PHP 5.3
69 if (version_compare(PHP_VERSION, '5.4.0', '<'))
70 {
71  JLoader::register('JsonSerializable', __DIR__ . '/compat/jsonserializable.php');
72 }
73 
74 // Add deprecated constants
75 // @deprecated 4.0
76 define('JPATH_ISWIN', IS_WIN);
77 define('JPATH_ISMAC', IS_MAC);
78 
79 // Register classes where the names have been changed to fit the autoloader rules
80 // @deprecated 4.0
81 JLoader::register('JSimpleCrypt', JPATH_PLATFORM . '/legacy/simplecrypt/simplecrypt.php');
82 JLoader::register('JTree', JPATH_PLATFORM . '/legacy/base/tree.php');
83 JLoader::register('JNode', JPATH_PLATFORM . '/legacy/base/node.php');
84 JLoader::register('JObserver', JPATH_PLATFORM . '/legacy/base/observer.php');
85 JLoader::register('JObservable', JPATH_PLATFORM . '/legacy/base/observable.php');
86 JLoader::register('LogException', JPATH_PLATFORM . '/legacy/log/logexception.php');
87 JLoader::register('JXMLElement', JPATH_PLATFORM . '/legacy/utilities/xmlelement.php');
88 JLoader::register('JRule', JPATH_PLATFORM . '/legacy/access/rule.php');
89 JLoader::register('JRules', JPATH_PLATFORM . '/legacy/access/rules.php');
90 JLoader::register('JCli', JPATH_PLATFORM . '/legacy/application/cli.php');
91 JLoader::register('JDaemon', JPATH_PLATFORM . '/legacy/application/daemon.php');
92 JLoader::register('JApplication', JPATH_LIBRARIES . '/legacy/application/application.php');