function SetWordTubeMedia($file, $image, $play_width, $play_height, $ID, $extension, $playertype, $all_options = '', $use_tb = false, $vid = '', $source = 'wt')
{
    // Init parameters
    if ($source == 'wt') {
        if ($all_options == '') {
            $all_options = get_wt_options_all();
        }
        $callback = WORDTUBE_URLPATH . 'wordtube-statistics.php';
        $player = WORDTUBE_URLPATH . $playertype;
    } elseif ($source == 'pta') {
        if ($all_options == '') {
            $all_options = get_pta_options_all();
        }
        $callback = PTALBUM_URLPATH . 'ptalbum-statistics.php';
        $player = PTALBUM_URLPATH . $playertype;
    }
    $settings = '';
    $hs_width = $play_width + 20;
    $body = '<a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see the wordTube Media Player.';
    // Prepare the script settings string
    if ($extension == "mp3" && $all_options['showeq']) {
        $settings .= "\n\t" . 'so' . $ID . '.addVariable("showeq", "true");';
        $play_height = 70;
        // fixed for equalizer
    } elseif ($extension == "mp3") {
        $play_height = 20;
    }
    $settings .= "\n\t" . 'so' . $ID . '.addVariable("autostart", "true");';
    if ($vid != '') {
        $settings .= "\n\t" . 'so' . $ID . '.addVariable("id", "' . $vid . '");';
    }
    if ($all_options['usewatermark']) {
        $settings .= "\n\t" . 'so' . $ID . '.addVariable("logo", "' . $all_options['watermarkurl'] . '");';
    }
    if ($all_options['repeat']) {
        $settings .= "\n\t" . 'so' . $ID . '.addVariable("repeat", "true");';
    }
    if ($all_options['overstretch']) {
        $settings .= "\n\t" . 'so' . $ID . '.addVariable("overstretch", "' . $all_options['overstretch'] . '");';
    }
    if ($all_options['showdigits']) {
        $settings .= "\n\t" . 'so' . $ID . '.addVariable("showdigits", "true");';
    }
    if ($all_options['showfsbutton']) {
        $settings .= "\n\t" . 'so' . $ID . '.addVariable("showfsbutton", "true");';
    }
    if ($all_options['statistic']) {
        $settings .= "\n\t" . 'so' . $ID . '.addVariable("callback", "' . $callback . '");';
    }
    $settings .= "\n\t" . 'so' . $ID . '.addVariable("backcolor", "0x' . $all_options['backcolor'] . '");';
    $settings .= "\n\t" . 'so' . $ID . '.addVariable("frontcolor", "0x' . $all_options['frontcolor'] . '");';
    $settings .= "\n\t" . 'so' . $ID . '.addVariable("lightcolor", "0x' . $all_options['lightcolor'] . '");';
    $settings .= "\n\t" . 'so' . $ID . '.addVariable("volume", "' . $all_options['volume'] . '");';
    $settings .= "\n\t" . 'so' . $ID . '.addVariable("bufferlength", "' . $all_options['bufferlength'] . '");';
    // neeeded for IE problems
    $settings .= "\n\t" . 'so' . $ID . '.addVariable("width", "' . $play_width . '");';
    $settings .= "\n\t" . 'so' . $ID . '.addVariable("height", "' . $play_height . '");';
    if ($wordtube_options['showfsbutton']) {
        $settings .= "\n\t" . 'so' . $ID . '.addParam("allowfullscreen", "true");';
    } else {
        // transparent didn't work with fullscreen mode
        $settings .= "\n\t" . 'so' . $ID . '.addVariable("showfsbutton", "false");';
        $settings .= "\n\t" . 'so' . $ID . '.addParam("wmode", "transparent");';
    }
    // Starts build the final string wrapped in <script>
    $replace = "\n\t" . '<script type="text/javascript">';
    if ($all_options['xhtmlvalid']) {
        $replace .= "\n\t" . '<!--';
    }
    if ($all_options['xhtmlvalid']) {
        $replace .= "\n\t" . '//<![CDATA[';
    }
    $replace .= "\n\t" . 'var so' . $ID . ' = new SWFObject("' . $player . '", "1", "' . $play_width . '", "' . $play_height . '", "7", "#FFFFFF");';
    $replace .= "\n\t" . 'so' . $ID . '.addVariable("file", "' . $file . '");';
    //	if ($extension != 'mp3') $replace .= "\n\t".'so'.$ID.'.addVariable("image", "'.$image.'");';
    $replace .= $settings;
    if ($use_tb) {
        $replace .= "\n\t" . 'so' . $ID . '.write("myBody' . $ID . '");';
    }
    if ($all_options['xhtmlvalid']) {
        $replace .= "\n\t" . '//]]>';
    }
    // Wordpress change the CDATA end tag
    if ($all_options['xhtmlvalid']) {
        $replace .= "\n\t" . '// -->';
    }
    $replace .= "\n\t" . '</script>' . "\n";
    return $replace;
}
 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;
 }
 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;
 }