function MakeThumb($ListAttr)
 {
     // Initialize parameters
     //		$the_image = NormalizeURL($ListAttr['img'].'.'.$ListAttr['ext']);
     $the_image = $ListAttr['img'] . '.' . $ListAttr['ext'];
     $ListAttr['alt'] = htmlspecialchars($ListAttr['alt']);
     $ListAttr['title'] = htmlspecialchars($ListAttr['title']);
     if ($ListAttr['align']) {
         $align = ' align="' . $ListAttr['align'] . '"';
     } else {
         $align = "";
     }
     if ($ListAttr['rel']) {
         $rel = ' rel="' . $ListAttr['rel'] . '"';
     } else {
         $rel = $this->lightbox;
     }
     // Prepare parameter for thumbnail
     $arg = 'ALTAPPEND=' . get_pt_options('p_append_text') . '&WIDTH=' . get_pt_options('p_resize_width') . '&HEIGHT=' . get_pt_options('p_resize_height') . $this->addArg;
     // Retrieve thumbnail
     $t = new pt_thumbnail(get_pt_options_all(), $the_image, $arg);
     $add_tag = $align;
     // Add thumbnail & highslide expand to image
     if (POSTTHUMB_USE_HS) {
         $h = new pt_highslide($the_image, $t->thumb_url, $ListAttr['alt']);
         $h->set_borders(get_pt_options('ovframe'));
         $h->set_title($ListAttr['title']);
         if ($this->p_has_caption) {
             $h->set_caption(addslashes($ListAttr['alt']));
         }
         $h->set_html_size();
         $h->set_href_text('', $add_tag);
         $h_str = $h->highslide_link();
         unset($h);
     } elseif (POSTTHUMB_USE_TB || POSTTHUMB_USE_SB) {
         $h = new pt_thickbox($the_image, $t->thumb_url, $ListAttr['alt']);
         $h->set_href_text('', $add_tag);
         $h_str = $h->thickbox_link();
         unset($h);
     } else {
         $h_str = '<a href="' . $the_image . '" title="' . $ListAttr['title'] . '" ' . $rel . ' ><img src="' . $t->thumb_url . '" alt="' . $ListAttr['alt'] . '"' . $align . ' /></a>';
     }
     unset($t);
     return $h_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;
}