AtD_redirect_call

This function is called as an action handler to admin-ajax.php.

Description

AtD_redirect_call(); 

Usage

  1. if ( !function_exists( 'AtD_redirect_call' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/after-the-deadline/proxy.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = AtD_redirect_call(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/modules/after-the-deadline/proxy.php  
  1. function AtD_redirect_call() { 
  2. if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) 
  3. $postText = trim( file_get_contents( 'php://input' ) ); 
  4.  
  5. check_admin_referer( 'proxy_atd' ); 
  6.  
  7. $url = $_GET['url']; 
  8. /** 
  9. * Change the AtD service domain. 
  10. * @module after-the-deadline 
  11. * @since 1.2.3 
  12. * @param string $var The URL for AtD service domain, default is service.afterthedeadline.com. 
  13. */ 
  14. $service = apply_filters( 'atd_service_domain', 'service.afterthedeadline.com' ); 
  15.  
  16. $user = wp_get_current_user(); 
  17.  
  18. $atd_lang = get_locale(); 
  19.  
  20. // If we're on WPCOM, this function should be available. 
  21. if ( function_exists( 'get_user_lang_code' ) ) { 
  22. $atd_lang = get_user_lang_code( $user->ID ); 
  23.  
  24. if ( ! empty( $atd_lang ) ) { 
  25. if ( strpos($atd_lang, 'pt') !== false ) 
  26. $service = 'pt.service.afterthedeadline.com'; 
  27. else if ( strpos($atd_lang, 'de') !== false ) 
  28. $service = 'de.service.afterthedeadline.com'; 
  29. else if ( strpos($atd_lang, 'es') !== false ) 
  30. $service = 'es.service.afterthedeadline.com'; 
  31. else if ( strpos($atd_lang, 'fr') !== false ) 
  32. $service = 'fr.service.afterthedeadline.com'; 
  33.  
  34. $guess = strcmp( AtD_get_setting( $user->ID, 'AtD_guess_lang' ), "true" ) == 0 ? "true" : "false"; 
  35.  
  36. $data = AtD_http_post( $postText . "&guess=$guess", defined('ATD_HOST') ? ATD_HOST : $service, $url, defined('ATD_PORT') ? ATD_PORT : 80 ); 
  37.  
  38. header( 'Content-Type: text/xml' ); 
  39.  
  40. if ( ! empty( $data[1] ) ) 
  41. echo $data[1]; 
  42.  
  43. die();