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_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_do_filmthumb($id, $idx, $do_for_feed = false, $glue = false) { $thumb = wppa_cache_thumb($id); $result = ''; $src = wppa_fix_poster_ext(wppa_get_thumb_path($thumb['id']), $thumb['id']); $max_size = wppa_opt('thumbsize'); if (wppa_in_widget()) { $max_size /= 2; } $com_alt = wppa('is_comten') && wppa_switch('comten_alt_display') && !wppa_in_widget(); $imgattr_a = wppa_get_imgstyle_a($thumb['id'], $src, $max_size, 'optional', 'fthumb'); $imgstyle = $imgattr_a['style']; $imgwidth = $imgattr_a['width']; $imgheight = $imgattr_a['height']; $cursor = $imgattr_a['cursor']; $url = wppa_fix_poster_ext(wppa_get_thumb_url($thumb['id'], '', $imgwidth, $imgheight), $thumb['id']); $furl = str_replace('/thumbs', '', $url); $events = wppa_get_imgevents('film', $thumb['id'], 'nopopup', $idx); $thumbname = wppa_get_photo_name($thumb['id']); $target = wppa_switch('film_blank') || $thumb['linktarget'] == '_blank' ? 'target="_blank" ' : ''; $psotitle = $thumb['linktitle'] ? 'title="' . esc_attr($thumb['linktitle']) . '" ' : ''; $psourl = wppa_switch('film_overrule') && $thumb['linkurl'] ? 'href="' . $thumb['linkurl'] . '" ' . $target . $psotitle : ''; $imgalt = wppa_get_imgalt($thumb['id']); if (wppa_opt('film_linktype') == 'lightbox') { // $title = esc_attr( wppa_zoom_in( $thumb['id'] ) ); } else { $events .= ' onclick="wppaGotoKeepState( ' . wppa('mocc') . ', ' . $idx . ' )"'; $events .= ' ondblclick="wppaStartStop( ' . wppa('mocc') . ', -1 )"'; } if (is_feed()) { if ($do_for_feed) { $style_a = wppa_get_imgstyle_a($thumb['id'], $src, '100', '4', 'thumb'); $style = $style_a['style']; $result .= '<a href="' . get_permalink() . '">' . '<img' . ' src="' . $url . '"' . ' ' . $imgalt . ' title="' . $thumbname . '"' . ' style="' . $style . '"' . ' />' . '</a>'; } } else { // If ! $do_for_feed: pre-or post-ambule. To avoid dup id change it in that case $tmp = $do_for_feed ? 'film' : 'pre'; $style = $glue ? 'style="' . wppa_get_thumb_frame_style($glue, 'film') . '"' : ''; $result .= '<div' . ' id="' . $tmp . '_wppatnf_' . $thumb['id'] . '_' . wppa('mocc') . '"' . ' class="thumbnail-frame"' . ' ' . $style . ' >'; if ($psourl) { // True only when pso activated and data present $result .= '<a ' . $psourl . '>'; // $psourl contains url, target and title } elseif (wppa_opt('film_linktype') == 'lightbox' && $tmp == 'film') { $title = wppa_get_lbtitle('slide', $thumb['id']); $videohtml = esc_attr(wppa_get_video_body($thumb['id'])); $audiohtml = esc_attr(wppa_get_audio_body($thumb['id'])); $result .= '<a href="' . $furl . '"' . ($videohtml ? ' data-videohtml="' . $videohtml . '"' . ' data-videonatwidth="' . wppa_get_videox($thumb['id']) . '"' . ' data-videonatheight="' . wppa_get_videoy($thumb['id']) . '"' : '') . ($audiohtml ? ' data-audiohtml="' . $audiohtml . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '[occ' . wppa('mocc') . ']"' . ($title ? ' ' . wppa('lbtitle') . '="' . $title . '"' : '') . ' >'; } if ($tmp == 'pre' && wppa_opt('film_linktype') == 'lightbox') { $cursor = 'cursor:default;'; } if ($tmp == 'film' && !$com_alt && !wppa_cdn('front') && !wppa_switch('lazy_or_htmlcomp')) { $result .= '<!--'; } if (wppa_is_video($thumb['id'])) { $result .= wppa_get_video_html(array('id' => $thumb['id'], 'width' => $imgattr_a['width'], 'height' => $imgattr_a['height'], 'controls' => false, 'margin_top' => $imgattr_a['margin-top'], 'margin_bottom' => $imgattr_a['margin-bottom'], 'cursor' => $imgattr_a['cursor'], 'events' => $events, 'tagid' => 'wppa-' . $tmp . '-' . $idx . '-' . wppa('mocc'))); } else { $result .= '<img' . ' id="wppa-' . $tmp . '-' . $idx . '-' . wppa('mocc') . '"' . ' class="wppa-' . $tmp . '-' . wppa('mocc') . '"' . ' src="' . $url . '"' . ' ' . $imgalt . ' style="' . $imgstyle . $cursor . '"' . ' ' . $events . ' data-title="' . ($psourl ? esc_attr($thumb['linktitle']) : '') . '"' . ' />'; } if ($tmp == 'film' && !$com_alt && !wppa_cdn('front') && !wppa_switch('lazy_or_htmlcomp')) { $result .= '-->'; } if ($psourl) { // True only when pso activated and data present $result .= '</a>'; // $psourl contains url, target and title } elseif (wppa_opt('film_linktype') == 'lightbox' && $tmp == 'film') { $result .= '</a>'; } $result .= '</div>'; } wppa_out($result); }
function wppa_sphoto() { $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="' . (wppa('align') ? 'align' . wppa('align') : '') . ' wppa-sphoto-' . wppa('mocc') . '"' . ' style="width:' . $contwidth . 'px;position:relative;"' . ' >'); // The script for responsive wppa_add_js_page_data("\n" . '<script type="text/javascript">'); if ($autocol) { wppa_add_js_page_data("\n" . 'wppaAutoColumnWidth[' . wppa('mocc') . '] = true;'); if ($width > 0 && $width <= 1.0) { wppa_add_js_page_data("\n" . 'wppaAutoColumnFrac[' . wppa('mocc') . '] = ' . $width . ';'); } else { wppa_add_js_page_data("\n" . 'wppaAutoColumnFrac[' . wppa('mocc') . '] = 1.0;'); } wppa_add_js_page_data("\n" . 'wppaColWidth[' . wppa('mocc') . '] = 0;'); } wppa_add_js_page_data("\n" . 'wppaTopMoc = ' . wppa('mocc') . ';'); wppa_add_js_page_data("\n" . '</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;'; // 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('fullimage_border_width') === '' ? 0 : wppa_opt('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_album_download_link($albumid) { if (!wppa_switch('allow_download_album')) { return; } // Not enabled wppa_out('<div style="clear:both;" ></div>'); wppa_out('<a onclick="wppaAjaxDownloadAlbum(' . wppa('mocc') . ', ' . $albumid . ' );" style="cursor:pointer;" title="' . __('Download', 'wp-photo-album-plus') . '">' . __('Download album', 'wp-photo-album-plus') . '</a>'); wppa_out('<img id="dwnspin-' . wppa('mocc') . '-' . $albumid . '" src="' . wppa_get_imgdir() . 'wpspin.gif" style="margin-left:6px; display:none;" alt="spin" />'); }
function wppa_smx_photo($stype) { $id = wppa('single_photo'); $width = wppa_get_container_width(); $style = wppa_get_container_style(); // wrapper for maximized auto wppa_container_wrapper('open'); // Open the pseudo container // The container defines size ( fixed pixels or percent ) and position ( left, center, right or default ) of the image wppa_out('<div' . ' id="wppa-container-' . wppa('mocc') . '"' . ' class="' . (wppa('align') ? 'align' . wppa('align') : '') . ' wppa-' . $stype . 'photo' . ' wppa-' . $stype . 'photo-' . wppa('mocc') . ($stype == 'm' || $stype == 'x' ? ' wp-caption' : '') . '"' . ' style="' . $style . '"' . ' >'); // The image html $html = wppa_get_picture_html(array('id' => $id, 'type' => $stype . 'photo', 'class' => 'size-medium wppa-' . $stype . 'photo')); wppa_out($html); // The subext if any if ($stype == 'm' || $stype == 'x') { // The subtitle wppa_out('<p class="wp-caption-text">' . wppa_get_photo_desc($id) . '</p>'); // The rating, only on xphoto when enabled in II-B7 if ($stype == 'x' && wppa_switch('rating_on')) { wppa_out(wppa_get_rating_range_html($id, false, 'wp-caption-text')); } // The share buttons on mphoto if enabled in II-C6, and on xphoto when enabled in II-C1 if (wppa_switch('share_on_mphoto') || $stype == 'x') { wppa_out(wppa_get_share_html($id, 'mphoto', false, true)); } // The commentform on xphoto when enabled in II-B10 if ($stype == 'x' && wppa_switch('show_comments')) { wppa_out('<div id="wppa-comments-' . wppa('mocc') . '" >'); wppa_out(wppa_comment_html($id, !wppa_switch('comment_login') || is_user_logged_in())); wppa_out('</div>'); } } // The pseudo container wppa_out('</div>'); // Wrapper for maximized auto wppa_container_wrapper('close'); }
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_get_imgstyle_a($id, $file, $xmax_size, $xvalign = '', $type = '') { $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('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('fullimage_border_width'); } } else { $max_size = $xmax_size; } $ratioref = wppa_opt('maxheight') / wppa_opt('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('coversize_is_height') && (wppa_opt('coverphoto_pos') == 'top' || wppa_opt('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('bcolor_img') != '') { // There is a border color given $result['style'] .= ' border: 1px solid ' . wppa_opt('bcolor_img') . ';'; } else { // No border color: no border $result['style'] .= ' border-width: 0px;'; } $result['style'] .= ' width:' . $width . 'px; height:' . $height . 'px;'; if (wppa_switch('use_cover_opacity') && !is_feed()) { $opac = wppa_opt('cover_opacity'); $result['style'] .= ' opacity:' . $opac / 100 . '; filter:alpha( opacity=' . $opac . ' );'; } if (wppa_opt('coverimg_linktype') == 'lightbox') { $result['cursor'] = ' cursor:url( ' . wppa_get_imgdir() . wppa_opt('magnifier') . ' ),pointer;'; } $result['style'] .= 'display:inline;'; 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('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('use_thumb_opacity') && !is_feed()) { $opac = wppa_opt('thumb_opacity'); $result['style'] .= ' opacity:' . $opac / 100 . '; filter:alpha( opacity=' . $opac . ' );'; } // Cursor $linktyp = ''; switch ($type) { case 'thumb': // Normal $linktyp = wppa_opt('thumb_linktype'); break; case 'ttthumb': // Topten v $linktyp = wppa_opt('topten_widget_linktype'); break; case 'comthumb': // Comment widget v $linktyp = wppa_opt('comment_widget_linktype'); break; case 'fthumb': // Filmthumb $linktyp = wppa_opt('film_linktype'); break; case 'twthumb': // Thumbnail widget v $linktyp = wppa_opt('thumbnail_widget_linktype'); break; case 'ltthumb': // Lasten widget v $linktyp = wppa_opt('lasten_widget_linktype'); break; case 'albthumb': // Album widget $linktyp = wppa_opt('album_widget_linktype'); } if ($linktyp == 'none') { $result['cursor'] = ' cursor:default;'; } elseif ($linktyp == 'lightbox') { $result['cursor'] = ' cursor:url(' . wppa_get_imgdir() . wppa_opt('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('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('fullimage_border_width')) { case '': break; case '0': $result['style'] .= ' border: 1px solid ' . wppa_opt('bcolor_fullimg') . ';'; break; default: $result['style'] .= ' border: 1px solid ' . wppa_opt('bcolor_fullimg') . ';'; $result['style'] .= ' background-color:' . wppa_opt('bgcolor_fullimg') . ';'; $result['style'] .= ' padding:' . wppa_opt('fullimage_border_width') . 'px;'; // If we do round corners... if (wppa_opt('bradius') > '0') { // then also here $result['style'] .= ' border-radius:' . wppa_opt('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; }
function wppa_statistics() { wppa_out(wppa_get_statistics()); }
function wppa_ajax_check_range($value, $fixed, $low, $high, $title) { if ($fixed !== false && $fixed == $value) { return; } // User enetred special value correctly if (!is_numeric($value)) { wppa('error', true); } // Must be numeric if not specaial value if ($low !== false && $value < $low) { wppa('error', true); } // Must be >= given min value if ($high !== false && $value > $high) { wppa('error', true); } // Must be <= given max value if (!wppa('error')) { return; } // Still no error, ok // Compose error message if ($low !== false && $high === false) { // Only Minimum given wppa_out(__('Please supply a numeric value greater than or equal to', 'wp-photo-album-plus') . ' ' . $low . ' ' . __('for', 'wp-photo-album-plus') . ' ' . $title); if ($fixed !== false) { if ($fixed) { wppa_out('. ' . __('You may also enter:', 'wp-photo-album-plus') . ' ' . $fixed); } else { wppa_out('. ' . __('You may also leave/set this blank', 'wp-photo-album-plus')); } } } else { // Also Maximum given wppa_out(__('Please supply a numeric value greater than or equal to', 'wp-photo-album-plus') . ' ' . $low . ' ' . __('and less than or equal to', 'wp-photo-album-plus') . ' ' . $high . ' ' . __('for', 'wp-photo-album-plus') . ' ' . $title); if ($fixed !== false) { if ($fixed) { wppa_out('. ' . __('You may also enter:', 'wp-photo-album-plus') . ' ' . $fixed); } else { wppa_out('. ' . __('You may also leave/set this blank', 'wp-photo-album-plus')); } } } }
function wppa_the_album_cats($alb) { if (!wppa_switch('show_cats')) { return; } $cats = wppa_get_album_item($alb, 'cats'); $cats = trim($cats, ','); $cats = str_replace(',', ', ', $cats); if ($cats) { wppa_out('<div id="wppa-cats-' . $alb . '-' . wppa('mocc') . '" style="float:right" >'); if (strpos($cats, ',')) { wppa_out(__('Categories:', 'wp-photo-album-plus') . ' <b>' . $cats . '</b>'); } else { wppa_out(__('Category:', 'wp-photo-album-plus') . ' <b>' . $cats . '</b>'); } wppa_out('</div>'); } }
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_album_download_link($albumid) { if (!wppa_switch('allow_download_album')) { return; } // Not enabled $result = '<div style="clear:both;" ></div>' . '<a' . ' onclick="wppaAjaxDownloadAlbum(' . wppa('mocc') . ', \'' . wppa_encrypt_album($albumid) . '\' );"' . ' style="cursor:pointer;"' . ' class="wppa-album-cover-link"' . ' title="' . esc_attr(__('Download', 'wp-photo-album-plus')) . '" ' . '>' . __('Download Album', 'wp-photo-album-plus') . '</a>' . '<img' . ' id="dwnspin-' . wppa('mocc') . '-' . wppa_encrypt_album($albumid) . '"' . ' src="' . wppa_get_imgdir() . 'spinner.gif"' . ' style="margin-left:6px; display:none;"' . ' alt="spin"' . ' />'; wppa_out($result); }
function wppa_the_album_cats($alb) { if (!wppa_switch('show_cats')) { return; } $cats = wppa_get_album_item($alb, 'cats'); $cats = trim($cats, ','); $cats = str_replace(',', ', ', $cats); if ($cats) { $temp = explode(',', $cats); $ncats = count($temp); wppa_out('<div id="wppa-cats-' . $alb . '-' . wppa('mocc') . '" class="wppa-album-cover-cats" style="float:right" >' . _n('Category:', 'Categories:', $ncats, 'wp-photo-album-plus') . ' <b>' . $cats . '</b>' . '</div>'); } }
function wppa_user_upload_html($alb, $width, $where = '', $mcr = false) { static $seqno; // Init $mocc = wppa('mocc'); $occur = wppa('occur'); // Using seqno to distinguish from different places within one occurrence because // the album no is not known when there is a selection box. if ($seqno) { $seqno++; } else { $seqno = '1'; } // Feature enabled? if (!wppa_switch('user_upload_on')) { return; } // Login required? if (wppa_switch('user_upload_login')) { if (!is_user_logged_in()) { return; } } // I should have access to this album ( $alb > 0 ). if ($alb > '0') { $album_owner = wppa_get_album_item($alb, 'owner'); if ($album_owner != wppa_get_user() && $album_owner != '--- public ---' && !wppa_have_access($alb)) { return; } } // Find max files for the user $allow_me = wppa_allow_user_uploads(); if (!$allow_me) { if (wppa_switch('show_album_full')) { wppa_out('<div style="clear:both"></div>' . '<span style="color:red">' . __a('Max uploads reached') . wppa_time_to_wait_html('0', true) . '</span>'); } return; } // Find max files for the album $allow_alb = wppa_allow_uploads($alb); if (!$allow_alb) { if (wppa_switch('show_album_full')) { wppa_out('<div style="clear:both"></div>' . '<span style="color:red">' . __a('Max uploads reached') . wppa_time_to_wait_html($alb) . '</span>'); } return; } if (wppa_is_user_blacklisted()) { return; } // Find max files for the system $allow_sys = ini_get('max_file_uploads'); // THE max if ($allow_me == '-1') { $allow_me = $allow_sys; } if ($allow_alb == '-1') { $allow_alb = $allow_sys; } $max = min($allow_me, $allow_alb, $allow_sys); // In a widget or multi column responsive? $small = wppa('in_widget') == 'upload' || $mcr; // Ajax upload? $ajax_upload = wppa_switch('ajax_upload') && wppa_browser_can_html5(); // Create the return url if ($ajax_upload) { $returnurl = wppa_switch('ajax_non_admin') ? WPPA_URL . '/wppa-ajax-front.php' : admin_url('admin-ajax.php'); $returnurl .= '?action=wppa&wppa-action=do-fe-upload'; } else { $returnurl = wppa_get_permalink(); if ($where == 'cover') { $returnurl .= 'wppa-album=' . $alb . '&wppa-cover=0&wppa-occur=' . $occur; } elseif ($where == 'thumb') { $returnurl .= 'wppa-album=' . $alb . '&wppa-cover=0&wppa-occur=' . $occur; } elseif ($where == 'widget' || $where == 'uploadbox') { } if (wppa('page')) { $returnurl .= '&wppa-page=' . wppa('page'); } $returnurl = trim($returnurl, '?'); $returnurl = wppa_trim_wppa_($returnurl); } // Make the HTML $t = $mcr ? 'mcr-' : ''; wppa_out('<div style="clear:both"></div>' . '<a' . ' id="wppa-up-' . $alb . '-' . $mocc . '"' . ' class="wppa-upload-' . $where . '"' . ' onclick="' . 'jQuery( \'#wppa-file-' . $t . $alb . '-' . $mocc . '\' ).css( \'display\',\'block\' );' . 'jQuery( \'#wppa-up-' . $alb . '-' . $mocc . '\' ).css( \'display\',\'none\' );' . 'jQuery( \'#wppa-cr-' . $alb . '-' . $mocc . '\' ).css( \'display\',\'none\' );' . 'jQuery( \'#wppa-ea-' . $alb . '-' . $mocc . '\' ).css( \'display\',\'none\' );' . 'jQuery( \'#wppa-cats-' . $alb . '-' . $mocc . '\' ).css( \'display\',\'none\' );' . 'jQuery( \'#_wppa-up-' . $alb . '-' . $mocc . '\' ).css( \'display\',\'block\' );' . '_wppaDoAutocol( ' . $mocc . ' )' . '"' . ' style="float:left; cursor:pointer;' . '" >' . __a('Upload Photo') . '</a>' . '<a' . ' id="_wppa-up-' . $alb . '-' . $mocc . '"' . ' class="wppa-upload-' . $where . '"' . ' onclick="' . 'jQuery( \'#wppa-file-' . $t . $alb . '-' . $mocc . '\' ).css( \'display\',\'none\' );' . 'jQuery( \'#wppa-cr-' . $alb . '-' . $mocc . '\' ).css( \'display\',\'block\' );' . 'jQuery( \'#wppa-up-' . $alb . '-' . $mocc . '\' ).css( \'display\',\'block\' );' . 'jQuery( \'#wppa-ea-' . $alb . '-' . $mocc . '\' ).css( \'display\',\'block\' );' . 'jQuery( \'#wppa-cats-' . $alb . '-' . $mocc . '\' ).css( \'display\',\'block\' );' . 'jQuery( \'#_wppa-up-' . $alb . '-' . $mocc . '\' ).css( \'display\',\'none\' );' . '_wppaDoAutocol( ' . $mocc . ' )' . '"' . ' style="float:right; cursor:pointer;display:none;' . '" >' . __a('Close') . '</a>' . '<div' . ' id="wppa-file-' . $t . $alb . '-' . $mocc . '"' . ' class="wppa-file-' . $t . $mocc . '"' . ' style="width:' . $width . 'px;text-align:center;display:none; clear:both;"' . ' >' . '<form' . ' id="wppa-uplform-' . $alb . '-' . $mocc . '"' . ' action="' . $returnurl . '"' . ' method="post"' . ' enctype="multipart/form-data"' . ' >' . wppa_nonce_field('wppa-check', 'wppa-nonce', false, false, $alb)); // If no album given: select one if (!$alb) { wppa_out('<select' . ' id="wppa-upload-album-' . $mocc . '-' . $seqno . '"' . ' name="wppa-upload-album"' . ' style="float:left; max-width: ' . $width . 'px;"' . ' onchange="jQuery( \'#wppa-sel-' . $alb . '-' . $mocc . '\' ).trigger( \'onchange\' )"' . ' >' . wppa_album_select_a(array('addpleaseselect' => true, 'checkowner' => true, 'checkupload' => true, 'path' => wppa_switch('hier_albsel'))) . '</select>' . '<br />'); } else { wppa_out('<input' . ' type="hidden"' . ' id="wppa-upload-album-' . $mocc . '-' . $seqno . '"' . ' name="wppa-upload-album"' . ' value="' . $alb . '"' . ' />'); } // One only ? if (wppa_switch('upload_one_only') && !current_user_can('administrator')) { wppa_out('<input' . ' type="file"' . ' accept="image/*"' . ' capture' . ' class="wppa-user-file"' . ' style="' . 'width:auto;' . 'max-width:' . $width . ';' . 'margin:6px 0;' . 'float:left;' . __wcs('wppa-box-text') . '"' . ' id="wppa-user-upload-' . $alb . '-' . $mocc . '"' . ' name="wppa-user-upload-' . $alb . '-' . $mocc . '[]"' . ' onchange="jQuery( \'#wppa-user-submit-' . $alb . '-' . $mocc . '\' ).css( \'display\', \'block\' )"' . ' />'); } else { wppa_out('<input' . ' type="file"' . ' accept="image/*"' . ' capture' . ' multiple="multiple"' . ' class="wppa-user-file"' . ' style="' . 'width:auto;' . 'max-width:' . $width . ';' . 'margin:6px 0;' . 'float:left;' . __wcs('wppa-box-text') . '"' . ' id="wppa-user-upload-' . $alb . '-' . $mocc . '"' . ' name="wppa-user-upload-' . $alb . '-' . $mocc . '[]"' . ' onchange="jQuery( \'#wppa-user-submit-' . $alb . '-' . $mocc . '\' ).css( \'display\', \'block\' )"' . ' />'); } // Onclick submit verify album is known if ($alb) { $onclick = ' onclick="if ( document.getElementById( \'wppa-upload-album-' . $mocc . '-' . $seqno . '\' ).value == 0 )' . ' {alert( \'' . esc_js(__a('Please select an album and try again')) . '\' );return false;}"'; } else { $onclick = ''; } // The submit button wppa_out('<input' . ' type="submit"' . ' id="wppa-user-submit-' . $alb . '-' . $mocc . '"' . $onclick . ' style="display:none; margin: 6px 0; float:right; ' . __wcs('wppa-box-text') . '"' . ' class="wppa-user-submit"' . ' name="wppa-user-submit-' . $alb . '-' . $mocc . '" value="' . __a('Upload photo') . '"' . ' />' . '<div style="clear:both"></div>'); // if ajax: progression bar if ($ajax_upload) { wppa_out('<div' . ' id="progress-' . $alb . '-' . $mocc . '"' . ' class="wppa-progress"' . ' style="border-color:' . wppa_opt('wppa_bcolor_upload') . '"' . ' >' . '<div id="bar-' . $alb . '-' . $mocc . '" class="wppa-bar" ></div>' . '<div id="percent-' . $alb . '-' . $mocc . '" class="wppa-percent" >0%</div >' . '</div>' . '<div id="message-' . $alb . '-' . $mocc . '" class="wppa-message" ></div>'); } // Explanation if (!wppa_switch('upload_one_only') && !current_user_can('administrator')) { if ($max) { wppa_out('<span style="font-size:10px;" >' . sprintf(__a('You may upload up to %s photos at once if your browser supports HTML-5 multiple file upload'), $max) . '</span>'); $maxsize = wppa_check_memory_limit(false); if (is_array($maxsize)) { wppa_out('<br />' . '<span style="font-size:10px;" >' . sprintf(__a('Max photo size: %d x %d (%2.1f MegaPixel)'), $maxsize['maxx'], $maxsize['maxy'], $maxsize['maxp'] / (1024 * 1024)) . '</span>'); } } } // Copyright notice if (wppa_switch('copyright_on')) { wppa_out('<div style="clear:both;" >' . __(wppa_opt('copyright_notice')) . '</div>'); } // Watermark if (wppa_switch('watermark_on') && wppa_switch('watermark_user')) { wppa_out('<table' . ' class="wppa-watermark wppa-box-text"' . ' style="margin:0; border:0; ' . __wcs('wppa-box-text') . '"' . ' >' . '<tbody>' . '<tr valign="top" style="border: 0 none; " >' . '<td' . ' class="wppa-box-text wppa-td"' . ' style="' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . __a('Apply watermark file:') . '</td>' . '</tr>' . '<tr>' . '<td' . ' class="wppa-box-text wppa-td"' . ' style="width: ' . $width . ';' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . '<select' . ' style="margin:0; padding:0; text-align:left; width:auto; "' . ' name="wppa-watermark-file"' . ' id="wppa-watermark-file"' . ' >' . wppa_watermark_file_select() . '</select>' . '</td>' . '</tr>' . '<tr valign="top" style="border: 0 none; " >' . '<td' . ' class="wppa-box-text wppa-td"' . ' style="width: ' . $width . ';' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . __a('Position:') . '</td>' . ($small ? '</tr><tr>' : '') . '<td' . ' class="wppa-box-text wppa-td"' . ' style="width: ' . $width . ';' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . '<select' . ' style="margin:0; padding:0; text-align:left; width:auto; "' . ' name="wppa-watermark-pos"' . ' id="wppa-watermark-pos"' . ' >' . wppa_watermark_pos_select() . '</select>' . '</td>' . '</tr>' . '</tbody>' . '</table>'); } // Name if (wppa_switch('wppa_name_user')) { switch (wppa_opt('wppa_newphoto_name_method')) { case 'none': $expl = ''; break; case '2#005': $expl = __a('If you leave this blank, iptc tag 005 (Graphic name) will be used as photoname if available, else the original filename will be used as photo name.'); break; case '2#120': $expl = __a('If you leave this blank, iptc tag 120 (Caption) will be used as photoname if available, else the original filename will be used as photo name.'); break; default: $expl = __a('If you leave this blank, the original filename will be used as photo name.'); } wppa_out('<div class="wppa-box-text wppa-td" style="clear:both; float:left; text-align:left; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . __a('Enter photo name.') . ' <span style="font-size:10px;" >' . $expl . '</span>' . '</div>' . '<input' . ' type="text"' . ' class="wppa-box-text wppa-file-' . $t . $mocc . '"' . ' style="padding:0; width:' . ($width - 6) . 'px; ' . __wcs('wppa-box-text') . '"' . ' name="wppa-user-name"' . ' />'); } // Description user fillable ? if (wppa_switch('wppa_desc_user')) { $desc = wppa_switch('apply_newphoto_desc_user') ? stripslashes(wppa_opt('wppa_newphoto_description')) : ''; wppa_out('<div' . ' class="wppa-box-text wppa-td"' . ' style="clear:both; float:left; text-align:left; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . __a('Enter/modify photo description') . '</div>' . '<textarea' . ' class="wppa-user-textarea wppa-box-text wppa-file-' . $t . $mocc . '"' . ' style="height:120px; width:' . ($width - 6) . 'px; ' . __wcs('wppa-box-text') . '"' . ' name="wppa-user-desc"' . ' >' . $desc . '</textarea>'); } elseif (wppa_switch('apply_newphoto_desc_user')) { wppa_out('<input' . ' type="hidden"' . ' value="' . esc_attr(wppa_opt('wppa_newphoto_description')) . '"' . ' name="wppa-user-desc"' . ' />'); } // Custom fields if (wppa_switch('fe_custom_fields')) { for ($i = '0'; $i < '10'; $i++) { if (wppa_opt('custom_caption_' . $i)) { wppa_out('<div' . ' class="wppa-box-text wppa-td"' . ' style="clear:both; float:left; text-align:left; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . __(wppa_opt('custom_caption_' . $i)) . ': ' . (wppa_switch('custom_visible_' . $i) ? '' : ' <small><i>( ' . __a('hidden', 'wppa') . ' )</i></small>') . '</div>' . '<input' . ' type="text"' . ' class="wppa-box-text wppa-file-' . $t . $mocc . '"' . ' style="padding:0; width:' . ($width - 6) . 'px; ' . __wcs('wppa-box-text') . '"' . ' name="wppa-user-custom-' . $i . '"' . ' />'); } } } // Tags if (wppa_switch('fe_upload_tags')) { // Prepare onclick action $onc = 'wppaPrevTags(\'wppa-sel-' . $alb . '-' . $mocc . '\', \'wppa-inp-' . $alb . '-' . $mocc . '\', \'wppa-upload-album-' . $mocc . '-' . $seqno . '\', \'wppa-prev-' . $alb . '-' . $mocc . '\')'; // Open the tag enter area wppa_out("\n" . '<div class="wppa-box-text wppa-td" style="clear:both; float:left; text-align:left; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >'); // Selection boxes 1..3 for ($i = '1'; $i < '4'; $i++) { if (wppa_switch('up_tagselbox_on_' . $i)) { wppa_out("\n" . '<div style="float:left; margin-right:4px;" >'); wppa_out('<small>' . __(wppa_opt('up_tagselbox_title_' . $i)) . '</small><br />'); wppa_out("\n" . '<select id="wppa-sel-' . $alb . '-' . $mocc . '-' . $i . '" style="float:left; margin-right: 4px;" name="wppa-user-tags-' . $i . '[]" ' . (wppa_switch('wppa_up_tagselbox_multi_' . $i) ? 'multiple' : '') . ' onchange="' . $onc . '" >'); if (wppa_opt('up_tagselbox_content_' . $i)) { // List of tags supplied $tags = explode(',', wppa_opt('up_tagselbox_content_' . $i)); wppa_out('<option value="" > </option>'); if (is_array($tags)) { foreach ($tags as $tag) { wppa_out('<option class="wppa-sel-' . $alb . '-' . $mocc . '" value="' . $tag . '">' . $tag . '</option>'); } } } else { // All existing tags $tags = wppa_get_taglist(); wppa_out('<option value="" > </option>'); if (is_array($tags)) { foreach ($tags as $tag) { wppa_out('<option class="wppa-sel-' . $alb . '-' . $mocc . '" value="' . $tag['tag'] . '">' . $tag['tag'] . '</option>'); } } } wppa_out("\n" . '</select>'); wppa_out('</div>'); } } // New tags if (wppa_switch('wppa_up_tag_input_on')) { wppa_out('<div style="float:left; margin-right:4px;" >'); wppa_out('<small>' . __(wppa_opt('up_tag_input_title')) . '</small><br />'); wppa_out('<input id="wppa-inp-' . $alb . '-' . $mocc . '" type="text" class="wppa-box-text " style="padding:0; width:150px; ' . __wcs('wppa-box-text') . '" name="wppa-new-tags" onchange="' . $onc . '" />'); wppa_out('</div>'); } // Preview area if (wppa_switch('wppa_up_tag_preview')) { wppa_out('<div style="margin:0; clear:both;" >' . __a('Preview tags:') . ' <small id="wppa-prev-' . $alb . '-' . $mocc . '"></small></div>'); wppa_out('<script type="text/javascript" >jQuery( document ).ready(function() {' . $onc . '})</script>'); } // Close tag enter area wppa_out('</div>'); } // Done wppa_out('</form></div>'); // Ajax upload script if ($ajax_upload) { wppa_out('<script>' . 'jQuery(document).ready(function() { var options = { beforeSend: function() { jQuery("#progress-' . $alb . '-' . $mocc . '").show(); //clear everything jQuery("#bar-' . $alb . '-' . $mocc . '").width(\'0%\'); jQuery("#message-' . $alb . '-' . $mocc . '").html(""); jQuery("#percent-' . $alb . '-' . $mocc . '").html(""); }, uploadProgress: function(event, position, total, percentComplete) { jQuery("#bar-' . $alb . '-' . $mocc . '").width(percentComplete+\'%\'); if ( percentComplete < 95 ) { jQuery("#percent-' . $alb . '-' . $mocc . '").html(percentComplete+\'%\'); } else { jQuery("#percent-' . $alb . '-' . $mocc . '").html(\'Processing...\'); } }, success: function() { jQuery("#bar-' . $alb . '-' . $mocc . '").width(\'100%\'); jQuery("#percent-' . $alb . '-' . $mocc . '").html(\'Done!\'); }, complete: function(response) { jQuery("#message-' . $alb . '-' . $mocc . '").html( \'<span style="font-size: 10px;" >\'+response.responseText+\'</span>\' );' . ($where == 'thumb' ? 'document.location.reload(true)' : '') . ' }, error: function() { jQuery("#message-' . $alb . '-' . $mocc . '").html( \'<span style="color: red;" >' . __a('ERROR: unable to upload files.') . '</span>\' ); } }; jQuery("#wppa-uplform-' . $alb . '-' . $mocc . '").ajaxForm(options); }); </script>'); } }