3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | This file is a part of CiviCRM. |
8 | CiviCRM is free software; you can copy, modify, and distribute it |
9 | under the terms of the GNU Affero General Public License |
10 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | CiviCRM is distributed in the hope that it will be useful, but |
13 | WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
15 | See the GNU Affero General Public License for more details. |
17 | You should have received a copy of the GNU Affero General Public |
18 | License and the CiviCRM Licensing Exception along |
19 | with this program; if not, contact CiviCRM LLC |
20 | at info[AT]civicrm[DOT]org. If you have questions about the |
21 | GNU Affero General Public License or the licensing of CiviCRM, |
22 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
23 +--------------------------------------------------------------------+
28 * PxPay Functionality Copyright (C) 2008 Lucas Baker, Logistic Information Systems Limited (Logis)
29 * PxAccess Functionality Copyright (C) 2008 Eileen McNaughton
30 * Licensed to CiviCRM under the Academic Free License version 3.0.
32 * Grateful acknowledgements go to Donald Lobo for invaluable assistance
33 * in creating this payment processor module
35 class CRM_Core_Payment_PaymentExpressUtils
{
37 static function _valueXml($element, $value = NULL) {
40 if (is_array($element)) {
42 foreach ($element as $elem => $value) {
43 $xml .= self
::_valueXml($elem, $value);
47 return "<" . $element . ">" . $value . "</" . $element . ">" . $nl;
50 static function _xmlElement($xml, $name) {
51 $value = preg_replace('/.*<' . $name . '[^>]*>(.*)<\/' . $name . '>.*/', '\1', $xml);
55 static function _xmlAttribute($xml, $name) {
56 $value = preg_replace('/<.*' . $name . '="([^"]*)".*>/', '\1', $xml);
57 return $value != $xml ?
$value : NULL;
60 static function &_initCURL($query, $url) {
63 curl_setopt($curl, CURLOPT_URL
, $url);
64 curl_setopt($curl, CURLOPT_FRESH_CONNECT
, TRUE);
65 curl_setopt($curl, CURLOPT_POST
, TRUE);
66 curl_setopt($curl, CURLOPT_POSTFIELDS
, $query);
67 curl_setopt($curl, CURLOPT_TIMEOUT
, 30);
68 curl_setopt($curl, CURLOPT_RETURNTRANSFER
, TRUE);
69 if (ini_get('open_basedir') == '' && ini_get('safe_mode') == 'Off') {
70 curl_setopt($curl, CURLOPT_FOLLOWLOCATION
, FALSE);
72 curl_setopt($curl, CURLOPT_HEADER
, 0);
73 curl_setopt($curl, CURLOPT_SSLVERSION
, 3);
75 if (strtoupper(substr(@php_uname
('s'), 0, 3)) === 'WIN') {
76 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER
, CRM_Core_BAO_Setting
::getItem(CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
, 'verifySSL'));
77 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST
, CRM_Core_BAO_Setting
::getItem(CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
, 'verifySSL') ?
2 : 0);