/** * Callback function for the regex that replaces Vimeo URLs with Vimeo embeds. * * @since 3.7.0 * * @param array $matches An array containing a Vimeo URL. * @return string The Vimeo HTML embed code. */ function vimeo_link_callback($matches) { $id = isset($matches[2]) ? $matches[2] : $matches[1]; if (isset($id) && ctype_digit($id)) { return "\n" . vimeo_shortcode(array('id' => $id)) . "\n"; } return $matches[0]; }
/** * Callback function for the regex that replaces Vimeo URLs with Vimeo embeds. * * @since 3.7.0 * * @param array $matches An array containing a Vimeo URL. * @return string THe Vimeo HTML embed code. */ function vimeo_link_callback($matches) { if (isset($matches[2]) && ctype_digit($matches[2])) { return "\n" . vimeo_shortcode(array('id' => $matches[2])) . "\n"; } return ''; }
/** * Callback function for the regex that replaces Vimeo URLs with Vimeo embeds. * * @since 3.7.0 * * @param array $matches An array containing a Vimeo URL. * @return string THe Vimeo HTML embed code. */ function vimeo_link_callback($matches) { // Grab the Vimeo ID from the URL if (preg_match('|vimeo\\.com/(\\d+)/?$|i', $matches[0], $match)) { $id = (int) $match[1]; } // Pass that ID to the Vimeo shortcode function. if ($id) { $atts = array('id' => $id); } return "\n" . vimeo_shortcode($atts) . "\n"; }
/** * Callback function for the regex that replaces Vimeo URLs with Vimeo embeds. * * @since 3.7.0 * * @param array $matches An array containing a Vimeo URL. * @return string THe Vimeo HTML embed code. */ function vimeo_link_callback($matches) { return "\n" . vimeo_shortcode(array('id' => $matches[1])) . "\n"; }