You are here

function _oembed_filter_apply in oEmbed 8

Same name and namespace in other branches
  1. 6.0 oembed.inc \_oembed_filter_apply()
  2. 7 oembed_legacy.inc \_oembed_filter_apply()
  3. 7.0 oembed_legacy.inc \_oembed_filter_apply()

@file Functions for the oEmbed filter

1 call to _oembed_filter_apply()
oembed_filter_oembed_legacy_process in ./oembed.filter.inc
Implements hook_filter_FILTER_process().

File

./oembed_legacy.inc, line 8
Functions for the oEmbed filter

Code

function _oembed_filter_apply($text, $filter, $format, $langcode, $cache, $cache_id) {
  global $_oembed_default_parameters;
  $_oembed_default_parameters = array_filter(array(
    'maxwidth' => intval($filter->settings['maxwidth']),
    'maxheight' => intval($filter->settings['maxheight']),
  ));
  $text = preg_replace_callback("`(^|<p(?:\\s[^>]*)*>|<li(?:\\s[^>]*)*>|<br(?:\\s[^>]*)*>|[ \n\r\t\\(])((http://|https://|ftp://|mailto:|smb://|afp://|file://|gopher://|news://|ssl://|sslv2://|sslv3://|tls://|tcp://|udp://)([a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))([.,?!]*?)(?=(\$|</p>|</li>|<br\\s*/?>|[ \n\r\t\\)]))`i", '_oembed_preg_parse', $text);
  unset($_oembed_default_parameters);
  return $text;
}