diff options
| author | 2017-04-22 12:48:26 +0200 | |
|---|---|---|
| committer | 2017-04-22 12:48:26 +0200 | |
| commit | ca4138d0217f699050f80aa6bfb37e121ebec9a6 (patch) | |
| tree | c95840c411c7d385021f2531bae09d47ca120750 /lib/Favicon/DataAccess.php | |
| parent | d14cc25c158af2e713708beef5ce3916150f06dd (diff) | |
Update to Favicon 1.2.0
https://github.com/ArthurHoaro/favicon/releases/tag/v1.2.0
Diffstat (limited to 'lib/Favicon/DataAccess.php')
| -rw-r--r-- | lib/Favicon/DataAccess.php | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/lib/Favicon/DataAccess.php b/lib/Favicon/DataAccess.php index 4c1a29541..2bfdf640e 100644 --- a/lib/Favicon/DataAccess.php +++ b/lib/Favicon/DataAccess.php @@ -9,33 +9,32 @@ namespace Favicon; **/ class DataAccess { public function retrieveUrl($url) { - $this->set_context(); - return @file_get_contents($url); + $this->set_context(); + return @file_get_contents($url); } - + public function retrieveHeader($url) { - $this->set_context(); - $headers = @get_headers($url, 1); - return is_array($headers) ? array_change_key_case($headers) : array(); - } - - public function saveCache($file, $data) { - file_put_contents($file, $data); - } - - public function readCache($file) { - return file_get_contents($file); - } - - private function set_context() { - stream_context_set_default( - array( - 'http' => array( - 'method' => 'GET', - 'timeout' => 10, - 'header' => "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0; Favicon; +https://github.com/ArthurHoaro/favicon) Gecko/20100101 Firefox/32.0\r\n", - ) - ) - ); + $this->set_context(); + return @get_headers($url, TRUE); } -} + + public function saveCache($file, $data) { + file_put_contents($file, $data); + } + + public function readCache($file) { + return file_get_contents($file); + } + + private function set_context() { + stream_context_set_default( + array( + 'http' => array( + 'method' => 'GET', + 'timeout' => 10, + 'header' => "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0; Favicon; +https://github.com/ArthurHoaro/favicon) Gecko/20100101 Firefox/32.0\r\n", + ) + ) + ); + } +}
\ No newline at end of file |
