예제 #1
0
 public function __construct($oembed)
 {
     parent::__construct();
     $oembed["html"] = ATTACHMENTS_CLASS_VideoTools::addCodeParam($oembed["html"]);
     if (!empty($oembed["thumbnail_url"])) {
         $oembed["html"] = ATTACHMENTS_CLASS_VideoTools::addAutoPlay($oembed["html"]);
     }
     $this->assign('oembed', $oembed);
 }
예제 #2
0
 public function __construct($oembed, $expandedView = false)
 {
     parent::__construct();
     $this->uniqId = uniqid('attachments');
     $this->assign('uniqId', $this->uniqId);
     $types = array('video', 'photo', 'link');
     $this->type = in_array($oembed['type'], $types) ? $oembed['type'] : 'link';
     if ($this->type == "video") {
         $oembed["html"] = ATTACHMENTS_CLASS_VideoTools::addCodeParam($oembed["html"]);
         if (!empty($oembed["thumbnail_url"])) {
             $oembed["html"] = ATTACHMENTS_CLASS_VideoTools::addAutoPlay($oembed["html"]);
         }
     }
     $this->oembed = $oembed;
     $plugin = OW::getPluginManager()->getPlugin('attachments');
     $this->setTemplate($plugin->getCmpViewDir() . 'att_' . $this->type . '.html');
     $this->assign('expandedView', $expandedView);
 }
예제 #3
0
 public function videoPreview($query)
 {
     $query['oembed']['html'] = ATTACHMENTS_CLASS_VideoTools::validateEmbedCode($query['oembed']['html']);
     if (empty($query['oembed']['html'])) {
         return array("error" => 'Not valid video embed');
     }
     if (empty($query['oembed']["thumbnail_url"])) {
         $query['oembed']["thumbnail_url"] = ATTACHMENTS_CLASS_VideoTools::detectThumbnail($query['oembed']['html']);
     }
     $cmp = new ATTACHMENTS_CMP_AttVideoPreview($query['oembed']);
     $markup = array('html' => $cmp->render(), 'js' => OW::getDocument()->getOnloadScript(), 'css' => '');
     return array("oembed" => $query['oembed'], "content" => $markup);
 }