jetpack_googlemaps_embed_to_short_code

Google maps iframe - transforms code that looks like that:
***** **-****** ***** into the [googlemaps http://.

Description

jetpack_googlemaps_embed_to_short_code( $content ); 

..] shortcode format

Parameters (1)

0. $content
The content.

Usage

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

Defined (1)

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

/modules/shortcodes/googlemaps.php  
  1. function jetpack_googlemaps_embed_to_short_code( $content ) { 
  2.  
  3. if ( false === strpos( $content, 'maps.google.' ) && 1 !== preg_match( '@google\.[^/]+/maps?@', $content ) ) 
  4. return $content; 
  5.  
  6. // IE and TinyMCE format things differently 
  7. // <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="<a href="https://maps.google.co.uk/maps/ms?msa=0&amp;msid=206216869547772496318.0004bf5f0ff25aea47bd9&amp;hl=en&amp;ie=UTF8&amp;t=m&amp;ll=50.91917, -1.398808&amp;spn=0.013225, 0.011794&amp;output=embed"></iframe><br">https://maps.google.co.uk/maps/ms?msa=0&amp;msid=206216869547772496318.0004bf5f0ff25aea47bd9&amp;hl=en&amp;ie=UTF8&amp;t=m&amp;ll=50.91917, -1.398808&amp;spn=0.013225, 0.011794&amp;output=embed"></iframe><br</a> /><small>View <a href="<a href="https://maps.google.co.uk/maps/ms?msa=0&amp;msid=206216869547772496318.0004bf5f0ff25aea47bd9&amp;hl=en&amp;ie=UTF8&amp;t=m&amp;ll=50.91917, -1.398808&amp;spn=0.013225, 0.011794&amp;source=embed">https://maps.google.co.uk/maps/ms?msa=0&amp;msid=206216869547772496318.0004bf5f0ff25aea47bd9&amp;hl=en&amp;ie=UTF8&amp;t=m&amp;ll=50.91917, -1.398808&amp;spn=0.013225, 0.011794&amp;source=embed</a>" style="color:#0000FF;text-align:left">OARA Membership Discount Map</a> in a larger map</small> 
  8. if ( strpos( $content, 'src="<a href="' ) !== false ) { 
  9. $content = preg_replace_callback( '#<iframe\s[^&]*?(?:&(?!gt;)[^&]*?)*?src="<a href="https?://(.*)?\.google\.(.*?)/(.*?)\?(.+?)"[^&]*?(?:&(?!gt;)[^&]*?)*?>\s*</iframe><br">[^"]*?">\s*</iframe>(?:<br</a>\s*/>\s*<small>.*?</small>)?#i', 'jetpack_googlemaps_embed_to_short_code_callback', $content ); 
  10. return $content; 
  11.  
  12. $content = preg_replace_callback( '!\<iframe\s[^>]*?src="https?://(.*)?\.google\.(.*?)/(.*?)\?(.+?)"[^>]*?\>\s*\</iframe\>(?:\s*(?:\<br\s*/?\>)?\s*\<small\>.*?\</small\>)?!i', 'jetpack_googlemaps_embed_to_short_code_callback', $content ); 
  13.  
  14. $content = preg_replace_callback( '#<iframe\s[^&]*?(?:&(?!gt;)[^&]*?)*?src="https?://(.*)?\.google\.(.*?)/(.*?)\?(.+?)"[^&]*?(?:&(?!gt;)[^&]*?)*?>\s*</iframe>(?:\s*(?:<br\s*/?>)?\s*<small>.*?</small>)?#i', 'jetpack_googlemaps_embed_to_short_code_callback', $content ); 
  15.  
  16. return $content;