diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-05-30 13:52:26 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-05-30 13:59:33 +0200 |
commit | 4346a86068781f4acdeb574d7e2af08b77b58ea7 (patch) | |
tree | 5c392314913f7cbcd2658893432ff5f9db318465 /src/Wallabag/CoreBundle/Helper | |
parent | 399bd777d7900f532bfcfa367da88767739391bc (diff) | |
download | wallabag-4346a86068781f4acdeb574d7e2af08b77b58ea7.tar.gz wallabag-4346a86068781f4acdeb574d7e2af08b77b58ea7.tar.zst wallabag-4346a86068781f4acdeb574d7e2af08b77b58ea7.zip |
CS
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-rwxr-xr-x | src/Wallabag/CoreBundle/Helper/Tools.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/Tools.php b/src/Wallabag/CoreBundle/Helper/Tools.php index 0fd5f259..be29ab99 100755 --- a/src/Wallabag/CoreBundle/Helper/Tools.php +++ b/src/Wallabag/CoreBundle/Helper/Tools.php | |||
@@ -5,15 +5,16 @@ namespace Wallabag\CoreBundle\Helper; | |||
5 | final class Tools | 5 | final class Tools |
6 | { | 6 | { |
7 | /** | 7 | /** |
8 | * Download a file (typically, for downloading pictures on web server) | 8 | * Download a file (typically, for downloading pictures on web server). |
9 | * | 9 | * |
10 | * @param $url | 10 | * @param $url |
11 | * | ||
11 | * @return bool|mixed|string | 12 | * @return bool|mixed|string |
12 | */ | 13 | */ |
13 | public static function getFile($url) | 14 | public static function getFile($url) |
14 | { | 15 | { |
15 | $timeout = 15; | 16 | $timeout = 15; |
16 | $useragent = "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"; | 17 | $useragent = 'Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0'; |
17 | 18 | ||
18 | if (in_array('curl', get_loaded_extensions())) { | 19 | if (in_array('curl', get_loaded_extensions())) { |
19 | # Fetch feed from URL | 20 | # Fetch feed from URL |
@@ -32,7 +33,7 @@ final class Tools | |||
32 | 33 | ||
33 | # FeedBurner requires a proper USER-AGENT... | 34 | # FeedBurner requires a proper USER-AGENT... |
34 | curl_setopt($curl, CURL_HTTP_VERSION_1_1, true); | 35 | curl_setopt($curl, CURL_HTTP_VERSION_1_1, true); |
35 | curl_setopt($curl, CURLOPT_ENCODING, "gzip, deflate"); | 36 | curl_setopt($curl, CURLOPT_ENCODING, 'gzip, deflate'); |
36 | curl_setopt($curl, CURLOPT_USERAGENT, $useragent); | 37 | curl_setopt($curl, CURLOPT_USERAGENT, $useragent); |
37 | 38 | ||
38 | $data = curl_exec($curl); | 39 | $data = curl_exec($curl); |
@@ -45,7 +46,7 @@ final class Tools | |||
45 | array( | 46 | array( |
46 | 'http' => array( | 47 | 'http' => array( |
47 | 'timeout' => $timeout, | 48 | 'timeout' => $timeout, |
48 | 'header' => "User-Agent: ".$useragent, | 49 | 'header' => 'User-Agent: '.$useragent, |
49 | 'follow_location' => true, | 50 | 'follow_location' => true, |
50 | ), | 51 | ), |
51 | 'ssl' => array( | 52 | 'ssl' => array( |
@@ -91,9 +92,10 @@ final class Tools | |||
91 | } | 92 | } |
92 | 93 | ||
93 | /** | 94 | /** |
94 | * Encode a URL by using a salt | 95 | * Encode a URL by using a salt. |
95 | * | 96 | * |
96 | * @param $string | 97 | * @param $string |
98 | * | ||
97 | * @return string | 99 | * @return string |
98 | */ | 100 | */ |
99 | public static function encodeString($string) | 101 | public static function encodeString($string) |