Example #1
0
 function oembed_preview()
 {
     if (isset($_POST['url'])) {
         $data = Shutter::get_oembed(urldecode($_POST['url']));
         $this->set_response_data($data);
     }
 }
Example #2
0
 function koken_oembed($attr)
 {
     if (!isset($attr['url']) || !isset($attr['endpoint'])) {
         return '';
     }
     $endpoint = $attr['endpoint'];
     if (strpos($endpoint, 'maxwidth=') === false) {
         if (strpos($endpoint, '?') !== false) {
             $endpoint .= '&';
         } else {
             $endpoint .= '?';
         }
         $endpoint .= 'maxwidth=1920&maxheight=1080';
     }
     if (strpos($endpoint, '?') !== false) {
         $endpoint .= '&';
     } else {
         $endpoint .= '?';
     }
     $info = Shutter::get_oembed($endpoint . 'url=' . $attr['url']);
     if (isset($info['html'])) {
         $html = preg_replace('/<iframe/', '<iframe style="display:none"', $info['html']);
     } else {
         if (isset($info['url'])) {
             $html = '<img src="' . $info['url'] . '" />';
         } else {
             return '';
         }
     }
     return '<figure class="k-content-embed"><div class="k-content">' . $html . '</div></figure>';
 }