vimeo_link_callback

Callback function for the regex that replaces Vimeo URLs with Vimeo embeds.

Description

(string) vimeo_link_callback( (array) $matches ); 

Returns (string)

THe Vimeo HTML embed code.

Parameters (1)

0. $matches (array)
An array containing a Vimeo URL.

Usage

  1. if ( !function_exists( 'vimeo_link_callback' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/shortcodes/vimeo.php'; 
  3.  
  4. // An array containing a Vimeo URL. 
  5. $matches = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = vimeo_link_callback($matches); 
  9.  

Defined (1)

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

/modules/shortcodes/vimeo.php  
  1. function vimeo_link_callback( $matches ) { 
  2. // Grab the Vimeo ID from the URL 
  3. if ( preg_match( '|vimeo\.com/(\d+)/?$|i', $matches[0], $match ) ) { 
  4. $id = (int) $match[1]; 
  5.  
  6. // Pass that ID to the Vimeo shortcode function. 
  7. if ( $id ) { 
  8. $atts = array( 'id' => $id ); 
  9. return "\n" . vimeo_shortcode( $atts ) . "\n";