You are here

protected function UrlToVideoFilterService::parseVimeoUrls in URL to Video Filter 8

Same name and namespace in other branches
  1. 2.0.x src/Service/UrlToVideoFilterService.php \Drupal\url_to_video_filter\Service\UrlToVideoFilterService::parseVimeoUrls()

Parses text for Vimeo URLs.

Parameters

string $text: The text to parse for Vimeo URLs.

Return value

array An array containing any Vimeo URLs found in the text

1 call to UrlToVideoFilterService::parseVimeoUrls()
UrlToVideoFilterService::convertVimeoUrls in src/Service/UrlToVideoFilterService.php
Converts URLs to embedded Vimeo videos.

File

src/Service/UrlToVideoFilterService.php, line 129

Class

UrlToVideoFilterService
Service class for the URL To Video Filter module.

Namespace

Drupal\url_to_video_filter\Service

Code

protected function parseVimeoUrls($text) {
  $vimeo_regex = '/(^|\\b)http(s)?:\\/\\/(www\\.)?vimeo\\.com.+?(?=($|\\s|\\r|\\r\\n|\\n|<))/m';
  preg_match_all($vimeo_regex, $text, $matches);
  return $matches[0];
}