コード例 #1
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;
 }
コード例 #2
0
 function GetImgHTML()
 {
     if ($this->def_image && $this->nodef) {
         return '';
     }
     // Starts Highslide output
     if ($this->LB_effect && $this->use_hs) {
         // If showpost true, or post doesn't has picture, and post doesn't have media
         if ($this->showpost || $this->showlink || !$this->has_image && !$this->has_media && !$this->has_youtube) {
             if ($this->showlink) {
                 $link = $this->default_link;
             } else {
                 $link = $this->post_url;
             }
             $h = new pt_highslide($link, $this->thumb_url, $this->title);
             $h->set_wrapClass('highslide-wrapper');
             $h->set_borders($this->settings['hsframe']);
             $h->set_href_text($this->img_title, $this->myclassimg . $this->align);
             $h->set_myclassimg($this->myclassimg);
             $h->set_myclasshref($this->myclasshref);
             $h->set_bottom(__('Direct link to: ', 'post-thumb') . $this->title, $link);
             $h->set_size($this->settings['hs_width'], $this->settings['hs_height'], $this->settings['hsmargin']);
             if ($this->ajax) {
                 $this->html = $h->highslide_link('ajax');
             } else {
                 $this->html = $h->highslide_link('iframe');
             }
             unset($h);
         } elseif ($this->has_media) {
             $this->html = $this->GetVideo($this->title, $this->the_default_media, $this->thumb_url, $this->settings['wordtube_pwidth'], $this->settings['wordtube_pheight']);
         } elseif ($this->has_youtube) {
             $this->html = SetYoutubeVideo($this->the_default_media, $this->title, $this->thumb_url, $this->settings, $this->myclassimg . $this->align);
         } else {
             $h = new pt_highslide($this->the_image, $this->thumb_url, $this->title);
             $h->set_borders($this->settings['ovframe']);
             $h->set_myclassimg($this->myclassimg);
             $h->set_myclasshref($this->myclasshref);
             $h->set_href_text('', $this->align);
             if ($this->has_caption) {
                 $h->set_caption(htmlspecialchars(str_replace("'", "\\'", $this->title), ENT_QUOTES));
             }
             $this->html = $h->highslide_link('overlay');
             unset($h);
         }
     } elseif ($this->LB_effect && ($this->use_tb || $this->use_sb)) {
         // If an image and showpost false
         if ($this->showpost || $this->showlink || !$this->has_image && !$this->has_media && !$this->has_youtube) {
             if ($this->showlink) {
                 $link = $this->default_link;
             } else {
                 $link = $this->post_url;
             }
             $this->html = $this->n . '<a href="' . $link . '"';
             $this->html .= ' title="' . $this->title . '"';
             if ($this->myclasshref != '') {
                 $this->html .= ' class="' . $this->myclasshref . '"';
             }
             $this->html .= '>';
             $this->html .= $this->nt . '<img src="' . $this->thumb_url . '" alt="' . $this->alt_text . '"';
             if ($this->myclassimg != '') {
                 $this->html .= $this->myclassimg;
             }
             $this->html .= ' />' . $this->n . '</a>';
             unset($h);
         } elseif ($this->has_media) {
             $this->html = $this->GetVideo($this->title, $this->the_default_media, $this->thumb_url, $this->settings['wordtube_pwidth'], $this->settings['wordtube_pheight']);
         } elseif ($this->has_youtube) {
             $this->html = SetYoutubeVideo($this->the_default_media, $this->title, $this->thumb_url, $this->settings, $this->myclassimg . $this->align);
         } else {
             $h = new pt_thickbox($this->the_image, $this->thumb_url, $this->title);
             $h->set_myclasshref($this->myclasshref);
             $this->html = $h->thickbox_link('overlay');
             unset($h);
         }
     } else {
         if ($this->showpost || !$this->has_image) {
             $this->html = $this->n . '<a href="' . $this->post_url . '"';
         } elseif ($this->showlink) {
             $this->html = $this->n . '<a href="' . $this->default_link . '"';
         } else {
             $this->html = $this->n . '<a href="' . $this->the_image . '"';
         }
         $this->html .= ' title="' . htmlspecialchars($this->title) . '"';
         if ($this->myclasshref != '') {
             $this->html .= ' class="' . $this->myclasshref . '"';
         }
         $this->html .= '>';
         $this->html .= $this->nt . '<img src="' . $this->thumb_url . '" alt="' . htmlspecialchars($this->alt_text) . '"';
         $this->html .= $this->myclassimg;
         $this->html .= $this->align;
         $this->html .= ' />' . $this->n . '</a>';
     }
     if ($this->show_title != '') {
         $this->get_add_html();
     }
     return $this->html;
 }