Esempio n. 1
0
 function route()
 {
     tr_hook::add("404", function () {
         echo "Page Not found";
     });
     $routeConfigTmp = tr_config::config()->get("route");
     list($app, $version, $from, $secondFrom) = tr::getVersion();
     $routeConfig = $routeConfigTmp[$app];
     if (!$routeConfig) {
         tr_hook::fire("404");
     }
     if ($routeConfig) {
         $newRouteConfig = array();
         $newRouteConfigTmp = array();
         arsort($routeConfig);
         foreach ($routeConfig as $k => $v) {
             if ($v) {
                 if ($version < $k) {
                     continue;
                 }
                 foreach ($v as $kEnd => $vEnd) {
                     $routetmp = $app . "/" . $from . $secondFrom . $k . "/" . $kEnd;
                     $routetmp = str_replace("//", '/', $routetmp);
                     $newRouteConfig[$routetmp] = $vEnd;
                     $newRouteConfigTmp[$kEnd] = $vEnd;
                 }
             }
         }
         //            print_r($newRouteConfig);
         //            print_r($newRouteConfigTmp);
         tr_route::serve($newRouteConfig, $newRouteConfigTmp);
     } else {
         tr_hook::fire("404");
     }
 }
Esempio n. 2
0
 function route()
 {
     tr_hook::add("404", function () {
         echo "Page Not found";
     });
     $routeConfig = tr_config::config()->get("route");
     if ($routeConfig) {
         tr_route::serve($routeConfig);
     }
 }
Esempio n. 3
0
 static function config()
 {
     return tr_config::config();
 }