Lines Matching refs:file

69     public $file;
72 * Create an instance of the class with the input file
74 * @param Sniffer $file Input file
76 public function __construct($file)
78 $this->file = $file;
82 * Get the Content-Type of the specified file
88 if (isset($this->file->headers['content-type'])) {
89 if (!isset($this->file->headers['content-encoding'])
90 && ($this->file->headers['content-type'] === 'text/plain'
91 || $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1'
92 || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1'
93 || $this->file->headers['content-type'] === 'text/plain; charset=UTF-8')) {
97 if (($pos = strpos($this->file->headers['content-type'], ';')) !== false) {
98 $official = substr($this->file->headers['content-type'], 0, $pos);
100 $official = $this->file->headers['content-type'];
134 if (substr($this->file->body, 0, 2) === "\xFE\xFF"
135 || substr($this->file->body, 0, 2) === "\xFF\xFE"
136 || substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF"
137 || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF") {
139 } elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body)) {
153 $ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20");
154 if (strtolower(substr($this->file->body, $ws, 14)) === '<!doctype html'
155 || strtolower(substr($this->file->body, $ws, 5)) === '<html'
156 || strtolower(substr($this->file->body, $ws, 7)) === '<script') {
158 } elseif (substr($this->file->body, 0, 5) === '%PDF-') {
160 } elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-') {
162 } elseif (substr($this->file->body, 0, 6) === 'GIF87a'
163 || substr($this->file->body, 0, 6) === 'GIF89a') {
165 } elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") {
167 } elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") {
169 } elseif (substr($this->file->body, 0, 2) === "\x42\x4D") {
171 } elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") {
185 if (substr($this->file->body, 0, 6) === 'GIF87a'
186 || substr($this->file->body, 0, 6) === 'GIF89a') {
188 } elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") {
190 } elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") {
192 } elseif (substr($this->file->body, 0, 2) === "\x42\x4D") {
194 } elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") {
208 $len = strlen($this->file->body);
209 $pos = strspn($this->file->body, "\x09\x0A\x0D\x20\xEF\xBB\xBF");
212 switch ($this->file->body[$pos]) {
217 $pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
228 if (substr($this->file->body, $pos, 3) === '!--') {
230 if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false) {
235 } elseif (substr($this->file->body, $pos, 1) === '!') {
236 if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false) {
241 } elseif (substr($this->file->body, $pos, 1) === '?') {
242 if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false) {
247 } elseif (substr($this->file->body, $pos, 3) === 'rss'
248 || substr($this->file->body, $pos, 7) === 'rdf:RDF') {
250 } elseif (substr($this->file->body, $pos, 4) === 'feed') {