Example #1
0
function wppa_slide_frame()
{
    if (is_feed()) {
        return;
    }
    if (wppa('is_filmonly')) {
        return;
    }
    if (wppa_switch('wppa_slide_pause')) {
        $pause = ' onmouseover="wppaSlidePause[' . wppa('mocc') . '] = \'' . __('Paused', 'wp-photo-album-plus') . '\'"' . ' onmouseout="wppaSlidePause[' . wppa('mocc') . '] = false"';
    } else {
        $pause = '';
    }
    // There are still users who turn off javascript...
    wppa_out('<noscript style="text-align:center; " >' . '<span style="color:red; ">' . __('To see the full size images, you need to enable javascript in your browser.', 'wp-photo-album-plus') . '</span>' . '</noscript>');
    wppa_out('<div' . ' id="slide_frame-' . wppa('mocc') . '"' . $pause . ' class="slide-frame"' . ' style="overflow:hidden;' . wppa_get_slide_frame_style() . '"' . ' >');
    $auto = wppa('auto_colwidth') || wppa_opt('colwidth') == 'auto';
    wppa_out('<div' . ' id="theslide0-' . wppa('mocc') . '"' . ' class="theslide theslide-' . wppa('mocc') . '"' . ' style="' . ($auto ? 'width:100%;' : 'width:' . wppa('slideframewidth') . 'px;') . 'margin:auto;' . '"' . ' >' . '</div>' . '<div' . ' id="theslide1-' . wppa('mocc') . '"' . ' class="theslide theslide-' . wppa('mocc') . '"' . ' style="' . ($auto ? 'width:100%;' : 'width:' . wppa('slideframewidth') . 'px;') . 'margin:auto;' . '"' . ' >' . '</div>');
    wppa_out('<div' . ' id="spinner-' . wppa('mocc') . '"' . ' class="spinner"' . ' >' . '</div>');
    if (!wppa_page('oneofone')) {
        // Big browsing buttons enabled ?
        if (wppa_switch('show_bbb') && !wppa_in_widget() || wppa_switch('show_bbb_widget') && wppa_in_widget()) {
            wppa_out('<img' . ' id="bbb-' . wppa('mocc') . '-l"' . ' class="bbb-l bbb-' . wppa('mocc') . '"' . ' src="' . wppa_get_imgdir() . 'bbbl.png"' . ' alt="bbbl"' . ' style="' . 'background-color:transparent;' . 'border:none;' . 'z-index:83;' . 'position:absolute;' . 'float:left;' . 'top:0px;' . 'width:' . wppa('slideframewidth') * 0.5 . 'px;' . 'height:' . wppa('slideframeheight') . 'px;' . 'box-shadow:none;' . 'cursor:default;' . '"' . ' onmouseover="wppaBbb(' . wppa('mocc') . ',\'l\',\'show\')"' . ' onmouseout="wppaBbb(' . wppa('mocc') . ',\'l\',\'hide\')"' . ' onclick="wppaBbb(' . wppa('mocc') . ',\'l\',\'click\')"' . ' />' . '<img' . ' id="bbb-' . wppa('mocc') . '-r"' . ' class="bbb-r bbb-' . wppa('mocc') . '"' . ' src="' . wppa_get_imgdir() . 'bbbr.png"' . ' alt="bbbr"' . ' style="' . 'background-color:transparent;' . 'border:none;' . 'z-index:83;' . 'position:absolute;' . 'float:right;' . 'top:0px;' . 'width:' . wppa('slideframewidth') * 0.5 . 'px;' . 'height:' . wppa('slideframeheight') . 'px;' . 'box-shadow:none;' . 'cursor:default;' . '"' . ' onmouseover="wppaBbb(' . wppa('mocc') . ',\'r\',\'show\')"' . ' onmouseout="wppaBbb(' . wppa('mocc') . ',\'r\',\'hide\')"' . ' onclick="wppaBbb(' . wppa('mocc') . ',\'r\',\'click\')"' . ' />');
        }
        // Ugly browse buttons ?
        if (wppa_switch('show_ubb') && !wppa_in_widget() || wppa_switch('show_ubb_widget') && wppa_in_widget()) {
            /*
            	wppaOvlLeftSymbolUrl = "'.(wppa_opt('left_symbol_url') ? wppa_opt('left_symbol_url') : wppa_get_imgdir( 'prev-'.wppa_opt('ovl_theme').'.gif', true )).'";
            	wppaOvlRightSymbolUrl = "'.(wppa_opt('right_symbol_url') ? wppa_opt('right_symbol_url') : wppa_get_imgdir( 'next-'.wppa_opt('ovl_theme').'.gif', true )).'";
            	wppaLeftRightSymbolSize = '.wppa_opt('left_right_symbol_size').';
            	wppaLeftRightSymbolBradius = '.wppa_opt('left_right_symbol_bradius').';
            						' onclick="wppaOvlShowPrev()"' +
            						' ontouchend="wppaOvlShowPrev()"' +
            						' onmouseover="jQuery(this).stop().fadeTo(200,1);"' +
            						' onmouseout="jQuery(this).stop().fadeTo(200,0);"' +
            						' ontouchstart="jQuery(this).stop().fadeTo(200,1);"' +
            						' onload="jQuery(this).stop().fadeTo(5000,0);"' +
            */
            wppa_out('<img' . ' id="ubb-' . wppa('mocc') . '-l"' . ' class="ubb ubb-l ubb-' . wppa('mocc') . '"' . ' src="' . (wppa_opt('left_symbol_url') ? wppa_opt('left_symbol_url') : wppa_get_imgdir('prev-' . wppa_opt('ovl_theme') . '.gif', true)) . '"' . ' alt="ubbl"' . ' style="' . 'background-color:transparent;' . 'border:none;' . 'z-index:85;' . 'position:absolute;' . 'top:50%;' . 'margin-top:-' . wppa_opt('left_right_symbol_size') / 2 . 'px;' . 'left:0;' . 'box-shadow:none;' . 'cursor:pointer;' . 'width:' . wppa_opt('left_right_symbol_size') . 'px;' . 'border-radius:' . wppa_opt('left_right_symbol_bradius') . 'px;' . '"' . ' onmouseover="wppaUbb(' . wppa('mocc') . ',\'l\',\'show\')"' . ' ontouchstart="wppaUbb(' . wppa('mocc') . ',\'l\',\'show\')"' . ' onmouseout="wppaUbb(' . wppa('mocc') . ',\'l\',\'hide\')"' . ' onclick="wppaUbb(' . wppa('mocc') . ',\'l\',\'click\')"' . ' ontouchend="wppaUbb(' . wppa('mocc') . ',\'l\',\'click\')"' . ' onload="wppaUbb(' . wppa('mocc') . ',\'l\',\'hide\')"' . ' />' . '<img' . ' id="ubb-' . wppa('mocc') . '-r"' . ' class="ubb ubb-r ubb-' . wppa('mocc') . '"' . ' src="' . (wppa_opt('right_symbol_url') ? wppa_opt('right_symbol_url') : wppa_get_imgdir('next-' . wppa_opt('ovl_theme') . '.gif', true)) . '"' . ' alt="ubbr"' . ' style="' . 'background-color:transparent;' . 'border:none;' . 'z-index:85;' . 'position:absolute;' . 'top:50%;' . 'margin-top:-' . wppa_opt('left_right_symbol_size') / 2 . 'px;' . 'right:0;' . 'box-shadow:none;' . 'cursor:pointer;' . 'width:' . wppa_opt('left_right_symbol_size') . 'px;' . 'border-radius:' . wppa_opt('left_right_symbol_bradius') . 'px;' . '"' . ' onmouseover="wppaUbb(' . wppa('mocc') . ',\'r\',\'show\')"' . ' ontouchstart="wppaUbb(' . wppa('mocc') . ',\'r\',\'show\')"' . ' onmouseout="wppaUbb(' . wppa('mocc') . ',\'r\',\'hide\')"' . ' onclick="wppaUbb(' . wppa('mocc') . ',\'r\',\'click\')"' . ' ontouchend="wppaUbb(' . wppa('mocc') . ',\'r\',\'click\')"' . ' onload="wppaUbb(' . wppa('mocc') . ',\'l\',\'hide\')"' . ' />');
        }
    }
    wppa_startstop_icons();
    wppa_numberbar();
    wppa_out('</div>');
}
Example #2
0
function wppa_get_imgstyle_a($id, $file, $xmax_size, $xvalign = '', $type = '')
{
    global $wppa;
    $result = array('style' => '', 'width' => '', 'height' => '', 'cursor' => '', 'margin-top' => '', 'margin-bottom' => '');
    // Init
    wppa_cache_thumb($id);
    if (!$id) {
        return $result;
    }
    // no image: no dimensions
    if ($file == '') {
        return $result;
    }
    // no image: no dimensions
    if (wppa_has_audio($id)) {
        $file = wppa_fix_poster_ext($file, $id);
    }
    if (!wppa_is_video($id) && !is_file($file)) {
        wppa_dbg_msg('Please check file ' . $file . ' it is missing while expected. Id=' . $id, 'red');
        return $result;
        // no file: no dimensions ( 2.3.0 )
    }
    if (strpos($file, '/wppa/thumbs/')) {
        $image_attr = wppa_get_imagexy($id, 'thumb');
    } else {
        $image_attr = wppa_get_imagexy($id, 'photo');
    }
    //	if ( wppa_is_video( $id ) ) {
    //		$image_attr = array( '0' => wppa_get_videox( $id ), '1' => wppa_get_videoy( $id ) );
    //	}
    //	else {
    //		$image_attr = array( '0' => wppa_get_photox( $id ), '1' => wppa_get_photoy( $id ) );
    //	}
    if (!$image_attr || !isset($image_attr['0']) || !$image_attr['0'] || !isset($image_attr['1']) || !$image_attr['1']) {
        // File is corrupt
        wppa_dbg_msg('Please check file ' . $file . ' it is corrupted. If it is a thumbnail image,' . ' regenerate them using Table VIII-A4 of the Photo Albums -> Settings admin page.', 'red');
        return $result;
    }
    // Adjust for 'border'
    if ($type == 'fullsize' && !$wppa['in_widget']) {
        switch (wppa_opt('wppa_fullimage_border_width')) {
            case '':
                $max_size = $xmax_size;
                break;
            case '0':
                $max_size = $xmax_size - '2';
                break;
            default:
                $max_size = $xmax_size - '2' - 2 * wppa_opt('wppa_fullimage_border_width');
        }
    } else {
        $max_size = $xmax_size;
    }
    $ratioref = wppa_opt('wppa_maxheight') / wppa_opt('wppa_fullsize');
    $max_height = round($max_size * $ratioref);
    if ($type == 'fullsize') {
        if ($wppa['portrait_only']) {
            $width = $max_size;
            $height = round($width * $image_attr[1] / $image_attr[0]);
        } else {
            if (wppa_is_wider($image_attr[0], $image_attr[1])) {
                $width = $max_size;
                $height = round($width * $image_attr[1] / $image_attr[0]);
            } else {
                $height = round($ratioref * $max_size);
                $width = round($height * $image_attr[0] / $image_attr[1]);
            }
            if ($image_attr[0] < $width && $image_attr[1] < $height) {
                if (!$wppa['enlarge']) {
                    $width = $image_attr[0];
                    $height = $image_attr[1];
                }
            }
        }
    } else {
        if ($type == 'cover' && wppa_switch('wppa_coversize_is_height') && (wppa_opt('wppa_coverphoto_pos') == 'top' || wppa_opt('wppa_coverphoto_pos') == 'bottom')) {
            $height = $max_size;
            $width = round($max_size * $image_attr[0] / $image_attr[1]);
        } else {
            if (wppa_is_landscape($image_attr)) {
                $width = $max_size;
                $height = round($max_size * $image_attr[1] / $image_attr[0]);
            } else {
                $height = $max_size;
                $width = round($max_size * $image_attr[0] / $image_attr[1]);
            }
        }
    }
    switch ($type) {
        case 'cover':
            if (wppa_opt('wppa_bcolor_img') != '') {
                // There is a border color given
                $result['style'] .= ' border: 1px solid ' . wppa_opt('wppa_bcolor_img') . ';';
            } else {
                // No border color: no border
                $result['style'] .= ' border-width: 0px;';
            }
            $result['style'] .= ' width:' . $width . 'px; height:' . $height . 'px;';
            if (wppa_switch('wppa_use_cover_opacity') && !is_feed()) {
                $opac = wppa_opt('wppa_cover_opacity');
                $result['style'] .= ' opacity:' . $opac / 100 . '; filter:alpha( opacity=' . $opac . ' );';
            }
            if (wppa_opt('wppa_coverimg_linktype') == 'lightbox') {
                $result['cursor'] = ' cursor:url( ' . wppa_get_imgdir() . wppa_opt('wppa_magnifier') . ' ),pointer;';
            }
            break;
        case 'thumb':
            // Normal
        // Normal
        case 'ttthumb':
            // Topten
        // Topten
        case 'comthumb':
            // Comment widget
        // Comment widget
        case 'fthumb':
            // Filmthumb
        // Filmthumb
        case 'twthumb':
            // Thumbnail widget
        // Thumbnail widget
        case 'ltthumb':
            // Lasten widget
        // Lasten widget
        case 'albthumb':
            // Album widget
            if ($type == 'thumb' && wppa_get_get('hilite') == $id) {
                $result['style'] .= ' border:2px solid blue;box-sizing:border-box;';
            } else {
                $result['style'] .= ' border-width: 0px;';
            }
            $result['style'] .= ' width:' . $width . 'px; height:' . $height . 'px;';
            if ($xvalign == 'optional') {
                $valign = wppa_opt('wppa_valign');
            } else {
                $valign = $xvalign;
            }
            if ($valign != 'default') {
                // Center horizontally
                $delta = floor(($max_size - $width) / 2);
                if (is_numeric($valign)) {
                    $delta += $valign;
                }
                if ($delta < '0') {
                    $delta = '0';
                }
                if ($delta > '0') {
                    $result['style'] .= ' margin-left:' . $delta . 'px; margin-right:' . $delta . 'px;';
                }
            }
            switch ($valign) {
                case 'top':
                    $delta = $max_size - $height;
                    if ($delta < '0') {
                        $delta = '0';
                    }
                    $result['style'] .= ' margin-bottom: ' . $delta . 'px;';
                    $result['margin-bottom'] = $delta;
                    break;
                case 'center':
                    $delta = round(($max_size - $height) / 2);
                    if ($delta < '0') {
                        $delta = '0';
                    }
                    $result['style'] .= ' margin-top: ' . $delta . 'px; margin-bottom: ' . $delta . 'px;';
                    $result['margin-top'] = $delta;
                    $result['margin-bottom'] = $delta;
                    break;
                case 'bottom':
                    $delta = $max_size - $height;
                    if ($delta < '0') {
                        $delta = '0';
                    }
                    $result['style'] .= ' margin-top: ' . $delta . 'px;';
                    $result['margin-top'] = $delta;
                    break;
                default:
                    if (is_numeric($valign)) {
                        $delta = $valign;
                        $result['style'] .= ' margin-top: ' . $delta . 'px;';
                        $result['style'] .= ' margin-bottom: ' . $delta . 'px;';
                        $result['margin-top'] = $delta;
                        $result['margin-bottom'] = $delta;
                    }
            }
            if (wppa_switch('wppa_use_thumb_opacity') && !is_feed()) {
                $opac = wppa_opt('wppa_thumb_opacity');
                $result['style'] .= ' opacity:' . $opac / 100 . '; filter:alpha( opacity=' . $opac . ' );';
            }
            // Cursor
            $linktyp = '';
            switch ($type) {
                case 'thumb':
                    // Normal
                    $linktyp = wppa_opt('wppa_thumb_linktype');
                    break;
                case 'ttthumb':
                    // Topten	v
                    $linktyp = wppa_opt('wppa_topten_widget_linktype');
                    break;
                case 'comthumb':
                    // Comment widget	v
                    $linktyp = wppa_opt('wppa_comment_widget_linktype');
                    break;
                case 'fthumb':
                    // Filmthumb
                    $linktyp = wppa_opt('wppa_film_linktype');
                    break;
                case 'twthumb':
                    // Thumbnail widget	v
                    $linktyp = wppa_opt('wppa_thumbnail_widget_linktype');
                    break;
                case 'ltthumb':
                    // Lasten widget	v
                    $linktyp = wppa_opt('wppa_lasten_widget_linktype');
                    break;
                case 'albthumb':
                    // Album widget
                    $linktyp = wppa_opt('wppa_album_widget_linktype');
            }
            if ($linktyp == 'none') {
                $result['cursor'] = ' cursor:default;';
            } elseif ($linktyp == 'lightbox') {
                $result['cursor'] = ' cursor:url(' . wppa_get_imgdir() . wppa_opt('wppa_magnifier') . '),pointer;';
            } else {
                $result['cursor'] = ' cursor:pointer;';
            }
            break;
        case 'fullsize':
            if ($wppa['auto_colwidth']) {
                // These sizes fit within the rectangle define by Table I-B1,2
                // times 2 for responsive themes,
                // and are supplied for ver 4 browsers as they have undefined natural sizes.
                $result['style'] .= ' max-width:' . $width * 2 . 'px;';
                $result['style'] .= ' max-height:' . $height * 2 . 'px;';
            } else {
                // These sizes fit within the rectangle define by Table I-B1,2
                // and are supplied for ver 4 browsers as they have undefined natural sizes.
                $result['style'] .= ' max-width:' . $width . 'px;';
                $result['style'] .= ' max-height:' . $height . 'px;';
                $result['style'] .= ' width:' . $width . 'px;';
                $result['style'] .= ' height:' . $height . 'px;';
            }
            if ($wppa['is_slideonly'] == '1') {
                if ($wppa['ss_widget_valign'] != '') {
                    $valign = $wppa['ss_widget_valign'];
                } else {
                    $valign = 'fit';
                }
            } elseif ($xvalign == 'optional') {
                $valign = wppa_opt('wppa_fullvalign');
            } else {
                $valign = $xvalign;
            }
            // Margin
            if ($valign != 'default') {
                $m_left = '0';
                $m_right = '0';
                $m_top = '0';
                $m_bottom = '0';
                // Center horizontally
                $delta = round(($max_size - $width) / 2);
                if ($delta < '0') {
                    $delta = '0';
                }
                if ($wppa['auto_colwidth']) {
                    $m_left = 'auto';
                    $m_right = 'auto';
                } else {
                    $m_left = $delta;
                    $m_right = '0';
                }
                // Position vertically
                if ($wppa['in_widget'] == 'ss' && $wppa['in_widget_frame_height'] > '0') {
                    $max_height = $wppa['in_widget_frame_height'];
                }
                $delta = '0';
                if (!$wppa['auto_colwidth'] && !wppa_page('oneofone')) {
                    switch ($valign) {
                        case 'top':
                        case 'fit':
                            $delta = '0';
                            break;
                        case 'center':
                            $delta = round(($max_height - $height) / 2);
                            if ($delta < '0') {
                                $delta = '0';
                            }
                            break;
                        case 'bottom':
                            $delta = $max_height - $height;
                            if ($delta < '0') {
                                $delta = '0';
                            }
                            break;
                    }
                }
                $m_top = $delta;
                $result['style'] .= wppa_combine_style('margin', $m_top, $m_left, $m_right, $m_bottom);
            }
            // Border and padding
            if (!$wppa['in_widget']) {
                switch (wppa_opt('wppa_fullimage_border_width')) {
                    case '':
                        break;
                    case '0':
                        $result['style'] .= ' border: 1px solid ' . wppa_opt('wppa_bcolor_fullimg') . ';';
                        break;
                    default:
                        $result['style'] .= ' border: 1px solid ' . wppa_opt('wppa_bcolor_fullimg') . ';';
                        $result['style'] .= ' background-color:' . wppa_opt('wppa_bgcolor_fullimg') . ';';
                        $result['style'] .= ' padding:' . wppa_opt('wppa_fullimage_border_width') . 'px;';
                        // If we do round corners...
                        if (wppa_opt('wppa_bradius') > '0') {
                            // then also here
                            $result['style'] .= ' border-radius:' . wppa_opt('wppa_fullimage_border_width') . 'px;';
                        }
                }
            }
            break;
        default:
            $wppa['out'] .= 'Error wrong "$type" argument: ' . $type . ' in wppa_get_imgstyle_a';
    }
    $result['width'] = $width;
    $result['height'] = $height;
    return $result;
}
Example #3
0
function wppa_theme()
{
    global $wppa_version;
    $wppa_version = '6-1-15-000';
    // The version number of this file
    global $wppa;
    global $wppa_show_statistics;
    // Can be set to true by a custom page template
    $curpage = wppa_get_curpage();
    // Get the page # we are on when pagination is on, or 1
    $didsome = false;
    // Required initializations for pagination
    $n_album_pages = '0';
    // "
    $n_thumb_pages = '0';
    // "
    // Open container
    wppa_container('open');
    // Show statistics if set so by the page template
    if ($wppa_show_statistics) {
        wppa_statistics();
    }
    // Display breadcrumb navigation only if it is set in the settings page
    wppa_breadcrumb('optional');
    if (wppa_page('albums')) {
        // Page 'Albums' requested
        // Get the albums and the thumbs and the number of pages for each set
        $albums = wppa_get_albums();
        // Get the albums
        $n_album_pages = wppa_get_npages('albums', $albums);
        // Get the number of album pages
        if (wppa_opt('thumbtype') != 'none') {
            $thumbs = wppa_get_thumbs();
            // Get the Thumbs
        } else {
            $thumbs = false;
        }
        $wanted_empty = wppa_is_wanted_empty($thumbs);
        // See if we need to display an empty thumbnail area
        $n_thumb_pages = wppa_get_npages('thumbs', $thumbs);
        // Get the number of thumb pages
        if ($n_thumb_pages == '0' && !$wanted_empty) {
            $thumbs = false;
        }
        // No pages: no thumbs. Maybe want covers only
        if ($wanted_empty) {
            $n_thumb_pages = '1';
        }
        // Get total number of pages
        if (!wppa_is_pagination()) {
            $totpag = '1';
        } else {
            $totpag = $n_album_pages + $n_thumb_pages;
        }
        // Make pagelinkbar if requested on top
        if (wppa_opt('pagelink_pos') == 'top' || wppa_opt('pagelink_pos') == 'both') {
            wppa_page_links($totpag, $curpage);
        }
        // Process the albums
        if (!wppa_switch('wppa_thumbs_first')) {
            if ($albums) {
                $counter_albums = '0';
                wppa_album_list('open');
                // Open Albums sub-container
                foreach ($albums as $album) {
                    // Loop the albums
                    $counter_albums++;
                    if (wppa_onpage('albums', $counter_albums, $curpage)) {
                        wppa_album_cover($album['id']);
                        // Show the cover
                        $didsome = true;
                    }
                    // End if on page
                }
                wppa_album_list('close');
                // Close Albums sub-container
            }
            // If albums
        }
        if ($didsome && wppa_is_pagination()) {
            $thumbs = false;
        }
        // Pag on and didsome: force a pagebreak by faking no thumbs
        if (count($thumbs) <= wppa_get_mincount() && !$wanted_empty) {
            $thumbs = false;
        }
        // Less than treshold value
        if (wppa_switch('wppa_thumbs_first') && $curpage > $n_thumb_pages) {
            $thumbs = false;
        }
        // If thumbs done, do not display an empty thumbarea
        // Process the thumbs
        if ($thumbs || $wanted_empty) {
            if (!$wanted_empty || !wppa_switch('thumbs_first') || wppa_get_curpage() == '1') {
                if (!$wanted_empty || wppa_switch('thumbs_first') || wppa_get_curpage() == $totpag) {
                    // Init
                    $counter_thumbs = '0';
                    // As covers
                    if (wppa_opt('wppa_thumbtype') == 'ascovers' || wppa_opt('wppa_thumbtype') == 'ascovers-mcr') {
                        // Do the thumbs As covers
                        wppa_thumb_list('open');
                        // Open Thumblist sub-container
                        $relpage = wppa_switch('wppa_thumbs_first') ? $curpage : $curpage - $n_album_pages;
                        foreach ($thumbs as $tt) {
                            global $thumb;
                            $thumb = $tt;
                            // Loop the Thumbs
                            $counter_thumbs++;
                            if (wppa_onpage('thumbs', $counter_thumbs, $relpage)) {
                                $didsome = true;
                                wppa_thumb_ascover($thumb['id']);
                                // Show Thumb as cover
                            }
                            // End if on page
                        }
                        wppa_thumb_list('close');
                        // Close Thumblist sub-container
                    } elseif (wppa_opt('wppa_thumbtype') == 'masonry-v') {
                        // Masonry
                        // The header
                        wppa_thumb_area('open');
                        // Open Thumbarea sub-container
                        wppa_popup();
                        // Prepare Popup box
                        wppa_album_name('top');
                        // Optionally display album name
                        wppa_album_desc('top');
                        // Optionally display album description
                        // Init
                        $relpage = wppa_switch('wppa_thumbs_first') ? $curpage : $curpage - $n_album_pages;
                        $cont_width = wppa_get_container_width();
                        $count_cols = ceil($cont_width / (wppa_opt('wppa_thumbsize') + wppa_opt('wppa_tn_margin')));
                        $correction = wppa_opt('wppa_tn_margin') * ($cont_width / $count_cols) / 100;
                        // Init the table
                        wppa_out('<table class="wppa-masonry" style="margin-top:3px;" ><tbody class="wppa-masonry" ><tr class="wppa-masonry" >');
                        // Init the columns
                        $col_headers = array();
                        $col_contents = array();
                        $col_heights = array();
                        $col_widths = array();
                        for ($col = 0; $col < $count_cols; $col++) {
                            $col_headers[$col] = '';
                            $col_contents[$col] = '';
                            $col_heights[$col] = 0;
                            $col_widths[$col] = 100;
                        }
                        // Process the thumbnails
                        $col = '0';
                        if ($thumbs) {
                            foreach ($thumbs as $tt) {
                                $id = $tt['id'];
                                $counter_thumbs++;
                                if (wppa_onpage('thumbs', $counter_thumbs, $relpage)) {
                                    $col_contents[$col] .= wppa_get_thumb_masonry($id);
                                    $col_heights[$col] += ($correction + wppa_get_thumby($id)) / ($correction + wppa_get_thumbx($id)) * $col_widths[$col];
                                    $col += '1';
                                    if ($col == $count_cols) {
                                        $col = '0';
                                    }
                                    $didsome = true;
                                }
                            }
                        }
                        // Find longest column
                        $long = 0;
                        for ($col = 0; $col < $count_cols; $col++) {
                            if ($col_heights[$col] > $long) {
                                $long = $col_heights[$col];
                            }
                        }
                        // Adjust column widths to resize lengths to equal lengths
                        for ($col = 0; $col < $count_cols; $col++) {
                            if ($col_heights[$col]) {
                                $col_widths[$col] = $long / $col_heights[$col] * $col_widths[$col];
                            }
                        }
                        // Adjust column widths to total 100
                        $wide = 0;
                        for ($col = 0; $col < $count_cols; $col++) {
                            $wide += $col_widths[$col];
                        }
                        for ($col = 0; $col < $count_cols; $col++) {
                            $col_widths[$col] = $col_widths[$col] * 100 / $wide;
                        }
                        // Make column headers
                        for ($col = 0; $col < $count_cols; $col++) {
                            $col_headers[$col] = '<td style="width: ' . $col_widths[$col] . '%; vertical-align:top;" class="wppa-masonry" >';
                        }
                        // Add the columns to the output stream
                        for ($col = 0; $col < $count_cols; $col++) {
                            wppa_out($col_headers[$col]);
                            wppa_out($col_contents[$col]);
                            wppa_out('</td>');
                        }
                        // Close the table
                        wppa_out('</tr></tbody></table>');
                        // The footer
                        wppa_album_name('bottom');
                        // Optionally display album name
                        wppa_album_desc('bottom');
                        // Optionally display album description
                        wppa_thumb_area('close');
                        // Close Thumbarea sub-container
                    } elseif (wppa_opt('wppa_thumbtype') == 'masonry-h') {
                        // Masonry
                        // The header
                        wppa_thumb_area('open');
                        // Open Thumbarea sub-container
                        wppa_popup();
                        // Prepare Popup box
                        wppa_album_name('top');
                        // Optionally display album name
                        wppa_album_desc('top');
                        // Optionally display album description
                        // Init
                        $relpage = wppa_switch('wppa_thumbs_first') ? $curpage : $curpage - $n_album_pages;
                        $cont_width = wppa_get_container_width('netto');
                        $correction = wppa_opt('wppa_tn_margin');
                        // Init the table
                        wppa_out('<table class="wppa-masonry" style="margin-top:3px;" ><tbody class="wppa-masonry" >');
                        // Process the thumbnails
                        $row_content = '';
                        $row_width = 0;
                        $target_row_height = wppa_opt('wppa_thumbsize') * 0.75 + $correction;
                        $rw_count = 0;
                        $tr_count = '1';
                        $done_count = 0;
                        $last = false;
                        $max_row_height = $target_row_height * 0.8;
                        // Init keep track for last
                        if ($thumbs) {
                            foreach ($thumbs as $tt) {
                                $id = $tt['id'];
                                $counter_thumbs++;
                                if (wppa_onpage('thumbs', $counter_thumbs, $relpage)) {
                                    $row_content .= wppa_get_thumb_masonry($tt['id']);
                                    $rw_count += 1;
                                    $row_width += wppa_get_thumbratioxy($id) * ($target_row_height - $correction);
                                    $didsome = true;
                                }
                                $done_count += 1;
                                $last = $done_count == count($thumbs);
                                if ($row_width > $cont_width || $last) {
                                    $tot_marg = $rw_count * $correction;
                                    $row_height = $row_width ? ($target_row_height - $correction) * ($cont_width - '3' - $tot_marg) / $row_width + $correction : '0';
                                    if (!$last) {
                                        $max_row_height = max($max_row_height, $row_height);
                                    }
                                    if ($last && $row_height > wppa_get_thumby($id)) {
                                        $row_height = $max_row_height;
                                    }
                                    $row_height_p = $row_height / $cont_width * 100;
                                    wppa_out('<tr class="wppa-masonry" >' . '<td style="border:none;padding:0;margin:0" >' . '<div' . ' id="wppa-mas-h-' . $tr_count . '-' . wppa('mocc') . '"' . ' style="height:' . $row_height . 'px;"' . ' class="wppa-masonry"' . ' data-height-perc="' . $row_height_p . '"' . ' >');
                                    wppa_out($row_content);
                                    wppa_out('</div></td></tr>');
                                    $row_content = '';
                                    $row_width = 0;
                                    $row_height = wppa_opt('wppa_thumbsize');
                                    $rw_count = 0;
                                    $tr_count += '1';
                                }
                            }
                        }
                        wppa_out('</tbody></table>');
                        // The footer
                        wppa_album_name('bottom');
                        // Optionally display album name
                        wppa_album_desc('bottom');
                        // Optionally display album description
                        wppa_thumb_area('close');
                        // Close Thumbarea sub-container
                    } elseif (wppa_opt('wppa_thumbtype') == 'default') {
                        // Do the thumbs As default
                        // The header
                        wppa_thumb_area('open');
                        // Open Thumbarea sub-container
                        wppa_popup();
                        // Prepare Popup box
                        wppa_album_name('top');
                        // Optionally display album name
                        wppa_album_desc('top');
                        // Optionally display album description
                        // Init
                        $relpage = wppa_switch('wppa_thumbs_first') ? $curpage : $curpage - $n_album_pages;
                        // Process the thumbnails
                        if ($thumbs) {
                            foreach ($thumbs as $tt) {
                                $counter_thumbs++;
                                if (wppa_onpage('thumbs', $counter_thumbs, $relpage)) {
                                    $didsome = true;
                                    wppa_thumb_default($tt['id']);
                                    // Show Thumb as default
                                }
                                // End if on page
                            }
                        }
                        // The footer
                        wppa_album_name('bottom');
                        // Optionally display album name
                        wppa_album_desc('bottom');
                        // Optionally display album description
                        wppa_thumb_area('close');
                        // Close Thumbarea sub-container
                    } else {
                        wppa_out('Unimplemented thumbnail type');
                    }
                }
            }
        }
        // If thumbs
        if ($didsome && wppa_is_pagination()) {
            $albums = false;
        }
        // Pag on and didsome: force a pagebreak by faking no albums
        if (!wppa_is_pagination()) {
            $n_thumb_pages = '0';
        }
        // Still on page one
        // Process the albums
        if (wppa_switch('wppa_thumbs_first')) {
            if ($albums) {
                $counter_albums = '0';
                wppa_album_list('open');
                // Open Albums sub-container
                foreach ($albums as $album) {
                    // Loop the albums
                    $counter_albums++;
                    if (wppa_onpage('albums', $counter_albums, $curpage - $n_thumb_pages)) {
                        wppa_album_cover($album['id']);
                        // Show the cover
                        $didsome = true;
                    }
                    // End if on page
                }
                wppa_album_list('close');
                // Close Albums sub-container
            }
            // If albums
        }
        // Make pagelinkbar if requested on bottom
        if (wppa_opt('pagelink_pos') == 'bottom' || wppa_opt('pagelink_pos') == 'both') {
            wppa_page_links($totpag, $curpage);
        }
        // Empty results?
        if (!$didsome && !$wanted_empty) {
            if (wppa('photos_only')) {
                wppa_out(wppa_errorbox(__a('No photos found matching your search criteria.', 'wppa_theme')));
            } elseif (wppa('albums_only')) {
                wppa_out(wppa_errorbox(__a('No albums found matching your search criteria.', 'wppa_theme')));
            } else {
                wppa_out(wppa_errorbox(__a('No albums or photos found matching your search criteria.', 'wppa_theme')));
            }
        }
    } elseif (wppa_page('slide') || wppa_page('single')) {
        // Page 'Slideshow' or 'Single' in browsemode requested
        $thumbs = wppa_get_thumbs();
        wppa_dbg_msg('From theme: #thumbs=' . ($thumbs ? count($thumbs) : '0'));
        if ($thumbs) {
            wppa_the_slideshow();
            // Producs all the html required for the slideshow
            wppa_run_slidecontainer('slideshow');
            // Fill in the photo array and display it.
        } else {
            wppa_out(wppa_errorbox(__a('No photos found matching your search criteria.', 'wppa_theme')));
        }
    }
    // wppa_page( 'slide' )
    // Close container
    wppa_container('close');
}
function wppa_container($action)
{
    global $wppa_version;
    // The theme version ( wppa_theme.php )
    global $wppa_microtime;
    global $wppa_microtime_cum;
    global $wppa_err_displayed;
    global $wppa_loadtime;
    global $wppa_initruntimetime;
    static $wppa_numqueries;
    static $auto;
    global $blog_id;
    if (is_feed()) {
        return;
    }
    // Need no container in RSS feeds
    if ($action == 'open') {
        $wppa_numqueries = get_num_queries();
        // Open the container
        if (!wppa('ajax')) {
            //			wppa( 'out' ) .= '<!-- Start WPPA+ generated code'.( is_multisite() ? ', Multi site, id='.$blog_id : ', Single site' ).' -->';
            //			if ( wppa( 'shortcode_content' ) ) {
            //				wppa( 'out' ) .= '<!-- ' . wppa( 'shortcode_content' ) . ' -->';
            //			}
            wppa_out('<div' . ' id="wppa-container-' . wppa('mocc') . '"' . ' style="' . wppa_get_container_style() . '"' . ' class="' . 'wppa-container' . ' ' . 'wppa-container-' . wppa('mocc') . ' ' . 'wppa-rev-' . wppa('revno') . ' ' . 'wppa-prevrev-' . wppa_opt('prevrev') . ' ' . 'wppa-theme-' . $wppa_version . ' ' . 'wppa-api-' . wppa('api_version') . '"' . ' >');
        }
        // Spinner for Ajax
        if (wppa_switch('allow_ajax')) {
            if (!wppa_in_widget()) {
                wppa_out('<img' . ' id="wppa-ajax-spin-' . wppa('mocc') . '"' . ' src="' . wppa_get_imgdir() . 'loader.gif"' . ' alt="spinner"' . ' style="' . 'box-shadow:none;' . 'z-index:1010;' . 'position:fixed;' . 'top:50%;' . 'margin-top:-32px;' . 'left:50%;' . 'margin-left:-32px;' . 'display:none;' . '"' . ' />');
            }
        }
        // Start timer if in debug mode
        if (wppa('debug')) {
            $wppa_microtime = -microtime(true);
            wppa_dbg_q('init');
        }
        if (wppa('mocc') == '1') {
            wppa_dbg_msg('Plugin load time :' . substr($wppa_loadtime, 0, 5) . 's.');
            wppa_dbg_msg('Init runtime time :' . substr($wppa_initruntimetime, 0, 5) . 's.');
            wppa_dbg_msg('Num queries before wppa :' . get_num_queries());
        }
        /* Check if wppa.js and jQuery are present */
        if (!$wppa_err_displayed && (WPPA_DEBUG || wppa_get_get('debug') || WP_DEBUG) && !wppa_switch('defer_javascript')) {
            wppa_out('<script type="text/javascript">/* <![CDATA[ */');
            wppa_out("if ( typeof( _wppaSlides ) == 'undefined' ) " . "alert( 'There is a problem with your theme. The file wppa.js is not loaded when it is expected ( Errloc = wppa_container ).' );");
            wppa_out("if ( typeof( jQuery ) == 'undefined' ) " . "alert( 'There is a problem with your theme. The jQuery library is not loaded when it is expected ( Errloc = wppa_container ).' );");
            wppa_out("/* ]]> */</script>");
            $wppa_err_displayed = true;
        }
        /* Check if init is properly done */
        if (!wppa_opt('fullsize')) {
            wppa_out('<script type="text/javascript">/* <![CDATA[ */');
            wppa_out("alert( 'The initialisation of wppa+ is not complete yet. " . "You will probably see division by zero errors. " . "Please run Photo Albums -> Settings admin page Table VIII-A1. ( Errloc = wppa_container ).' );");
            wppa_out("/* ]]> */</script>");
        }
        // Nonce field check for rating security
        if (wppa('mocc') == '1') {
            if (wppa_get_get('rating')) {
                $nonce = wppa_get_get('nonce');
                $ok = wp_verify_nonce($nonce, 'wppa-check');
                if ($ok) {
                    wppa_dbg_msg('Rating nonce ok');
                    if (!is_user_logged_in()) {
                        sleep(2);
                    }
                } else {
                    die('<b>' . __('ERROR: Illegal attempt to enter a rating.', 'wp-photo-album-plus') . '</b>');
                }
            }
        }
        // Nonce field check for comment security
        if (wppa('mocc') == '1') {
            if (wppa_get_post('comment')) {
                $nonce = wppa_get_post('nonce');
                $ok = wp_verify_nonce($nonce, 'wppa-check');
                if ($ok) {
                    wppa_dbg_msg('Comment nonce ok');
                    if (!is_user_logged_in()) {
                        sleep(2);
                    }
                } else {
                    die('<b>' . __('ERROR: Illegal attempt to enter a comment.', 'wp-photo-album-plus') . '</b>');
                }
            }
        }
        wppa_out(wppa_nonce_field('wppa-check', 'wppa-nonce', false, false));
        if (wppa_page('oneofone')) {
            wppa('portrait_only', true);
        }
        wppa('alt', 'alt');
        // Javascript occurrence dependant stuff
        wppa_add_js_page_data("\n" . '<script type="text/javascript">');
        // wppa( 'auto_colwidth' ) is set by the filter or by wppa_albums in case called directly
        // wppa_opt( 'colwidth' ) is the option setting
        // script or call has precedence over option setting
        // so: if set by script or call: auto, else if set by option: auto
        $auto = false;
        $contw = wppa_get_container_width();
        if (wppa('auto_colwidth')) {
            $auto = true;
        } elseif (wppa_opt('colwidth') == 'auto') {
            $auto = true;
        } elseif ($contw > 0 && $contw <= 1.0) {
            $auto = true;
        }
        if ($auto) {
            wppa_add_js_page_data("\n" . 'wppaAutoColumnWidth[' . wppa('mocc') . '] = true;');
            if ($contw > 0 && $contw <= 1.0) {
                wppa_add_js_page_data("\n" . 'wppaAutoColumnFrac[' . wppa('mocc') . '] = ' . $contw . ';');
            } else {
                wppa_add_js_page_data("\n" . 'wppaAutoColumnFrac[' . wppa('mocc') . '] = 1.0;');
            }
            wppa_add_js_page_data("\n" . 'wppaColWidth[' . wppa('mocc') . '] = 0;');
        } else {
            wppa_add_js_page_data("\n" . 'wppaAutoColumnWidth[' . wppa('mocc') . '] = false;');
            wppa_add_js_page_data("\n" . 'wppaColWidth[' . wppa('mocc') . '] = ' . wppa_get_container_width() . ';');
        }
        wppa_add_js_page_data("\n" . 'wppaTopMoc = ' . wppa('mocc') . ';');
        if (wppa_opt('thumbtype') == 'masonry-v') {
            wppa_add_js_page_data("\n" . 'wppaMasonryCols[' . wppa('mocc') . '] = ' . ceil(wppa_get_container_width() / wppa_opt('thumbsize')) . ';');
        } else {
            wppa_add_js_page_data("\n" . 'wppaMasonryCols[' . wppa('mocc') . '] = 0;');
        }
        if (wppa('src_script')) {
            wppa_add_js_page_data("\n" . wppa('src_script'));
        }
        // Aspect ratio and fullsize
        if (wppa_in_widget() == 'ss' && is_numeric(wppa('in_widget_frame_width')) && wppa('in_widget_frame_width') > '0') {
            $asp = wppa('in_widget_frame_height') / wppa('in_widget_frame_width');
            $fls = wppa('in_widget_frame_width');
        } else {
            $asp = wppa_opt('maxheight') / wppa_opt('fullsize');
            $fls = wppa_opt('fullsize');
        }
        wppa_add_js_page_data("\n" . 'wppaAspectRatio[' . wppa('mocc') . '] = ' . $asp . ';');
        wppa_add_js_page_data("\n" . 'wppaFullSize[' . wppa('mocc') . '] = ' . $fls . ';');
        // last minute change: fullvalign with border needs a height correction in slideframe
        if (wppa_opt('fullimage_border_width') != '' && !wppa_in_widget()) {
            $delta = (1 + wppa_opt('fullimage_border_width')) * 2;
        } else {
            $delta = 0;
        }
        wppa_add_js_page_data("\n" . 'wppaFullFrameDelta[' . wppa('mocc') . '] = ' . $delta . ';');
        // last minute change: script %%size != default colwidth
        $temp = wppa_get_container_width() - (2 * 6 + 2 * 36 + 2 * wppa_opt('bwidth'));
        if (wppa_in_widget()) {
            $temp = wppa_get_container_width() - (2 * 6 + 2 * 18 + 2 * wppa_opt('bwidth'));
        }
        wppa_add_js_page_data("\n" . 'wppaFilmStripLength[' . wppa('mocc') . '] = ' . $temp . ';');
        // last minute change: filmstrip sizes and related stuff. In widget: half size.
        $temp = wppa_opt('tf_width') + wppa_opt('tn_margin');
        if (wppa_in_widget()) {
            $temp /= 2;
        }
        wppa_add_js_page_data("\n" . 'wppaThumbnailPitch[' . wppa('mocc') . '] = ' . $temp . ';');
        $temp = wppa_opt('tn_margin') / 2;
        if (wppa_in_widget()) {
            $temp /= 2;
        }
        wppa_add_js_page_data("\n" . 'wppaFilmStripMargin[' . wppa('mocc') . '] = ' . $temp . ';');
        $temp = 2 * 6 + 2 * 42 + 2 * wppa_opt('bwidth');
        if (wppa_in_widget()) {
            $temp = 2 * 6 + 2 * 21 + 2 * wppa_opt('bwidth');
        }
        wppa_add_js_page_data("\n" . 'wppaFilmStripAreaDelta[' . wppa('mocc') . '] = ' . $temp . ';');
        if (wppa_in_widget()) {
            wppa_add_js_page_data("\n" . 'wppaIsMini[' . wppa('mocc') . '] = true;');
        } else {
            wppa_add_js_page_data("\n" . 'wppaIsMini[' . wppa('mocc') . '] = false;');
        }
        $target = false;
        if (wppa_in_widget() == 'ss' && wppa_switch('sswidget_blank')) {
            $target = true;
        }
        if (!wppa_in_widget() && wppa_switch('slideshow_blank')) {
            $target = true;
        }
        if ($target) {
            wppa_add_js_page_data("\n" . 'wppaSlideBlank[' . wppa('mocc') . '] = true;');
        } else {
            wppa_add_js_page_data("\n" . 'wppaSlideBlank[' . wppa('mocc') . '] = false;');
        }
        wppa_add_js_page_data("\n" . 'wppaLightBox[' . wppa('mocc') . '] = "xxx";');
        // If this occur is a slideshow, determine if its link is to lightbox. This may differ between normal slideshow or ss widget
        $is_slphoto = wppa('is_slide') && wppa('start_photo') && wppa('is_single');
        if ('ss' == wppa_in_widget() || wppa_page('slide') || $is_slphoto) {
            $ss_linktype = 'ss' == wppa_in_widget() ? wppa_opt('slideonly_widget_linktype') : wppa_opt('slideshow_linktype');
            switch ($ss_linktype) {
                case 'file':
                    $lbkey = 'file';
                    // gives anchor tag with rel="file"
                    break;
                case 'lightbox':
                case 'lightboxsingle':
                    $lbkey = wppa_opt('lightbox_name');
                    // gives anchor tag with rel="lightbox" or the like
                    break;
                default:
                    $lbkey = '';
                    // results in omitting the anchor tag
                    break;
            }
            wppa_add_js_page_data("\n" . 'wppaLightBox[' . wppa('mocc') . '] = "' . $lbkey . '";' . "\n" . 'wppaConsoleLog("mocc:' . wppa('mocc') . ' lbkey:"+wppaLightBox[' . wppa('mocc') . '] );');
            wppa_add_js_page_data("\n" . 'wppaLightboxSingle[' . wppa('mocc') . '] = ' . (wppa_opt('slideshow_linktype') == 'lightboxsingle' ? 'true' : 'false') . ';');
        }
        wppa_add_js_page_data("\n" . '</script>');
    } elseif ($action == 'close') {
        if (wppa_page('oneofone')) {
            wppa('portrait_only', false);
        }
        if (!wppa_in_widget()) {
            wppa_out('<div style="clear:both;"></div>');
        }
        // Add diagnostic <p> if debug is 1
        if (wppa('debug') == '1' && wppa('mocc') == '1') {
            wppa_out('<p id="wppa-debug-' . wppa('mocc') . '" style="font-size:9px; color:#070; line-size:12px;" ></p>');
        }
        // Init lightbox intermediate to facillitate premature clicks to lightbox when not yet document.complete
        wppa_out("\n" . '<script type="text/javascript" >if ( typeof(wppaInitOverlay) != "undefined" ) { wppaInitOverlay(); }</script>');
        if (!wppa('ajax')) {
            wppa_out('<div id="wppa-container-' . wppa('mocc') . '-end" ></div>');
            wppa_out('</div>');
        }
        if (wppa('debug')) {
            $laptim = $wppa_microtime + microtime(true);
            $wppa_numqueries = get_num_queries() - $wppa_numqueries;
            if (!is_numeric($wppa_microtime_cum)) {
                $wppa_mcrotime_cum = '0';
            }
            $wppa_microtime_cum += $laptim;
            wppa_dbg_msg('Time elapsed occ ' . wppa('mocc') . ':' . substr($laptim, 0, 5) . 's. Tot:' . substr($wppa_microtime_cum, 0, 5) . 's.');
            wppa_dbg_msg('Number of queries occ ' . wppa('mocc') . ':' . $wppa_numqueries, 'green');
            wppa_dbg_q('print');
        }
    } else {
        wppa_out("\n" . '<span style="color:red;">Error, wppa_container() called with wrong argument: ' . $action . '. Possible values: \'open\' or \'close\'</span>');
    }
}
Example #5
0
function wppa_breadcrumb($opt = '')
{
    global $wpdb;
    global $wppa_session;
    // See if they need us
    // Check Table II-A1 a and b
    if ($opt == 'optional') {
        $pid = wppa_get_the_page_id();
        $type = $wpdb->get_var($wpdb->prepare("SELECT `post_type` FROM `" . $wpdb->posts . "` WHERE `ID` = %s", $pid));
        wppa_dbg_q('Q-bc1');
        if ($type == 'post' && !wppa_switch('show_bread_posts')) {
            return;
            // Nothing to do here
        }
        if ($type != 'post' && !wppa_switch('show_bread_pages')) {
            return;
            // Nothing to do here
        }
    }
    // Check special cases
    if (wppa('is_single')) {
        return;
    }
    // A single image slideshow needs no navigation
    if (wppa_page('oneofone')) {
        return;
    }
    // Never at a single image page
    if (wppa('is_slideonly')) {
        return;
    }
    // Not when slideonly
    if (wppa_in_widget()) {
        return;
    }
    // Not in a widget
    if (is_feed()) {
        return;
    }
    // Not in a feed
    $thumbhref = '';
    // Any special selection has its own switch
    if (wppa('is_topten') && !wppa_switch('bc_on_topten')) {
        return;
    }
    if (wppa('is_lasten') && !wppa_switch('bc_on_lasten')) {
        return;
    }
    if (wppa('is_comten') && !wppa_switch('bc_on_comten')) {
        return;
    }
    if (wppa('is_featen') && !wppa_switch('bc_on_featen')) {
        return;
    }
    if (wppa('is_related') && !wppa_switch('bc_on_related')) {
        return;
    }
    if (wppa('is_tag') && !wppa_switch('bc_on_tag')) {
        return;
    }
    if (wppa('src') && !wppa_switch('bc_on_search')) {
        return;
    }
    // Get the album number
    $alb = wppa_is_int(wppa('start_album')) ? wppa('start_album') : '0';
    // A single album or all ( all = 0 here )
    $is_albenum = strlen(wppa('start_album')) > '0' && !wppa_is_int(wppa('start_album'));
    wppa_dbg_msg('alb=' . $alb . ', albenum=' . $is_albenum, 'green');
    $virtual = wppa_is_virtual() || wppa('last_albums');
    if (wppa('last_albums')) {
        $alb = wppa('last_albums_parent');
    }
    wppa_dbg_msg('alb=' . $alb . ', albenum=' . $is_albenum . ', l_a=' . wppa('last_albums') . ', l_a_p=' . wppa('last_albums_parent'), 'green');
    // See if the album is a 'stand alone' album
    $separate = wppa_is_separate($alb);
    // See if the album links to slides in stead of thumbnails
    $slide = wppa_get_album_title_linktype($alb) == 'slide' ? '&amp;wppa-slide' : '';
    // See if we link to covers or to contents
    $to_cover = wppa_opt('thumbtype') == 'none' ? '1' : '0';
    // Photo number?
    $photo = wppa('start_photo');
    wppa_dbg_msg('pid=' . $pid . ', type=' . $type . ', alb=' . $alb . ', sep=' . $separate . ', slide=' . $slide . ', t_c=0, ph=' . $photo, 'green');
    // Open the breadcrumb box
    wppa_out('<div' . ' id="wppa-bc-' . wppa('mocc') . '"' . ' class="wppa-nav wppa-box wppa-nav-text" ' . 'style="' . __wcs('wppa-nav') . __wcs('wppa-box') . __wcs('wppa-nav-text') . '" >');
    // Do we need Home?
    if (wppa_switch('show_home')) {
        $value = __(wppa_opt('home_text'));
        $href = wppa_dbg_url(get_bloginfo('url'));
        $title = get_bloginfo('title');
        wppa_bcitem($value, $href, $title, 'b1');
    }
    // Page ( grand )parents ?
    if ($type == 'page' && wppa_switch('show_page')) {
        wppa_crumb_page_ancestors($pid);
    }
    // Do the post/page
    if (wppa_switch('show_page')) {
        $value = __(stripslashes($wpdb->get_var($wpdb->prepare("SELECT `post_title` FROM `" . $wpdb->posts . "` WHERE `post_status` = 'publish' AND `ID` = %s LIMIT 0,1", $pid))));
        wppa_dbg_q('Q-bc2');
        $href = $alb || $virtual || $is_albenum ? wppa_get_permalink($pid, true) : '';
        $title = $type == 'post' ? __('Post:', 'wp-photo-album-plus') . ' ' . $value : __('Page:', 'wp-photo-album-plus') . ' ' . $value;
        wppa_bcitem($value, $href, $title, 'b3');
    }
    // The album ( grand ) parents if not separate
    //		if ( ! $separate ) {
    wppa_crumb_ancestors($alb, $to_cover);
    //		}
    // The album and optional placeholder for photo
    // Supersearch ?
    if (wppa('supersearch')) {
        $value = ' ';
        $ss_data = explode(',', wppa('supersearch'));
        switch ($ss_data['0']) {
            case 'a':
                $value .= ' ' . __('Albums', 'wp-photo-album-plus');
                switch ($ss_data['1']) {
                    case 'c':
                        $value .= ' ' . __('with category:', 'wp-photo-album-plus');
                        break;
                    case 'n':
                        $value .= ' ' . __('with name:', 'wp-photo-album-plus');
                        break;
                    case 't':
                        $value .= ' ' . __('with words:', 'wp-photo-album-plus');
                        break;
                }
                $value .= ' <b>' . str_replace('.', '</b> ' . __('and', 'wp-photo-album-plus') . ' <b>', $ss_data['3']) . '</b>';
                break;
            case 'p':
                $value .= ' ' . __('Photos', 'wp-photo-album-plus');
                switch ($ss_data['1']) {
                    case 'g':
                        $value .= ' ' . __('with tag:', 'wp-photo-album-plus') . ' <b>' . str_replace('.', '</b> ' . __('and', 'wp-photo-album-plus') . ' <b>', $ss_data['3']) . '</b>';
                        break;
                    case 'n':
                        $value .= ' ' . __('with name:', 'wp-photo-album-plus') . ' <b>' . $ss_data['3'] . '</b>';
                        break;
                    case 't':
                        $ss_data['3'] = str_replace('...', '***', $ss_data['3']);
                        $value .= ' ' . __('with words:', 'wp-photo-album-plus') . ' <b>' . str_replace('.', '</b> ' . __('and', 'wp-photo-album-plus') . ' <b>', $ss_data['3']) . '</b>';
                        $value = str_replace('***', '...', $value);
                        break;
                    case 'o':
                        $value .= ' ' . __('of owner:', 'wp-photo-album-plus') . ' <b>' . $ss_data['3'] . '</b>';
                        break;
                    case 'i':
                        $label = $wpdb->get_var($wpdb->prepare("SELECT `description` FROM `" . WPPA_IPTC . "` WHERE `tag` = %s AND `photo` = '0'", str_replace('H', '#', $ss_data['2'])));
                        $label = trim($label, ':');
                        $value .= ' ' . __('with iptc tag:', 'wp-photo-album-plus') . ' <b>' . __($label, 'wp-photo-album-plus') . '</b> ' . __('with content:', 'wp-photo-album-plus') . ' <b>' . $ss_data['3'] . '</b>';
                        break;
                    case 'e':
                        $label = $wpdb->get_var($wpdb->prepare("SELECT `description` FROM `" . WPPA_EXIF . "` WHERE `tag` = %s AND `photo` = '0'", str_replace('H', '#', $ss_data['2'])));
                        $label = trim($label, ':');
                        $value .= ' ' . __('with exif tag:', 'wp-photo-album-plus') . ' <b>' . __($label, 'wp-photo-album-plus') . '</b> ' . __('with content:', 'wp-photo-album-plus') . ' <b>' . $ss_data['3'] . '</b>';
                        break;
                }
                break;
        }
        if (wppa('is_slide')) {
            $thumbhref = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-supersearch=' . stripslashes(wppa('supersearch'));
            $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-supersearch=' . stripslashes(wppa('supersearch'));
            $title = __('View the thumbnails', 'wp-photo-album-plus');
            wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax);
        }
        $href = '';
        $title = '';
        wppa_bcitem($value, $href, $title, 'b9');
    } elseif (wppa('src') && !wppa('is_related')) {
        $searchroot = $wppa_session['search_root'];
        if (!$searchroot) {
            $searchroot = '-2';
            // To get 'All albums'
        }
        $albtxt = wppa('is_rootsearch') ? ' <span style="cursor:pointer;" title="' . esc_attr(sprintf(__('Searchresults from album %s and its subalbums', 'wp-photo-album-plus'), wppa_display_root($searchroot))) . '">*</span> ' : '';
        if (wppa('is_slide')) {
            $value = __('Searchstring:', 'wp-photo-album-plus') . ' ' . (isset($wppa_session['display_searchstring']) ? $wppa_session['display_searchstring'] : stripslashes(wppa('searchstring'))) . $albtxt;
            $thumbhref = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-searchstring=' . stripslashes(str_replace(' ', '+', $wppa_session['use_searchstring']));
            $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-searchstring=' . stripslashes(str_replace(' ', '+', $wppa_session['use_searchstring']));
            $title = __('View the thumbnails', 'wp-photo-album-plus');
            wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax);
        }
        $value = __('Searchstring:', 'wp-photo-album-plus') . ' ' . (isset($wppa_session['display_searchstring']) ? $wppa_session['display_searchstring'] : stripslashes(wppa('searchstring'))) . $albtxt;
        $href = '';
        $title = isset($wppa_session['display_searchstring']) ? wppa_dss_to_title($wppa_session['display_searchstring']) : '';
        wppa_bcitem($value, $href, $title, 'b9');
    } elseif (wppa('calendar')) {
        if (wppa('is_slide')) {
            switch (wppa('calendar')) {
                case 'exifdtm':
                    $value = __('Photos by EXIF date', 'wp-photo-album-plus') . ': ' . wppa('caldate');
                    break;
                case 'timestamp':
                    $value = __('Photos by date of upload', 'wp-photo-album-plus') . ': ' . date('M d D Y', wppa('caldate') * 24 * 60 * 60);
                    break;
                case 'modified':
                    $value = __('Photos by date last modified', 'wp-photo-album-plus') . ': ' . date('M d D Y', wppa('caldate') * 24 * 60 * 60);
                    break;
            }
            $thumbhref = '#';
            $title = 'T8';
            wppa_bcitem($value, $thumbhref, $title, 'b8');
        }
        switch (wppa('calendar')) {
            case 'exifdtm':
                $value = __('Photos by EXIF date', 'wp-photo-album-plus') . ': ' . wppa('caldate');
                break;
            case 'timestamp':
                $value = __('Photos by date of upload', 'wp-photo-album-plus') . ': ' . date('M d D Y', wppa('caldate') * 24 * 60 * 60);
                break;
            case 'modified':
                $value = __('Photos by date last modified', 'wp-photo-album-plus') . ': ' . date('M d D Y', wppa('caldate') * 24 * 60 * 60);
                break;
        }
        $href = '';
        $title = '';
        wppa_bcitem($value, $href, $title, 'b9');
    } elseif (wppa('is_upldr')) {
        $usr = get_user_by('login', wppa('is_upldr'));
        if ($usr) {
            $user = $usr->display_name;
        } else {
            $user = wppa('is_upldr');
        }
        if (wppa('is_slide')) {
            $value = sprintf(__('Photos by %s', 'wp-photo-album-plus'), $user);
            if (wppa('start_album')) {
                $thumbhref = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-upldr=' . wppa('is_upldr') . '&amp;wppa-album=' . wppa('start_album');
                $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-upldr=' . wppa('is_upldr') . '&amp;wppa-album=' . wppa('start_album');
            } else {
                $thumbhref = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-upldr=' . wppa('is_upldr');
                $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-upldr=' . wppa('is_upldr');
            }
            $title = __('View the thumbnails', 'wp-photo-album-plus');
            wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax);
        }
        $value = sprintf(__('Photos by %s', 'wp-photo-album-plus'), $user);
        $href = '';
        $title = '';
        wppa_bcitem($value, $href, $title, 'b9');
    } elseif (wppa('is_topten')) {
        // TopTen
        if (wppa('start_album')) {
            $value = $is_albenum ? __('Various albums', 'wp-photo-album-plus') : wppa_get_album_name($alb);
            $href = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $title = $is_albenum ? __('Albums:', 'wp-photo-album-plus') . ' ' . wppa('start_album') : __('Album:', 'wp-photo-album-plus') . ' ' . $value;
            wppa_bcitem($value, $href, $title, 'b7', $ajax);
        }
        if (wppa('is_slide')) {
            $value = __('Top rated photos', 'wp-photo-album-plus');
            $thumbhref = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-topten=' . wppa('topten_count') . '&amp;wppa-album=' . wppa('start_album');
            $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-topten=' . wppa('topten_count') . '&amp;wppa-album=' . wppa('start_album');
            $title = __('View the thumbnails', 'wp-photo-album-plus');
            wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax);
        }
        $value = __('Top rated photos', 'wp-photo-album-plus');
        $href = '';
        $title = '';
        wppa_bcitem($value, $href, $title, 'b9');
    } elseif (wppa('is_lasten')) {
        // Lasten
        if (wppa('start_album')) {
            $value = $is_albenum ? __('Various albums', 'wp-photo-album-plus') : wppa_get_album_name($alb);
            $href = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $title = $is_albenum ? __('Albums:', 'wp-photo-album-plus') . ' ' . wppa('start_album') : __('Album:', 'wp-photo-album-plus') . ' ' . $value;
            wppa_bcitem($value, $href, $title, 'b7', $ajax);
        }
        if (wppa('is_slide')) {
            if (wppa_switch('lasten_use_modified')) {
                $value = __('Recently modified photos', 'wp-photo-album-plus');
            } else {
                $value = __('Recently uploaded photos', 'wp-photo-album-plus');
            }
            $thumbhref = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-lasten=' . wppa('lasten_count') . '&amp;wppa-album=' . wppa('start_album');
            $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-lasten=' . wppa('lasten_count') . '&amp;wppa-album=' . wppa('start_album');
            $title = __('View the thumbnails', 'wp-photo-album-plus');
            wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax);
        }
        if (wppa_switch('lasten_use_modified')) {
            $value = __('Recently modified photos', 'wp-photo-album-plus');
        } else {
            $value = __('Recently uploaded photos', 'wp-photo-album-plus');
        }
        $href = '';
        $title = '';
        wppa_bcitem($value, $href, $title, 'b9');
    } elseif (wppa('is_comten')) {
        // Comten
        if (wppa('start_album')) {
            $value = $is_albenum ? __('Various albums', 'wp-photo-album-plus') : wppa_get_album_name($alb);
            $href = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $title = $is_albenum ? __('Albums:', 'wp-photo-album-plus') . ' ' . wppa('start_album') : __('Album:', 'wp-photo-album-plus') . ' ' . $value;
            wppa_bcitem($value, $href, $title, 'b7', $ajax);
        }
        if (wppa('is_slide')) {
            $value = __('Recently commented photos', 'wp-photo-album-plus');
            $thumbhref = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-comten=' . wppa('comten_count') . '&amp;wppa-album=' . wppa('start_album');
            $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-comten=' . wppa('comten_count') . '&amp;wppa-album=' . wppa('start_album');
            $title = __('View the thumbnails', 'wp-photo-album-plus');
            wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax);
        }
        $value = __('Recently commented photos', 'wp-photo-album-plus');
        $href = '';
        $title = '';
        wppa_bcitem($value, $href, $title, 'b9');
    } elseif (wppa('is_featen')) {
        // Featen
        if (wppa('start_album')) {
            $value = $is_albenum ? __('Various albums', 'wp-photo-album-plus') : wppa_get_album_name($alb);
            $href = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $title = $is_albenum ? __('Albums:', 'wp-photo-album-plus') . ' ' . wppa('start_album') : __('Album:', 'wp-photo-album-plus') . ' ' . $value;
            wppa_bcitem($value, $href, $title, 'b7', $ajax);
        }
        if (wppa('is_slide')) {
            $value = __('Featured photos', 'wp-photo-album-plus');
            $thumbhref = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-featen=' . wppa('featen_count') . '&amp;wppa-album=' . wppa('start_album');
            $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-featen=' . wppa('featen_count') . '&amp;wppa-album=' . wppa('start_album');
            $title = __('View the thumbnails', 'wp-photo-album-plus');
            wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax);
        }
        $value = __('Featured photos', 'wp-photo-album-plus');
        $href = '';
        $title = '';
        wppa_bcitem($value, $href, $title, 'b9');
    } elseif (wppa('is_related')) {
        // Related photos
        if (wppa('is_slide')) {
            $value = __('Related photos', 'wp-photo-album-plus');
            $href = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-tag=' . wppa('is_tag') . '&amp;wppa-album=' . wppa('start_album');
            $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-tag=' . wppa('is_tag') . '&amp;wppa-album=' . wppa('start_album');
            $title = __('View the thumbnails', 'wp-photo-album-plus');
            wppa_bcitem($value, $href, $title, 'b8', $ajax);
        }
        $value = __('Related photos', 'wp-photo-album-plus');
        $href = '';
        $title = '';
        wppa_bcitem($value, $href, $title, 'b9');
    } elseif (wppa('is_tag')) {
        // Tagged photos
        if (wppa('is_slide')) {
            $value = __('Tagged photos:', 'wp-photo-album-plus') . '&nbsp;' . str_replace(';', ' ' . __('or', 'wp-photo-album-plus') . ' ', str_replace(',', ' ' . __('and', 'wp-photo-album-plus') . ' ', trim(wppa('is_tag'), ',;')));
            if (wppa_get_get('inv')) {
                $value .= ' (' . __('Inverted', 'wp-photo-album-plus') . ')';
            }
            $thumbhref = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-tag=' . wppa('is_tag') . '&amp;wppa-album=' . wppa('start_album');
            $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-tag=' . wppa('is_tag') . '&amp;wppa-album=' . wppa('start_album');
            if (wppa('is_inverse')) {
                $thumbhref .= '&amp;wppa-inv=1';
                $thumbajax .= '&amp;wppa-inv=1';
            }
            $title = __('View the thumbnails', 'wp-photo-album-plus');
            wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax);
        }
        $value = __('Tagged photos:', 'wp-photo-album-plus') . '&nbsp;' . str_replace(';', ' ' . __('or', 'wp-photo-album-plus') . ' ', str_replace(',', ' ' . __('and', 'wp-photo-album-plus') . ' ', trim(wppa('is_tag'), ',;')));
        if (wppa_get_get('inv')) {
            $value .= ' (' . __('Inverted', 'wp-photo-album-plus') . ')';
        }
        $href = '';
        $title = '';
        wppa_bcitem($value, $href, $title, 'b9');
    } elseif (wppa('is_cat')) {
        // Categorized albums
        if (wppa('is_slide')) {
            $value = __('Category:', 'wp-photo-album-plus') . '&nbsp;' . wppa('is_cat');
            //str_replace( ';', ' '.__( 'or' ).' ', str_replace( ',', ' '.__( 'and' ).' ', trim( wppa( 'is_tag' ), ',;' ) ) );
            $thumbhref = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-cat=' . wppa('is_cat') . '&amp;wppa-album=' . wppa('start_album');
            $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-cat=' . wppa('is_cat') . '&amp;wppa-album=' . wppa('start_album');
            $title = __('View the thumbnails', 'wp-photo-album-plus');
            wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax);
        }
        $value = __('Category:', 'wp-photo-album-plus') . '&nbsp;' . wppa('is_cat');
        //str_replace( ';', ' '.__( 'or' ).' ', str_replace( ',', ' '.__( 'and' ).' ', trim( wppa( 'is_tag' ), ',;' ) ) );
        $href = '';
        $title = '';
        wppa_bcitem($value, $href, $title, 'b9');
    } elseif (wppa('last_albums')) {
        // Recently modified albums( s )
        if (wppa('last_albums_parent')) {
            $value = wppa_get_album_name($alb);
            $href = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $title = __('Album:', 'wp-photo-album-plus') . ' ' . $value;
            wppa_bcitem($value, $href, $title, 'b7', $ajax);
        }
        if (wppa('is_slide')) {
            $value = __('Recently updated albums', 'wp-photo-album-plus');
            $thumbhref = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $title = __('View the thumbnails', 'wp-photo-album-plus');
            wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax);
        }
        $value = __('Recently updated albums', 'wp-photo-album-plus');
        $href = '';
        $title = '';
        wppa_bcitem($value, $href, $title, 'b9');
    } else {
        // Maybe a simple normal standard album???
        if (wppa('is_owner')) {
            $usr = get_user_by('login', wppa('is_owner'));
            if ($usr) {
                $dispname = $usr->display_name;
            } else {
                $dispname = wppa('is_owner');
            }
            // User deleted
            $various = sprintf(__('Various albums by %s', 'wp-photo-album-plus'), $dispname);
        } else {
            $various = __('Various albums', 'wp-photo-album-plus');
        }
        if (wppa('is_slide')) {
            $value = $is_albenum ? $various : wppa_get_album_name($alb);
            $href = wppa_get_permalink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&amp;wppa-occur=' . wppa('occur') . '&amp;wppa-album=' . wppa('start_album');
            $title = $is_albenum ? __('Albums:', 'wp-photo-album-plus') . ' ' . wppa('start_album') : __('Album:', 'wp-photo-album-plus') . ' ' . $value;
            wppa_bcitem($value, $href, $title, 'b7', $ajax);
        }
        $value = $is_albenum ? $various : wppa_get_album_name($alb);
        $href = '';
        $title = '';
        $class = 'b10';
        wppa_bcitem($value, $href, $title, $class);
    }
    // 'Go to thumbnail display' - icon
    if (wppa('is_slide') && !wppa('calendar')) {
        if (wppa_switch('bc_slide_thumblink')) {
            //				$pg = ( ( wppa_opt('thumb_page_size' ) == wppa_opt( 'slideshow_pagesize' ) ) && wppa_get_curpage() != '1' ) ? '&wppa-page='.wppa_get_curpage() : '';
            //				$thumbhref .= $pg;
            if ($virtual) {
                if ($thumbhref) {
                    $thumbhref = wppa_trim_wppa_($thumbhref);
                    $fs = wppa_opt('fontsize_nav');
                    if ($fs != '') {
                        $fs += 3;
                    } else {
                        $fs = '15';
                    }
                    // iconsize = fontsize+3, Default to 15
                    $imgs = 'height: ' . $fs . 'px; margin:0 0 -3px 0; padding:0; box-shadow:none;';
                    wppa_out('<a href="' . $thumbhref . '" title="' . __('Thumbnail view', 'wp-photo-album-plus') . '" class="wppa-nav-text" style="' . __wcs('wppa-nav-text') . 'float:right; cursor:pointer;" ' . 'onmouseover="jQuery(\'#wppa-tnv-' . wppa('mocc') . '\').css(\'display\', \'none\'); jQuery(\'#wppa-tnvh-' . wppa('mocc') . '\').css(\'display\', \'\')" ' . 'onmouseout="jQuery(\'#wppa-tnv-' . wppa('mocc') . '\').css(\'display\', \'\'); jQuery(\'#wppa-tnvh-' . wppa('mocc') . '\').css(\'display\', \'none\')" >' . '<img id="wppa-tnv-' . wppa('mocc') . '" class="wppa-tnv" src="' . wppa_get_imgdir() . 'application_view_icons.png" alt="' . __('Thumbs', 'wp-photo-album-plus') . '" style="' . $imgs . '" />' . '<img id="wppa-tnvh-' . wppa('mocc') . '" class="wppa-tnv" src="' . wppa_get_imgdir() . 'application_view_icons_hover.png" alt="' . __('Thumbs', 'wp-photo-album-plus') . '" style="display:none;' . $imgs . '" />' . '</a>');
                }
            } else {
                $s = wppa('src') ? '&wppa-searchstring=' . urlencode(wppa('searchstring')) : '';
                $onclick = "wppaDoAjaxRender( " . wppa('mocc') . ", '" . wppa_get_album_url_ajax(wppa('start_album'), '0') . "&amp;wppa-photos-only=1" . $s . "', '" . wppa_convert_to_pretty(wppa_get_album_url(wppa('start_album'), '0') . '&wppa-photos-only=1' . $s) . "' )";
                $fs = wppa_opt('fontsize_nav');
                if ($fs != '') {
                    $fs += 3;
                } else {
                    $fs = '15';
                }
                // iconsize = fontsize+3, Default to 15
                $imgs = 'height: ' . $fs . 'px; margin:0 0 -3px 0; padding:0; box-shadow:none;';
                wppa_out('<a title="' . __('Thumbnail view', 'wp-photo-album-plus') . '" class="wppa-nav-text" style="' . __wcs('wppa-nav-text') . 'float:right; cursor:pointer;" ' . 'onclick="' . $onclick . '" ' . 'onmouseover="jQuery(\'#wppa-tnv-' . wppa('mocc') . '\').css(\'display\', \'none\'); jQuery(\'#wppa-tnvh-' . wppa('mocc') . '\').css(\'display\', \'\')" ' . 'onmouseout="jQuery(\'#wppa-tnv-' . wppa('mocc') . '\').css(\'display\', \'\'); jQuery(\'#wppa-tnvh-' . wppa('mocc') . '\').css(\'display\', \'none\')" >' . '<img id="wppa-tnv-' . wppa('mocc') . '" class="wppa-tnv" src="' . wppa_get_imgdir() . 'application_view_icons.png" alt="' . __('Thumbs', 'wp-photo-album-plus') . '" style="' . $imgs . '" />' . '<img id="wppa-tnvh-' . wppa('mocc') . '" class="wppa-tnv" src="' . wppa_get_imgdir() . 'application_view_icons_hover.png" alt="' . __('Thumbs', 'wp-photo-album-plus') . '" style="display:none;' . $imgs . '" />' . '</a>');
            }
        }
    }
    // Close the breadcrumb box
    wppa_out('<div style="clear:both;" ></div>');
    wppa_out('</div>');
}
function wppa_theme()
{
    global $wppa_version;
    $wppa_version = '4-0-0';
    // The version number of this file, please change if you modify this file
    global $wppa;
    global $wppa_opt;
    global $wppa_show_statistics;
    // Can be set to true by a custom page template
    $curpage = wppa_get_curpage();
    // Get the page # we are on when pagination is on, or 1
    $didsome = false;
    // Required initializations for pagination
    $n_album_pages = '0';
    // "
    $n_thumb_pages = '0';
    // "
    wppa_container('open');
    // Open container
    if ($wppa_show_statistics) {
        wppa_statistics();
    }
    // Show statistics if set so by the page template
    wppa_breadcrumb('optional');
    // Display breadcrumb navigation only if it is set in the settings page
    if (wppa_page('albums')) {
        // Page 'Albums' requested
        $albums = wppa_get_albums();
        // Get the albums
        if ($albums) {
            $counter_albums = '0';
            $n_album_pages = wppa_get_npages('albums', $albums);
            wppa_album_list('open');
            // Open Albums sub-container
            foreach ($albums as $ta) {
                global $album;
                $album = $ta;
                // Loop the albums
                $counter_albums++;
                if (wppa_onpage('albums', $counter_albums, $curpage)) {
                    $didsome = true;
                    wppa_album_cover();
                    // Show the cover
                }
                // End if on page
            }
            wppa_album_list('close');
            // Close Albums sub-container
        }
        // If albums
        if ($wppa_opt['wppa_thumbtype'] != 'none') {
            $thumbs = wppa_get_thumbs();
            // Get the Thumbs
        } else {
            $thumbs = false;
        }
        $n_thumb_pages = wppa_get_npages('thumbs', $thumbs);
        // How many pages of thumbs will there be?
        if ($n_thumb_pages == '0') {
            $thumbs = false;
        }
        // No pages: no thumbs. Maybe want covers only
        if ($didsome && wppa_is_pagination()) {
            $thumbs = false;
        }
        // Pag on and didsome: pagebreak
        if (count($thumbs) <= wppa_get_mincount()) {
            $thumbs = false;
        }
        // Less than treshold value
        if ($thumbs) {
            $counter_thumbs = '0';
            if (get_option('wppa_thumbtype', 'default') == 'ascovers') {
                // Do the thumbs As covers
                wppa_thumb_list('open');
                // Open Thumblist sub-container
                foreach ($thumbs as $tt) {
                    global $thumb;
                    $thumb = $tt;
                    // Loop the Thumbs
                    $counter_thumbs++;
                    if (wppa_onpage('thumbs', $counter_thumbs, $curpage - $n_album_pages)) {
                        $didsome = true;
                        wppa_thumb_ascover();
                        // Show Thumb as cover
                    }
                    // End if on page
                }
                wppa_thumb_list('close');
                // Close Thumblist sub-container
            } else {
                // Do the thumbs As default
                wppa_thumb_area('open');
                // Open Thumbarea sub-container
                foreach ($thumbs as $tt) {
                    global $thumb;
                    $thumb = $tt;
                    // Loop the Thumbs
                    $counter_thumbs++;
                    if (wppa_onpage('thumbs', $counter_thumbs, $curpage - $n_album_pages)) {
                        $didsome = true;
                        wppa_thumb_default();
                        // Show Thumb as default
                    }
                    // End if on page
                }
                wppa_popup();
                // Prepare Popup box
                wppa_thumb_area('close');
                // Close Thumbarea sub-container
            }
            // As default
        }
        // If thumbs
        if (!wppa_is_pagination()) {
            $totpag = '1';
        } else {
            $totpag = $n_album_pages + $n_thumb_pages;
        }
        wppa_page_links($totpag, $curpage);
        // Show pages navigaion bar if needed
        if (!$didsome && $wppa['src']) {
            $wppa['out'] .= '<div class="center">' . __a('No albums or photos found matching your search criteria.', 'wppa_theme') . '</div>';
        }
    } elseif (wppa_page('oneofone')) {
        // Page 'Single image' requested
        wppa_slide_frame();
        // Setup slideframe
        wppa_run_slidecontainer('single');
        // Fill in the photo and display it
    } elseif (wppa_page('slide') || wppa_page('single')) {
        // Page 'Slideshow' or 'Single' in browsemode requested
        wppa_the_slideshow();
        // Producs all the html required for the slideshow
        wppa_run_slidecontainer('slideshow');
        // Fill in the photo array and display it.
    }
    // wppa_page('slide')
    wppa_container('close');
}
function wppa_slide_frame()
{
    global $wppa;
    global $wppa_opt;
    if (is_feed()) {
        return;
    }
    if ($wppa['is_filmonly']) {
        return;
    }
    //	if ( wppa_switch('wppa_slide_swipe') ) {
    //		$ontouch = 'ontouchstart="wppaTouchStart(event,\'slide_frame-'.$wppa['mocc'].'\', '.$wppa['mocc'].');"  ontouchend="wppaTouchEnd(event);" ontouchmove="wppaTouchMove(event);" ontouchcancel="wppaTouchCancel(event);"';
    //	}
    //	else
    $ontouch = '';
    if (wppa_switch('wppa_slide_pause')) {
        $pause = 'onmouseover="wppaSlidePause[' . $wppa['mocc'] . '] = \'' . __a('Paused', 'wppa_theme') . '\'" onmouseout="wppaSlidePause[' . $wppa['mocc'] . '] = false"';
    } else {
        $pause = '';
    }
    // There are still users who turn off javascript...
    $wppa['out'] .= wppa_nltab() . '<noscript style="text-align:center; " ><span style="color:red; ">' . __a('To see the full size images, you need to enable javascript in your browser.', 'wppa') . '</span></noscript>';
    $wppa['out'] .= wppa_nltab('+') . '<div id="slide_frame-' . $wppa['mocc'] . '" ' . $ontouch . ' ' . $pause . ' class="slide-frame" style="overflow:hidden; ' . wppa_get_slide_frame_style() . '">';
    $auto = false;
    if ($wppa['auto_colwidth']) {
        $auto = true;
    } elseif ($wppa_opt['wppa_colwidth'] == 'auto') {
        $auto = true;
    }
    if ($auto) {
        $wppa['out'] .= wppa_nltab() . '<div id="theslide0-' . $wppa['mocc'] . '" class="theslide theslide-' . $wppa['mocc'] . '" style="width:100%; margin:auto;" ></div>';
        $wppa['out'] .= wppa_nltab() . '<div id="theslide1-' . $wppa['mocc'] . '" class="theslide theslide-' . $wppa['mocc'] . '" style="width:100%; margin:auto;" ></div>';
    } else {
        $wppa['out'] .= wppa_nltab() . '<div id="theslide0-' . $wppa['mocc'] . '" class="theslide theslide-' . $wppa['mocc'] . '" style="width:' . $wppa['slideframewidth'] . 'px; " ></div>';
        $wppa['out'] .= wppa_nltab() . '<div id="theslide1-' . $wppa['mocc'] . '" class="theslide theslide-' . $wppa['mocc'] . '" style="width:' . $wppa['slideframewidth'] . 'px; " ></div>';
    }
    $wppa['out'] .= wppa_nltab() . '<div id="spinner-' . $wppa['mocc'] . '" class="spinner" ></div>';
    if (!wppa_page('oneofone')) {
        if (wppa_switch('wppa_show_bbb') && !$wppa['in_widget'] || wppa_switch('wppa_show_bbb_widget') && $wppa['in_widget']) {
            // big browsing buttons enabled
            $wppa['out'] .= wppa_nltab() . '<img id="bbb-' . $wppa['mocc'] . '-l" class="bbb-l bbb-' . $wppa['mocc'] . '" src="' . wppa_get_imgdir() . 'bbbl.png" alt="bbbl" style="background-color: transparent; border:none; z-index:83; position: absolute; float:left;  top: 0px; width: ' . $wppa['slideframewidth'] * 0.5 . 'px; height: ' . $wppa['slideframeheight'] . 'px; box-shadow: none; cursor:default;" onmouseover="wppaBbb(' . $wppa['mocc'] . ',\'l\',\'show\')" onmouseout="wppaBbb(' . $wppa['mocc'] . ',\'l\',\'hide\')" onclick="wppaBbb(' . $wppa['mocc'] . ',\'l\',\'click\')" />';
            $wppa['out'] .= wppa_nltab() . '<img id="bbb-' . $wppa['mocc'] . '-r" class="bbb-r bbb-' . $wppa['mocc'] . '" src="' . wppa_get_imgdir() . 'bbbr.png" alt="bbbr" style="background-color: transparent; border:none; z-index:83; position: absolute; float:right; top: 0px; width: ' . $wppa['slideframewidth'] * 0.5 . 'px; height: ' . $wppa['slideframeheight'] . 'px; box-shadow: none; cursor:default;" onmouseover="wppaBbb(' . $wppa['mocc'] . ',\'r\',\'show\')" onmouseout="wppaBbb(' . $wppa['mocc'] . ',\'r\',\'hide\')" onclick="wppaBbb(' . $wppa['mocc'] . ',\'r\',\'click\')" />';
        }
        /***/
        if (wppa_switch('wppa_show_ubb') && !$wppa['in_widget'] || wppa_switch('wppa_show_ubb_widget') && $wppa['in_widget']) {
            // Ugly browse buttons
            $wppa['out'] .= wppa_nltab() . '<img id="ubb-' . $wppa['mocc'] . '-l" class="ubb-l ubb-' . $wppa['mocc'] . '" src="' . wppa_get_imgdir() . 'ubbl.png" alt="ubbl" style="background-color: transparent; border:none; z-index:183; position: absolute; top: 100px; left:0; box-shadow: none; cursor:pointer; top:' . ($wppa['slideframeheight'] / 2 - 10) . 'px;" onmouseover="wppaUbb(' . $wppa['mocc'] . ',\'l\',\'show\')" onmouseout="wppaUbb(' . $wppa['mocc'] . ',\'l\',\'hide\')" onclick="wppaUbb(' . $wppa['mocc'] . ',\'l\',\'click\')" />';
            $wppa['out'] .= wppa_nltab() . '<img id="ubb-' . $wppa['mocc'] . '-r" class="ubb-r ubb-' . $wppa['mocc'] . '" src="' . wppa_get_imgdir() . 'ubbr.png" alt="ubbr" style="background-color: transparent; border:none; z-index:183; position: absolute; top: 100px; right:0; box-shadow: none; cursor:pointer; top:' . ($wppa['slideframeheight'] / 2 - 10) . 'px;" onmouseover="wppaUbb(' . $wppa['mocc'] . ',\'r\',\'show\')" onmouseout="wppaUbb(' . $wppa['mocc'] . ',\'r\',\'hide\')" onclick="wppaUbb(' . $wppa['mocc'] . ',\'r\',\'click\')" />';
        }
    }
    wppa_numberbar();
    $wppa['out'] .= wppa_nltab('-') . '</div>';
}