You are here

function oembed_provider_process in oEmbed 7

Same name and namespace in other branches
  1. 8 oembed.oembed.inc \oembed_provider_process()
  2. 7.0 oembed.oembed.inc \oembed_provider_process()
1 string reference to 'oembed_provider_process'
oembed_ctools_plugin_type in ./oembed.module
Implements hook_ctools_plugin_type().

File

./oembed.oembed.inc, line 29

Code

function oembed_provider_process(&$plugin, $info) {

  // For plugins which provide children based on the URL, a scheme callback allows a
  // map to be used to generate a regular expression for the whole plugin and each
  // child. Probably the plugin properties 'scheme callback' and 'scheme' are mutually
  // exclusive.
  $function = ctools_plugin_get_function($plugin, 'scheme callback');
  if ($function) {
    $schemes = array();
    $plugin['scheme map'] = $function();
    foreach ($plugin['scheme map'] as $id => $scheme) {
      if (is_array($scheme)) {
        $scheme = implode("\n", $scheme);
      }
      $schemes[] = $scheme;
      $plugin['scheme map'][$id] = oembed_scheme_to_regex($scheme, $plugin['capture subpatterns']);
    }
    uasort($plugin['scheme map'], '_oembed_specificity_compare');
  }
  else {
    if (is_array($plugin['scheme'])) {
      $schemes = $plugin['scheme'];
    }
    else {
      $schemes = array(
        $plugin['scheme'],
      );
    }
  }
  if (!empty($schemes)) {
    $plugin['scheme'] = implode("\n", $schemes);
    $plugin['scheme'] = oembed_scheme_to_regex($plugin['scheme'], $plugin['capture subpatterns']);
    if (empty($plugin['weight'])) {
      $plugin['weight'] = strlen($plugin['scheme']);
    }
  }
}