jetpack_photon_url_scheme

The Jetpack by WordPress.com 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 ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/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. $scheme = is_ssl() ? 'https' : 'http'; 
  4.  
  5. if ( 'network_path' == $scheme ) { 
  6. $scheme_slashes = '//'; 
  7. } else { 
  8. $scheme_slashes = "$scheme://"; 
  9.  
  10. return preg_replace( '#^[a-z:]+//#i', $scheme_slashes, $url );