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_slide_filmstrip($opt = '') { // A single image slideshow needs no navigation if (wppa('is_single')) { return; } $do_it = false; // Init if (is_feed()) { $do_it = true; } else { // Not a feed if ($opt != 'optional') { $do_it = true; } else { // optional if (wppa_switch('wppa_filmstrip')) { // optional and option on if (!wppa('is_slideonly')) { $do_it = true; } // always except slideonly } if (wppa('film_on')) { $do_it = true; } // explicitly turned on } } if (!$do_it) { return; } // Don't do it $t = -microtime(true); $alb = wppa_get_get('album'); $thumbs = wppa_get_thumbs(); if (!$thumbs || count($thumbs) < 1) { return; } $preambule = wppa_get_preambule(); $width = (wppa_opt('tf_width') + wppa_opt('tn_margin')) * (count($thumbs) + 2 * $preambule); $width += wppa_opt('tn_margin') + 2; $topmarg = wppa_opt('thumbsize') / 2 - 16; $height = wppa_opt('thumbsize') + wppa_opt('tn_margin'); $height1 = wppa_opt('thumbsize'); $marg = '42'; // 32 $fs = '24'; $fw = '42'; if (wppa_in_widget()) { $width /= 2; $topmarg /= 2; $height /= 2; $height1 /= 2; $marg = '21'; $fs = '12'; $fw = '21'; } $conw = wppa_get_container_width(); if ($conw < 1) { $conw *= 640; } $w = $conw - (2 * 6 + 2 * 42 + 2 * wppa_opt('bwidth')); /* 2*padding + 2*arrows + 2*border */ if (wppa_in_widget()) { $w = $conw - (2 * 6 + 2 * 21 + 2 * wppa_opt('bwidth')); } /* 2*padding + 2*arrow + 2*border */ $IE6 = 'width: ' . $w . 'px;'; $pagsiz = round($w / (wppa_opt('thumbsize') + wppa_opt('tn_margin'))); if (wppa_in_widget()) { $pagsiz = round($w / (wppa_opt('thumbsize') / 2 + wppa_opt('tn_margin') / 2)); } wppa_add_js_page_data('<script type="text/javascript">'); wppa_add_js_page_data('wppaFilmPageSize[' . wppa('mocc') . '] = ' . $pagsiz . ';'); wppa_add_js_page_data('</script>'); if (is_feed()) { wppa_out('<div style="' . __wcs('wppa-box') . __wcs('wppa-nav') . '">'); } else { wppa_out('<div' . ' class="wppa-box wppa-nav"' . ' style="text-align:center; ' . __wcs('wppa-box') . __wcs('wppa-nav') . 'height:' . $height . 'px;"' . ' >' . '<div' . ' style="float:left; text-align:left; cursor:pointer; margin-top:' . $topmarg . 'px; width: ' . $fw . 'px; font-size: ' . $fs . 'px;"' . ' >' . '<a' . ' class="wppa-prev-' . wppa('mocc') . ' wppa-arrow"' . ' style="' . __wcs('wppa-arrow') . '"' . ' id="prev-film-arrow-' . wppa('mocc') . '"' . ' onclick="wppaFirst(' . wppa('mocc') . ');"' . ' title="' . __('First', 'wp-photo-album-plus') . '"' . ' >' . '«' . '</a>' . '<a' . ' class="wppa-prev-' . wppa('mocc') . ' wppa-arrow"' . ' style="' . __wcs('wppa-arrow') . '"' . ' id="prev-film-arrow-1-' . wppa('mocc') . '"' . ' onclick="wppaPrev(' . wppa('mocc') . ');"' . ' title="' . __('Previous', 'wp-photo-album-plus') . '"' . ' >' . '‹' . '</a>' . '</div>' . '<div' . ' style="float:right; text-align:right; cursor:pointer; margin-top:' . $topmarg . 'px; width: ' . $fw . 'px; font-size: ' . $fs . 'px;"' . ' >' . '<a' . ' class="wppa-next-' . wppa('mocc') . ' wppa-arrow"' . ' style="' . __wcs('wppa-arrow') . '"' . ' id="next-film-arrow-1-' . wppa('mocc') . '"' . ' onclick="wppaNext(' . wppa('mocc') . ');"' . ' title="' . __('Next', 'wp-photo-album-plus') . '"' . ' >' . '›' . '</a>' . '<a' . ' class="wppa-next-' . wppa('mocc') . ' wppa-arrow"' . ' style="' . __wcs('wppa-arrow') . '"' . ' id="next-film-arrow-' . wppa('mocc') . '"' . ' onclick="wppaLast(' . wppa('mocc') . ');"' . ' title="' . __('Last', 'wp-photo-album-plus') . '"' . ' >' . '»' . '</a>' . '</div>' . '<div' . ' id="filmwindow-' . wppa('mocc') . '"' . ' class="filmwindow"' . ' style="' . $IE6 . ' position:absolute; display: block; height:' . $height . 'px; margin: 0 0 0 ' . $marg . 'px; overflow:hidden;"' . ' >' . '<div' . ' id="wppa-filmstrip-' . wppa('mocc') . '"' . ' style="height:' . $height1 . 'px; width:' . $width . 'px; max-width:' . $width . 'px;margin-left: -100px;"' . ' >'); } wppa_out('<style type="text/css" scoped >' . '.thumbnail-frame { ' . wppa_get_thumb_frame_style(false, 'film') . ' }' . '.wppa-filmthumb-active { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }' . '</style>'); $cnt = count($thumbs); $start = $cnt - $preambule; $end = $cnt; $idx = $start; // Preambule while ($idx < $end) { $glue = $cnt == $idx + 1 ? true : false; $ix = $idx; while ($ix < 0) { $ix += $cnt; } $thumb = $thumbs[$ix]; wppa_do_filmthumb($thumb['id'], $ix, false, $glue); $idx++; } // Real thumbs $idx = 0; foreach ($thumbs as $tt) { $thumb = $tt; $glue = $cnt == $idx + 1 ? true : false; wppa_do_filmthumb($thumb['id'], $idx, true, $glue); $idx++; } // Postambule $start = '0'; $end = $preambule; $idx = $start; while ($idx < $end) { $ix = $idx; while ($ix >= $cnt) { $ix -= $cnt; } $thumb = $thumbs[$ix]; wppa_do_filmthumb($thumb['id'], $ix, false); $idx++; } if (is_feed()) { wppa_out('</div>'); } else { wppa_out('</div>'); wppa_out('</div>'); wppa_out('</div>'); } $t += microtime(true); wppa_dbg_msg('Filmstrip took ' . $t . ' seconds.'); }
function wppa_slide_filmstrip($opt = '') { global $wppa; global $wppa_opt; global $thumb; // A single image slideshow needs no navigation if ($wppa['is_single']) { return; } $do_it = false; // Init if (is_feed()) { $do_it = true; } else { // Not a feed if ($opt != 'optional') { $do_it = true; } else { // optional if (wppa_switch('wppa_filmstrip')) { // optional and option on if (!$wppa['is_slideonly']) { $do_it = true; } // always except slideonly } if ($wppa['film_on']) { $do_it = true; } // explicitly turned on } } if (!$do_it) { return; } // Don't do it $t = -microtime(true); $alb = wppa_get_get('album'); // To be tested: // Album id is in $wppa['start_album'] $thumbs = wppa_get_thumbs($alb); if (!$thumbs || count($thumbs) < 1) { return; } $preambule = wppa_get_preambule(); $width = ($wppa_opt['wppa_tf_width'] + $wppa_opt['wppa_tn_margin']) * (count($thumbs) + 2 * $preambule); $width += $wppa_opt['wppa_tn_margin'] + 2; $topmarg = $wppa_opt['wppa_thumbsize'] / 2 - 16; $height = $wppa_opt['wppa_thumbsize'] + $wppa_opt['wppa_tn_margin']; $height1 = $wppa_opt['wppa_thumbsize']; $marg = '42'; // 32 $fs = '24'; $fw = '42'; if ($wppa['in_widget']) { $width /= 2; $topmarg /= 2; $height /= 2; $height1 /= 2; $marg = '21'; $fs = '12'; $fw = '21'; } $conw = wppa_get_container_width(); if ($conw < 1) { $conw *= 640; } $w = $conw - (2 * 6 + 2 * 42 + 2 * $wppa_opt['wppa_bwidth']); /* 2*padding + 2*arrows + 2*border */ if ($wppa['in_widget']) { $w = $conw - (2 * 6 + 2 * 21 + 2 * $wppa_opt['wppa_bwidth']); } /* 2*padding + 2*arrow + 2*border */ $IE6 = 'width: ' . $w . 'px;'; $pagsiz = round($w / ($wppa_opt['wppa_thumbsize'] + $wppa_opt['wppa_tn_margin'])); if ($wppa['in_widget']) { $pagsiz = round($w / ($wppa_opt['wppa_thumbsize'] / 2 + $wppa_opt['wppa_tn_margin'] / 2)); } wppa_add_js_page_data('<script type="text/javascript">'); // $wppa['out'] .= wppa_nltab('+').'/* <![CDATA[ */'; wppa_add_js_page_data('wppaFilmPageSize[' . $wppa['mocc'] . '] = ' . $pagsiz . ';'); // $wppa['out'] .= wppa_nltab('-').'/* ]]> */'; wppa_add_js_page_data('</script>'); if (is_feed()) { $wppa['out'] .= wppa_nltab() . '<div style="' . __wcs('wppa-box') . __wcs('wppa-nav') . '">'; } else { $wppa['out'] .= wppa_nltab('+') . '<div class="wppa-box wppa-nav" style="text-align:center; ' . __wcs('wppa-box') . __wcs('wppa-nav') . 'height:' . $height . 'px;">'; $wppa['out'] .= wppa_nltab() . '<div style="float:left; text-align:left; cursor:pointer; margin-top:' . $topmarg . 'px; width: ' . $fw . 'px; font-size: ' . $fs . 'px;">'; $wppa['out'] .= wppa_nltab() . '<a class="wppa-prev-' . $wppa['mocc'] . ' wppa-arrow" style="' . __wcs('wppa-arrow') . '" id="prev-film-arrow-' . $wppa['mocc'] . '" onclick="wppaFirst(' . $wppa['mocc'] . ');" title="' . __a('First', 'wppa_theme') . '" >«</a>'; $wppa['out'] .= wppa_nltab() . '<a class="wppa-prev-' . $wppa['mocc'] . ' wppa-arrow" style="' . __wcs('wppa-arrow') . '" id="prev-film-arrow-1-' . $wppa['mocc'] . '" onclick="wppaPrev(' . $wppa['mocc'] . ');" title="' . __a('Previous', 'wppa_theme') . '" >‹</a>'; $wppa['out'] .= wppa_nltab() . '</div>'; $wppa['out'] .= wppa_nltab() . '<div style="float:right; text-align:right; cursor:pointer; margin-top:' . $topmarg . 'px; width: ' . $fw . 'px; font-size: ' . $fs . 'px;">'; $wppa['out'] .= wppa_nltab() . '<a class="wppa-next-' . $wppa['mocc'] . ' wppa-arrow" style="' . __wcs('wppa-arrow') . '" id="next-film-arrow-1-' . $wppa['mocc'] . '" onclick="wppaNext(' . $wppa['mocc'] . ');" title="' . __a('Next', 'wppa_theme') . '" >›</a>'; $wppa['out'] .= wppa_nltab() . '<a class="wppa-next-' . $wppa['mocc'] . ' wppa-arrow" style="' . __wcs('wppa-arrow') . '" id="next-film-arrow-' . $wppa['mocc'] . '" onclick="wppaLast(' . $wppa['mocc'] . ');" title="' . __a('Last', 'wppa_theme') . '" >»</a>'; $wppa['out'] .= wppa_nltab() . '</div>'; $wppa['out'] .= wppa_nltab() . '<div id="filmwindow-' . $wppa['mocc'] . '" class="filmwindow" style="' . $IE6 . ' position:absolute; display: block; height:' . $height . 'px; margin: 0 0 0 ' . $marg . 'px; overflow:hidden;">'; $wppa['out'] .= wppa_nltab('+') . '<div id="wppa-filmstrip-' . $wppa['mocc'] . '" style="height:' . $height1 . 'px; width:' . $width . 'px; margin-left: -100px;">'; } $cnt = count($thumbs); $start = $cnt - $preambule; $end = $cnt; $idx = $start; /* #wppa-container-'.$wppa['mocc'].' */ $wppa['out'] .= ' <style type="text/css" scoped > .thumbnail-frame { ' . wppa_get_thumb_frame_style(false, 'film') . ' } .wppa-filmthumb-active { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } </style>'; while ($idx < $end) { $glue = $cnt == $idx + 1 ? true : false; $ix = $idx; while ($ix < 0) { $ix += $cnt; } $thumb = $thumbs[$ix]; wppa_do_filmthumb($ix, false, $glue); $idx++; } $idx = 0; foreach ($thumbs as $tt) { $thumb = $tt; $glue = $cnt == $idx + 1 ? true : false; wppa_do_filmthumb($idx, true, $glue); $idx++; } $start = '0'; $end = $preambule; $idx = $start; while ($idx < $end) { $ix = $idx; while ($ix >= $cnt) { $ix -= $cnt; } $thumb = $thumbs[$ix]; wppa_do_filmthumb($ix, false); $idx++; } if (is_feed()) { $wppa['out'] .= wppa_nltab('-') . '</div>'; } else { $wppa['out'] .= wppa_nltab('-') . '</div>'; $wppa['out'] .= wppa_nltab('-') . '</div>'; $wppa['out'] .= wppa_nltab('-') . '</div>'; } $t += microtime(true); wppa_dbg_msg('Filmstrip took ' . $t . ' seconds.'); }