예제 #1
0
 public function getLogicalRoute()
 {
     // si no hay mapping para la app, o si el que hay no matchea,
     // busca el Mapping de Core.
     $mapping = NULL;
     $mappingPath = "apps/" . $this->requested_route['app'] . "/AppMapping.php";
     if (file_exists($mappingPath)) {
         include_once $mappingPath;
         $mapping = new AppMapping();
         if (preg_match($mapping->mapping, $this->relative_logic_url)) {
             return $mapping->getLogicalRoute($this->field_list);
         } else {
             // Va al mapping por defecto
             // Siempre existe
             $mappingPath = "apps/core/AppMapping.php";
             include_once $mappingPath;
             $mapping = new AppMapping();
             // Siempre matchea, ni pregunto...
             return $mapping->getLogicalRoute($this->field_list);
         }
     } else {
         // Va al mapping por defecto
         // Siempre existe
         $mappingPath = "apps/core/AppMapping.php";
         include_once $mappingPath;
         $mapping = new AppMapping();
         // Siempre matchea, ni pregunto...
         return $mapping->getLogicalRoute($this->field_list);
     }
 }
예제 #2
0
파일: app.php 프로젝트: tejdeeps/tejcs.com
define("APP_CONTR_DIR", APP_DIR . "controller/");
define("APP_VIEW_DIR", APP_DIR . "view/");
// VIEWS
// specific Views are not autoloaded so fa:
//require(APP_VIEW_DIR."specific/SpecificView.class.php");
// Autoloading
function __autoload($classname)
{
    if (file_exists(MAIN_DIR . "view/" . $classname . ".class.php")) {
        require MAIN_DIR . "view/" . $classname . ".class.php";
    }
    if (file_exists(APP_CONTR_DIR . $classname . ".class.php")) {
        require APP_CONTR_DIR . $classname . ".class.php";
    }
    if (file_exists(APP_CONTR_DIR . "forms/" . $classname . ".class.php")) {
        require APP_CONTR_DIR . "forms/" . $classname . ".class.php";
    }
    if (file_exists(APP_CONTR_DIR . "exceptions/" . $classname . ".class.php")) {
        require APP_CONTR_DIR . "exceptions/" . $classname . ".class.php";
    }
    if (file_exists(APP_VIEW_DIR . $classname . ".class.php")) {
        require APP_VIEW_DIR . $classname . ".class.php";
    }
    if (file_exists(MODEL_DIR . $classname . ".php")) {
        require MODEL_DIR . $classname . ".php";
    }
    DIYFrameworkLoader::__autoload($classname, "lib/diy-framework/classes/diy-framework/");
}
// Runs controller
AppController::getInstance()->process(Request::getInstance(), Response::getInstance(), AppMapping::getInstance());