You are here

function _googtube_process in Googtube 7

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

File

./googtube.module, line 37

Code

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

  //youtube regex
  $text = preg_replace_callback('#(((http://)?)|(^./))(((www.)?)|(^./))youtube\\.com/watch[?]v=([^\\[\\]()<.,\\s\\n\\t\\r]+)(?![^<]*</a>)#i', 'googtube_youtube', $text);

  //google video regex
  $text = preg_replace_callback('#(((http://)?)|(^./))(((www.)?)|(^./))video\\.google\\.(com|ca|co\\.uk)(\\.[a-z]+)?/videoplay[?]docid=([^\\[\\]()<.,\\s\\n\\t\\r]+)(?![^<]*</a>)#i', 'googtube_google', $text);

  //vimeo video regex
  $text = preg_replace_callback('#(((http://)?)|(^./))(((www.)?)|(^./))vimeo\\.com/([0-9]+)(?![^<]*</a>)#i', 'googtube_vimeo', $text);
  $text = substr($text, 1, -1);
  return $text;
}