pmpro_besecure

The Paid Memberships Pro pmpro besecure function.

Description

pmpro_besecure(); 

Usage

  1. if ( !function_exists( 'pmpro_besecure' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/https.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_besecure(); 
  7.  

Defined (1)

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

/includes/https.php  
  1. function pmpro_besecure() 
  2. global $besecure, $post; 
  3.  
  4. //check the post option 
  5. if(!is_admin() && !empty($post->ID) && !$besecure) 
  6. $besecure = get_post_meta($post->ID, "besecure", true); 
  7.  
  8. //if forcing ssl on admin, be secure in admin and login page 
  9. if(!$besecure && force_ssl_admin() && (is_admin() || pmpro_is_login_page())) 
  10. $besecure = true;  
  11.  
  12. $besecure = apply_filters("pmpro_besecure", $besecure); 
  13.  
  14. $use_ssl = pmpro_getOption("use_ssl"); 
  15. if($use_ssl == 1) 
  16. {  
  17. if($besecure && (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off" || $_SERVER['HTTPS'] == "false")) 
  18. //need to be secure  
  19. wp_redirect("https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 
  20. exit; 
  21. elseif(!$besecure && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off" && $_SERVER['HTTPS'] != "false") 
  22. //don't need to be secure  
  23. wp_redirect("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 
  24. exit; 
  25. }