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 . '&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 ReplaceLinks($content) { $attrList = array("src", "alt", "title", "align", "width", "height"); if (is_feed()) { return $content; } if (pt_stripos($content, 'rel="ptlink"') === false and pt_stripos($content, "rel='ptlink'") === false) { return $content; } $r_ID = rand(); // Replace thumbnail $pattern = '/<a(.*?)href=[\'|"](.*?)[\'|"](.*?)><img([^>]*)rel\\=[\'|"]ptlink[\'|"]([^>]*)\\/><\\/a>/i'; if (preg_match_all($pattern, $content, $matches, PREG_SET_ORDER)) { $i = 1; foreach ($matches as $match) { $ListAttr = pt_parseAtributes($match[4] . $match[5], $attrList); $ListAttr['ext'] = substr(strrchr($ListAttr['src'], "."), 1); $ListAttr['img'] = substr($ListAttr['src'], 0, strlen($ListAttr['src']) - (strlen($ListAttr['ext']) + 1)); $ID = $r_ID . $i; $main_url = $match[2]; $thumb_url = $ListAttr['src']; if (POSTTHUMB_USE_HS) { if ($ListAttr['title'] == '') { $title = $ListAttr['title']; } else { $title = $ListAttr['alt']; } $h = new pt_highslide($main_url, $thumb_url, $title); $h->set_borders(get_pt_options('hsframe')); $h->set_href_text($match[8]); $h->set_bottom(__('Direct link to: ', 'post-thumb') . $title, $main_url); $h->set_size(get_pt_options('hs_width'), get_pt_options('hs_height'), get_pt_options('hsmargin')); $replacement = $h->highslide_link('iframe'); unset($h); } elseif (POSTTHUMB_USE_TB) { } $content = str_replace($match[0], $replacement, $content); $i++; } } return $content; }
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; }