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 get_pt_excerpt_sub($text = '', $morelink = '...', $arg = '') { global $post; $new_args = pt_parse_arg($arg); // Retrieves specific parameters $excerpt_length = 0; $excerpt_words = 0; if (isset($new_args['WORDS'])) { $excerpt_words = $new_args['WORDS']; } elseif (isset($new_args['LENGTH'])) { $excerpt_length = $new_args['LENGTH']; } else { $excerpt_words = 40; } if (isset($new_args['NOMORE'])) { $no_more = $new_args['NOMORE'] == 1; } else { $no_more = false; } if (isset($new_args['NOSEMIO'])) { $no_semiologic = $new_args['NOSEMIO'] == 1; } else { $no_semiologic = false; } // First cleaning $text = pt_clean_text($post->post_content, $no_semiologic); // Excerpt based on number of words if ($excerpt_words > 0) { if (!$no_more && strpos($text, '<!--more-->')) { $text = explode('<!--more-->', $text, 2); $l = count($text[0]); $more_link = 1; } else { $words = explode(' ', $text, $excerpt_words + 1); if (count($words) > $excerpt_length) { array_pop($words); $output = implode(' ', $words); $output .= $morelink; } else { $output = $text; } } // Excerpt based on number of characters } elseif ($excerpt_length > 0) { if (!$no_more && strpos($text, '<!--more-->')) { $text = explode('<!--more-->', $text, 2); $l = count($text[0]); $more_link = 1; } else { if (strlen($text) + 3 > $excerpt_length) { $output = substr($text, 0, $excerpt_length - 3) . $morelink; } else { $output = $text; } } } else { $output = $text; } return $output; }
function TheExcerpt($earg = '', $arg = '', $addstr = '') { global $post; setup_postdata($post); $new_args = pt_parse_arg($earg); // Retrieves specific parameters if (isset($new_args['SHOW'])) { $show = strtoupper($new_args['SHOW']); } else { $show = 'ITAE'; } if (isset($new_args['ITAG'])) { $itag = $new_args['ITAG']; } else { $itag = ''; } if (isset($new_args['TTAG'])) { $ttag = $new_args['TTAG']; } else { $ttag = 'h2'; } if (isset($new_args['ETAG'])) { $etag = $new_args['ETAG']; } else { $etag = 'p'; } $ret_str = ''; while ($show != '') { $option = substr($show, 0, 1); switch ($option) { case 'I': $before = '<' . $itag . '>'; $after = '</' . $itag . '>'; $p = new pt_post_thumbnail($this->settings, $post, $arg); $ret = $p->GetImgHTML(); unset($p); break; case 'T': $before = '<' . $ttag . '>'; $after = '</' . $ttag . '>'; $ret = '<a href="' . get_permalink() . '" rel="bookmark" title="Permanent Link to ' . get_the_title() . '">' . get_the_title() . '</a>'; break; case 'A': $before = ''; $after = ''; $ret = $addstr; break; case 'E': $before = '<' . $etag . '>'; $after = '</' . $etag . '>'; $post->post_content = exclude_regex($post->post_content); $ret = get_pt_excerpt($earg); break; default: $before = ''; $after = ''; $ret = ''; } $ret_str .= $before . $ret . $after; $show = substr($show, 1); } // Return everything return $ret_str; }
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 parse_arg() { $new_args = pt_parse_arg($this->arg); if (isset($new_args['NOFORM'])) { $this->n = ""; $this->nt = ""; } if (isset($new_args['WIDTH'])) { $this->resize_width = $new_args['WIDTH']; } else { $this->resize_width = (int) $this->settings['resize_width']; } $this->nodef = isset($new_args['NODEF']); $this->ajax = isset($new_args['AJAX']); if (isset($new_args['ALTTEXT'])) { $this->alt_text = str_clean($new_args['ALTTEXT']); } else { if ($this->post->post_title == '') { $this->alt_text = $this->default_title; } else { $this->alt_text = $this->post->post_title; } } if (isset($new_args['USECATNAME'])) { $this->use_catname = $new_args['USECATNAME'] == 1; } else { $this->use_catname = $this->settings['use_catname'] == 'true'; } if (isset($new_args['SHOWTITLE']) && $new_args['SHOWTITLE'] != '') { $this->show_title = $this->Return_Title($new_args['SHOWTITLE']); } if (isset($new_args['CAPTION'])) { $this->has_caption = $new_args['CAPTION'] == 1; } else { $this->has_caption = $this->settings['caption'] == 'true'; } if (isset($new_args['TITLE'])) { $this->img_title = $this->Get_Title($new_args['TITLE']); } else { $this->img_title = $this->title; } if (isset($new_args['MYCLASSHREF'])) { $this->myclasshref = $new_args['MYCLASSHREF']; } if (isset($new_args['ALIGN'])) { $this->align = ' align="' . $new_args['ALIGN'] . '"'; } if (isset($new_args['MYCLASSIMG'])) { $this->myclassimg = ' class="' . $new_args['MYCLASSIMG'] . '"'; } if (isset($new_args['LB_EFFECT'])) { $this->LB_effect = $new_args['LB_EFFECT'] == 1; } if (isset($new_args['SHOWPOST'])) { $this->showpost = $new_args['SHOWPOST'] == 1; } if (isset($new_args['LINK'])) { $this->link = $new_args['LINK']; if ($this->link == 'p') { $this->showpost = true; } if ($this->link == 'u' && $this->default_link != '') { $this->showlink = true; } } }