function googtube_filter in Googtube 5
Same name and namespace in other branches
- 6.2 googtube.module \googtube_filter()
- 6 googtube.module \googtube_filter()
File
- ./
googtube.module, line 26
Code
function googtube_filter($op, $delta = 0, $format = -1, $text = '') {
switch ($op) {
case 'list':
return array(
0 => t('googtube filter'),
);
case 'description':
return t('Youtube and google video links are automatically converted into embedded videos.');
/* no settings that work yet
case 'settings':
$form['filter_googtube'] = array('#type' => 'fieldset', '#title' => t('googtube filter'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['filter_googtube']['googtube_include_link'] = array(
'#type' => 'checkbox',
'#title' => t('Include the original link below the video?'),
'#default_value' => variable_get('googtube_include_link_'. $format, 0),
'#description' => t(''),
);
return $form;
break;
*/
case 'process':
$text = ' ' . $text . ' ';
//youtube regex
$text = preg_replace_callback('!(((http://)?)|(^./))(((www.)?)|(^./))youtube\\.com/watch[?]v=([^\\[\\]()<.,\\s\\n\\t\\r]+)!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]+)!i', 'googtube_google', $text);
$text = substr($text, 1, -1);
return $text;
case 'no_cache':
return false;
default:
return $text;
}
}