li3_cake / branches / master / config / bootstrap.php

history
<?php
/**
 * Li3_Cake: Connecting the most rad framework with CakePHP
 *
 * @copyright     Copyright 2009, Union of RAD (http://union-of-rad.org)
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */

use \lithium\core\Libraries;

$config = Libraries::get('li3_cake') + array('name' => 'cakephp', 'core' => null);

defined('DS') ?: define('DS', DIRECTORY_SEPARATOR);
defined('ROOT') ?: define('ROOT', dirname(LITHIUM_APP_PATH));
defined('APP_DIR') ?: define('APP_DIR', basename(LITHIUM_APP_PATH));
defined('WEBROOT_DIR') ?: define('WEBROOT_DIR', 'webroot');
defined('WWW_ROOT') ?: define('WWW_ROOT', LITHIUM_APP_PATH . DS . 'webroot' . DS);

defined('E_DEPRECATED') ?: define('E_DEPRECATED', 8192);
error_reporting(E_ALL & ~E_DEPRECATED);

if (!defined('CAKE_CORE_INCLUDE_PATH')) {
	if (!$config['core']) {
		$app = LITHIUM_APP_PATH;
		$core = LITHIUM_LIBRARY_PATH;
		$paths = array("{$app}/libraries/{$config['name']}", "{$core}/{$config['name']}");

		foreach ($paths as $path) {
			if (is_dir($path)) {
				define('CAKE_CORE_INCLUDE_PATH', $path);
				break;
			}
		}
		if (!defined('CAKE_CORE_INCLUDE_PATH')) {
			throw new Exception("CakePHP core not found");
		}
	} else {
		define('CAKE_CORE_INCLUDE_PATH', $config['core']);
	}
}

if (!defined('CORE_PATH')) {
	$ps = PATH_SEPARATOR;
	$path = CAKE_CORE_INCLUDE_PATH . $ps . ROOT . DS . APP_DIR . DS . $ps . ini_get('include_path');
	ini_set('include_path', $path);
	define('APP_PATH', null);
	define('CORE_PATH', null);
}

include CAKE_CORE_INCLUDE_PATH . '/cake/bootstrap.php';

?>