<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
+ | Copyright CiviCRM LLC. All rights reserved. |
| |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
* want to deal with that so late in the 4.3 dev cycle.
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
*/
class CRM_Utils_HttpClient {
protected static $singleton;
/**
- * @var int|NULL
+ * @var int|null
* seconds; or NULL to use system default
*/
protected $connectionTimeout;
ts('As a result, actions like retrieving the CiviCRM news feed will fail. Talk to your server administrator or hosting company to rectify this.'),
ts('Curl is not installed')
);
- return array(self::STATUS_DL_ERROR, NULL);
+ return [self::STATUS_DL_ERROR, NULL];
}
list($ch, $caConfig) = $this->createCurl($remoteFile);
if (preg_match('/^https:/', $remoteFile) && !$caConfig->isEnableSSL()) {
// CRM_Core_Error::fatal('Cannot install this extension - does not support SSL');
- return array(self::STATUS_DL_ERROR, NULL);
+ return [self::STATUS_DL_ERROR, NULL];
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
if (curl_errno($ch)) {
- return array(self::STATUS_DL_ERROR, $data);
+ return [self::STATUS_DL_ERROR, $data];
}
else {
curl_close($ch);
}
- return array(self::STATUS_OK, $data);
+ return [self::STATUS_OK, $data];
}
/**
// Download extension zip file ...
if (!function_exists('curl_init')) {
//CRM_Core_Error::fatal('Cannot install this extension - curl is not installed!');
- return array(self::STATUS_DL_ERROR, NULL);
+ return [self::STATUS_DL_ERROR, NULL];
}
list($ch, $caConfig) = $this->createCurl($remoteFile);
if (preg_match('/^https:/', $remoteFile) && !$caConfig->isEnableSSL()) {
// CRM_Core_Error::fatal('Cannot install this extension - does not support SSL');
- return array(self::STATUS_DL_ERROR, NULL);
+ return [self::STATUS_DL_ERROR, NULL];
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$data = curl_exec($ch);
if (curl_errno($ch)) {
- return array(self::STATUS_DL_ERROR, $data);
+ return [self::STATUS_DL_ERROR, $data];
}
else {
curl_close($ch);
}
- return array(self::STATUS_OK, $data);
+ return [self::STATUS_OK, $data];
}
/**
* (0 => resource, 1 => CA_Config_Curl)
*/
protected function createCurl($remoteFile) {
- $caConfig = CA_Config_Curl::probe(array(
+ $caConfig = CA_Config_Curl::probe([
'verify_peer' => (bool) Civi::settings()->get('verifySSL'),
- ));
+ ]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $remoteFile);
curl_setopt_array($ch, $caConfig->toCurlOptions());
}
- return array($ch, $caConfig);
+ return [$ch, $caConfig];
}
/**