Ejemplo n.º 1
0
function wppa_thumb_ascover($id)
{
    global $cover_count_key;
    global $thlinkmsggiven;
    // Init
    $result = '';
    // Get the photo info
    $thumb = wppa_cache_thumb($id);
    // Get the album info
    $album = wppa_cache_album($thumb['album']);
    $path = wppa_fix_poster_ext(wppa_get_thumb_path($id), $id);
    $imgattr_a = wppa_get_imgstyle_a($id, $path, wppa_opt('smallsize'), '', 'cover');
    $events = is_feed() ? '' : wppa_get_imgevents('cover');
    $src = wppa_fix_poster_ext(wppa_get_thumb_url($id, '', $imgattr_a['width'], $imgattr_a['height']), $id);
    $link = wppa_get_imglnk_a('thumb', $id);
    if ($link) {
        $href = $link['url'];
        $title = $link['title'];
        $target = $link['target'];
    } else {
        $href = '';
        $title = '';
        $target = '';
    }
    if (!$link['is_url']) {
        if (!$thlinkmsggiven) {
            wppa_dbg_msg('Title link may not be an event in thumbs as covers.');
        }
        $href = '';
        $title = '';
        $thlinkmsggiven = true;
    }
    $mcr = wppa_opt('thumbtype') == 'ascovers-mcr' ? 'mcr-' : '';
    $photo_left = wppa_switch('thumbphoto_left');
    $class_asym = 'wppa-asym-text-frame-' . $mcr . wppa('mocc');
    $style = __wcs('wppa-box') . __wcs('wppa-' . wppa('alt'));
    if (is_feed()) {
        $style .= ' padding:7px;';
    }
    $wid = wppa_get_cover_width('thumb');
    $style .= 'width: ' . $wid . 'px;';
    if ($cover_count_key == 'm') {
        $style .= 'margin-left: 8px;';
    } elseif ($cover_count_key == 'r') {
        $style .= 'float:right;';
    } else {
        $style .= 'clear:both;';
    }
    wppa_step_covercount('thumb');
    $result .= "\n" . '<div' . ' id="thumb-' . $id . '-' . wppa('mocc') . '"' . ' class="thumb wppa-box wppa-cover-box wppa-cover-box-' . $mcr . wppa('mocc') . ' wppa-' . wppa('alt') . '"' . ' style="' . $style . '"' . ' >';
    if ($photo_left) {
        $result .= wppa_the_thumbascoverphoto($id, $src, $photo_left, $link, $imgattr_a, $events);
    }
    $textframestyle = wppa_get_text_frame_style($photo_left, 'thumb');
    $result .= '<div' . ' id="thumbtext_frame_' . $id . '_' . wppa('mocc') . '"' . ' class="wppa-text-frame-' . wppa('mocc') . ' wppa-text-frame thumbtext-frame ' . $class_asym . '"' . ' ' . $textframestyle . ' >' . '<h2' . ' class="wppa-title"' . ' style="clear:none;"' . ' >';
    if ($link['is_lightbox']) {
        $result .= wppa_get_photo_name($id);
    } else {
        $result .= '<a' . ' href="' . $href . '"' . ' target="' . $target . '"' . ' title="' . $title . '"' . ' style="' . __wcs('wppa-title') . '"' . ' >' . wppa_get_photo_name($id) . '</a>';
    }
    $result .= '</h2>';
    $desc = wppa_get_photo_desc($id);
    if (in_array($thumb['status'], array('pending', 'scheduled'))) {
        $desc .= wppa_moderate_links('thumb', $id);
    }
    $result .= '<p' . ' class="wppa-box-text wppa-black"' . ' style="' . __wcs('wppa-box-text') . __wcs('wppa-black') . '" >' . $desc . '</p>';
    $result .= '</div>';
    if (!$photo_left) {
        $result .= wppa_the_thumbascoverphoto($id, $src, $photo_left, $link, $imgattr_a, $events);
    }
    $result .= '</div>';
    // Toggle alt/even
    wppa_toggle_alt();
    wppa_out($result);
}
function wppa_album_cover_longdesc($albumid, $multicolresp = false)
{
    global $cover_count_key;
    global $wpdb;
    $album = wppa_cache_album($albumid);
    if ($multicolresp) {
        $mcr = 'mcr-';
    } else {
        $mcr = '';
    }
    $coverphoto = wppa_get_coverphoto_id($albumid);
    $image = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `id` = %s", $coverphoto), ARRAY_A);
    $photocount = wppa_get_photo_count($albumid, true);
    $albumcount = wppa_get_album_count($albumid, true);
    $mincount = wppa_get_mincount();
    $title = '';
    $linkpage = '';
    $href_title = '';
    $href_slideshow = '';
    $href_content = '';
    $onclick_title = '';
    $onclick_slideshow = '';
    $onclick_content = '';
    // See if there is substantial content to the album
    $has_content = $albumcount > '0' || $photocount > $mincount;
    // What is the albums title linktype
    $linktype = $album['cover_linktype'];
    if (!$linktype) {
        $linktype = 'content';
    }
    // Default
    // What is the albums title linkpage
    $linkpage = $album['cover_linkpage'];
    if ($linkpage == '-1') {
        $linktype = 'none';
    }
    // for backward compatibility
    // Find the cover title href, onclick and title
    $title_attr = wppa_get_album_title_attr_a($albumid, $linktype, $linkpage, $has_content, $coverphoto, $photocount);
    $href_title = $title_attr['href'];
    $onclick_title = $title_attr['onclick'];
    $title = $title_attr['title'];
    // Find the slideshow link and onclick
    $href_slideshow = wppa_convert_to_pretty(wppa_get_slideshow_url($albumid, $linkpage));
    if (wppa_switch('allow_ajax') && !$linkpage) {
        $onclick_slideshow = "wppaDoAjaxRender( " . wppa('mocc') . ", '" . wppa_get_slideshow_url_ajax($albumid, $linkpage) . "', '" . wppa_convert_to_pretty($href_slideshow) . "' )";
        $href_slideshow = "#";
    }
    // Find the content 'View' link
    $href_content = wppa_convert_to_pretty(wppa_get_album_url($albumid, $linkpage));
    if (wppa_switch('allow_ajax') && !$linkpage) {
        $onclick_content = "wppaDoAjaxRender( " . wppa('mocc') . ", '" . wppa_get_album_url_ajax($albumid, $linkpage) . "', '" . wppa_convert_to_pretty($href_content) . "' )";
        $href_content = "#";
    }
    // Find the coverphoto link
    if ($coverphoto) {
        $photolink = wppa_get_imglnk_a('coverimg', $coverphoto, $href_title, $title, $onclick_title, '', $albumid);
    } else {
        $photolink = false;
    }
    // Find the coverphoto details
    if ($coverphoto) {
        $path = wppa_get_thumb_path($coverphoto);
        $imgattr_a = wppa_get_imgstyle_a($coverphoto, $path, wppa_opt('smallsize'), '', 'cover');
        $src = wppa_get_thumb_url($coverphoto, '', $imgattr_a['width'], $imgattr_a['height']);
    } else {
        $path = '';
        $imgattr_a = false;
        $src = '';
    }
    // Feed?
    if (is_feed()) {
        $events = '';
    } else {
        $events = wppa_get_imgevents('cover');
    }
    $photo_pos = wppa('coverphoto_pos');
    $style = __wcs('wppa-box') . __wcs('wppa-' . wppa('alt'));
    if (is_feed()) {
        $style .= ' padding:7px;';
    }
    $wid = wppa_get_cover_width('cover');
    $style .= 'width: ' . $wid . 'px;';
    if ($cover_count_key == 'm') {
        $style .= 'margin-left: 8px;';
    } elseif ($cover_count_key == 'r') {
        $style .= 'float:right;';
    } else {
        $style .= 'clear:both;';
    }
    wppa_step_covercount('cover');
    $target = wppa_switch('allow_ajax') ? '_self' : $photolink['target'];
    // Open the album box
    wppa_out('<div' . ' id="album-' . $albumid . '-' . wppa('mocc') . '"' . ' class="' . 'wppa-album-cover-longdesc ' . 'album ' . 'wppa-box ' . 'wppa-cover-box ' . 'wppa-cover-box-' . $mcr . wppa('mocc') . ' ' . 'wppa-' . wppa('alt') . '"' . ' style="' . $style . __wcs('wppa-cover-box') . '"' . ' >');
    // First The Cover photo?
    if ($photo_pos == 'left' || $photo_pos == 'top') {
        wppa_the_coverphoto($albumid, $image, $src, $photo_pos, $photolink, $title, $imgattr_a, $events);
    }
    // Open the Cover text frame
    $textframestyle = wppa_get_text_frame_style($photo_pos, 'cover');
    wppa_out('<div' . ' id="covertext_frame_' . $albumid . '_' . wppa('mocc') . '"' . ' class="' . 'wppa-text-frame-' . wppa('mocc') . ' ' . 'wppa-text-frame ' . 'wppa-cover-text-frame ' . 'wppa-asym-text-frame-' . $mcr . wppa('mocc') . '"' . ' ' . $textframestyle . '>');
    // The Album title
    wppa_the_album_title($albumid, $href_title, $onclick_title, $title, $target);
    // The 'Slideshow'/'Browse' link
    wppa_the_slideshow_browse_link($photocount, $href_slideshow, $onclick_slideshow, $target);
    // The 'View' link
    wppa_album_cover_view_link($albumid, $has_content, $photocount, $albumcount, $mincount, $href_content, $target, $onclick_content);
    // Close the Cover text frame
    wppa_out('</div>');
    // The Cover photo last?
    if ($photo_pos == 'right' || $photo_pos == 'bottom') {
        wppa_the_coverphoto($albumid, $image, $src, $photo_pos, $photolink, $title, $imgattr_a, $events);
    }
    // The Album description
    if (wppa_switch('show_cover_text')) {
        $textheight = wppa_opt('text_frame_height') > '0' ? 'min-height:' . wppa_opt('text_frame_height') . 'px; ' : '';
        wppa_out('<div' . ' id="coverdesc_frame_' . $albumid . '_' . wppa('mocc') . '"' . ' style="clear:both"' . ' >' . '<p' . ' class="wppa-box-text wppa-black wppa-box-text-desc"' . ' style="' . $textheight . __wcs('wppa-box-text') . __wcs('wppa-black') . '"' . ' >' . wppa_get_album_desc($albumid) . '</p>' . '</div>');
    }
    // The sublinks
    wppa_albumcover_sublinks($albumid, wppa_get_cover_width('cover'), $multicolresp);
    // Prepare for closing
    wppa_out('<div style="clear:both;"></div>');
    // Close the album box
    wppa_out('</div>');
    // Toggle alt/even
    wppa_toggle_alt();
}