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;
 }
Ejemplo n.º 2
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;
}
function RecentImages($arg = '', $slice = 5, $timeout = 0)
{
    global $PTRevisited, $wpdb;
    // check cache
    if ($timeout > 0) {
        $filename = 'recentimages' . md5($arg);
        $dirname = get_pt_options('base_path') . '/' . get_pt_options('folder_name') . '/_cache/';
        $ret_str = pt_load_cache($filename, $dirname, $timeout);
        if ($ret_str !== false) {
            return $ret_str;
        }
    }
    $ListImages = array();
    $ListImages['pic'] = array();
    $ListImages['endDB'] = false;
    // Retrieves specific parameters
    $new_args = pt_parse_arg($arg);
    if (isset($new_args['LIMIT'])) {
        $limit = (int) $new_args['LIMIT'];
    } else {
        $limit = 10;
    }
    $offset = 0;
    $i = 0;
    while ($i < $limit) {
        $ListImages = RecentImages_sub($ListImages, $slice, $offset, $i, $limit);
        $offset = $offset + $slice;
        $i = count($ListImages['pic']);
        if ($ListImages['endDB']) {
            break;
        }
    }
    // Delete image in excess
    while (count($ListImages['pic']) > $limit) {
        array_pop($ListImages['pic']);
    }
    $ret_str = '';
    foreach ($ListImages['pic'] as $image) {
        $t = new pt_thumbnail(get_pt_options_all(), $image[0], $arg);
        // Add thumbnail & highslide expand to image
        if (POSTTHUMB_USE_HS) {
            $h = new pt_highslide($image[0], $t->thumb_url, $image[1]);
            $h->set_borders(get_pt_options('ovframe'));
            $h->set_title($image[1]);
            if (get_pt_options('caption') == 'true') {
                $h->set_caption(addslashes($image[1]));
            }
            $h->set_html_size();
            $h->set_href_text('', $add_tag);
            $ret_str .= $h->highslide_link();
            unset($h);
        } else {
            $ret_str .= '<a href="' . $image[0] . '" title="' . $image[1] . '" ><img src="' . $t->thumb_url . '" alt="' . $image[1] . '" /></a>';
        }
        unset($t);
    }
    unset($ListImages);
    if ($timeout > 0) {
        pt_save_cache($filename, $dirname, $ret_str);
    }
    return $ret_str;
}
 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;
 }