You are here

omlex.inc in oEmbed 7.0

File

oembedprovider_embed/plugins/providers/omlex.inc
View source
<?php

$plugin = array(
  'title' => 'Omlex',
  'callback' => 'oembedprovider_embed_omlex_callback',
  'scheme' => '*',
);
function oembedprovider_embed_omlex_callback($plugin, $url, $matches, $parameters) {
  $embed = FALSE;
  $ombed = new Omlex\OEmbed($url);

  // oEmbed response is a protected property of the object, so casting to an array is
  // the only way. See http://www.php.net/manual/en/language.types.array.php#language.types.array.casting
  $object = (array) $ombed
    ->getObject($parameters);
  if ($object) {
    $embed = (array) $object["\0*\0object"];
  }
  return $embed;
}