diff options
Diffstat (limited to 'vendor/smarty/smarty/libs/plugins/function.fetch.php')
-rw-r--r-- | vendor/smarty/smarty/libs/plugins/function.fetch.php | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/vendor/smarty/smarty/libs/plugins/function.fetch.php b/vendor/smarty/smarty/libs/plugins/function.fetch.php index cb60dd918..9539e1fcc 100644 --- a/vendor/smarty/smarty/libs/plugins/function.fetch.php +++ b/vendor/smarty/smarty/libs/plugins/function.fetch.php @@ -8,8 +8,8 @@ /** * Smarty {fetch} plugin - * Type: function<br> - * Name: fetch<br> + * Type: function + * Name: fetch * Purpose: fetch file, web or ftp data and display results * * @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch} @@ -25,7 +25,7 @@ function smarty_function_fetch($params, $template) { if (empty($params[ 'file' ])) { - trigger_error("[plugin] fetch parameter 'file' cannot be empty", E_USER_NOTICE); + trigger_error('[plugin] fetch parameter \'file\' cannot be empty', E_USER_NOTICE); return; } @@ -55,15 +55,15 @@ function smarty_function_fetch($params, $template) } $content = ''; - if ($protocol == 'http') { + if ($protocol === 'http') { // http fetch if ($uri_parts = parse_url($params[ 'file' ])) { // set defaults $host = $server_name = $uri_parts[ 'host' ]; $timeout = 30; - $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; - $agent = "Smarty Template Engine " . Smarty::SMARTY_VERSION; - $referer = ""; + $accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*'; + $agent = 'Smarty Template Engine ' . Smarty::SMARTY_VERSION; + $referer = ''; $uri = !empty($uri_parts[ 'path' ]) ? $uri_parts[ 'path' ] : '/'; $uri .= !empty($uri_parts[ 'query' ]) ? '?' . $uri_parts[ 'query' ] : ''; $_is_proxy = false; @@ -81,29 +81,29 @@ function smarty_function_fetch($params, $template) // loop through parameters, setup headers foreach ($params as $param_key => $param_value) { switch ($param_key) { - case "file": - case "assign": - case "assign_headers": + case 'file': + case 'assign': + case 'assign_headers': break; - case "user": + case 'user': if (!empty($param_value)) { $user = $param_value; } break; - case "pass": + case 'pass': if (!empty($param_value)) { $pass = $param_value; } break; - case "accept": + case 'accept': if (!empty($param_value)) { $accept = $param_value; } break; - case "header": + case 'header': if (!empty($param_value)) { if (!preg_match('![\w\d-]+: .+!', $param_value)) { - trigger_error("[plugin] invalid header format '" . $param_value . "'", E_USER_NOTICE); + trigger_error("[plugin] invalid header format '{$param_value}'", E_USER_NOTICE); return; } else { @@ -111,41 +111,41 @@ function smarty_function_fetch($params, $template) } } break; - case "proxy_host": + case 'proxy_host': if (!empty($param_value)) { $proxy_host = $param_value; } break; - case "proxy_port": + case 'proxy_port': if (!preg_match('!\D!', $param_value)) { $proxy_port = (int) $param_value; } else { - trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE); + trigger_error("[plugin] invalid value for attribute '{$param_key }'", E_USER_NOTICE); return; } break; - case "agent": + case 'agent': if (!empty($param_value)) { $agent = $param_value; } break; - case "referer": + case 'referer': if (!empty($param_value)) { $referer = $param_value; } break; - case "timeout": + case 'timeout': if (!preg_match('!\D!', $param_value)) { $timeout = (int) $param_value; } else { - trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE); + trigger_error("[plugin] invalid value for attribute '{$param_key}'", E_USER_NOTICE); return; } break; default: - trigger_error("[plugin] unrecognized attribute '" . $param_key . "'", E_USER_NOTICE); + trigger_error("[plugin] unrecognized attribute '{$param_key}'", E_USER_NOTICE); return; } @@ -185,7 +185,7 @@ function smarty_function_fetch($params, $template) } } if (!empty($user) && !empty($pass)) { - fputs($fp, "Authorization: BASIC " . base64_encode("$user:$pass") . "\r\n"); + fputs($fp, 'Authorization: BASIC ' . base64_encode("$user:$pass") . "\r\n"); } fputs($fp, "\r\n"); |