Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function loadResource ( $key )
- {
- $key_bits = explode ( ".", $key );
- $id = UrlShortener::shortToInt ( $key_bits [ 0 ] );
- $type = $key_bits [ 1 ];
- $query = mysql_query ( "SELECT name, built FROM resources_v2 WHERE id = '$id' AND type = '$type' LIMIT 1" );
- if ( mysql_num_rows ( $query ) > 0 )
- {
- $row = mysql_fetch_assoc ( $query );
- if ( is_array ( $this -> packages [ $type ] [ $row [ 'name' ] ] ) )
- {
- header("Cache-Control: max-age=1209600, must-revalidate");
- //header("Last-Modified: " . gmdate('D, d M Y H:i:s', strtotime ( $row [ 'built' ] ) ) . ' GMT' );
- //header("HTTP/1.1 304 Not Modified");
- $path = $this -> getPath ( $type );
- $content = '';
- foreach ( $this -> packages [ $type ] [ $row [ 'name' ] ] [ 'files' ] as $file )
- {
- $content .= file_get_contents ( $path . $file ) . "\n";
- }
- switch ( $type )
- {
- case "js":
- header ( "content-type: application/javascript" );
- echo $this -> minifyJS ( $content );
- break;
- case "css":
- header ( "content-type: text/css" );
- echo $this -> minifyCSS ( $content );
- break;
- }
- return;
- }
- }
- header ( 'HTTP/1.0 404 Not Found' );
- die ( "404, Not found" );
- }
Add Comment
Please, Sign In to add comment