function wppa_the_album_title($alb, $href_title, $onclick_title, $title, $target)
{
    $album = wppa_cache_album($alb);
    wppa_out('<h2 class="wppa-title" style="clear:none; ' . __wcs('wppa-title') . '">');
    if ($href_title) {
        if ($href_title == '#') {
            wppa_out('<a onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="cursor:pointer; ' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>');
        } else {
            wppa_out('<a href="' . $href_title . '" target="' . $target . '" onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>');
        }
    } else {
        wppa_out(wppa_get_album_name($alb));
    }
    $fsize = '12';
    if (wppa_is_album_new($alb)) {
        $type = 'new';
    } elseif (wppa_is_album_modified($alb)) {
        $type = 'mod';
    } else {
        $type = '';
    }
    $do_image = !wppa_switch('wppa_new_mod_label_is_text');
    if ($type) {
        if ($do_image) {
            wppa_out('<img' . ' src="' . wppa_opt($type . '_label_url') . '"' . ' title="' . __('New!', 'wp-photo-album-plus') . '"' . ' class="wppa-albumnew"' . ' style="border:none;margin:0;padding:0;box-shadow:none;"' . ' alt="' . __('New', 'wp-photo-album-plus') . '"' . ' />');
        } else {
            wppa_out(' <div' . ' style="' . 'display:inline;' . 'box-sizing:border-box;' . 'font-size:' . $fsize . 'px;' . 'line-height:' . $fsize . 'px;' . 'font-family:\'Arial Black\', Gadget, sans-serif;' . 'border-radius:4px;' . 'border-width:2px;' . 'border-style:solid;' . wppa_get_text_medal_color_style($type, '2') . '"' . ' >' . '&nbsp;' . __(wppa_opt($type . '_label_text')) . '&nbsp;' . '</div>');
        }
    }
    wppa_out('</h2>');
}
Exemplo n.º 2
0
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_the_album_title($alb, $href_title, $onclick_title, $title, $target)
{
    $album = wppa_cache_album($alb);
    wppa_out('<h2 class="wppa-title" style="clear:none; ' . __wcs('wppa-title') . '">');
    if ($href_title) {
        if ($href_title == '#') {
            wppa_out('<a onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="cursor:pointer; ' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>');
        } else {
            wppa_out('<a href="' . $href_title . '" target="' . $target . '" onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>');
        }
    } else {
        wppa_out(wppa_get_album_name($alb));
    }
    // Photo count?
    if (wppa_opt('count_on_title') != '-none-') {
        if (wppa_opt('count_on_title') == 'self') {
            $cnt = wppa_get_photo_count($alb);
        }
        if (wppa_opt('count_on_title') == 'total') {
            $temp = wppa_treecount_a($alb);
            $cnt = $temp['photos'];
            if (current_user_can('wppa_moderate')) {
                $cnt += $temp['pendphotos'];
            }
        }
        if ($cnt) {
            wppa_out(' <span class="wppa-cover-pcount" >(' . $cnt . ')</span>');
        }
    }
    $fsize = '12';
    if (wppa_is_album_new($alb)) {
        $type = 'new';
    } elseif (wppa_is_album_modified($alb)) {
        $type = 'mod';
    } else {
        $type = '';
    }
    $do_image = !wppa_switch('new_mod_label_is_text');
    if ($type) {
        if ($do_image) {
            wppa_out('<img' . ' src="' . wppa_opt($type . '_label_url') . '"' . ' title="' . __('New!', 'wp-photo-album-plus') . '"' . ' class="wppa-albumnew"' . ' style="border:none;margin:0;padding:0;box-shadow:none;"' . ' alt="' . __('New', 'wp-photo-album-plus') . '"' . ' />');
        } else {
            wppa_out(' <span' . ' style="' . 'display:inline;' . 'box-sizing:border-box;' . 'font-size:' . $fsize . 'px;' . 'line-height:' . $fsize . 'px;' . 'font-family:\'Arial Black\', Gadget, sans-serif;' . 'border-radius:4px;' . 'border-width:2px;' . 'border-style:solid;' . wppa_get_text_medal_color_style($type, '2') . '"' . ' >' . '&nbsp;' . __(wppa_opt($type . '_label_text')) . '&nbsp;' . '</span>');
        }
    }
    wppa_out('</h2>');
}