mirror of
https://github.com/gantry/gantry5.git
synced 2026-08-19 01:15:04 -05:00
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
defined('_JEXEC') or die;
|
|
|
|
use Gantry\Framework\Gantry;
|
|
|
|
try
|
|
{
|
|
// Attempt to locate Gantry Framework if it hasn't already been loaded.
|
|
if (!class_exists('Gantry'))
|
|
{
|
|
$gantryPaths = array(
|
|
GANTRYADMIN_PATH . '/src/bootstrap.php', // Look if Gantry has been included to the admin.
|
|
);
|
|
|
|
foreach ($gantryPaths as $gantryPath)
|
|
{
|
|
if ($gantryPath && is_file($gantryPath))
|
|
{
|
|
$gantryBootstrap = $gantryPath;
|
|
}
|
|
}
|
|
|
|
if (!isset($gantryBootstrap))
|
|
{
|
|
throw new LogicException('Gantry Framework not found!');
|
|
}
|
|
|
|
require_once $gantryBootstrap;
|
|
|
|
unset($gantryPaths, $gantryPath, $gantryBootstrap);
|
|
}
|
|
|
|
// Get Gantry instance and return it.
|
|
return Gantry::instance();
|
|
}
|
|
catch (Exception $e)
|
|
{
|
|
// Oops, something went wrong!
|
|
|
|
if (class_exists( '\Tracy\Debugger' ) && \Tracy\Debugger::isEnabled() && !\Tracy\Debugger::$productionMode ) {
|
|
// We have Tracy enabled; will display and/or log error with it.
|
|
throw $e;
|
|
}
|
|
|
|
// In frontend we want to prevent template from loading.
|
|
JError::raiseError(500, 'Failed to load admin: ' . $e->getMessage());
|
|
}
|