$url,
$binary,
$redirects,
- array('timeout'=>$timeout,
+ ['timeout'=>$timeout,
'accept_content'=>$accept_content,
'cookiejar'=>$cookiejar
- )
+ ]
);
return($ret['body']);
* string 'header' => HTTP headers
* string 'body' => fetched content
*/
-function z_fetch_url($url, $binary = false, &$redirects = 0, $opts = array())
+function z_fetch_url($url, $binary = false, &$redirects = 0, $opts = [])
{
- $ret = array('return_code' => 0, 'success' => false, 'header' => '', 'info' => '', 'body' => '');
+ $ret = ['return_code' => 0, 'success' => false, 'header' => '', 'info' => '', 'body' => ''];
$stamp1 = microtime(true);
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
- array('Accept: ' . $opts['accept_content'])
+ ['Accept: ' . $opts['accept_content']]
);
}
$newurl = $new_location_info['scheme'] . '://' . $new_location_info['host'] . $old_location_info['path'];
}
- $matches = array();
+ $matches = [];
if (preg_match('/(Location:|URI:)(.*?)\n/i', $header, $matches)) {
$newurl = trim(array_pop($matches));
if (defined('LIGHTTPD')) {
if (!is_array($headers)) {
- $headers = array('Expect:');
+ $headers = ['Expect:'];
} else {
if (!in_array('Expect:', $headers)) {
array_push($headers, 'Expect:');
}
if ($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) {
- $matches = array();
+ $matches = [];
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
$newurl = trim(array_pop($matches));
function xml_status($st, $message = '')
{
- $result = array('status' => $st);
+ $result = ['status' => $st];
if ($message != '') {
$result['message'] = $message;
header("Content-type: text/xml");
- $xmldata = array("result" => $result);
+ $xmldata = ["result" => $result];
echo XML::fromArray($xmldata, $xml);
* 'title' => header title
* 'description' => optional message
*/
-function http_status_exit($val, $description = array())
+function http_status_exit($val, $description = [])
{
$err = '';
if ($val >= 400) {
$tpl = get_markup_template('http_status.tpl');
echo replace_macros(
$tpl,
- array(
+ [
'$title' => $description["title"],
- '$description' => $description["description"])
+ '$description' => $description["description"]]
);
}
return true;
}
- $domain_blocklist = Config::get('system', 'blocklist', array());
+ $domain_blocklist = Config::get('system', 'blocklist', []);
if (! $domain_blocklist) {
return false;
}
}
if ($ssl_changed) {
- $fields = array('url' => $contact['url'], 'request' => $contact['request'],
+ $fields = ['url' => $contact['url'], 'request' => $contact['request'],
'notify' => $contact['notify'], 'poll' => $contact['poll'],
- 'confirm' => $contact['confirm'], 'poco' => $contact['poco']);
- dba::update('contact', $fields, array('id' => $contact['id']));
+ 'confirm' => $contact['confirm'], 'poco' => $contact['poco']];
+ dba::update('contact', $fields, ['id' => $contact['id']]);
}
}
foreach ($querydata as $param => $value) {
if (in_array(
$param,
- array(
+ [
"utm_source", "utm_medium", "utm_term", "utm_content", "utm_campaign",
"wt_mc", "pk_campaign", "pk_kwd", "mc_cid", "mc_eid",
"fb_action_ids", "fb_action_types", "fb_ref",
"awesm", "wtrid",
- "woo_campaign", "woo_source", "woo_medium", "woo_content", "woo_term")
+ "woo_campaign", "woo_source", "woo_medium", "woo_content", "woo_term"]
)
) {
$pair = $param . "=" . urlencode($value);
$pair = $param . "=" . $value;
$url = str_replace($pair, "", $url);
- $url = str_replace(array("?&", "&&"), array("?", ""), $url);
+ $url = str_replace(["?&", "&&"], ["?", ""], $url);
}
}
}
$list = $xpath->query("//meta[@content]");
foreach ($list as $node) {
- $attr = array();
+ $attr = [];
if ($node->attributes->length) {
foreach ($node->attributes as $attribute) {
$attr[$attribute->name] = $attribute->value;
$yourls->set('password', $yourls_password);
$yourls->set('ssl', $yourls_ssl);
$yourls->set('yourls-url', $yourls_url);
- $slinky->set_cascade(array($yourls, new Slinky_Ur1ca(), new Slinky_TinyURL()));
+ $slinky->set_cascade([$yourls, new Slinky_Ur1ca(), new Slinky_TinyURL()]);
} else {
// setup a cascade of shortening services
// try to get a short link from these services
// in the order ur1.ca, tinyurl
- $slinky->set_cascade(array(new Slinky_Ur1ca(), new Slinky_TinyURL()));
+ $slinky->set_cascade([new Slinky_Ur1ca(), new Slinky_TinyURL()]);
}
return $slinky->short();
}