pmpro_ssl_javascript_redirect

The Paid Memberships Pro pmpro ssl javascript redirect function.

Description

pmpro_ssl_javascript_redirect(); 

Usage

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

Defined (1)

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

/includes/https.php  
  1. function pmpro_ssl_javascript_redirect() 
  2. global $besecure; 
  3. $use_ssl = pmpro_getOption("use_ssl"); 
  4. if(!is_admin() && $use_ssl == 2) 
  5. if($besecure) 
  6. ?> 
  7. <script lang="JavaScript"> 
  8. //needs to be secure 
  9. if (window.location.protocol != "https:") 
  10. window.location.href = "https:" + window.location.href.substring(window.location.protocol.length); 
  11. </script> 
  12. <?php 
  13. else 
  14. ?> 
  15. <script lang="JavaScript"> 
  16. //should be over http 
  17. if (window.location.protocol != "http:") 
  18. window.location.href = "http:" + window.location.href.substring(window.location.protocol.length); 
  19. </script> 
  20. <?php