public static function getInstance() { static $instance = null; if (null === $instance) { $config = new \PSU\Config(); $config->load(); $instance = new self($config); } return $instance; }
<?php require dirname(dirname(__DIR__)) . '/legacy/git-bootstrap.php'; require_once 'autoload.php'; PSU::session_start(); $config = new PSU\Config(); $config->load(); define('PSU_API_APPID', $config->get('ape', 'api_appid')); define('PSU_API_APPKEY', $config->get('ape', 'api_key')); /*******************[Site Constants]*****************/ // Base directory of application $GLOBALS['BASE_DIR'] = dirname(__FILE__); // Base URL PSU::get()->base_url = $GLOBALS['BASE_URL'] = $config->get('ape', 'base_url'); if (file_exists('debug.php')) { // 1. debug.php should override $GLOBALS['BASE_URL'] and PSU::get()->base_url // 2. also modify auto_prepend_file and RewriteBase in .htaccess, but make sure you don't commit those changes include 'debug.php'; } if (isset($_GET['go'])) { PSU::redirect($config->get('ape', 'base_url') . '/user/' . $_GET['go']); } // Local Includes $GLOBALS['LOCAL_INCLUDES'] = $GLOBALS['BASE_DIR'] . '/includes'; // Temp $GLOBALS['TMP'] = '/web/temp'; // Templates $GLOBALS['TEMPLATES'] = $GLOBALS['BASE_DIR'] . '/templates'; // Icons $GLOBALS['ICONS'] = $config->get('app_url') . '/core/images/my/icons'; // Javascript