コード例 #1
0
function SetYoutubeVideo($ytb_ID, $title = '', $thumb, $settings, $add_arg = '')
{
    $ID = 'y' . rand();
    $url = 'http://youtube.com/watch?v=' . $ytb_ID;
    if ($title == '') {
        $title = 'Youtube video';
    }
    $replacement = "\n" . '<script type="text/javascript">';
    $replacement .= "\n\t" . 'var so' . $ID . 'y = new SWFObject("http://youtube.com/v/' . $ytb_ID . '&amp;autoplay=1"';
    $replacement .= ', "1", "' . $settings['youtube_pwidth'] . '", "' . $settings['youtube_pheight'] . '", "7", "' . get_pt_options('bgcolor') . '");';
    $replacement .= "\n\t" . 'so' . $ID . 'y.addParam("wmode", "transparent");';
    if (class_exists('pt_thickbox')) {
        $replacement .= "\n\t" . 'so' . $ID . 'y.write("myBody' . $ID . '");';
    }
    $replacement .= "\n" . '</script>' . "\n";
    if (class_exists('pt_highslide')) {
        $h = new pt_highslide($url, $thumb, $title);
        $h->set_wrapClass('highslide-wrapper-ytb');
        $h->set_borders($settings['hsframe']);
        $h->set_size($settings['youtube_pwidth'], $settings['youtube_pheight'], $settings['hsmargin']);
        $h->set_href_text($title, $add_arg);
        $h->set_bottom(__('Direct link to: ', 'post-thumb') . $title, $url);
        $replacement .= $h->highslide_link('swfObject', 'so' . $ID . 'y');
        unset($h);
    } elseif (class_exists('pt_thickbox')) {
        $h = new pt_thickbox($url, $thumb, $title);
        $h->set_size($settings['youtube_pwidth'] + 5, $settings['youtube_pheight'] + 10);
        $h->set_href_text($title);
        $h->set_body($replacement);
        $replacement = $h->thickbox_link('swfObject', $ID);
        unset($h);
    } else {
        $replacement = "\n" . '<object data="http://youtube.com/v/' . $ytb_ID . '" type="application/x-shockwave-flash" width="' . $settings['youtube_pwidth'] . '" height="' . $settings['youtube_pheight'] . '">';
        $replacement .= "\n\t" . '<param name="movie" value="http://youtube.com/v/' . $ytb_ID . '" />';
        $replacement .= "\n" . '</object>';
    }
    return $replacement;
}
コード例 #2
0
 function GetVideo($name, $file, $image, $play_width, $play_height, $arg = '', $vid)
 {
     // Init parameters
     $settings = '';
     $path = pathinfo($file);
     $extension = strtolower($path['extension']);
     $hs_width = $play_width;
     $ID = 'v' . rand();
     // Prepare the script string
     if ($extension == "flv") {
         $text = get_pt_options('wordtube_vtext');
     } elseif ($extension == "mp3") {
         $text = get_pt_options('wordtube_mtext');
         $playertype = get_wt_playertypemp3();
         if (get_wt_options('showeq')) {
             $play_height = 70;
         } else {
             $play_height = 20;
         }
     }
     $new_args = pt_parse_arg($arg);
     if (isset($new_args['MYCLASSHREF'])) {
         $myclasshref = $new_args['MYCLASSHREF'];
     } else {
         $myclasshref = '';
     }
     if (isset($new_args['MYCLASSIMG'])) {
         $myclassimg = ' class="' . $new_args['MYCLASSIMG'] . '"';
     } else {
         $myclassimg = '';
     }
     // Get thumbnail
     if ($arg == '') {
         $t = new pt_thumbnail(get_pt_options_all(), $image, 'keepratio=0&width=' . get_pt_options('wordtube_width') . '&height=' . get_pt_options('wordtube_height') . '&altappend=' . get_pt_options('wordtube_text') . '&textbox=1&text=' . $text . $this->addArg);
     } else {
         $t = new pt_thumbnail(get_pt_options_all(), $image, $arg . $this->addArg);
     }
     $thumb_url = $t->thumb_url;
     unset($t);
     // returns custom message for RSS feeds
     if (is_feed()) {
         if (!empty($thumb_url)) {
             $replace = '<br /><a href="' . $image . '"><img src="' . $thumb_url . '" alt="media"></a><br />' . "\n";
         }
         if (get_wt_options('activaterss')) {
             $replace .= "[" . get_wt_options('rssmessage') . "]";
         }
         return $replace;
     }
     // Prepare highslide html
     if (POSTTHUMB_USE_HS) {
         $replace = SetWordTubeMedia($file, $image, $play_width, $play_height, $ID, $extension, get_wt_playertype(), get_wt_options_all(), false, $vid);
         $h = new pt_highslide('#', $thumb_url, $name);
         $h->set_wrapClass('highslide-wrapper-wtb');
         $h->set_borders(get_pt_options('hsframe'));
         $h->set_size($play_width, $play_height, get_pt_options('hsmargin'));
         $h->set_href_text($name, $this->myclassimg . $this->align);
         $h->set_myclassimg($myclassimg);
         $h->set_myclasshref($myclasshref);
         $highslide = $h->highslide_link('swfObject', 'so' . $ID);
         unset($h);
         $replace .= $highslide;
     } elseif (POSTTHUMB_USE_TB || POSTTHUMB_USE_SB) {
         $replace = SetWordTubeMedia($file, $image, $play_width, $play_height, $ID, $extension, get_wt_playertype(), get_wt_options_all(), true, $vid);
         $h = new pt_thickbox('', $thumb_url, $name);
         $h->set_size($play_width + 5, $play_height + 10);
         $h->set_href_text($name);
         $h->set_myclasshref($myclasshref);
         $h->set_body($replace);
         $replace = $h->thickbox_link('swfObject', $ID);
         unset($h);
     }
     return $replace;
 }
コード例 #3
0
 function GetVideo($name, $file, $image, $play_width, $play_height)
 {
     // Init parameters
     $settings = '';
     $path = pathinfo($file);
     $extension = strtoupper($path['extension']);
     $hs_width = $play_width;
     $ID = 'v' . rand();
     // Prepare the script string
     if ($extension == "FLV") {
         $text = $this->settings['wordtube_vtext'];
     } elseif ($extension == "MP3") {
         $text = $this->settings['wordtube_mtext'];
     }
     // Prepare highslide html
     if (class_exists('pt_highslide')) {
         $replace = SetWordTubeMedia($file, $image, $play_width, $play_height, $ID, $extension, get_wt_playertype(), get_wt_options_all());
         $h = new pt_highslide('#', $this->thumb_url, $name);
         $h->set_wrapClass('highslide-wrapper-wtb');
         $h->set_borders($this->settings['hsframe']);
         $h->set_size($play_width, $play_height, $this->settings['hsmargin']);
         $h->set_href_text($name, $this->myclassimg . $this->align);
         $h->set_myclassimg($this->myclassimg);
         $h->set_myclasshref($this->myclasshref);
         $highslide = $h->highslide_link('swfObject', 'so' . $ID);
         unset($h);
         $replace .= $highslide;
     } elseif (class_exists('pt_thickbox')) {
         $replace = SetWordTubeMedia($file, $image, $play_width, $play_height, $ID, $extension, get_wt_playertype(), get_wt_options_all(), true);
         $h = new pt_thickbox('', $this->thumb_url, $name);
         $h->set_size($play_width + 5, $play_height + 10);
         $h->set_href_text($name);
         $h->set_body($replace);
         $replace = $h->thickbox_link('swfObject', $ID);
     }
     return $replace;
 }