Source of file VideoEmbedController.php
Size: 1,014 Bytes - Last Modified: 2021-12-24T06:49:09+00:00
/var/www/docs.ssmods.com/process/src/code/controllers/VideoEmbedController.php
12345678910111213141516171819202122232425262728293031 | <?php class videoEmbedController extends Controller { private static $allowed_actions = array('getOembedData'); private static $url_handlers = array( 'video-embed/oembed.json' => 'getOembedData' ); public function GetOembedData(SS_HTTPRequest $request) { $response = "{}"; $this->getResponse()->addHeader("Content-Type", "application/json; charset=utf-8"); $url = $request->postVar('url') ? $request->postVar('url') : $request->getVar("mediaurl"); if (Director::is_site_url($url) && VideoEmbed::GetByURL($url)) { $video = VideoEmbed::GetByURL($url); $response = $video->GetOembedJson(); } else { $oembed = Oembed::get_oembed_from_url($url); if ($oembed && $oembed->exists()) { $response = $oembed->toJson(); } } echo $response; } public function index(SS_HTTPRequest $request) { return $this->GetOembedData($request); } } |