*/
class CRM_Core_Payment_PaymentExpressUtils {
-function _valueXml($element, $value = NULL) {
- $nl = "\n";
+ static function _valueXml($element, $value = NULL) {
+ $nl = "\n";
- if (is_array($element)) {
- $xml = '';
- foreach ($element as $elem => $value) {
- $xml .= self::_valueXml($elem, $value);
+ if (is_array($element)) {
+ $xml = '';
+ foreach ($element as $elem => $value) {
+ $xml .= self::_valueXml($elem, $value);
+ }
+ return $xml;
}
- return $xml;
+ return "<" . $element . ">" . $value . "</" . $element . ">" . $nl;
}
- return "<" . $element . ">" . $value . "</" . $element . ">" . $nl;
-}
-function _xmlElement($xml, $name) {
- $value = preg_replace('/.*<' . $name . '[^>]*>(.*)<\/' . $name . '>.*/', '\1', $xml);
- return $value;
-}
+ static function _xmlElement($xml, $name) {
+ $value = preg_replace('/.*<' . $name . '[^>]*>(.*)<\/' . $name . '>.*/', '\1', $xml);
+ return $value;
+ }
-function _xmlAttribute($xml, $name) {
- $value = preg_replace('/<.*' . $name . '="([^"]*)".*>/', '\1', $xml);
- return $value != $xml ? $value : NULL;
-}
+ static function _xmlAttribute($xml, $name) {
+ $value = preg_replace('/<.*' . $name . '="([^"]*)".*>/', '\1', $xml);
+ return $value != $xml ? $value : NULL;
+ }
-function &_initCURL($query, $url) {
- $curl = curl_init();
+ static function &_initCURL($query, $url) {
+ $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_FRESH_CONNECT, TRUE);
- curl_setopt($curl, CURLOPT_POST, TRUE);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $query);
- curl_setopt($curl, CURLOPT_POSTFIELDSIZE, 0);
- curl_setopt($curl, CURLOPT_TIMEOUT, 30);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
- if (ini_get('open_basedir') == '' && ini_get('safe_mode') == 'Off') {
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, FALSE);
- }
- curl_setopt($curl, CURLOPT_HEADER, 0);
- curl_setopt($curl, CURLOPT_SSLVERSION, 3);
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_FRESH_CONNECT, TRUE);
+ curl_setopt($curl, CURLOPT_POST, TRUE);
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $query);
+ curl_setopt($curl, CURLOPT_TIMEOUT, 30);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
+ if (ini_get('open_basedir') == '' && ini_get('safe_mode') == 'Off') {
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, FALSE);
+ }
+ curl_setopt($curl, CURLOPT_HEADER, 0);
+ curl_setopt($curl, CURLOPT_SSLVERSION, 3);
- if (strtoupper(substr(@php_uname('s'), 0, 3)) === 'WIN') {
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'));
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0);
+ if (strtoupper(substr(@php_uname('s'), 0, 3)) === 'WIN') {
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'));
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0);
+ }
+ return $curl;
}
- return $curl;
-}
}