Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Reformats code

AuthorDave Jarvis <email>
Date2026-02-09 12:40:32 GMT-0800
Commit9672ae7c5daa2d3a94759679b1ce10e6468d72fd
Parentd68cc33
RawPage.php
private $hash;
- public function __construct($git, $hash) {
+ public function __construct( $git, $hash ){
$this->git = $git;
$this->hash = $hash;
}
- public function render() {
+ public function render(){
$filename = $_GET['name'] ?? 'file';
$buffer = '';
- // Get the exact size from git for the header
- $size = $this->git->getObjectSize($this->hash);
+ $size = $this->git->getObjectSize( $this->hash );
- $this->git->stream($this->hash, function($d) use (&$buffer) {
- if (strlen($buffer) < 12) $buffer .= $d;
- });
+ $this->git->stream( $this->hash, function( $d ) use ( &$buffer ){
+ if( strlen( $buffer ) < 12 ){
+ $buffer .= $d;
+ }
+ } );
- $mediaType = MediaTypeSniffer::isMediaType($buffer, $filename);
+ $mediaType = MediaTypeSniffer::isMediaType( $buffer, $filename );
- header("Content-Type: " . $mediaType);
- header("Content-Length: " . $size);
- header("Content-Disposition: inline; filename=\"" . addslashes($filename) . "\"");
+ if( ob_get_level() ){
+ ob_end_clean();
+ }
- $this->git->stream($this->hash, function($d) {
+ header( "Content-Type: " . $mediaType );
+ header( "Content-Length: " . $size );
+ header( "Content-Disposition: inline; filename=\"" . addslashes( $filename ) . "\"" );
+
+ $this->git->stream( $this->hash, function( $d ){
echo $d;
- });
+ } );
+
exit;
}
Delta19 lines added, 13 lines removed, 6-line increase