function wppa_get_thumbnail_area_width() { $result = wppa_get_container_width(); $result -= wppa_get_thumbnail_area_delta(); return $result; }
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_get_thumb_default($id) { global $wpdb; // Validate args if (!wppa_is_int($id) || $id < '0') { wppa_dbg_msg('Please check file wppa-theme.php or any other php file that calls wppa_get_thumb_default(). Argument 1: photo id is missing or illegal!', 'red', 'force'); die('Please check your configuration'); } // Initialize $result = ''; // Encrypted photo id $xid = wppa_encrypt_photo($id); // Get the photo info $thumb = wppa_cache_thumb($id); // Get the album info $album = wppa_cache_album($thumb['album']); wppa('current_album', $album['id']); // Get photo info $is_video = wppa_is_video($id); $has_audio = wppa_has_audio($id); $com_alt = wppa('is_comten') && wppa_switch('comten_alt_display') && !wppa_in_widget(); $frameattr_a = wppa_get_thumb_frame_style_a(); $framestyle = $frameattr_a['style']; $framewidth = $frameattr_a['width']; $frameheight = $frameattr_a['height']; // Get class depending of comment alt display if ($com_alt) { $class = 'thumbnail-frame-comalt thumbnail-frame-comalt-' . wppa('mocc') . ' thumbnail-frame-photo-' . $xid; } else { $class = 'thumbnail-frame thumbnail-frame-' . wppa('mocc') . ' thumbnail-frame-photo-' . $xid; } // If no image to display, die gracefully $imgsrc = wppa_fix_poster_ext(wppa_get_thumb_path($id), $id); if (!wppa_is_video($id) && !is_file($imgsrc) && !wppa_has_audio($id)) { $result .= '<div' . ' class="' . $class . '"' . ' style="' . $framestyle . '; color:red;" >' . 'Missing thumbnail image #' . $id . '</div>'; return $result; } // Find image attributes $alt = $album['alt_thumbsize'] == 'yes' ? '_alt' : ''; $imgattr_a = wppa_get_imgstyle_a($id, $imgsrc, wppa_opt('thumbsize' . $alt), 'optional', 'thumb'); $imgstyle = $imgattr_a['style']; $imgwidth = $imgattr_a['width']; $imgheight = $imgattr_a['height']; $imgmargintop = $imgattr_a['margin-top']; $imgmarginbottom = $imgattr_a['margin-bottom']; // Special case for comment alt display if ($com_alt) { $imgwidth = wppa_opt('comten_alt_thumbsize'); $imgheight = round($imgwidth * $imgattr_a['height'] / $imgattr_a['width']); $imgstyle .= 'float:left; margin:0 20px 8px 0;width:' . $imgwidth . 'px; height:' . $imgheight . 'px;'; } // Cursor depends on link $cursor = $imgattr_a['cursor']; // Find the required image sizes if (wppa_switch('use_thumb_popup')) { // Landscape? if ($imgwidth > $imgheight) { $popwidth = wppa_opt('popupsize'); $popheight = round($popwidth * $imgheight / $imgwidth); } else { $popheight = wppa_opt('popupsize'); $popwidth = round($popheight * $imgwidth / $imgheight); } } else { $popwidth = $imgwidth; $popheight = $imgheight; } // More image attributes $imgurl = wppa_fix_poster_ext(wppa_get_thumb_url($id, '', $popwidth, $popheight), $id); $events = wppa_get_imgevents('thumb', $id); $imgalt = wppa_get_imgalt($id); // returns something like ' alt="Any text" ' $title = esc_attr(wppa_get_photo_name($id)); // Feed ? if (is_feed()) { $imgattr_a = wppa_get_imgstyle_a($id, $imgsrc, '100', '4', 'thumb'); $style = $imgattr_a['style']; $result .= '<a href="' . get_permalink() . '">' . '<img src="' . $imgurl . '" ' . $imgalt . ' title="' . $title . '" style="' . $style . '" />' . '</a>'; return $result; } // Open Com alt wrapper if ($com_alt) { $result .= '<div>'; } // Open the thumbframe $result .= '<div' . ' id="thumbnail_frame_' . $xid . '_' . wppa('mocc') . '"' . ' class="' . $class . '"' . ' style="' . $framestyle . '"' . ' >'; // Open the image container $imgcontheight = $com_alt ? $imgheight : max($imgwidth, $imgheight); if (!is_file($imgsrc) && !wppa_is_video($id)) { $imgcontheight = 2 * wppa_get_audio_control_height(); } if ($com_alt) { $framewidth = $imgwidth + '4'; } $result .= '<div' . ' class="wppa-tn-img-container"' . ' style="' . 'height:' . $imgcontheight . 'px;' . 'width:' . $framewidth . 'px;' . ($com_alt ? 'float:left;' : '') . 'overflow:hidden;"' . '>'; // The medals if at the top $medalsize = $com_alt ? 'S' : 'M'; $result .= wppa_get_medal_html_a(array('id' => $id, 'size' => $medalsize, 'where' => 'top')); // The audio when no popup if (wppa_switch('thumb_audio') && wppa_has_audio($id) && !$com_alt) { $result .= '<div style="position:relative;z-index:11;">'; $is_safari = strpos($_SERVER["HTTP_USER_AGENT"], 'Safari'); $cont_h = $is_safari ? 16 : 28; $audiotop = $imgattr_a['height'] + $imgattr_a['margin-top'] - $cont_h; if (!is_file($imgsrc)) { // Audio without image $audiotop = wppa_get_audio_control_height(); $imgwidth = wppa_opt('tf_width'); $imgheight = wppa_get_audio_control_height(); } $result .= wppa_get_audio_html(array('id' => $id, 'width' => $imgwidth, 'height' => $cont_h, 'style' => 'position:absolute;top:' . $audiotop . 'px;left:0;border:none;')); $result .= '</div>'; } // Get the image link if (wppa('is_topten')) { $no_album = !wppa('start_album'); if ($no_album) { $tit = __('View the top rated photos', 'wp-photo-album-plus'); } else { $tit = esc_attr(__(stripslashes($thumb['description']))); } $link = wppa_get_imglnk_a('thumb', $id, '', $tit, '', $no_album); } else { $link = wppa_get_imglnk_a('thumb', $id); } // voor parent uplr // See if ajax possible if ($link) { // Is link an url? if ($link['is_url']) { if (wppa_switch('allow_ajax') && wppa_opt('thumb_linktype') == 'photo' && wppa_opt('thumb_linkpage') == '0' && !wppa_switch('thumb_blank') && !(wppa_switch('thumb_overrule') && $thumb['linkurl']) && !wppa('is_topten') && !wppa('is_lasten') && !wppa('is_comten') && !wppa('is_featen') && !wppa('is_tag') && !wppa('is_upldr') && !wppa('src') && !wppa('supersearch') && (wppa_is_int(wppa('start_album')) || wppa('start_album') == '')) { // Ajax possible // The a img ajax $p = wppa('calendar') ? '' : '&wppa-photo=' . $xid; $onclick = 'wppaDoAjaxRender( ' . wppa('mocc') . ', \'' . wppa_encrypt_url(wppa_get_slideshow_url_ajax(wppa('start_album'), '0')) . '&wppa-photo=' . $xid . '\', \'' . wppa_convert_to_pretty(wppa_encrypt_url(wppa_get_slideshow_url(wppa('start_album'), '0') . $p)) . '\' )'; $result .= '<a style="position:static;" class="thumb-img" id="x-' . $xid . '-' . wppa('mocc') . '">'; // Video? if ($is_video) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => wppa_switch('thumb_video'), 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'cursor' => 'cursor:pointer;', 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => $onclick, 'lb' => false, 'class' => '', 'style' => $imgstyle)); } else { $result .= '<img' . ' onclick="' . $onclick . '"' . ' id="i-' . $xid . '-' . wppa('mocc') . '"' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . $imgstyle . ' cursor:pointer;"' . ' ' . $events . ' />'; } // Close the a img ajax $result .= '</a>'; } else { // The a img non ajax $result .= '<a style="position:static;" href="' . $link['url'] . '" target="' . $link['target'] . '" class="thumb-img" id="x-' . $xid . '-' . wppa('mocc') . '">'; if ($is_video) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => wppa_switch('thumb_video'), 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'i-' . $xid . '-' . wppa('mocc'), 'cursor' => 'cursor:pointer;', 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => $imgstyle)); } else { $result .= '<img' . ' id="i-' . $xid . '-' . wppa('mocc') . '"' . ' src="' . $imgurl . '" ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . $imgstyle . ' cursor:pointer;"' . ' ' . $events . ' />'; } // Close the img non ajax $result .= '</a>'; } } elseif ($link['is_lightbox']) { $title = wppa_get_lbtitle('thumb', $id); // The a img $result .= '<a href="' . $link['url'] . '" target="' . $link['target'] . '"' . ($is_video ? ' data-videohtml="' . esc_attr(wppa_get_video_body($id)) . '"' . ' data-videonatwidth="' . wppa_get_videox($id) . '"' . ' data-videonatheight="' . wppa_get_videoy($id) . '"' : '') . ($has_audio ? ' data-audiohtml="' . esc_attr(wppa_get_audio_body($id)) . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '[occ' . wppa('mocc') . ']"' . ' ' . wppa('lbtitle') . '="' . $title . '" ' . ' class="thumb-img" id="x-' . $xid . '-' . wppa('mocc') . '"' . ' data-alt="' . esc_attr(wppa_get_imgalt($id, true)) . '"' . ' >'; if ($is_video) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => wppa_switch('thumb_video'), 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'i-' . $xid . '-' . wppa('mocc'), 'cursor' => $cursor, 'events' => $events, 'title' => wppa_zoom_in($id), 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => $imgstyle)); } else { $title = wppa_zoom_in($id); $result .= '<img' . ' id="i-' . $xid . '-' . wppa('mocc') . '"' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . $imgstyle . $cursor . '"' . ' ' . $events . ' />'; } // Close the a img $result .= '</a>'; } else { // is onclick // The div img $result .= '<div onclick="' . $link['url'] . '" class="thumb-img" id="x-' . $xid . '-' . wppa('mocc') . '">'; if ($is_video) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => wppa_switch('thumb_video'), 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'i-' . $xid . '-' . wppa('mocc'), 'cursor' => 'cursor:pointer;', 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => $imgstyle)); } else { $result .= '<img' . ' id="i-' . $xid . '-' . wppa('mocc') . '"' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . $imgstyle . ' cursor:pointer;"' . ' ' . $events . ' />'; } $result .= '</div>'; $result .= '<script type="text/javascript">'; $result .= '/* <![CDATA[ */'; $result .= 'wppaPopupOnclick[' . $id . '] = "' . $link['url'] . '";'; $result .= '/* ]]> */'; $result .= '</script>'; } } else { // no link if (wppa_switch('use_thumb_popup')) { $result .= '<div id="x-' . $xid . '-' . wppa('mocc') . '">'; if ($is_video) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => false, 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'i-' . $xid . '-' . wppa('mocc'), 'cursor' => '', 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => $imgstyle)); } else { $result .= '<img' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . $imgstyle . '"' . ' ' . $events . ' />'; } $result .= '</div>'; } else { if ($is_video) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => wppa_switch('thumb_video'), 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'cursor' => '', 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => $imgstyle)); } else { $result .= '<img' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . $imgstyle . '"' . ' ' . $events . ' />'; } } } // The medals if near the bottom $result .= wppa_get_medal_html_a(array('id' => $id, 'size' => $medalsize, 'where' => 'bot')); // Close the image container $result .= '</div>'; /* // The audio when popup if ( wppa_switch( 'use_thumb_popup' ) && wppa_switch( 'thumb_audio' ) && wppa_has_audio( $id ) && ! $com_alt ) { $result .= wppa_get_audio_html( array( 'id' => $id, 'width' => $imgwidth )); } */ // Comten alt display? if ($com_alt) { $comaltwidth = wppa_get_container_width() - $imgwidth - 16 - wppa_get_thumbnail_area_delta(); $result .= '<div' . ' class="wppa-com-alt wppa-com-alt-' . wppa('mocc') . '"' . ' style="' . 'height:' . $imgheight . 'px;' . 'overflow:auto;' . 'margin: 0 0 8px 10px;' . 'border:1px solid ' . wppa_opt('bcolor_alt') . ';' . 'width:' . $comaltwidth . 'px;' . '"' . ' >'; $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s AND `status` = 'approved' ORDER BY `timestamp` DESC", $id), ARRAY_A); $first = true; if ($comments) { foreach ($comments as $com) { $result .= '<h6' . ' style="' . 'font-size:10px;' . 'line-height:12px;' . 'font-weight:bold;' . 'padding:' . ($first ? '0' : '6px') . ' 0 0 6px;' . 'margin:0;float:left;' . '"' . '>' . $com['user'] . ' ' . __('wrote', 'wp-photo-album-plus') . ' ' . wppa_get_time_since($com['timestamp']) . ':' . '</h6>' . '<p' . ' style="' . 'font-size:10px;' . 'line-height:12px;' . 'padding:0 0 0 6px;' . 'text-align:left;' . 'margin:0;' . 'clear:left;' . '"' . '>' . html_entity_decode(convert_smilies(stripslashes($com['comment']))) . '</p>'; $first = false; } } $result .= '</div>'; } else { // Open the subtext container $margtop = wppa_switch('align_thumbtext') ? '' : 'margin-top:' . -$imgmarginbottom . 'px;'; $subtextcontheight = $frameheight - max($imgwidth, $imgheight); if (!wppa_switch('align_thumbtext')) { $subtextcontheight += $imgmarginbottom; } $result .= '<div' . ' class="thumbnail-subtext-frame"' . ' style="' . 'height:' . $subtextcontheight . 'px;' . 'width:' . $framewidth . 'px;' . 'position:absolute;' . $margtop . 'overflow:hidden;' . '" >'; // Single button voting system if (wppa_opt('rating_max') == '1' && wppa_switch('vote_thumb')) { $mylast = $wpdb->get_row($wpdb->prepare('SELECT * FROM `' . WPPA_RATING . '` WHERE `photo` = %s AND `user` = %s ORDER BY `id` DESC LIMIT 1', $id, wppa_get_user()), ARRAY_A); // Likes if (wppa_opt('rating_display_type') == 'likes') { $lt = wppa_get_like_title_a($id); $src = $lt['mine'] ? wppa_get_imgdir() . 'thumbdown.png' : wppa_get_imgdir() . 'thumbup.png'; $result .= '<div' . ' id="wppa-like-imgdiv-' . wppa('mocc') . '"' . ' style="display:inline"' . ' >' . '<img' . ' id="wppa-like-' . $id . '-' . wppa('mocc') . '"' . ' src="' . $src . '"' . ' alt="up"' . ' title="' . esc_attr($lt['title']) . '"' . ' style="height:16px; margin:0 0 -3px 0; padding:0 4px; box-shadow:none; display:inline;"' . ' class="no-shadow"' . ' onmouseover="jQuery(this).stop().fadeTo(100, 1.0);"' . ' onmouseout="jQuery(this).stop().fadeTo(100, wppaStarOpacity);"' . ' onclick="wppaOvlRateIt( \'' . wppa_encrypt_photo($id) . '\', 1, ' . wppa('mocc') . ' );' . '"' . ' onload="jQuery(this).trigger(\'onmouseout\');"' . ' />'; if (wppa_switch('show_avg_rating')) { $result .= '<span' . ' id="wppa-liketext-' . $id . '-' . wppa('mocc') . '"' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . '> ' . $lt['display'] . '</span>'; } $result .= '</div>'; } else { $buttext = $mylast ? __(wppa_opt('voted_button_text'), 'wp-photo-album-plus') : __(wppa_opt('vote_button_text'), 'wp-photo-album-plus'); $result .= '<input' . ' id="wppa-vote-button-' . wppa('mocc') . '-' . $xid . '"' . ' class="wppa-vote-button-thumb"' . ' style="margin:0;"' . ' type="button"' . ' onclick="wppaVoteThumb( ' . wppa('mocc') . ', \'' . $xid . '\' )"' . ' value="' . $buttext . '"' . ' />'; } } // Name if (wppa_switch('thumb_text_name') || wppa_switch('thumb_text_owner')) { $result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . wppa_get_photo_name($id, wppa_switch('thumb_text_owner'), false, false, wppa_switch('thumb_text_name')) . '</div>'; } // searching, link to album // if ( wppa( 'src' ) || wppa( 'supersearch' ) || ( ( wppa( 'is_comten') || wppa( 'is_topten' ) || wppa( 'is_lasten' ) || wppa( 'is_featen') ) && wppa( 'start_album' ) != $thumb['album'] ) ) { if (wppa_switch('thumb_text_virt_album') && wppa_is_virtual() && wppa('start_album') != $thumb['album']) { $result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . '<a' . ' href="' . wppa_get_album_url($thumb['album']) . '"' . ' >' . '<span class="wppa-tnpar" >(</span>' . stripslashes(__(wppa_get_album_name($thumb['album']), 'wp-photo-album-plus')) . '<span class="wppa-tnpar" >)</span>' . '</a>' . '</div>'; } // Share if (wppa_switch('share_on_thumbs')) { $result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . wppa_get_share_html($id, 'thumb') . '</div>'; } // Delete and Edit links if (wppa_switch('edit_thumb')) { // Open the div $result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >'; // The admins choice link if (wppa_user_is('administrator') && wppa_switch('enable_admins_choice')) { $result .= '<span' . ' id="admin-choice-' . wppa_encrypt_photo($thumb['id']) . '-' . wppa('mocc') . '"' . ' style="color:gray;"' . ' >'; if (!wppa_is_photo_in_zip($thumb['id'])) { $result .= '<a' . ' style="color:blue;cursor:pointer;"' . ' onclick="' . esc_attr('if ( confirm( "' . __('Are you sure you want to add this photo to your zip?', 'wp-photo-album-plus') . '" ) ) ' . 'wppaAjaxAddPhotoToZip( ' . wppa('mocc') . ', \'' . wppa_encrypt_photo($thumb['id']) . '\', false ); return false;') . '"' . '>' . __('MyChoice', 'wp-photo-album-plus') . '</a>'; } else { $result .= __('Selected', 'wp-photo-album-plus'); } $result .= '</span> '; } // The delete link if (wppa_may_user_fe_delete($id)) { $result .= '<a' . ' style="color:red;cursor:pointer;"' . ' onclick="' . esc_attr('if ( confirm( "' . __('Are you sure you want to remove this photo?', 'wp-photo-album-plus') . '" ) ) wppaAjaxRemovePhoto( ' . wppa('mocc') . ', \'' . $xid . '\', false ); return false;') . '"' . ' >' . __('Delete', 'wp-photo-album-plus') . '</a>' . ' '; } // The edit link if (wppa_may_user_fe_edit($id)) { $result .= '<a' . ' style="color:green;cursor:pointer;"' . ' onclick="wppaEditPhoto( ' . wppa('mocc') . ', \'' . $xid . '\' ); return false;"' . ' >' . __('Edit', 'wp-photo-album-plus') . '</a>'; } // Close the div $result .= '</div>'; } // Description if (wppa_switch('thumb_text_desc') || $thumb['status'] == 'pending' || $thumb['status'] == 'scheduled') { $desc = ''; if ($thumb['status'] == 'pending' || $thumb['status'] == 'scheduled') { $desc .= wppa_moderate_links('thumb', $id); } $desc .= wppa_get_photo_desc($id, wppa_switch('allow_foreign_shortcodes_thumbs')); $result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . $desc . '</div>'; } // Rating if (wppa_switch('thumb_text_rating')) { $rating = wppa_get_rating_by_id($id); if ($rating && wppa_switch('show_rating_count')) { $rating .= ' ( ' . wppa_get_rating_count_by_id($id) . ' )'; } $result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . $rating . '</div>'; } // Comcount if (wppa_switch('thumb_text_comcount')) { $comcount = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_COMMENTS . "` WHERE `photo` = " . $id); if ($comcount) { $result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . sprintf(_n('%d comment', '%d comments', $comcount, 'wp-photo-album-plus'), $comcount) . '</div>'; } } // Viewcount if (wppa_switch('thumb_text_viewcount')) { $result .= '<div' . ' class="wppa-thumb-text"' . ' style="clear:both;' . __wcs('wppa-thumb-text') . '"' . ' >' . sprintf(_n('%d view', '%d views', $thumb['views'], 'wp-photo-album-plus'), $thumb['views']) . '</div>'; } // Close the subtext container $result .= '</div>'; } // if ! $com_alt // Close the thumbframe $result .= '</div>'; if ($com_alt) { $result .= '</div>'; } return $result; }