jetpack_googlemaps_embed_to_short_code_callback

The Jetpack by WordPress.com jetpack googlemaps embed to short code callback function.

Description

jetpack_googlemaps_embed_to_short_code_callback( $match ); 

Parameters (1)

0. $match
The match.

Usage

  1. if ( !function_exists( 'jetpack_googlemaps_embed_to_short_code_callback' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/shortcodes/googlemaps.php'; 
  3.  
  4. // The match. 
  5. $match = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = jetpack_googlemaps_embed_to_short_code_callback($match); 
  9.  

Defined (1)

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

/modules/shortcodes/googlemaps.php  
  1. function jetpack_googlemaps_embed_to_short_code_callback( $match ) { 
  2.  
  3. if ( preg_match( '/\bwidth=[\'"](\d+)(%)?/', $match[0], $width ) ) { 
  4. $percent = ! empty( $width[2] ) ? '%' : ''; 
  5. $width = absint( $width[1] ) . $percent; 
  6. } else { 
  7. $width = 425; 
  8.  
  9. if ( preg_match( '/\bheight=[\'"](\d+)(%)?/', $match[0], $height ) ) { 
  10. $percent = ! empty( $height[2] ) ? '%' : ''; 
  11. $height = absint( $height[1] ) . $percent; 
  12. } else { 
  13. $height = 350; 
  14.  
  15. $url = "https://{$match[1]}.google.{$match[2]}/{$match[3]}?{$match[4]}&w={$width}&h={$height}"; 
  16.  
  17. /** This action is documented in modules/shortcodes/youtube.php */ 
  18. do_action( 'jetpack_embed_to_shortcode', 'googlemaps', $url ); 
  19.  
  20. return "[googlemaps $url]";