pmpro_replaceURLsInBuffer

The Paid Memberships Pro pmpro replaceURLsInBuffer function.

Description

pmpro_replaceURLsInBuffer( $buffer ); 

Parameters (1)

0. $buffer
The buffer.

Usage

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

Defined (1)

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

/includes/https.php  
  1. function pmpro_replaceURLsInBuffer($buffer) 
  2. global $besecure; 
  3.  
  4. //only swap URLs if this page is secure 
  5. if($besecure) 
  6. /** 
  7. okay swap out all links like these: 
  8. *http//domain.com 
  9. *http//anysubdomain.domain.com 
  10. *http//any.number.of.sub.domains.domain.com 
  11. */ 
  12. $buffer = preg_replace("/http\:\/\/([a-zA-Z0-9\.\-]*" . str_replace(".", "\.", PMPRO_DOMAIN) . ")/i", "https://$1", $buffer);  
  13.  
  14. return $buffer;