Changeset 2042292
- Timestamp:
- 03/01/2019 04:24:16 PM (7 years ago)
- Location:
- chargify/trunk
- Files:
-
- 3 edited
-
chargify.php (modified) (1 diff)
-
lib/ChargifyConnector.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
chargify/trunk/chargify.php
r1657870 r2042292 5 5 Description: Manage subscriptions to WordPress using the Chargify API 6 6 Author: Subscription Tools - Programming by 9seeds 7 Version: 2. 0.107 Version: 2.1 8 8 Author URI: http://9seeds.com/plugins 9 9 */ -
chargify/trunk/lib/ChargifyConnector.php
r1652566 r2042292 259 259 protected function sendRequest($uri, $post_xml = null,$method = null) { 260 260 $apiUrl = "https://{$this->active_domain}.chargify.com{$uri}"; 261 $ch = curl_init(); 262 curl_setopt($ch, CURLOPT_URL, $apiUrl); 263 curl_setopt($ch, CURLOPT_USERPWD,$this->active_api_key.':x'); 264 curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 265 curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); 266 curl_setopt($ch, CURLOPT_HEADER , 0); 267 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 268 curl_setopt ($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); 261 262 $args = array( 263 'headers' => array( 264 'Authorization' => 'Basic ' . base64_encode( $this->active_api_key . ':x') 265 ), 266 'method' => 'GET' 267 ); 269 268 270 269 if($method == 'put') 271 270 { 272 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");271 $args['method'] = 'PUT'; 273 272 } 274 273 if($post_xml) 275 274 { 276 curl_setopt($ch, CURLOPT_POST, 1); 277 curl_setopt($ch, CURLOPT_POSTFIELDS, $post_xml); 278 curl_setopt($ch, CURLOPT_HTTPHEADER , array('Content-Type: application/xml')); 275 $args['body'] = $post_xml; 276 $args['headers']['Content-Type'] = 'application/xml'; 279 277 } 280 278 if($method == 'delete') 281 279 { 282 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 283 } 284 curl_setopt($ch, CURLOPT_TIMEOUT, 60); 285 $xml = curl_exec($ch); 280 $args['method'] = 'DELETE'; 281 } 282 $error = false; 283 284 $response = wp_remote_request( $apiUrl, $args ); 285 $response_code = wp_remote_retrieve_response_code( $response ); 286 286 287 curl_close($ch);288 287 288 if(substr($response_code,0,1) != 2){ 289 $error = wp_remote_retrieve_body($response); 290 $xml = '<error>'.$error.'</error>'; 291 } else { 292 $xml = wp_remote_retrieve_body($response); 293 } 289 294 libxml_use_internal_errors(true); 290 295 $sxe = simplexml_load_string($xml); 291 296 if (!$sxe) { $xml = '<error>'.$xml.'</error>'; } 292 297 298 293 299 return $xml; 294 300 } -
chargify/trunk/readme.txt
r1657870 r2042292 4 4 Tags: Chargify, subscription, registration, tools, membership 5 5 Requires at least: 2.9 6 Tested up to: 4.7.47 Stable Tag: 2. 0.106 Tested up to: 5.1 7 Stable Tag: 2.1 8 8 9 9 WP-Chargify allows users to integrate the Chargify service with WordPress. … … 44 44 45 45 == Changelog == 46 = 2.1 = 47 * Test up to WP 5.1 48 * Change hard curl calls to wp_remote_request 49 46 50 = 2.0.10 = 47 51 * Fix versioning
Note: See TracChangeset
for help on using the changeset viewer.