function wppa_get_medal_html_a($args)
{
    // Completize args
    $args = wp_parse_args((array) $args, array('id' => '0', 'size' => 'M', 'where' => ''));
    // Validate args
    if ($args['id'] == '0') {
        return '';
    }
    // Missing required id
    if (!in_array($args['size'], array('S', 'M', 'L', 'XL'))) {
        return '';
    }
    // Missing or not implemented size spec
    if (!in_array($args['where'], array('top', 'bot'))) {
        return '';
    }
    // Missing or not implemented where
    // Do it here?
    if (strpos(wppa_opt('medal_position'), $args['where']) === false) {
        return '';
    }
    // No
    // Get rquired photo and config data
    $id = $args['id'];
    $new = wppa_is_photo_new($id);
    $mod = wppa_is_photo_modified($id);
    $status = wppa_get_photo_item($id, 'status');
    $medal = in_array($status, array('gold', 'silver', 'bronze')) ? $status : '';
    // Have a medal to show?
    if (!$new && !$medal && !$mod) {
        return '';
        // No
    }
    // Init local vars
    $result = '';
    $color = wppa_opt('medal_color');
    $left = strpos(wppa_opt('medal_position'), 'left') !== false;
    $ctop = strpos(wppa_opt('medal_position'), 'top') === false ? '-32' : '0';
    $sizes = array('S' => '16', 'M' => '20', 'L' => '24', 'XL' => '32');
    $nsizes = array('S' => '14', 'M' => '16', 'L' => '20', 'XL' => '24');
    $fsizes = array('S' => '9', 'M' => '10', 'L' => '14', 'XL' => '20');
    $smargs = array('S' => '4', 'M' => '5', 'L' => '6', 'XL' => '8');
    $lmargs = array('S' => '22', 'M' => '28', 'L' => '36', 'XL' => '48');
    $tops = array('S' => '8', 'M' => '8', 'L' => '6', 'XL' => '0');
    $ntops = array('S' => '10', 'M' => '10', 'L' => '8', 'XL' => '0');
    $titles = array('gold' => __('Gold medal', 'wp-photo-album-plus'), 'silver' => __('Silver medal', 'wp-photo-album-plus'), 'bronze' => __('Bronze medal', 'wp-photo-album-plus'));
    $size = $sizes[$args['size']];
    $nsize = $nsizes[$args['size']];
    $fsize = $fsizes[$args['size']];
    $smarg = $smargs[$args['size']];
    $lmarg = $lmargs[$args['size']];
    $top = $tops[$args['size']];
    $ntop = $ntops[$args['size']];
    $title = $medal ? esc_attr($titles[$medal]) : '';
    $sstyle = $left ? 'left:' . $smarg . 'px;' : 'right:' . $smarg . 'px;';
    $lstyle = $left ? 'left:' . $lmarg . 'px;' : 'right:' . $lmarg . 'px;';
    // The medal container
    $result .= '<div style="position:relative;top:' . $ctop . 'px;z-index:10;">';
    // The medal
    if ($medal) {
        $result .= '<img' . ' src="' . WPPA_URL . '/images/medal_' . $medal . '_' . $color . '.png"' . ' title="' . $title . '"' . ' alt="' . $title . '"' . ' style="' . $sstyle . 'top:4px;' . 'position:absolute;' . 'border:none;' . 'margin:0;' . 'padding:0;' . 'box-shadow:none;' . 'height:' . $size . 'px;' . 'top:' . $top . 'px;' . '"' . ' />';
    }
    // Is there a new or modified indicator to display?
    if ($new) {
        $type = 'new';
    } elseif ($mod) {
        $type = 'mod';
    } else {
        $type = '';
    }
    // Style adjustment if only a new/modified without a real medal
    if (!$medal) {
        $lstyle = $sstyle;
    }
    $do_image = !wppa_switch('wppa_new_mod_label_is_text');
    // Yes there is one to display
    if ($type) {
        if ($do_image) {
            $result .= '<img' . ' src="' . wppa_opt($type . '_label_url') . '"' . ' title="' . esc_attr(__('New', 'wp-photo-album-plus')) . '"' . ' alt="' . esc_attr(__('New', 'wp-photo-album-plus')) . '"' . ' class="wppa-thumbnew"' . ' style="' . $lstyle . 'top:' . $ntop . 'px;' . 'position:absolute;' . 'border:none;' . 'margin:0;' . 'padding:0;' . 'box-shadow:none;' . 'height:' . $nsize . 'px;' . '"' . ' />';
        } else {
            $result .= '<div' . ' style="' . $lstyle . 'position:absolute;' . 'top:' . $ntop . 'px;' . 'box-sizing:border-box;' . 'float:' . ($left ? 'left;' : 'right;') . 'font-size:' . $fsize . 'px;' . 'line-height:' . $fsize . 'px;' . 'font-family:\'Arial Black\', Gadget, sans-serif;' . 'border-radius:2px;' . 'border-width:1px;' . 'border-style:solid;' . 'padding:1px;' . wppa_get_text_medal_color_style($type) . '"' . ' >' . '&nbsp;' . __(wppa_opt($type . '_label_text')) . '&nbsp;' . '</div>';
        }
    }
    // Close container
    $result .= '</div>';
    return $result;
}
function wppa_get_medal_html_a($args)
{
    // Completize args
    $args = wp_parse_args((array) $args, array('id' => '0', 'size' => 'M', 'where' => ''));
    // Validate args
    if ($args['id'] == '0') {
        return '';
    }
    // Missing required id
    if (!in_array($args['size'], array('S', 'M', 'L', 'XL'))) {
        return '';
    }
    // Missing or not implemented size spec
    if (!in_array($args['where'], array('top', 'bot'))) {
        return '';
    }
    // Missing or not implemented where
    // Do it here?
    if (strpos(wppa_opt('medal_position'), $args['where']) === false) {
        return '';
    }
    // No
    // Get rquired photo and config data
    $id = $args['id'];
    $new = wppa_is_photo_new($id);
    $status = wppa_get_photo_item($id, 'status');
    $medal = in_array($status, array('gold', 'silver', 'bronze')) ? $status : '';
    // Have a medal to show?
    if (!$new && !$medal) {
        return '';
        // No
    }
    // Init local vars
    $result = '';
    $color = wppa_opt('medal_color');
    $left = strpos(wppa_opt('medal_position'), 'left') !== false;
    $ctop = strpos(wppa_opt('medal_position'), 'top') === false ? '-32' : '0';
    $sizes = array('S' => '16', 'M' => '20', 'L' => '24', 'XL' => '32');
    $nsizes = array('S' => '14', 'M' => '16', 'L' => '20', 'XL' => '24');
    $smargs = array('S' => '4', 'M' => '5', 'L' => '6', 'XL' => '8');
    $lmargs = array('S' => '22', 'M' => '28', 'L' => '36', 'XL' => '48');
    $tops = array('S' => '8', 'M' => '8', 'L' => '6', 'XL' => '0');
    $ntops = array('S' => '10', 'M' => '10', 'L' => '8', 'XL' => '0');
    $titles = array('gold' => __a('Gold medal'), 'silver' => __a('Silver medal'), 'bronze' => __a('Bronze medal'));
    $size = $sizes[$args['size']];
    $nsize = $nsizes[$args['size']];
    $smarg = $smargs[$args['size']];
    $lmarg = $lmargs[$args['size']];
    $top = $tops[$args['size']];
    $ntop = $ntops[$args['size']];
    $title = $medal ? esc_attr($titles[$medal]) : '';
    $sstyle = $left ? 'left:' . $smarg . 'px;' : 'right:' . $smarg . 'px;';
    $lstyle = $left ? 'left:' . $lmarg . 'px;' : 'right:' . $lmarg . 'px;';
    // The medal container
    $result .= '<div style="position:relative;top:' . $ctop . 'px;z-index:10;">';
    // The medal
    if ($medal) {
        $result .= '<img' . ' src="' . WPPA_URL . '/images/medal_' . $medal . '_' . $color . '.png"' . ' title="' . $title . '"' . ' alt="' . $title . '"' . ' style="' . $sstyle . 'top:4px;' . 'position:absolute;' . 'border:none;' . 'margin:0;' . 'padding:0;' . 'box-shadow:none;' . 'height:' . $size . 'px;' . 'top:' . $top . 'px;' . '"' . ' />';
    }
    // The new indicator
    if (!$medal) {
        $lstyle = $sstyle;
    }
    if ($new) {
        $result .= '<img' . ' src="' . WPPA_URL . '/images/new.png"' . ' title="' . esc_attr(__a('New')) . '"' . ' alt="' . esc_attr(__a('New')) . '"' . ' class="wppa-thumbnew"' . ' style="' . $lstyle . 'top:' . $ntop . 'px;' . 'position:absolute;' . 'border:none;' . 'margin:0;' . 'padding:0;' . 'box-shadow:none;' . 'height:' . $nsize . 'px;' . '"' . ' />';
    }
    // Close container
    $result .= '</div>';
    return $result;
}