function wppa_get_statistics() { $count = wppa_get_total_album_count(); $y_id = wppa_get_youngest_album_id(); $y_name = __(wppa_get_album_name($y_id)); $p_id = wppa_get_parentalbumid($y_id); $p_name = __(wppa_get_album_name($p_id)); $result = '<div class="wppa-box wppa-nav" style="text-align: center; ' . __wcs('wppa-box') . __wcs('wppa-nav') . '">'; $result .= __a('There are') . ' ' . $count . ' ' . __a('photo albums. The last album added is') . ' '; $result .= '<a href="' . wppa_get_permalink() . 'wppa-album=' . $y_id . '&wppa-cover=0&wppa-occur=1">' . $y_name . '</a>'; if ($p_id > '0') { $result .= __a(', a subalbum of') . ' '; $result .= '<a href="' . wppa_get_permalink() . 'wppa-album=' . $p_id . '&wppa-cover=0&wppa-occur=1">' . $p_name . '</a>'; } $result .= '.</div>'; return $result; }
function wppa_errorbox($text) { wppa_out('<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') . '"' . ' >' . $text . '</div>'); }
function wppa_the_thumbascoverphoto($id, $src, $photo_left, $link, $imgattr_a, $events) { $result = ''; $href = $link['url']; $title = $link['title']; $imgattr = $imgattr_a['style']; $imgwidth = $imgattr_a['width']; $imgheight = $imgattr_a['height']; $frmwidth = $imgwidth + '10'; // + 2 * 1 border + 2 * 4 padding if (!$src) { return ''; } if (wppa_in_widget()) { $photoframestyle = 'style="text-align:center;"'; } else { $photoframestyle = $photo_left ? 'style="float:left; margin-right:5px;width:' . $frmwidth . 'px;"' : 'style="float:right; margin-left:5px;width:' . $frmwidth . 'px;"'; } $result .= '<div' . ' id="thumbphoto_frame_' . $id . '_' . wppa('mocc') . '"' . ' class="thumbphoto-frame"' . ' ' . $photoframestyle . '>'; if ($link['is_lightbox']) { $href = wppa_get_hires_url($id); $cursor = ' cursor:url( ' . wppa_get_imgdir() . wppa_opt('magnifier') . ' ),pointer;'; $result .= '<a' . ' href="' . $href . '"' . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '[occ' . wppa('mocc') . ']"' . ($title ? ' ' . wppa('lbtitle') . '="' . $title . '"' : '') . ' >'; if (wppa_is_video($id)) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => false, 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'lb' => false, 'class' => 'image wppa-img', 'style' => __wcs('wppa-img') . $imgattr . $cursor)); } else { $result .= '<img' . ' src="' . $src . '"' . ' ' . wppa_get_imgalt($id) . ' class="image wppa-img"' . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . __wcs('wppa-img') . $imgattr . $cursor . '"' . ' ' . $events . ' />'; } $result .= '</a>'; } elseif ($link['is_url']) { $result .= '<a' . ' href="' . $href . '"' . ($title ? ' title="' . $title . '"' : '') . ' >'; if (wppa_is_video($id)) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => false, 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'lb' => false, 'class' => 'image wppa-img', 'style' => __wcs('wppa-img') . $imgattr)); } else { $result .= '<img' . ' src="' . $src . '"' . ' ' . wppa_get_imgalt($id) . ' class="image wppa-img"' . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . __wcs('wppa-img') . $imgattr . '"' . ' ' . $events . ' />'; } $result .= '</a>'; } else { if (wppa_is_video($id)) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => false, 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => $href, 'lb' => false, 'class' => 'image wppa-img', 'style' => __wcs('wppa-img') . $imgattr)); } else { $result .= '<img' . ' src="' . $src . '"' . ' ' . wppa_get_imgalt($id) . ' class="image wppa-img"' . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . __wcs('wppa-img') . $imgattr . '"' . ' ' . $events . ' onclick="' . $href . '"' . ' />'; } } $result .= '</div>'; return $result; }
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'); } // Calendar ? if (wppa('calendar')) { $extra_url .= '&wppa-calendar=' . wppa('calendar') . '&wppa-caldate=' . wppa('caldate'); } // Photos only? if (wppa('photos_only')) { $extra_url .= '&wppa-photos-only=1'; } // Albums only? if (wppa('albums_only')) { $extra_url .= '&wppa-albums-only=1'; } // Inverse? if (wppa('is_inverse')) { $extra_url .= '&wppa-inv=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('pagelinks_max')) { $delta = floor(wppa_opt('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)) . '\')" >' . __('Previous', 'wp-photo-album-plus') . '</a>'); } else { wppa_out('<a style="cursor:pointer;" href="' . $link_url . '&wppa-page=' . ($curpage - 1) . '" >' . __('Previous', 'wp-photo-album-plus') . '</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)) . '\')" >' . __('Next', 'wp-photo-album-plus') . '</a>'); } else { wppa_out('<a style="cursor:pointer;" href="' . $link_url . '&wppa-page=' . ($curpage + 1) . '" >' . __('Next', 'wp-photo-album-plus') . '</a>'); } wppa_out('<span class="wppa-arrow" style="' . __wcs('wppa-arrow') . 'cursor: default;"> »</span>'); wppa_out('</div><!-- #next-page -->'); // The numbered pagelinks ? if (wppa_opt('pagelinks_max')) { 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(' . . .'); } } else { wppa_out($curpage . '/' . $npages); } wppa_out('</div><!-- #prevnext-a-' . wppa('mocc') . ' -->'); }
function wppa_get_text_frame_style($photo_left, $type) { if (wppa_in_widget()) { $result = ''; } else { if ($type == 'thumb') { $width = wppa_get_cover_width($type); $width -= 13; // margin $width -= 2; // border $width -= wppa_opt('smallsize'); if ($photo_left) { $result = 'style="width:' . $width . 'px; float:right;"'; } else { $result = 'style="width:' . $width . 'px; float:left;"'; } } elseif ($type == 'cover') { $width = wppa_get_cover_width($type); $photo_pos = $photo_left; switch ($photo_pos) { case 'left': $width -= 13; // margin $width -= 2; // border $width -= wppa_opt('smallsize'); $result = 'style="width:' . $width . 'px; float:right;' . __wcs('wppa-cover-text-frame') . '"'; break; case 'right': $width -= 13; // margin $width -= 2; // border $width -= wppa_opt('smallsize'); $result = 'style="width:' . $width . 'px; float:left;' . __wcs('wppa-cover-text-frame') . '"'; break; case 'top': // $width -= 13; $result = 'style="' . __wcs('wppa-cover-text-frame') . '"'; //'style="width:'.$width.'px;"'; break; case 'bottom': // $width -= 13; $result = 'style="' . __wcs('wppa-cover-text-frame') . '"'; //'style="width:'.$width.'px;"'; break; default: wppa_dbg_msg('Illegal $photo_pos in wppa_get_text_frame_style', 'red'); } } else { wppa_dbg_msg('Illegal $type in wppa_get_text_frame_style', 'red'); } } return $result; }
function wppa_bcitem($value = '', $href = '', $title = '', $class = '', $ajax = '') { static $sep; // Convert url to pretty $href = wppa_convert_to_pretty($href); // Has content? if (!$value) { return; } // No content if ($href) { wppa_out('<a' . ($ajax && wppa_switch('allow_ajax') ? ' onclick="wppaDoAjaxRender(' . wppa('mocc') . ', \'' . $ajax . '\', \'' . $href . '\' );"' : ' href="' . $href . '"') . ' class="wppa-nav-text ' . $class . '"' . ' style="' . __wcs('wppa-nav-text') . '"' . ' title="' . esc_attr($title) . '" >' . $value . '</a>'); } else { // No link, its the last item wppa_out('<span' . ' id="bc-pname-' . wppa('mocc') . '"' . ' class="wppa-nav-text ' . $class . '"' . ' style="' . ($title ? 'cursor:pointer;' : '') . __wcs('wppa-nav-text') . '"' . ' title="' . esc_attr($title) . '"' . ' >' . $value . '</span>'); return; } // Add seperator if (!$sep) { // Compute the seperator $temp = wppa_opt('bc_separator'); switch ($temp) { case 'url': $size = wppa_opt('fontsize_nav'); if ($size == '') { $size = '12'; } $style = 'height:' . $size . 'px;'; $sep = ' ' . '<img' . ' src="' . wppa_opt('bc_url') . '"' . ' class="no-shadow"' . ' style="' . $style . '"' . ' />' . ' '; break; case 'txt': $sep = ' ' . html_entity_decode(stripslashes(wppa_opt('bc_txt')), ENT_QUOTES) . ' '; break; default: $sep = ' &' . $temp . '; '; } } wppa_out('<span' . ' class="wppa-nav-text ' . $class . '"' . ' style="' . __wcs('wppa-nav-text') . '"' . ' >' . $sep . '</span>'); }
function wppa_stereo_box() { // Init $result = ''; // No search box on feeds if (is_feed()) { return; } // Open container wppa_container('open'); // Open wrapper $result .= "\n"; $result .= '<div' . ' id="wppa-stereo-' . wppa('mocc') . '"' . ' class="wppa-box wppa-stereo"' . ' style="' . __wcs('wppa-box') . __wcs('wppa-stereo') . '"' . ' >'; // The search html $result .= wppa_get_stereo_html(); // Clear both $result .= '<div class="wppa-clear" style="' . __wis('clear:both;') . '" ></div>'; // Close wrapper $result .= '</div>'; // Output wppa_out($result); // Close container wppa_container('close'); }
function wppa_bcitem($value = '', $href = '', $title = '', $class = '') { global $wppa; static $sep; // Convert url to pretty $href = wppa_convert_to_pretty($href); // Has content? if (!$value) { return; } // No content if ($href) { $wppa['out'] .= '<a href="' . $href . '" class="wppa-nav-text ' . $class . '" style="' . __wcs('wppa-nav-text') . '" title="' . esc_attr($title) . '" >' . $value . '</a>'; } else { // No link, its the last item $wppa['out'] .= '<span id="bc-pname-' . $wppa['mocc'] . '" class="wppa-nav-text ' . $class . '" style="' . __wcs('wppa-nav-text') . '" title="' . esc_attr($title) . '" >' . $value . '</span>'; return; } // Add seperator if (!$sep) { // Compute the seperator $temp = wppa_opt('wppa_bc_separator'); switch ($temp) { case 'url': $size = wppa_opt('wppa_fontsize_nav'); if ($size == '') { $size = '12'; } $style = 'height:' . $size . 'px;'; $sep = ' <img src="' . wppa_opt('wppa_bc_url') . '" class="no-shadow" style="' . $style . '" /> '; break; case 'txt': $sep = ' ' . html_entity_decode(stripslashes(wppa_opt('wppa_bc_txt')), ENT_QUOTES) . ' '; break; default: $sep = ' &' . $temp . '; '; } } $wppa['out'] .= '<span class="wppa-nav-text ' . $class . '" style="' . __wcs('wppa-nav-text') . '" >' . $sep . '</span>'; }
function wppa_the_slideshow_browse_link($photocount, $href_slideshow, $onclick_slideshow, $target) { if (wppa_switch('show_slideshowbrowselink')) { wppa_out('<div class="wppa-box-text wppa-black wppa-info wppa-slideshow-browse-link">'); if ($photocount > wppa_get_mincount()) { $label = wppa_switch('enable_slideshow') ? __('Slideshow', 'wp-photo-album-plus') : __('Browse photos', 'wp-photo-album-plus'); if ($href_slideshow == '#') { wppa_out('<a onclick="' . $onclick_slideshow . '" title="' . $label . '" style="cursor:pointer;' . __wcs('wppa-box-text-nocolor') . '" >' . $label . '</a>'); } else { wppa_out('<a href="' . $href_slideshow . '" target="' . $target . '" onclick="' . $onclick_slideshow . '" title="' . $label . '" style="cursor:pointer;' . __wcs('wppa-box-text-nocolor') . '" >' . $label . '</a>'); } } else { wppa_out(' '); } 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_bcitem($value = '', $href = '', $title = '', $class = '', $ajax = '', $hash = '#wppa-container-') { static $sep; // Encrypt if ($href) { $href = wppa_encrypt_url($href); } if ($ajax) { $ajax = wppa_encrypt_url($ajax); } // Convert url to pretty if ($href) { $href = wppa_convert_to_pretty($href) . $hash . wppa('mocc'); } // Has content? if (!$value) { return; } // No content // If in ajax modal dialog, distinguish from original bc for update during slideshow $bc_pname = 'bc-pname-'; if (wppa('ajax') && wppa_switch('ajax_render_modal')) { $bc_pname = 'bc-pname-modal-'; } if ($href) { wppa_out('<a' . ($ajax && wppa_switch('allow_ajax') ? ' onclick="wppaDoAjaxRender(' . wppa('mocc') . ', \'' . $ajax . '\', \'' . $href . '\' );"' : ' href="' . $href . '"') . ' class="wppa-nav-text ' . $class . '"' . ' style="cursor:pointer;' . __wcs('wppa-nav-text') . '"' . ' title="' . esc_attr($title) . '" >' . $value . '</a>'); } else { // No link, its the last item wppa_out('<span' . ' id="' . $bc_pname . wppa('mocc') . '"' . ' class="wppa-nav-text ' . $class . '"' . ' style="' . ($title ? 'cursor:pointer;' : '') . __wcs('wppa-nav-text') . '"' . ' title="' . esc_attr($title) . '"' . ' >' . $value . '</span>'); return; } // Add seperator if (!$sep) { // Compute the seperator $temp = wppa_opt('bc_separator'); switch ($temp) { case 'url': $size = wppa_opt('fontsize_nav'); if ($size == '') { $size = '12'; } $style = 'height:' . $size . 'px;'; $sep = ' ' . '<img' . ' src="' . wppa_opt('bc_url') . '"' . ' class="no-shadow"' . ' style="' . $style . '"' . ' />' . ' '; break; case 'txt': $sep = ' ' . html_entity_decode(stripslashes(wppa_opt('bc_txt')), ENT_QUOTES) . ' '; break; default: $sep = ' &' . $temp . '; '; } } wppa_out('<span' . ' class="wppa-nav-text ' . $class . '"' . ' style="' . __wcs('wppa-nav-text') . '"' . ' >' . $sep . '</span>'); }
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'); }