- Timestamp:
- Aug 25, 2009, 11:35:32 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xpressme_integration_kit/wp-content/plugins/xpressme/xpressme.php
r369 r370 34 34 add_submenu_page(__FILE__, __('Integration Settings', 'xpressme'), __('Integration Settings', 'xpressme'), 8, 'integration_option_page', 'integration_option_page'); 35 35 add_submenu_page(__FILE__, __('Other Settings', 'xpressme'), __('Other Settings', 'xpressme'), 8, 'other_option_page', 'other_option_page'); 36 if (function_exists('wp_remote_get'))36 // if (function_exists('wp_remote_get')) 37 37 add_submenu_page(__FILE__, __('Upgrade', 'xpressme'), __('Upgrade', 'xpressme'), 8, 'upgrade_page', 'upgrade_page'); 38 38 add_submenu_page(__FILE__, __('to XOOPS Admin', 'xpressme'), __('to XOOPS Admin', 'xpressme'), 8, 'redirect_xoops_admin', 'redirect_xoops_admin'); … … 308 308 } 309 309 310 function xp_remote_get($url, $headers = ""){ 311 global $xoops_config; 312 $xpress_version = $xoops_config->module_version . $xoops_config->module_codename; 313 314 require_once( $xoops_config->module_path . '/wp-includes/class-snoopy.php'); 315 316 // Snoopy is an HTTP client in PHP 317 $client = new Snoopy(); 318 $client->agent = 'XPressME/' . $xpress_version; 319 $client->read_timeout = 2; 320 if (is_array($headers) ) { 321 $client->rawheaders = $headers; 322 } 323 324 @$client->fetch($url); 325 $response['response']['code'] = $client->status; 326 $response['body'] = $client->results; 327 return $response; 328 return $client; 329 330 } 331 310 332 function get_xpress_latest_version(){ 311 333 global $wp_version, $wpdb, $wp_local_package; … … 320 342 ); 321 343 322 if (! function_exists('wp_remote_get')) return false; 323 324 $response = wp_remote_get($check_url, $request_options); 325 if ( is_wp_error( $response ) ) 326 return false; 327 344 if (! function_exists('wp_remote_get')) { 345 $response = xp_remote_get($check_url); 346 347 if (empty($response['body'])) return false; 348 } else { 349 350 $response = wp_remote_get($check_url, $request_options); 351 352 if ( is_wp_error( $response ) ) 353 return false; 354 } 328 355 if ( 200 != $response['response']['code'] ) 329 356 return false; 330 331 357 $body = trim( $response['body'] ); 332 358 $body = str_replace(array("\r\n", "\r"), "\n", $body); 333 359 $returns = explode("\n", $body); 334 $response = esc_attr( $returns[0] );360 $response = $returns[0]; 335 361 if ( isset( $returns[1] ) ) 336 $url = esc_url( $returns[1] );362 $url = clean_url( $returns[1] ); 337 363 if ( isset( $returns[2] ) ) 338 $package = esc_url( $returns[2] );364 $package = clean_url( $returns[2] ); 339 365 if ( isset( $returns[3] ) ) 340 $latest_version = esc_attr( $returns[3] );366 $latest_version = $returns[3]; 341 367 342 368 $write_options = array (
Note: See TracChangeset
for help on using the changeset viewer.