function wppa_breadcrumb($opt = '') { global $wppa; 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('wppa_show_bread_posts')) { return; // Nothing to do here } if ($type != 'post' && !wppa_switch('wppa_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'] == '1') { 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('wppa_bc_on_topten')) { return; } if ($wppa['is_lasten'] && !wppa_switch('wppa_bc_on_lasten')) { return; } if ($wppa['is_comten'] && !wppa_switch('wppa_bc_on_comten')) { return; } if ($wppa['is_featen'] && !wppa_switch('wppa_bc_on_featen')) { return; } if ($wppa['is_related'] && !wppa_switch('wppa_bc_on_related')) { return; } if ($wppa['is_tag'] && !wppa_switch('wppa_bc_on_tag')) { return; } if ($wppa['src'] && !wppa_switch('wppa_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_topten'] || $wppa['is_lasten'] || $wppa['is_comten'] || $wppa['is_featen'] || $wppa['is_tag'] || $wppa['last_albums'] || $wppa['is_upldr'] || $wppa['supersearch']; 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' ? '&wppa-slide' : ''; // See if we link to covers or to contents $to_cover = wppa_opt('wppa_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'] .= wppa_nltab('+') . '<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('wppa_show_home')) { $value = __a('Home'); $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('wppa_show_page')) { wppa_crumb_page_ancestors($pid); } // Do the post/page if (wppa_switch('wppa_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 || $wppa['src'] || $wppa['supersearch'] || $is_albenum ? wppa_get_permalink($pid, true) : ''; $title = $type == 'post' ? __a('Post:') . ' ' . $value : __a('Page:') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b3'); } // The album ( grant )parents if not separate if (!$separate) { wppa_crumb_ancestors($alb, $to_cover); } // The album and optionall placeholder for photo // Supersearch ? if ($wppa['supersearch']) { $value = ' '; // . __a( 'Searching:' ); $ss_data = explode(',', $wppa['supersearch']); switch ($ss_data['0']) { case 'a': $value .= ' ' . __a('Albums'); switch ($ss_data['1']) { case 'c': $value .= ' ' . __a('with category:'); break; case 'n': $value .= ' ' . __a('with name:'); break; case 't': $value .= ' ' . __a('with words:'); break; } $value .= ' <b>' . str_replace('.', '</b> ' . __a('and') . ' <b>', $ss_data['3']) . '</b>'; break; case 'p': $value .= ' ' . __a('Photos'); switch ($ss_data['1']) { case 'g': $value .= ' ' . __a('with tag:') . ' <b>' . str_replace('.', '</b> ' . __a('and') . ' <b>', $ss_data['3']) . '</b>'; break; case 'n': $value .= ' ' . __a('with name:') . ' <b>' . $ss_data['3'] . '</b>'; break; case 't': $ss_data['3'] = str_replace('...', '***', $ss_data['3']); $value .= ' ' . __a('with words:') . ' <b>' . str_replace('.', '</b> ' . __a('and') . ' <b>', $ss_data['3']) . '</b>'; $value = str_replace('***', '...', $value); break; case 'o': $value .= ' ' . __a('of owner:') . ' <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:') . ' <b>' . $label . '</b> ' . __('with content:') . ' <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:') . ' <b>' . $label . '</b> ' . __('with content:') . ' <b>' . $ss_data['3'] . '</b>'; break; } break; } if ($wppa['is_slide']) { $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-supersearch=' . stripslashes($wppa['supersearch']); $title = __a('View the thumbnails'); wppa_bcitem($value, $thumbhref, $title, 'b8'); } $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif ($wppa['src'] && !$wppa['is_related']) { if (isset($wppa_session['search_root'])) { $searchroot = $wppa_session['search_root']; } else { $searchroot = '-2'; } $albtxt = $wppa['is_rootsearch'] ? ' <span style="cursor:pointer;" title="' . esc_attr(sprintf(__a('Searchresults from album %s and its subalbums'), wppa_get_album_name($searchroot))) . '">*</span> ' : ''; if ($wppa['is_slide']) { $value = __a('Searchstring:') . ' ' . (isset($wppa_session['display_searchstring']) ? $wppa_session['display_searchstring'] : stripslashes($wppa['searchstring'])) . $albtxt; $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-searchstring=' . stripslashes($wppa['searchstring']); $title = __a('View the thumbnails'); wppa_bcitem($value, $thumbhref, $title, 'b8'); } $value = __a('Searchstring:') . ' ' . (isset($wppa_session['display_searchstring']) ? $wppa_session['display_searchstring'] : stripslashes($wppa['searchstring'])) . $albtxt; $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(__a('Photos by %s'), $user); if ($wppa['start_album']) { $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-upldr=' . $wppa['is_upldr'] . '&wppa-album=' . $wppa['start_album']; } else { $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-upldr=' . $wppa['is_upldr']; } $title = __a('View the thumbnails'); wppa_bcitem($value, $thumbhref, $title, 'b8'); } $value = sprintf(__a('Photos by %s'), $user); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif ($wppa['is_topten']) { // TopTen if ($wppa['start_album']) { $value = $is_albenum ? __a('Various albums') : wppa_get_album_name($alb); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-album=' . $wppa['start_album']; $title = $is_albenum ? __a('Albums:') . ' ' . $wppa['start_album'] : __a('Album:') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7'); } if ($wppa['is_slide']) { $value = __a('Top rated photos'); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-topten=' . $wppa['topten_count'] . '&wppa-album=' . $wppa['start_album']; $title = __a('View the thumbnails'); wppa_bcitem($value, $thumbhref, $title, 'b8'); } $value = __a('Top rated photos'); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif ($wppa['is_lasten']) { // Lasten if ($wppa['start_album']) { $value = $is_albenum ? __a('Various albums') : wppa_get_album_name($alb); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-album=' . $wppa['start_album']; $title = $is_albenum ? __a('Albums:') . ' ' . $wppa['start_album'] : __a('Album:') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7'); } if ($wppa['is_slide']) { $value = __a('Recently uploaded photos'); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-lasten=' . $wppa['lasten_count'] . '&wppa-album=' . $wppa['start_album']; $title = __a('View the thumbnails'); wppa_bcitem($value, $thumbhref, $title, 'b8'); } $value = __a('Recently uploaded photos'); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif ($wppa['is_comten']) { // Comten if ($wppa['start_album']) { $value = $is_albenum ? __a('Various albums') : wppa_get_album_name($alb); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-album=' . $wppa['start_album']; $title = $is_albenum ? __a('Albums:') . ' ' . $wppa['start_album'] : __a('Album:') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7'); } if ($wppa['is_slide']) { $value = __a('Recently commented photos'); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-comten=' . $wppa['comten_count'] . '&wppa-album=' . $wppa['start_album']; $title = __a('View the thumbnails'); wppa_bcitem($value, $thumbhref, $title, 'b8'); } $value = __a('Recently commented photos'); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif ($wppa['is_featen']) { // Featen if ($wppa['start_album']) { $value = $is_albenum ? __a('Various albums') : wppa_get_album_name($alb); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-album=' . $wppa['start_album']; $title = $is_albenum ? __a('Albums:') . ' ' . $wppa['start_album'] : __a('Album:') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7'); } if ($wppa['is_slide']) { $value = __a('Featured photos'); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-featen=' . $wppa['featen_count'] . '&wppa-album=' . $wppa['start_album']; $title = __a('View the thumbnails'); wppa_bcitem($value, $thumbhref, $title, 'b8'); } $value = __a('Featured photos'); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif ($wppa['is_related']) { // Related photos if ($wppa['is_slide']) { $value = __a('Related photos'); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-tag=' . $wppa['is_tag'] . '&wppa-album=' . $wppa['start_album']; $title = __a('View the thumbnails'); wppa_bcitem($value, $href, $title, 'b8'); } $value = __a('Related photos'); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif ($wppa['is_tag']) { // Tagged photos if ($wppa['is_slide']) { $value = __a('Tagged photos:') . ' ' . str_replace(';', ' ' . __a('or') . ' ', str_replace(',', ' ' . __a('and') . ' ', trim($wppa['is_tag'], ',;'))); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-tag=' . $wppa['is_tag'] . '&wppa-album=' . $wppa['start_album']; $title = __a('View the thumbnails'); wppa_bcitem($value, $thumbhref, $title, 'b8'); } $value = __a('Tagged photos:') . ' ' . str_replace(';', ' ' . __a('or') . ' ', str_replace(',', ' ' . __a('and') . ' ', trim($wppa['is_tag'], ',;'))); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif ($wppa['is_cat']) { // Categorized albums if ($wppa['is_slide']) { $value = __a('Category:') . ' ' . $wppa['is_cat']; //str_replace( ';', ' '.__a( 'or' ).' ', str_replace( ',', ' '.__a( 'and' ).' ', trim( $wppa['is_tag'], ',;' ) ) ); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-cat=' . $wppa['is_cat'] . '&wppa-album=' . $wppa['start_album']; $title = __a('View the thumbnails'); wppa_bcitem($value, $thumbhref, $title, 'b8'); } $value = __a('Category:') . ' ' . $wppa['is_cat']; //str_replace( ';', ' '.__a( 'or' ).' ', str_replace( ',', ' '.__a( '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&wppa-occur=' . $wppa['occur'] . '&wppa-album=' . $wppa['start_album']; $title = __a('Album:') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7'); } if ($wppa['is_slide']) { $value = __a('Recently updated albums'); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-album=' . $wppa['start_album']; $title = __a('View the thumbnails'); wppa_bcitem($value, $thumbhref, $title, 'b8'); } $value = __a('Recently updated albums'); $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(__a('Various albums by %s'), $dispname); } else { $various = __a('Various albums'); } if ($wppa['is_slide']) { $value = $is_albenum ? $various : wppa_get_album_name($alb); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . $wppa['occur'] . '&wppa-album=' . $wppa['start_album']; $title = $is_albenum ? __a('Albums:') . ' ' . $wppa['start_album'] : __a('Album:') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7'); } $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']) { if (wppa_switch('wppa_bc_slide_thumblink')) { if ($virtual) { if ($thumbhref) { $thumbhref = wppa_trim_wppa_($thumbhref); $fs = wppa_opt('wppa_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="' . __a('Thumbnail view', 'wppa') . '" 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="' . __a('Thumbs', 'wppa_theme') . '" style="' . $imgs . '" />' . '<img id="wppa-tnvh-' . $wppa['mocc'] . '" class="wppa-tnv" src="' . wppa_get_imgdir() . 'application_view_icons_hover.png" alt="' . __a('Thumbs', 'wppa_theme') . '" 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') . "&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('wppa_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="' . __a('Thumbnail view', 'wppa') . '" 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="' . __a('Thumbs', 'wppa_theme') . '" style="' . $imgs . '" />' . '<img id="wppa-tnvh-' . $wppa['mocc'] . '" class="wppa-tnv" src="' . wppa_get_imgdir() . 'application_view_icons_hover.png" alt="' . __a('Thumbs', 'wppa_theme') . '" style="display:none;' . $imgs . '" />' . '</a>'; } } } // Close the breadcrumb box $wppa['out'] .= wppa_nltab('-') . '</div>'; }
function wppa_page_links($npages = '1', $curpage = '1', $slide = false) { if ($npages < '2') { return; } // Nothing to display if (is_feed()) { return; } // Compose the Previous and Next Page urls // Get the main link $link_url = wppa_get_permalink(); $ajax_url = wppa_get_ajaxlink(); // cover if (wppa_get_get('cover')) { $ic = wppa_get_get('cover'); } else { if (wppa('is_cover') == '1') { $ic = '1'; } else { $ic = '0'; } } $extra_url = 'wppa-cover=' . $ic; // occur $occur = wppa('in_widget') ? wppa_get_get('woccur') : wppa_get_get('occur'); $ref_occur = wppa('in_widget') ? wppa('widget_occur') : wppa('occur'); // album if (($occur == $ref_occur || wppa('ajax')) && wppa_get_get('album')) { $alb = wppa_get_get('album'); } elseif (wppa('start_album')) { $alb = wppa('start_album'); } else { $alb = '0'; } $extra_url .= '&wppa-album=' . $alb; // slide or photo if ($slide) { $extra_url .= '&wppa-slide=1'; } elseif (wppa_get_get('photo')) { $extra_url .= '&wppa-photo=' . wppa_get_get('photo'); } // occur if (!wppa('ajax')) { $occur = wppa('in_widget') ? wppa('widget_occur') : wppa('occur'); $w = wppa('in_widget') ? 'w' : ''; $extra_url .= '&wppa-' . $w . 'occur=' . $occur; } else { if (wppa_get_get('occur')) { $occur = wppa_get_get('occur'); $extra_url .= '&wppa-occur=' . strval(intval($occur)); } elseif (wppa_get_get('woccur')) { $occur = wppa_get_get('woccur'); $extra_url .= '&wppa-woccur=' . strval(intval($occur)); } else { $extra_url .= '&wppa-occur=' . wppa('occur'); // Should never get here? } } // Topten? if (wppa('is_topten')) { $extra_url .= '&wppa-topten=' . wppa('topten_count'); } // Lasten? if (wppa('is_lasten')) { $extra_url .= '&wppa-lasten=' . wppa('lasten_count'); } // Comten? if (wppa('is_comten')) { $extra_url .= '&wppa-comten=' . wppa('comten_count'); } // Featen? if (wppa('is_featen')) { $extra_url .= '&wppa-featen=' . wppa('featen_count'); } // Tag? if (wppa('is_tag') && !wppa('is_related')) { $extra_url .= '&wppa-tag=' . wppa('is_tag'); } // Search? if (wppa('src') && !wppa('is_related')) { $extra_url .= '&wppa-searchstring=' . urlencode(wppa('searchstring')); } // Supersearch? if (wppa('supersearch')) { $extra_url .= '&wppa-supersearch=' . urlencode(wppa('supersearch')); } // Related if (wppa('is_related')) { $extra_url .= '&wppa-rel=' . wppa('is_related') . '&wppa-relcount=' . wppa('related_count'); } // Uploader? if (wppa('is_upldr')) { $extra_url .= '&wppa-upldr=' . wppa('is_upldr'); } // Photos only? if (wppa('photos_only')) { $extra_url .= '&wppa-photos-only=1'; } // Albums only? if (wppa('albums_only')) { $extra_url .= '&wppa-albums-only=1'; } // Almost ready $link_url .= $extra_url; $ajax_url .= $extra_url; // Compress $link_url = wppa_trim_wppa_($link_url); $ajax_url = wppa_trim_wppa_($ajax_url); // Adjust display range $from = 1; $to = $npages; if ($npages > wppa_opt('wppa_pagelinks_max')) { $delta = floor(wppa_opt('wppa_pagelinks_max') / 2); $from = $curpage - $delta; $to = $curpage + $delta; while ($from < '1') { $from++; $to++; } while ($to > $npages) { $from--; $to--; } } // Doit wppa_out("\n" . '<div class="wppa-nav-text wppa-box wppa-nav" style="clear:both; text-align:center; ' . __wcs('wppa-box') . __wcs('wppa-nav') . '" >'); $vis = $curpage == '1' ? 'visibility: hidden;' : ''; wppa_out('<div style="float:left; text-align:left; ' . $vis . '">'); wppa_out('<span class="wppa-arrow" style="' . __wcs('wppa-arrow') . 'cursor: default;">« </span>'); if (wppa_switch('wppa_allow_ajax')) { wppa_out('<a style="cursor:pointer;" onclick="wppaDoAjaxRender(' . wppa('mocc') . ', \'' . $ajax_url . '&wppa-page=' . ($curpage - 1) . '\', \'' . wppa_convert_to_pretty($link_url . '&wppa-page=' . ($curpage - 1)) . '\')" >' . __a('Previous') . '</a>'); } else { wppa_out(wppa_nltab() . '<a style="cursor:pointer;" href="' . $link_url . '&wppa-page=' . ($curpage - 1) . '" >' . __a('Previous') . '</a>'); } wppa_out('</div><!-- #prev-page -->'); $vis = $curpage == $npages ? 'visibility: hidden;' : ''; wppa_out('<div style="float:right; text-align:right; ' . $vis . '">'); if (wppa_switch('wppa_allow_ajax')) { wppa_out('<a style="cursor:pointer;" onclick="wppaDoAjaxRender(' . wppa('mocc') . ', \'' . $ajax_url . '&wppa-page=' . ($curpage + 1) . '\', \'' . wppa_convert_to_pretty($link_url . '&wppa-page=' . ($curpage + 1)) . '\')" >' . __a('Next') . '</a>'); } else { wppa_out('<a style="cursor:pointer;" href="' . $link_url . '&wppa-page=' . ($curpage + 1) . '" >' . __a('Next') . '</a>'); } wppa_out('<span class="wppa-arrow" style="' . __wcs('wppa-arrow') . 'cursor: default;"> »</span>'); wppa_out('</div><!-- #next-page -->'); if ($from > '1') { wppa_out('. . . '); } for ($i = $from; $i <= $to; $i++) { if ($curpage == $i) { wppa_out('<div class="wppa-mini-box wppa-alt wppa-black" style="display:inline; text-align:center; ' . __wcs('wppa-mini-box') . __wcs('wppa-alt') . __wcs('wppa-black') . ' text-decoration: none; cursor: default; font-weight:normal; " >'); wppa_out(' ' . $i . ' '); wppa_out('</div>'); } else { wppa_out('<div class="wppa-mini-box wppa-even" style="display:inline; text-align:center; ' . __wcs('wppa-mini-box') . __wcs('wppa-even') . '" >'); if (!$slide && wppa_switch('wppa_allow_ajax') || $slide && wppa_switch('wppa_slideshow_page_allow_ajax')) { wppa_out('<a style="cursor:pointer;" onclick="wppaDoAjaxRender(' . wppa('mocc') . ', \'' . $ajax_url . '&wppa-page=' . $i . '\', \'' . wppa_convert_to_pretty($link_url . '&wppa-page=' . $i) . '\')"> ' . $i . ' </a>'); } else { wppa_out('<a style="cursor:pointer;" href="' . $link_url . '&wppa-page=' . $i . '"> ' . $i . ' </a>'); } wppa_out('</div>'); } } if ($to < $npages) { wppa_out(' . . .'); } wppa_out('</div><!-- #prevnext-a-' . wppa('mocc') . ' -->'); }
function wppa_sphoto() { global $wppa; $id = $wppa['single_photo']; $width = wppa_get_container_width(); $height = floor($width / wppa_get_ratio($id)); $usethumb = wppa_use_thumb_file($id, $width, $height); $src = $usethumb ? wppa_get_thumb_url($id, '', $width, $height) : wppa_get_photo_url($id, '', $width, $height); if (wppa_has_audio($id)) { $src = wppa_fix_poster_ext($src, $id); } if (!$wppa['in_widget']) { wppa_bump_viewcount('photo', $id); } $autocol = $wppa['auto_colwidth'] || $width > 0 && $width <= 1.0; // The initial width is $width if not autocol, else it should default to initial column width when auto // or initial column width * fraction if ($autocol) { if ($width == 'auto') { $contwidth = wppa_opt('initial_colwidth'); } else { $contwidth = wppa_opt('initial_colwidth') * $width; } } else { $contwidth = $width; } // Open the pseudo container $wppa['out'] .= '<div id="wppa-container-' . $wppa['mocc'] . '" class="'; if ($wppa['align'] != '') { $wppa['out'] .= ' align' . $wppa['align']; } $wppa['out'] .= ' wppa-sphoto-' . $wppa['mocc']; $wppa['out'] .= '" style="width: ' . $contwidth . 'px; position:relative;">'; // The script for responsive wppa_add_js_page_data(wppa_nltab() . '<script type="text/javascript">'); if ($autocol) { wppa_add_js_page_data(wppa_nltab() . 'wppaAutoColumnWidth[' . $wppa['mocc'] . '] = true;'); if ($width > 0 && $width <= 1.0) { wppa_add_js_page_data(wppa_nltab() . 'wppaAutoColumnFrac[' . $wppa['mocc'] . '] = ' . $width . ';'); } else { wppa_add_js_page_data(wppa_nltab() . 'wppaAutoColumnFrac[' . $wppa['mocc'] . '] = 1.0;'); } wppa_add_js_page_data(wppa_nltab() . 'wppaColWidth[' . $wppa['mocc'] . '] = 0;'); } wppa_add_js_page_data(wppa_nltab() . 'wppaTopMoc = ' . $wppa['mocc'] . ';'); wppa_add_js_page_data(wppa_nltab() . '</script>'); $wppa['portrait_only'] = true; $fis = wppa_get_fullimgstyle_a($id); $width = $fis['width']; $height = $fis['height']; $style = $fis['style']; $style .= 'box-sizing:content-box;vertical-align:middle;'; /* // Add audio? sphoto if ( wppa_has_audio( $id ) ) { $wppa['out'] .= '<div style="position:relative;z-index:11;" >'; $is_safari = strpos( $_SERVER["HTTP_USER_AGENT"], 'Safari' ); $cont_h = $is_safari ? 16 : 28; $audiotop = $height - $cont_h; $wppa['out'] .= wppa_get_audio_html( array( 'id' => $id, 'width' => $width, 'cursor' => 'cursor:pointer;', 'style' => $style.'position:absolute;top:'.$audiotop.'px;left:0;height:'.$cont_h.'px;',//padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;width:98.5%;', 'class' => 'size-medium wppa-sphoto wppa-simg-'.$wppa['mocc'] /* 'id' => $id, 'cursor' => 'cursor:pointer;', 'style' => $style.'height:auto;', 'class' => 'size-medium wppa-sphoto wppa-simg-'.$wppa['mocc'] * ) ); $wppa['out'] .= '</div>'; } */ // The link $link = wppa_get_imglnk_a('sphoto', $id); if ($link) { if ($link['is_lightbox']) { $lbtitle = wppa_get_lbtitle('sphoto', $id); $videobody = esc_attr(wppa_get_video_body($id)); $audiobody = esc_attr(wppa_get_audio_body($id)); $videox = wppa_get_videox($id); $videoy = wppa_get_videoy($id); $wppa['out'] .= '<a' . ' href="' . $link['url'] . '"' . ($lbtitle ? ' ' . wppa('lbtitle') . '="' . $lbtitle . '"' : '') . ($videobody ? ' data-videohtml="' . $videobody . '"' : '') . ($audiobody ? ' data-audiohtml="' . $audiobody . '"' : '') . ($videox ? ' data-videonatwidth="' . $videox . '"' : '') . ($videoy ? ' data-videonatheight="' . $videoy . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '"' . ($link['target'] ? ' target="' . $link['target'] . '"' : '') . ' class="thumb-img"' . ' id="a-' . $id . '-' . $wppa['mocc'] . '"' . ' >'; } else { $wppa['out'] .= '<a' . ' href="' . $link['url'] . '"' . ' title="' . $link['title'] . '"' . ' target="' . $link['target'] . '"' . ' class="thumb-img"' . ' id="a-' . $id . '-' . $wppa['mocc'] . '"' . ' >'; } } // The image $title = $link ? esc_attr($link['title']) : esc_attr(stripslashes(wppa_get_photo_name($id))); if ($link['is_lightbox']) { $style .= ' cursor:url( ' . wppa_get_imgdir() . wppa_opt('magnifier') . ' ),pointer;'; $title = wppa_zoom_in($id); } if (wppa_is_video($id)) { if ($autocol) { $wppa['out'] .= wppa_get_video_html(array('id' => $id, 'controls' => !$link['is_lightbox'], 'style' => $style, 'class' => 'size-medium wppa-sphoto wppa-simg-' . $wppa['mocc'])); } else { $wppa['out'] .= wppa_get_video_html(array('id' => $id, 'width' => $width, 'height' => $height, 'controls' => !$link['is_lightbox'], 'style' => $style, 'class' => 'size-medium wppa-sphoto wppa-simg-' . $wppa['mocc'])); } } else { $wppa['out'] .= '<img' . ' src="' . $src . '"' . ' ' . wppa_get_imgalt($id) . ' class="size-medium wppa-sphoto wppa-simg-' . $wppa['mocc'] . '"' . ' ' . wppa_get_imgalt($id) . ($title ? ' title="' . $title . '" ' : '') . ' style="' . $style . '"' . ($autocol ? '' : ' width="' . $width . '" height="' . $height . '" ') . '/>'; } // Close the link if ($link) { $wppa['out'] .= '</a>'; } // Add audio? sphoto if (wppa_has_audio($id)) { $wppa['out'] .= '<div style="position:relative;z-index:11;" >'; $margl = wppa_opt('wppa_fullimage_border_width') === '' ? 0 : wppa_opt('wppa_fullimage_border_width') + 1; $margb = $margl; $wppa['out'] .= wppa_get_audio_html(array('id' => $id, 'cursor' => 'cursor:pointer;', 'style' => $style . 'position:absolute;left:' . $margl . 'px;bottom:' . $margb . 'px;padding:0;margin:0;border:none;height:' . wppa_get_audio_control_height() . 'px;border-radius:0;', 'class' => 'size-medium wppa-sphoto wppa-simg-' . $wppa['mocc'])); $wppa['out'] .= '</div>'; } // The pseudo container $wppa['out'] .= '</div>'; }
function wppa_the_slideshow_browse_link($photocount, $href_slideshow, $onclick_slideshow, $target) { global $wppa; if (wppa_switch('wppa_show_slideshowbrowselink')) { $wppa['out'] .= wppa_nltab('+') . '<div class="wppa-box-text wppa-black wppa-info wppa-slideshow-browse-link">'; if ($photocount > wppa_get_mincount()) { $label = wppa_switch('wppa_enable_slideshow') ? __a('Slideshow') : __a('Browse photos'); if ($href_slideshow == '#') { $wppa['out'] .= wppa_nltab() . '<a onclick="' . $onclick_slideshow . '" title="' . $label . '" style="' . __wcs('wppa-box-text-nocolor') . '" >' . $label . '</a>'; } else { $wppa['out'] .= wppa_nltab() . '<a href="' . $href_slideshow . '" target="' . $target . '" onclick="' . $onclick_slideshow . '" title="' . $label . '" style="' . __wcs('wppa-box-text-nocolor') . '" >' . $label . '</a>'; } } else { $wppa['out'] .= ' '; } $wppa['out'] .= wppa_nltab('-') . '</div>'; } }
function wppa_errorbox($text) { global $wppa; $wppa['out'] .= wppa_nltab('+') . '<div id="error-' . $wppa['mocc'] . '" class="wppa-box wppa-box-text wppa-nav wppa-errorbox " style="text-align: center; ' . __wcs('wppa-box') . __wcs('wppa-box-text') . __wcs('wppa-nav') . '">'; $wppa['out'] .= wppa_nltab() . $text; $wppa['out'] .= wppa_nltab('-') . '</div><!-- #error -->'; }
function wppa_bestof_box($args) { global $wppa; wppa_container('open'); $wppa['out'] .= wppa_nltab('+') . '<div id="wppa-bestof-' . $wppa['mocc'] . '" class="wppa-box wppa-bestof" style="' . __wcs('wppa-box') . __wcs('wppa-bestof') . '">'; $wppa['out'] .= wppa_bestof_html($args, false); $wppa['out'] .= wppa_nltab('-') . '<div style="clear:both; height:4px;"></div></div>'; wppa_container('close'); }