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);
    }
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);
    }
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 ) ; }
This method transforms an array or a string with urls
into another string using a specified template.

@param string|array $body An array or string with Urls
@return string
This method transforms an array or a string with urls into another string using a specified template .