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_create_wppa_init_js() { global $wppa_api_version; global $wppa_lang; global $wppa; global $wppa_init_js_data; // Init if (is_numeric(wppa_opt('wppa_fullimage_border_width'))) { $fbw = wppa_opt('wppa_fullimage_border_width') + '1'; } else { $fbw = '0'; } // Make content $content = '/* -- WPPA+ Runtime parameters /* /* Dynamicly Created on ' . date('c') . ' /* */ '; if ((WPPA_DEBUG || wppa_get_get('debug') || WP_DEBUG) && !wppa_switch('wppa_defer_javascript')) { $content .= ' /* Check if wppa.js and jQuery are present */ if (typeof(_wppaSlides) == \'undefined\') alert(\'There is a problem with your theme. The file wppa.js is not loaded when it is expected (Errloc = wppa_kickoff).\'); if (typeof(jQuery) == \'undefined\') alert(\'There is a problem with your theme. The jQuery library is not loaded when it is expected (Errloc = wppa_kickoff).\'); '; } /* This goes into wppa.js */ /* If you add something that uses an element from $wppa_opt[], */ /* or a function that uses an element from $wppa_opt[], */ /* add the optionslug to $init_js_critical[] in wppa_update_option in wppa-utils.php !!!!! */ $content .= ' wppaVersion = "' . $wppa_api_version . '"; wppaBackgroundColorImage = "' . wppa_opt('wppa_bgcolor_img') . '"; wppaPopupLinkType = "' . wppa_opt('wppa_thumb_linktype') . '"; wppaAnimationType = "' . wppa_opt('wppa_animation_type') . '"; wppaAnimationSpeed = ' . wppa_opt('wppa_animation_speed') . '; wppaThumbnailAreaDelta = ' . wppa_get_thumbnail_area_delta() . '; wppaTextFrameDelta = ' . wppa_get_textframe_delta() . '; wppaBoxDelta = ' . wppa_get_box_delta() . '; wppaSlideShowTimeOut = ' . wppa_opt('wppa_slideshow_timeout') . '; wppaPreambule = ' . wppa_get_preambule() . '; wppaFilmShowGlue = ' . (wppa_switch('wppa_film_show_glue') ? 'true' : 'false') . '; wppaSlideShow = "' . __a('Slideshow') . '"; wppaStart = "' . __a('Start') . '"; wppaStop = "' . __a('Stop') . '"; wppaSlower = "' . __a('Slower') . '"; wppaFaster = "' . __a('Faster') . '"; wppaPhoto = "' . __a('Photo') . '"; wppaOf = "' . __a('of') . '"; wppaPreviousPhoto = "' . __a('Previous photo') . '"; wppaNextPhoto = "' . __a('Next photo') . '"; wppaPrevP = "' . __a('Prev.') . '"; wppaNextP = "' . __a('Next') . '"; wppaAvgRating = "' . __a('Average rating') . '"; wppaMyRating = "' . __a('My rating') . '"; wppaAvgRat = "' . __a('Avg.') . '"; wppaMyRat = "' . __a('Mine') . '"; wppaDislikeMsg = "' . __a('You marked this image as inappropriate.') . '"; wppaShowDislikeCount = ' . (wppa_switch('wppa_dislike_show_count') ? 'true' : 'false') . '; wppaNoDislikes = "' . __a('No dislikes') . '"; wppa1Dislike = "' . __a('1 dislike') . '"; wppaDislikes = "' . __a('dislikes') . '"; wppaIncludingMine = "' . __a('including mine') . '"; wppaMiniTreshold = ' . (wppa_opt('wppa_mini_treshold') ? wppa_opt('wppa_mini_treshold') : '0') . '; wppaRatingOnce = ' . (wppa_switch('wppa_rating_change') || wppa_switch('wppa_rating_multi') ? 'false' : 'true') . '; wppaPleaseName = "' . __a('Please enter your name') . '"; wppaPleaseEmail = "' . __a('Please enter a valid email address') . '"; wppaPleaseComment = "' . __a('Please enter a comment') . '"; wppaHideWhenEmpty = ' . (wppa_switch('wppa_hide_when_empty') ? 'true' : 'false') . '; wppaBGcolorNumbar = "' . wppa_opt('wppa_bgcolor_numbar') . '"; wppaBcolorNumbar = "' . wppa_opt('wppa_bcolor_numbar') . '"; wppaBGcolorNumbarActive = "' . wppa_opt('wppa_bgcolor_numbar_active') . '"; wppaBcolorNumbarActive = "' . wppa_opt('wppa_bcolor_numbar_active') . '"; wppaFontFamilyNumbar = "' . wppa_opt('wppa_fontfamily_numbar') . '"; wppaFontSizeNumbar = "' . wppa_opt('wppa_fontsize_numbar') . 'px"; wppaFontColorNumbar = "' . wppa_opt('wppa_fontcolor_numbar') . '"; wppaFontWeightNumbar = "' . wppa_opt('wppa_fontweight_numbar') . '"; wppaFontFamilyNumbarActive = "' . wppa_opt('wppa_fontfamily_numbar_active') . '"; wppaFontSizeNumbarActive = "' . wppa_opt('wppa_fontsize_numbar_active') . 'px"; wppaFontColorNumbarActive = "' . wppa_opt('wppa_fontcolor_numbar_active') . '"; wppaFontWeightNumbarActive = "' . wppa_opt('wppa_fontweight_numbar_active') . '"; wppaNumbarMax = "' . wppa_opt('wppa_numbar_max') . '"; wppaLang = "' . $wppa_lang . '"; wppaNextOnCallback = ' . (wppa_switch('wppa_next_on_callback') ? 'true' : 'false') . '; wppaStarOpacity = ' . wppa_opt('wppa_star_opacity') / '100' . '; wppaSlideWrap = ' . (wppa_switch('wppa_slide_wrap') ? 'true' : 'false') . '; wppaEmailRequired = ' . (wppa_switch('wppa_comment_email_required') ? 'true' : 'false') . '; wppaSlideBorderWidth = ' . $fbw . '; wppaAllowAjax = ' . (wppa_switch('wppa_allow_ajax') ? 'true' : 'false') . '; wppaUsePhotoNamesInUrls = ' . (wppa_switch('wppa_use_photo_names_in_urls') ? 'true' : 'false') . '; wppaThumbTargetBlank = ' . (wppa_switch('wppa_thumb_blank') ? 'true' : 'false') . '; wppaRatingMax = ' . wppa_opt('wppa_rating_max') . '; wppaRatingDisplayType = "' . wppa_opt('wppa_rating_display_type') . '"; wppaRatingPrec = ' . wppa_opt('wppa_rating_prec') . '; wppaStretch = ' . (wppa_switch('wppa_enlarge') ? 'true' : 'false') . '; wppaMinThumbSpace = ' . wppa_opt('wppa_tn_margin') . '; wppaThumbSpaceAuto = ' . (wppa_switch('wppa_thumb_auto') ? 'true' : 'false') . '; wppaMagnifierCursor = "' . wppa_opt('wppa_magnifier') . '"; wppaArtMonkyLink = "' . wppa_opt('wppa_art_monkey_link') . '"; wppaAutoOpenComments = ' . (wppa_switch('wppa_auto_open_comments') ? 'true' : 'false') . '; wppaUpdateAddressLine = ' . (wppa_switch('wppa_update_addressline') ? 'true' : 'false') . '; wppaFilmThumbTitle = "' . (wppa_opt('wppa_film_linktype') == 'lightbox' ? wppa_zoom_in(false) : __a('Double click to start/stop slideshow running')) . '"; wppaVoteForMe = "' . __(wppa_opt('wppa_vote_button_text')) . '"; wppaVotedForMe = "' . __(wppa_opt('wppa_voted_button_text')) . '"; wppaSlideSwipe = ' . (wppa_switch('wppa_slide_swipe') ? 'true' : 'false') . '; wppaMaxCoverWidth = ' . wppa_opt('wppa_max_cover_width') . '; wppaDownLoad = "' . __a('Download') . '"; wppaSlideToFullpopup = ' . (wppa_opt('wppa_slideshow_linktype') == 'fullpopup' ? 'true' : 'false') . '; wppaComAltSize = ' . wppa_opt('wppa_comten_alt_thumbsize') . '; wppaBumpViewCount = ' . (wppa_switch('wppa_track_viewcounts') ? 'true' : 'false') . '; wppaShareHideWhenRunning = ' . (wppa_switch('wppa_share_hide_when_running') ? 'true' : 'false') . '; wppaFotomoto = ' . (wppa_switch('wppa_fotomoto_on') ? 'true' : 'false') . '; wppaArtMonkeyButton = ' . (wppa_opt('wppa_art_monkey_display') == 'button' ? 'true' : 'false') . '; wppaFotomotoHideWhenRunning = ' . (wppa_switch('wppa_fotomoto_hide_when_running') ? 'true' : 'false') . '; wppaCommentRequiredAfterVote = ' . (wppa_switch('wppa_vote_needs_comment') ? 'true' : 'false') . '; wppaFotomotoMinWidth = ' . wppa_opt('wppa_fotomoto_min_width') . '; wppaShortQargs = ' . (wppa_switch('wppa_use_short_qargs') ? 'true' : 'false') . '; wppaOvlHires = ' . (wppa_switch('wppa_lb_hres') ? 'true' : 'false') . '; wppaSlideVideoStart = ' . (wppa_switch('start_slide_video') ? 'true' : 'false') . '; wppaSlideAudioStart = ' . (wppa_switch('start_slide_audio') ? 'true' : 'false') . '; wppaAudioHeight = ' . wppa_get_audio_control_height() . '; wppaRel = "' . (wppa_opt('lightbox_name') == 'wppa' ? 'data-rel' : 'rel') . '"; '; // Open file $file = @fopen(WPPA_PATH . '/wppa-init.' . $wppa_lang . '.js', 'wb'); if ($file) { // Write file fwrite($file, $content); // Close file fclose($file); $wppa_init_js_data = ''; } else { $wppa_init_js_data = '<script type="text/javascript"> /* Warning: file wppa-init.' . $wppa_lang . '.js could not be created */ /* The content is therefor output here */ ' . $content . ' </script> '; } }
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.'); }