public function transform($body = null)
{
$providers = array();
if ($urls = $this->embera->getUrlInfo($body)) {
foreach ($urls as $url => $data) {
if (!$this->allowOffline && (int) $data['embera_using_fake'] === 1) {
$this->errors[] = 'Using fake oembed response on ' . $url;
continue;
}
$providers[$url] = $this->replace($data, $this->template);
}
}
if (is_array($body)) {
$return = implode('', $providers);
} else {
$return = str_replace(array_keys($providers), array_values($providers), $body);
}
// Remove unchanged placeholders
return preg_replace('~{([\\w\\d\\-_]+)}~i', '', $return);
}