function GetYoutube($id, $title, $thumb) { return SetYoutubeVideo($id, $title, $thumb, get_pt_options_all()); }
function web_last_youtube($args) { extract($args); $options = get_option('web_last_youtube'); $author_id = trim($options['id']); $k = $options['keepratio'] ? '1' : '0'; $w = $options['width']; $h = $options['height']; $title = empty($options['title']) ? __('Last youtube', 'post-thumb') : $options['title']; $XML = GetUserYoutubeVideo($author_id, 1); $id = $XML['id']; $ytitle = $XML['title']; $ythumb = $XML['thumbnail_url']; $arg = 'width=' . $w . '&height=' . $h . '&subfolder=last&keepratio=1&dirname=1'; $t = new pt_thumbnail(get_pt_options_all(), $ythumb, $arg); $thumb_url = $t->thumb_url; unset($t); ?> <?php echo $before_widget; ?> <?php echo $before_title . $title . $after_title; ?> <ul> <li> <?php echo get_Youtube($id, $ytitle, $thumb_url); ?> </li> </ul> <?php echo $after_widget; ?> <li class="clear"></li> <?php }
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; }