コード例 #1
0
ファイル: player.php プロジェクト: robjcordes/nexnewwp
 public function buildPlayer($profileid = 1, $videoid = 1, $autodetect = 1)
 {
     global $wpdb;
     $profile = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "allvideogallery_profiles WHERE id=" . $profileid);
     $this->width = $profile->width;
     $this->height = $profile->height;
     if (isset($_GET['slg']) && $autodetect == 1) {
         $slug = $_GET['slg'];
         $video = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "allvideogallery_videos WHERE slug='{$slug}'");
         $videoid = $video->id;
     } else {
         $video = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "allvideogallery_videos WHERE  id=" . $videoid);
     }
     if ($video->type == 'thirdparty') {
         $result = '<div style="width:' . $this->width . 'px; height:' . $this->height . 'px;">';
         $result .= $video->thirdparty;
         $result .= '</div>';
     } else {
         $arr_params = array();
         $custpage = $profile->custom_page_url ? $profile->custom_page_url : $this->curPageURL();
         if (isset($_GET['catid'])) {
             $arr_params['catid'] = $_GET['catid'];
         }
         if (isset($_GET['sort'])) {
             $arr_params['sort'] = $_GET['sort'];
         }
         $flashvars = 'base=' . get_option('siteurl') . '&wp=1&vid=' . $videoid . '&pid=' . $profileid . '&page=' . urlencode(@add_query_arg($arr_params, $custpage));
         $detect = new IsMobile();
         $result = $detect->isMobile() ? $this->gethtmlplayer($profile, $video) : $this->getflashplayer($profile, $flashvars);
     }
     $this->updatehits($video->slug);
     $cust_class = $profile->custom_player_class ? $profile->custom_player_class : 'avs_player';
     $output = '<style type="text/css">' . "\n";
     $output .= $profile->player_css . "\n";
     $output .= '</style>' . "\n";
     $output .= '<div class="' . $cust_class . '" style="width:' . $this->width . 'px;">' . "\n";
     if ($profile->title) {
         $output .= '<div class="title">' . $video->title . '</div>' . "\n";
     }
     if ($profile->category) {
         $output .= '<div class="category"><strong>Category : </strong>' . $video->category . '</div>' . "\n";
     }
     if ($profile->hits) {
         $output .= '<div class="hits"><strong>Hits : </strong>' . $video->hits . '</div>' . "\n";
     }
     $output .= '<div style="clear:both;"></div>' . "\n";
     $output .= $result . "\n";
     if ($video->description) {
         $output .= '<div class="description">' . $video->description . '</div>' . "\n";
     }
     $output .= '</div>' . "\n";
     return $output;
 }