Embera\Providers\Facebook::modifyResponse PHP Method

modifyResponse() protected method

Need to modify the html response, to use the iframe instead. The html returned by facebook always adds the javascript code and the famous
. When embedding multiple links, the code seems to conflict and doesnt embed properly
protected modifyResponse ( array $response = [] )
$response array
    protected function modifyResponse(array $response = array())
    {
        if (!empty($response['html'])) {
            $iframe = '<iframe id="embera-iframe-{md5}" class="embera-facebook-iframe" src="https://www.facebook.com/plugins/post.php?href={url}&width={width}&height={height}&show_text=true&appId" width="{width}" height="{height}"" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>';
            if (!empty($response['height'])) {
                $height = $response['height'];
            } else {
                $height = min(680, (int) ($response['width'] + 100));
            }
            $table = array('{url}' => rawurlencode($this->url), '{md5}' => substr(md5($this->url), 0, 5), '{width}' => $response['width'], '{height}' => $height);
            // Backup the real response
            $response['raw']['html'] = $response['html'];
            // Replace the html response
            $response['html'] = str_replace(array_keys($table), array_values($table), $iframe);
        }
        return $response;
    }