Example #1
0
 public static function getConfig()
 {
     if (self::$__instance === null) {
         $s = __CLASS__;
         self::$__instance = new $s();
     }
     return self::$__instance;
 }
Example #2
0
File: boot.php Project: Eteng/lorb
/*** include the path for the library utill ***/
//todo:modle the autoload properly
/*** auto load model classes ***/
function __autoload($class_name)
{
    $filename = strtolower($class_name) . '.Model.php';
    $file = __SITE_PATH . '/model/' . $filename;
    if (file_exists($file) == false) {
        return false;
    }
    include $file;
}
/**A function used to load Dodeye library
 * @param String $path of the Class to inport e.g <"Dodeye.util.basic">
 * @return requirement to the path
 */
function pitch($path)
{
    $path = str_replace('.', "\\", $path);
    $path = $path . ".php";
    return require_once "{$path}";
}
/*** a new registry object ***/
$registry = new Registry();
$registry->dodeye = new Dodeye($registry);
/**creating the database reg object ***/
$registry->db = DB::getDB(LorbConfig::getConfig()->getDefaultDB());
$registry->cfg = LorbConfig::getConfig();
$registry->maps = Maps::getInstance();
Template::setBaseDir();
$registry->front = new FrontController($registry);
Example #3
0
 private function parseRequest()
 {
     //getting the URL
     $requrl = $_SERVER['REQUEST_URI'];
     //remove application url from the request url
     $count = 0;
     //intialise the counter to 0;
     $requrl = str_replace(LorbConfig::getConfig()->appSetting('baseURL'), "", $requrl, $count);
     /*TODO: there must be a problem to get more than one match
       could be resolve using matching */
     if ($count > 1) {
         throw new Exception("URL Parse Error");
     }
     return $requrl;
 }