You are here

function _googtube_process in Googtube 7.2

Same name and namespace in other branches
  1. 7 googtube.module \_googtube_process()
1 string reference to '_googtube_process'
googtube_filter_info in ./googtube.module
Implement hook_filter_info().

File

./googtube.module, line 132

Code

function _googtube_process($text = '', $filter, $format = -1) {

  //youtube regex
  if (preg_match_all('#(((http://)?)|(^./))(((www.)?)|(^./))youtube\\.com/watch[?]v=([^\\[\\]()<.,\\s\\n\\t\\r]+)(?![^<]*</a>)#i', $text, $matches)) {
  }
  foreach ($matches[0] as $mi => $match) {
    $replace = googtube_youtube($match, $filter);
    $text = str_replace($match, $replace, $text);
  }

  //vimeo video regex
  if (preg_match_all('#(((http://)?)|(^./))(((www.)?)|(^./))vimeo\\.com/([0-9]+)(?![^<]*</a>)#i', $text, $matches)) {
    foreach ($matches[0] as $mi => $match) {
      $replace = googtube_vimeo($match, $filter);
      $text = str_replace($match, $replace, $text);
    }
  }
  return $text;
}