Example #1
0
 public static function detect_assets()
 {
     self::register("framework", "File", FRAMEWORK_DIR . "/utilities/File.php");
     if (!isset($_GET["route"])) {
         return false;
     }
     $temp_route = $_GET["route"];
     $_temp_route = preg_replace("/[^a-zA-Z0-9_\\-\\.]/", "", $temp_route);
     while (strpos($temp_route, "..")) {
         $temp_route = str_replace("..", ".", $temp_route);
     }
     $asset_paths = explode("/", $_GET["route"]);
     if ($asset_paths[0] == "images" || $asset_paths[0] == "javascripts" || $asset_paths[0] == "stylesheets") {
         $plugins = scandir(PLUGIN_DIR);
         $type = array_shift($asset_paths);
         rsort($plugins);
         foreach ($plugins as $plugin) {
             $path = PLUGIN_DIR . $plugin . "/resources/public/" . $type . "/" . implode("/", $asset_paths);
             if ($type == "images") {
                 File::display_image($path);
             }
             if ($type == "javascripts") {
                 File::display_asset($path, "text/javascript");
             }
             if ($type == "stylesheets") {
                 File::display_asset($path, "text/css");
             }
         }
     }
 }