"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
- "hash": "1177f075c09daf9849c259a2f3c79236",
+ "hash": "20bffa57e6d8564e8b9bf75a6d2f70af",
"packages": [
-
+ {
+ "name": "andy128k/routeexpression",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/andy128k/routeexpression.git",
+ "reference": "60f822ca0f7ea50a3bccdd29970d7ee1900c10a8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/andy128k/routeexpression/zipball/60f822ca0f7ea50a3bccdd29970d7ee1900c10a8",
+ "reference": "60f822ca0f7ea50a3bccdd29970d7ee1900c10a8",
+ "shasum": ""
+ },
+ "require-dev": {
+ "phpunit/phpunit": "3.7.*"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src"
+ ]
+ },
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Andrey Kutejko",
+ "email": "andy128k@gmail.com"
+ }
+ ],
+ "description": "Route expression",
+ "support": {
+ "source": "https://github.com/andy128k/routeexpression/tree/master",
+ "issues": "https://github.com/andy128k/routeexpression/issues"
+ },
+ "time": "2013-06-22 08:01:38"
+ }
],
"packages-dev": [
{
],
"minimum-stability": "stable",
- "stability-flags": [
-
- ],
+ "stability-flags": {
+ "andy128k/routeexpression": 20
+ },
"platform": [
],
// This is a index stub for a IPF Projects
$here = dirname(__FILE__);
-$ipf_path = $here.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'ipf';
-$project_path = $here.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'project';
-set_include_path(get_include_path() . PATH_SEPARATOR . $ipf_path . PATH_SEPARATOR . $project_path);
-require 'ipf.php';
-return IPF::boot($ipf_path, $project_path, $here) && IPF_Project::getInstance()->run();
+$project_path = $here . '/../project';
+require $project_path . '/vendor/andy128k/ipf/ipf.php';
+return IPF::setUp($project_path, $here) && IPF_Project::getInstance()->run();
<?php
-function IPF_Autoload($class_name)
-{
- require_once strtolower(str_replace('_', '/', $class_name)) . '.php';
-}
-
-spl_autoload_register('IPF_Autoload');
-
final class IPF
{
private static $settings = array();
return is_file($path);
}
- public static function boot($ipf_path, $project_path, $document_root)
+ public static function setUp($project_path, $document_root)
{
if (php_sapi_name() === 'cli-server' && IPF::requestedFileExists())
return false;
- IPF::$settings['ipf_path'] = $ipf_path;
+ IPF_ClassLoader::getInstance($project_path);
+
+ IPF::$settings['ipf_path'] = dirname(__FILE__);
IPF::$settings['project_path'] = $project_path;
IPF::$settings['document_root'] = $document_root;
try {
IPF::loadSettings();
date_default_timezone_set(IPF::$settings['time_zone']);
- } catch(IPF_Exception_Settings $e) {
+ } catch (IPF_Exception_Settings $e) {
die('Setting Error: '.$e->getMessage()."\n");
}
return true;
{
if (function_exists($function))
return;
- if (preg_match('/^(\w+)::\w+$/', $function, $m)) {
- IPF_Autoload($m[1]);
- return;
- }
+
+ if (preg_match('/^(\w+)::\w+$/', $function, $m))
+ return; // nothing to do. autoloader will load a class.
+
$elts = explode('_', $function);
array_pop($elts);
$file = strtolower(implode(DIRECTORY_SEPARATOR, $elts)).'.php';
}
}
+class IPF_ClassLoader
+{
+ private $classMap;
+
+ private static $loader = null;
+
+ public static function getInstance($project_path)
+ {
+ if (self::$loader == null)
+ self::$loader = new IPF_ClassLoader($project_path);
+ return self::$loader;
+ }
+
+ private function __construct($project_path)
+ {
+ $dir = $project_path . '/vendor/composer/';
+
+ $includePaths = require $project_path . '/vendor/composer/include_paths.php';
+ array_push($includePaths, get_include_path());
+ set_include_path(join(PATH_SEPARATOR, $includePaths));
+
+ $this->classMap = require $project_path . '/vendor/composer/autoload_classmap.php';
+
+ spl_autoload_register(array($this, 'load'), true, true);
+ }
+
+ public function load($class)
+ {
+ if (isset($this->classMap[$class])) {
+ include $this->classMap[$class];
+ }
+ }
+}
+
function __($str)
{
$t = trim($str);