[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/ -> cms.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  defined('_JEXEC') or die;
  11  
  12  trigger_error(
  13      sprintf(
  14          'Bootstrapping Joomla using the %1$s file is deprecated.  Use %2$s instead.',
  15          __FILE__,
  16          __DIR__ . '/bootstrap.php'
  17      ),
  18      E_USER_DEPRECATED
  19  );
  20  
  21  // Set the platform root path as a constant if necessary
  22  if (!defined('JPATH_PLATFORM')) {
  23      define('JPATH_PLATFORM', __DIR__);
  24  }
  25  
  26  // Import the library loader if necessary
  27  if (!class_exists('JLoader')) {
  28      require_once  JPATH_PLATFORM . '/loader.php';
  29  }
  30  
  31  // Make sure that the Joomla Platform has been successfully loaded
  32  if (!class_exists('JLoader')) {
  33      throw new RuntimeException('Joomla Platform not loaded.');
  34  }
  35  
  36  // Create the Composer autoloader
  37  $loader = require  JPATH_LIBRARIES . '/vendor/autoload.php';
  38  
  39  // We need to pull our decorated class loader into memory before unregistering Composer's loader
  40  class_exists('\\Joomla\\CMS\\Autoload\\ClassLoader');
  41  
  42  $loader->unregister();
  43  
  44  // Decorate Composer autoloader
  45  spl_autoload_register(array(new \Joomla\CMS\Autoload\ClassLoader($loader), 'loadClass'), true, true);
  46  
  47  // Register the class aliases for Framework classes that have replaced their Platform equivalents
  48  require_once  JPATH_LIBRARIES . '/classmap.php';
  49  
  50  // Suppress phar stream wrapper for non .phar files
  51  $behavior = new \TYPO3\PharStreamWrapper\Behavior();
  52  \TYPO3\PharStreamWrapper\Manager::initialize(
  53      $behavior->withAssertion(new \TYPO3\PharStreamWrapper\Interceptor\PharExtensionInterceptor())
  54  );
  55  
  56  if (in_array('phar', stream_get_wrappers())) {
  57      stream_wrapper_unregister('phar');
  58      stream_wrapper_register('phar', 'TYPO3\\PharStreamWrapper\\PharStreamWrapper');
  59  }
  60  
  61  // Define the Joomla version if not already defined
  62  if (!defined('JVERSION')) {
  63      define('JVERSION', (new \Joomla\CMS\Version())->getShortVersion());
  64  }
  65  
  66  // Register a handler for uncaught exceptions that shows a pretty error page when possible
  67  set_exception_handler(array('Joomla\CMS\Exception\ExceptionHandler', 'handleException'));
  68  
  69  // Set up the message queue logger for web requests
  70  if (array_key_exists('REQUEST_METHOD', $_SERVER)) {
  71      \Joomla\CMS\Log\Log::addLogger(array('logger' => 'messagequeue'), \Joomla\CMS\Log\Log::ALL, ['jerror']);
  72  }
  73  
  74  // Register the Crypto lib
  75  JLoader::register('Crypto', JPATH_PLATFORM . '/php-encryption/Crypto.php');


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer