Calling URI * */ public function __construct($url){ } /* Generate _SERVER.js * */ public function server(){ header('Content-Type: text/javascript; charset=utf-8'); echo "window._SERVER = ".json_encode([ 'session' => [ 'name' => $_SESSION['NAME'] ] ])."\n"; } /* Manage bundle hash * */ public function bundle(){ /* (1) Extract /public_html/js/ all .js files */ $js_scripts = glob(__PUBLIC__.'/js/*.js'); /* (2) If match pattern 'bundle@*.js' */ foreach($js_scripts as $fname){ $bname = basename($fname); // if match -> load it and exit if( preg_match('/bundle@[\da-f]+\.js/', $bname) ) header("Location: /js/$bname"); } } /* POST-CALL * */ public function __destruct(){ } }