function sp_ProfileShowUserPhotos($args = '')
{
    global $spProfileUser;
    if (!sp_get_auth('view_profiles')) {
        return;
    }
    $defs = array('tagClass' => 'spProfileShowUserPhotos', 'photoClass' => 'spProfileShowUserPhotos', 'imageClass' => 'spProfileShowUserPhotos', 'numCols' => 2, 'showEmpty' => 0, 'echo' => 1, 'get' => 0);
    $a = wp_parse_args($args, $defs);
    $a = apply_filters('sph_ProfileShowUserPhotos_args', $a);
    extract($a, EXTR_SKIP);
    # sanitize before use
    $tagClass = esc_attr($tagClass);
    $imageClass = esc_attr($imageClass);
    $photoClass = esc_attr($photoClass);
    $numCols = (int) $numCols;
    $showEmpty = (int) $showEmpty;
    $echo = (int) $echo;
    $get = (int) $get;
    if ($get) {
        return $spProfileUser->photos;
    }
    # output first name
    if (!empty($spProfileUser->photos) || $showEmpty) {
        $sfprofile = sp_get_option('sfprofile');
        $out = '';
        $out .= "<table class='{$tagClass}' style='width:100%'>";
        $col = 0;
        $width = 100 / $numCols;
        if (!empty($spProfileUser->photos)) {
            foreach ($spProfileUser->photos as $photo) {
                if ($col == 0) {
                    $out .= '<tr>';
                }
                $out .= "<td class='{$photoClass}' style='width:{$width}%'>";
                if (!empty($photo)) {
                    $img = sp_get_image_size($photo, true);
                    $width = $height = $style = '';
                    if (!empty($img) && $img[0] > $sfprofile['photoswidth']) {
                        $width = "width:{$sfprofile['photoswidth']}px;";
                    }
                    if (!empty($img) && $img[1] > $sfprofile['photosheight']) {
                        $height = "height:{$sfprofile['photosheight']}px;";
                    }
                    if (!empty($width) || !empty($height)) {
                        $style = " style='{$width}{$height}'";
                    }
                    $out .= "<img class='{$imageClass}'{$style} src='{$photo}' />";
                }
                $out .= '</td>';
                $col++;
                if ($col == $numCols) {
                    $out .= '</tr>';
                    $col = 0;
                }
            }
        }
        $out .= "</table>\n";
        $out = apply_filters('sph_ProfileShowUserPhotos', $out, $spProfileUser, $a);
        if ($echo) {
            echo $out;
        } else {
            return $out;
        }
    }
}
function sp_check_sig($match)
{
    $sfsigimagesize = sp_get_option('sfsigimagesize');
    # get the elements of the img tags
    preg_match('/title\\s*=\\s*"([^"]*)"|title\\s*=\\s*\'([^\']*)\'/i', $match[0], $title);
    preg_match('/width\\s*=\\s*"([^"]*)"|width\\s*=\\s*\'([^\']*)\'/i', $match[0], $width);
    preg_match('/height\\s*=\\s*"([^"]*)"|height\\s*=\\s*\'([^\']*)\'/i', $match[0], $height);
    preg_match('/src\\s*=\\s*"([^"]*)"|src\\s*=\\s*\'([^\']*)\'/i', $match[0], $src);
    preg_match('/style\\s*=\\s*"([^"]*)"|style\\s*=\\s*\'([^\']*)\'/i', $match[0], $style);
    preg_match('/alt\\s*=\\s*"([^"]*)"|alt\\s*=\\s*\'([^\']*)\'/i', $match[0], $alt);
    # check for possible single quote match or double quote
    if (empty($title[1]) && !empty($title[2])) {
        $title[1] = $title[2];
    }
    if (empty($width[1]) && !empty($width[2])) {
        $width[1] = $width[2];
    }
    if (empty($height[1]) && !empty($height[2])) {
        $height[1] = $height[2];
    }
    if (empty($src[1]) && !empty($src[2])) {
        $src[1] = $src[2];
    }
    if (empty($style[1]) && !empty($style[2])) {
        $style[1] = $style[2];
    }
    if (empty($alt[1]) && !empty($alt[2])) {
        $alt[1] = $alt[2];
    }
    # if user defined heights are valid, just return
    if (isset($width[1]) && $width[1] <= $sfsigimagesize['sfsigwidth'] && (isset($height[1]) && $height[1] <= $sfsigimagesize['sfsigheight'])) {
        return $match[0];
    }
    # insepct the image itself
    $display_width = '';
    $display_height = '';
    $size = sp_get_image_size($src[1], true);
    if (!empty($size)) {
        # Did image exist?
        if ($size[0] && $size[1]) {
            # check width
            if (isset($width[1]) && ($width[1] <= $sfsigimagesize['sfsigwidth'] || $sfsigimagesize['sfsigwidth'] == 0)) {
                # width specified and less than max allowed
                $display_width = ' width="' . $width[1] . '"';
            } else {
                if ($sfsigimagesize['sfsigwidth'] > 0 && $size[0] > $sfsigimagesize['sfsigwidth']) {
                    $display_width = ' width="' . $sfsigimagesize['sfsigwidth'] . '"';
                }
            }
            # check the height
            if (isset($height[1]) && ($height[1] <= $sfsigimagesize['sfsigheight'] || $sfsigimagesize['sfsigheight'] == 0)) {
                # height specified and less than max allowed
                $display_height = ' height="' . $height[1] . '"';
            } else {
                if ($sfsigimagesize['sfsigheight'] > 0 && $size[1] > $sfsigimagesize['sfsigheight']) {
                    $display_height = ' height="' . $sfsigimagesize['sfsigheight'] . '"';
                }
            }
        } else {
            # image not found, strip tags
            return '';
        }
    } else {
        # problem checking sizes, so just limit
        $display_width = ' width="' . $sfsigimagesize['sfsigwidth'] . '"';
        $display_height = ' height="' . $sfsigimagesize['sfsigheight'] . '"';
    }
    # add attributes back in if passed
    $style = !empty($style) ? ' style="' . $style[1] . '"' : '';
    $title = !empty($title) ? ' title="' . $title[1] . '"' : '';
    $alt = !empty($alt) ? ' alt="' . $alt[1] . '"' : '';
    return '<img src="' . $src[1] . '"' . $display_width . $display_height . $style . $title . $alt . ' />';
}