Пример #1
0
<?php

require_once __DIR__ . '/../framework/Loader.php';
Loader::addNamespacePath('Blog\\', __DIR__ . '/../src/Blog');
$app = new \Framework\Application(__DIR__ . '/../app/config/config.php');
$app->run();
Пример #2
0
            if ($this->_includeFile($file, $get_only_path)) {
                return $file;
            }
        }
        // File not found.
        return false;
    }
    /**
     * If file exists then loads it.
     *
     * @param string $file File to load
     * @param boolean $get_only_path If true - only return path for file to be loaded
     * @return bool True if file exists, otherwise - false
     */
    private function _includeFile($file, $get_only_path)
    {
        if (file_exists($file)) {
            if ($get_only_path == false) {
                include_once $file;
            }
            return true;
        }
        return false;
    }
}
// Register base directory for namespace prefix Framework\ ..
Loader::addNamespacePath('Framework\\', __DIR__);
$instance = Loader::getInstance();
// Register autoloader.
// Add Loader instance to the ObjectPool::_loaded_instances
ObjectPool::add($instance);
Пример #3
0
<?php

require_once '../define.php';
require_once __DIR__ . '/../framework/Loader.php';
Loader::init();
Loader::addNamespacePath('Portfolio\\', __DIR__ . '/../src/Portfolio');
Loader::addNamespacePath('CMS\\', __DIR__ . '/../src/CMS');
(new \Framework\Application(__DIR__ . '/../app/config/config.php'))->run();
Пример #4
0
<?php

require_once __DIR__ . '/../core/Loader.php';
Loader::addNamespacePath('Shop\\', __DIR__ . '/../src/Shop');
Core\DIContainer::setConfig(__DIR__ . '/../config/di_config.php');
$app = Core\DIContainer::build('Core\\Application');
$app->run();