function ubik_photo_meta_template($class = 'ubik-photo-meta', $mode = 'table')
{
    // Get photo metadata and exit early if there's nothing to work with
    $photo_meta = ubik_photo_meta();
    if (empty($photo_meta)) {
        return;
    }
    // Initialize
    $output = array();
    // Microdata handling
    $microdata_id = ubik_photo_meta_microdata_id();
    // Class is required for output
    if (empty($class)) {
        $class = 'ubik-photo-meta';
    }
    // Table output
    if ($mode == 'table') {
        // Loop through the array and format name and data
        foreach ($photo_meta as $key => $value) {
            if (!empty($microdata_id) && ubik_photo_meta_set('microdata', $value)) {
                $output[] = '<tr' . $value['microdata']['container'] . '><td class="' . esc_attr($class) . '-name"' . $value['microdata']['name'] . '>' . $value['name'] . '</td><td class="' . esc_attr($class) . '-data"' . $value['microdata']['value'] . '>' . $value['data'] . '</td></tr>';
            } else {
                $output[] = '<tr><td class="ubik-photo-meta-name">' . $value['name'] . '</td><td class="ubik-photo-meta-value">' . $value['data'] . '</td></tr>';
            }
        }
        // Return what we got
        if (!empty($output) && is_array($output)) {
            return '<table class="' . esc_attr($class) . '"' . $microdata_id . '>' . implode('', $output) . '</table>';
        }
    } elseif ($mode == 'list') {
        // Loop through the array and format name and data
        foreach ($photo_meta as $key => $value) {
            if (!empty($microdata_id) && ubik_photo_meta_set('microdata', $value)) {
                $output[] = '<li' . $value['microdata']['container'] . '><span' . $value['microdata']['name'] . '>' . $value['name'] . '</span>: <span' . $value['microdata']['value'] . '>' . $value['data'] . '</span></li>';
            } else {
                $output[] = '<li>' . $value['name'] . ': ' . $value['data'] . '</li>';
            }
        }
        // Return generated markup or null if nothing remains
        if (!empty($output) && is_array($output)) {
            return '<ul class="' . esc_attr($class) . '"' . $microdata_id . '><li>' . implode('', $output) . '</ul>';
        }
    }
    return;
}
function ubik_photo_meta_sizes()
{
    // Get the attachment ID
    $id = ubik_photo_meta_attachment_id();
    // Exit early if necessary
    if (empty($id)) {
        return;
    }
    // Initialize links array
    $links = $dimensions = array();
    // Microdata switch
    $microdata = '';
    $microdata_id = ubik_photo_meta_microdata_id($id);
    // Limit the returned sizes to a pre-defined list; sizes will also display in this order
    $sizes = apply_filters('ubik_photo_meta_sizes', array('full', 'large', 'medium', 'thumbnail'));
    // Loop through the specified sizes and build links where avilable
    foreach ($sizes as $size) {
        // Get the current image size (returns false if unavailable)
        $image = wp_get_attachment_image_src($id, $size);
        // Conditionally add the link to the array if: 1) there's an image; 2) the image is intermediate or full; 3) there isn't already an image in the array with the same dimensions
        if (!empty($image) && ($image[3] == true || $size == 'full') && !in_array($image[1] . $image[2], $dimensions)) {
            if (!empty($microdata_id)) {
                if ($size == 'full') {
                    $microdata = ' itemprop="contentURL"';
                } elseif ($size == 'thumbnail') {
                    $microdata = ' itemprop="thumbnailURL"';
                } else {
                    $microdata = '';
                }
            }
            $links[] = '<a href="' . $image[0] . '"' . $microdata . ' rel="enclosure">' . $image[1] . apply_filters('ubik_photo_meta_sizes_times', '&#x200a;&#215;&#x200a;') . $image[2] . '</a>';
            $dimensions[] = $image[1] . $image[2];
        }
    }
    return apply_filters('ubik_photo_meta_sizes_links', $links);
}