google_apis_fix

The Google Font Fix google apis fix function.

Description

google_apis_fix( $buffer ); 

Parameters (1)

0. $buffer
The buffer.

Usage

  1. if ( !function_exists( 'google_apis_fix' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-font-fix/google-font-fix.php'; 
  3.  
  4. // The buffer. 
  5. $buffer = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = google_apis_fix($buffer); 
  9.  

Defined (1)

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

/google-font-fix.php  
  1. function google_apis_fix($buffer) { 
  2. $country_code = gff_get_country_code($_SERVER['REMOTE_ADDR']); 
  3. if ( $countryCode != 'CN' ) { 
  4. return $buffer; 
  5. return preg_replace_callback( 
  6. '|(https*:)*//(.*).googleapis.com/|', function($matches) { 
  7. global $gff_options; 
  8. return sprintf('//%s.%s/', $matches[2], $gff_options['google_service']); 
  9. }, preg_replace_callback( 
  10. '|http://[0-9]+.gravatar.com/avatar|', function($matches) { 
  11. global $gff_options; 
  12. return $gff_options['gravatar_service']; 
  13. }, $buffer));