Esempio n. 1
0
 public function GetChunk()
 {
     if ($this->IsActive()) {
         if ($this->video_mode == 2) {
             if (empty($this->youtube_url)) {
                 return;
             }
             // TODO need decent return messages.
             $the_data = FeaturedVideoModule::GetYouTubeVideo($this->youtube_url);
             // TODO check the url is not empty
             $the_chunk = '';
             if ($the_data['xml_response'] == 'Video not found') {
                 $the_chunk .= '<div id="video-not-found">' . "\n";
                 $the_chunk .= 'Sorry, the video has been removed.' . "\n";
                 $the_chunk .= '</div>' . "\n";
             } else {
                 $video_size = OnePanelConfig::GetYoutubeVideoSize();
                 if (!is_array($video_size)) {
                     $video_size['Width'] = 216;
                     $video_size['Height'] = 197;
                 }
                 $the_chunk .= '<div id="featured-video">' . "\n";
                 $the_chunk .= '<object data="' . $the_data['url'] . '" type="' . $the_data['type'] . '" width="' . $video_size['Width'] . '" height="' . $video_size['Height'] . '">' . "\n";
                 $the_chunk .= '	<param name="movie" value="' . $the_data['url'] . '"></param>' . "\n";
                 $the_chunk .= '</object>' . "\n";
                 $the_chunk .= '</div>' . "\n";
             }
             return $the_chunk;
         } elseif ($this->video_mode == 3) {
             if (empty($this->embed_code)) {
                 return;
             }
             // TODO need decent return messages.
             $the_chunk = '';
             $the_chunk .= '<div id="featured-video">' . "\n";
             $the_chunk .= stripcslashes($this->embed_code);
             $the_chunk .= '</div>' . "\n";
             return $the_chunk;
         } else {
             if (OnePanelConfig::UsingDebug()) {
                 return $this->GetInactiveMessage();
             }
         }
     }
 }