jetpack_photon_url_scheme

The WordPress Core jetpack photon url scheme function.

Description

jetpack_photon_url_scheme( $url, $scheme ); 

Parameters (2)

0. $url
The url.
1. $scheme
The scheme.

Usage

  1. if ( !function_exists( 'jetpack_photon_url_scheme' ) ) { 
  2. require_once '/functions.photon.php'; 
  3.  
  4. // The url. 
  5. $url = null; 
  6.  
  7. // The scheme. 
  8. $scheme = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = jetpack_photon_url_scheme($url, $scheme); 
  12.  

Defined (1)

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

/functions.photon.php  
  1. function jetpack_photon_url_scheme( $url, $scheme ) { 
  2. if ( ! in_array( $scheme, array( 'http', 'https', 'network_path' ) ) ) { 
  3. if ( preg_match( '#^(https?:)?//#', $url ) ) { 
  4. return $url; 
  5.  
  6. $scheme = 'http'; 
  7.  
  8. if ( 'network_path' == $scheme ) { 
  9. $scheme_slashes = '//'; 
  10. } else { 
  11. $scheme_slashes = "$scheme://"; 
  12.  
  13. return preg_replace( '#^([a-z:]+)?//#i', $scheme_slashes, $url );