Esempio n. 1
0
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') . '"' . ' >' . '&laquo;' . '</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') . '"' . ' >' . '&lsaquo;' . '</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') . '"' . ' >' . '&rsaquo;' . '</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') . '"' . ' >' . '&raquo;' . '</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.');
}
Esempio n. 2
0
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');
}
Esempio n. 3
0
function wppa_get_thumb_masonry($id)
{
    global $wpdb;
    // Init
    if (!$id) {
        wppa_dbg_msg('Please check file wppa-theme.php or any other php file that calls wppa_thumb_masonry(). Argument 1: photo id is missing!', 'red', 'force');
        die('Please check your configuration');
    }
    $result = '';
    $cont_width = wppa_get_container_width();
    $count_cols = ceil($cont_width / wppa_opt('thumbsize'));
    // Get the photo info
    $thumb = wppa_cache_thumb($id);
    // Get the album info
    $album = wppa_cache_album($thumb['album']);
    // Get photo info
    $is_video = wppa_is_video($id);
    $has_audio = wppa_has_audio($id);
    $imgsrc = wppa_fix_poster_ext(wppa_get_thumb_path($id), $id);
    if (!wppa_is_video($id) && !is_file($imgsrc)) {
        $result .= '<div' . ' class=""' . ' style="' . 'font-size:10px;' . 'color:red;' . 'width:' . wppa_opt('thumbsize') . 'px;' . 'position:static;' . 'float:left;' . '"' . ' >' . sprintf(__('Missing thumbnail image #%s', 'wp-photo-album-plus'), $id) . '</div>';
        return $result;
    }
    $alt = $album['alt_thumbsize'] == 'yes' ? '_alt' : '';
    $imgattr_a = wppa_get_imgstyle_a($id, $imgsrc, wppa_opt('thumbsize' . $alt), 'optional', 'thumb');
    // Verical style ?
    if (wppa_opt('thumbtype') == 'masonry-v') {
        $imgwidth = wppa_opt('thumbsize');
        $imgheight = $imgwidth * wppa_get_thumbratioyx($id);
        $imgstyle = 'width:100%; height:auto; margin:0; position:relative; box-sizing:border-box;';
        $frame_h = '';
    } else {
        $imgheight = wppa_opt('thumbsize');
        $imgwidth = $imgheight * wppa_get_thumbratioxy($id);
        $imgstyle = 'height:100%;' . 'width:auto;' . 'margin:0;' . 'position:relative;' . 'box-sizing:border-box;' . '';
        $frame_h = 'height:100%; ';
    }
    // Mouseover effect?
    if (wppa_switch('use_thumb_opacity')) {
        $opac = wppa_opt('thumb_opacity');
        $imgstyle .= ' opacity:' . $opac / 100 . '; filter:alpha( opacity=' . $opac . ' );';
    }
    // Padding
    if (wppa_is_int(wppa_opt('tn_margin') / 2)) {
        $imgstyle .= ' padding:' . wppa_opt('tn_margin') / 2 . 'px;';
    } else {
        $p1 = floor(wppa_opt('tn_margin') / 2);
        $p2 = ceil(wppa_opt('tn_margin') / 2);
        $imgstyle .= ' padding:' . $p1 . 'px ' . $p2 . 'px ' . $p2 . 'px ' . $p1 . 'px;';
    }
    // Cursor
    $cursor = $imgattr_a['cursor'];
    // Popup ?
    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;
    }
    $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_masonry_title($id));
    // 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="' . $title . '"' : '') . ' style="' . $style . '"' . ' />' . '</a>';
        return;
    }
    // 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
    // Open the thumbframe
    // Add class wppa-mas-h-{mocc} for ie if horizontal
    $is_ie_or_chrome = strpos($_SERVER["HTTP_USER_AGENT"], 'Trident') || strpos($_SERVER["HTTP_USER_AGENT"], 'Chrome');
    $result .= '
				<div' . ' id="thumbnail_frame_masonry_' . $id . '_' . wppa('mocc') . '"' . ($is_ie_or_chrome && wppa_opt('thumbtype') == 'masonry-h' ? ' class="wppa-mas-h-' . wppa('mocc') . '"' : '') . ' style="' . $frame_h . 'position:static;' . 'float:left;' . 'font-size:12px;' . 'line-height:8px;' . 'overflow:hidden;' . 'box-sizing:content-box;' . '" >';
    // The medals
    $result .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'top'));
    // See if ajax possible
    if ($link) {
        if ($link['is_url']) {
            // 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') ? '' : '&amp;wppa-photo=' . $id;
                $onclick = 'wppaDoAjaxRender( ' . wppa('mocc') . ', \'' . wppa_get_slideshow_url_ajax(wppa('start_album'), '0') . '&amp;wppa-photo=' . $id . '\', \'' . wppa_convert_to_pretty(wppa_get_slideshow_url(wppa('start_album'), '0') . $p) . '\' )';
                // old			$onclick = "wppaDoAjaxRender( ".wppa( 'mocc' ).", '".wppa_get_slideshow_url_ajax( wppa( 'start_album' ), '0' ).'&amp;wppa-photo='.$id."', '".wppa_convert_to_pretty( wppa_get_slideshow_url( wppa( 'start_album' ), '0' )."&amp;wppa-photo=".$id )."' )";
                $result .= '<a style="position:static;" class="thumb-img" id="x-' . $id . '-' . wppa('mocc') . '">';
                if ($is_video) {
                    //					$result .= '<video preload="metadata" onclick="'.$onclick.'" id="i-'.$id.'-'.wppa( 'mocc' ).'" '.$imgalt.' title="'.$title.'" style="'.$imgstyle.' cursor:pointer;" '.$events.' >'.wppa_get_video_body( $id ).'</video>';
                    $result .= wppa_get_video_html(array('id' => $id, 'controls' => false, '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, 'use_thumb' => true));
                } else {
                    $result .= '<img' . ' onclick="' . $onclick . '"' . ' id="i-' . $id . '-' . wppa('mocc') . '"' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' style="' . $imgstyle . ' cursor:pointer;"' . ' ' . $events . ' />';
                }
                $result .= '</a>';
            } else {
                // non ajax
                // The a img non ajax
                $result .= '<a style="position:static;" href="' . $link['url'] . '" target="' . $link['target'] . '" class="thumb-img" id="x-' . $id . '-' . wppa('mocc') . '">';
                if ($is_video) {
                    //					$result .= '<video preload="metadata" id="i-'.$id.'-'.wppa( 'mocc' ).'" '.$imgalt.' title="'.$title.'" width="'.$imgwidth.'" height="'.$imgheight.'" style="'.$imgstyle.' cursor:pointer;" '.$events.' >'.wppa_get_video_body( $id ).'</video>';
                    $result .= wppa_get_video_html(array('id' => $id, 'controls' => false, 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'cursor' => 'cursor:pointer;', 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => $imgstyle, 'use_thumb' => true));
                } else {
                    $result .= '<img' . ' id="i-' . $id . '-' . wppa('mocc') . '"' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' style="' . $imgstyle . 'cursor:pointer;"' . ' ' . $events . ' />';
                }
                $result .= '</a>';
            }
        } elseif ($link['is_lightbox']) {
            // The a img
            $title = wppa_get_lbtitle('thumb', $id);
            $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') . ']"' . ($title ? ' ' . wppa('lbtitle') . '="' . $title . '"' : '') . ' class="thumb-img"' . ' id="x-' . $id . '-' . wppa('mocc') . '">';
            // The image
            $title = wppa_zoom_in($id);
            // Video?
            if ($is_video) {
                $result .= wppa_get_video_html(array('id' => $id, 'controls' => false, 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'cursor' => $cursor, 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => $imgstyle, 'use_thumb' => true));
            } else {
                $result .= '<img' . ' id="i-' . $id . '-' . wppa('mocc') . '"' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' style="' . $imgstyle . $cursor . '"' . ' ' . $events . ' />';
            }
            $result .= '</a>';
        } else {
            // The div img
            $result .= '<div onclick="' . $link['url'] . '" class="thumb-img" id="x-' . $id . '-' . wppa('mocc') . '" style="height:100%;" >';
            // Video?
            if ($is_video) {
                $result .= wppa_get_video_html(array('id' => $id, 'controls' => false, 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'cursor' => 'cursor:pointer;', 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => $imgstyle, 'use_thumb' => true));
            } else {
                $result .= '<img' . ' id="i-' . $id . '-' . wppa('mocc') . '"' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' 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-' . $id . '-' . wppa('mocc') . '" style="height:100%" >';
            if ($is_video) {
                $result .= wppa_get_video_html(array('id' => $id, 'controls' => false, 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'cursor' => '', 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => $imgstyle, 'use_thumb' => true));
            } else {
                $result .= '<img' . ' id="i-' . $id . '-' . wppa('mocc') . '"' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . $imgstyle . '"' . ' ' . $events . ' />';
            }
            $result .= '</div>';
        } else {
            if ($is_video) {
                //				$result .= '<video preload="metadata" '.$imgalt.' title="'.$title.'" width="'.$imgwidth.'" height="'.$imgheight.'" style="'.$imgstyle.'" '.$events.' >'.wppa_get_video_body( $id ).'</video>';
                $result .= wppa_get_video_html(array('id' => $id, 'controls' => false, 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'cursor' => '', 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => $imgstyle, 'use_thumb' => true));
            } else {
                $result .= '<img' . ' id="i-' . $id . '-' . wppa('mocc') . '"' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . $imgstyle . '" ' . $events . ' />';
            }
        }
    }
    // The audio when no popup
    if (wppa_switch('thumb_audio') && wppa_has_audio($id)) {
        $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, 'tagid' => 'a-' . $id . '-' . wppa('mocc'), 'style' => 'width:100%;position:absolute;bottom:0;margin:0;padding:' . wppa_opt('tn_margin') / 2 . 'px;left:0;border:none;z-index:10;'));
        $result .= '</div>';
    }
    // The medals
    $result .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'bot'));
    // Close the thumbframe
    $result .= '</div>';
    return $result;
}
function wppa_have_photos($xwidth = '0')
{
    if (!is_search()) {
        return false;
    }
    $width = $xwidth ? $xwidth : wppa_get_container_width();
    wppa('searchresults', wppa_albums('', '', $width));
    return wppa('any');
}
Esempio n. 5
0
function wppa_get_ajaxlink($key = '', $deltamoccur = '0')
{
    global $wppa_lang;
    if (wppa_switch('ajax_non_admin')) {
        $al = WPPA_URL . '/wppa-ajax-front.php?action=wppa&amp;wppa-action=render';
    } else {
        $al = admin_url('admin-ajax.php') . '?action=wppa&amp;wppa-action=render';
    }
    // See if this call is from an ajax operation or...
    if (wppa('ajax')) {
        if (wppa_get_get('size')) {
            $al .= '&amp;wppa-size=' . wppa_get_get('size');
        }
        if (wppa_get_get('moccur')) {
            $al .= '&amp;wppa-moccur=' . wppa_get_get('moccur');
        }
        if (is_numeric($key) && $key > '0') {
            $al .= '&amp;page_id=' . $key;
        } else {
            if (wppa_get_get('page_id')) {
                $al .= '&amp;page_id=' . wppa_get_get('page_id');
            }
        }
        if (wppa_get_get('p')) {
            $al .= '&amp;p=' . wppa_get_get('p');
        }
        if (wppa_get_get('fromp')) {
            $al .= '&amp;wppa-fromp=' . wppa_get_get('wppa-fromp');
        }
    } else {
        // directly from a page or post
        $al .= '&amp;wppa-size=' . wppa_get_container_width();
        $al .= '&amp;wppa-moccur=' . (wppa('mocc') + $deltamoccur);
        if (is_numeric($key) && $key > '0') {
            $al .= '&amp;page_id=' . $key;
        } else {
            if (wppa_get_get('p')) {
                $al .= '&amp;p=' . wppa_get_get('p');
            }
            if (wppa_get_get('page_id')) {
                $al .= '&amp;page_id=' . wppa_get_get('page_id');
            }
        }
        $al .= '&amp;wppa-fromp=' . get_the_ID();
    }
    if (wppa_get_get('lang')) {
        // If lang in querystring: keep it
        if (strpos($al, 'lang=') === false) {
            // Not yet
            if ($key == 'js') {
                $al .= '&lang=' . $wppa_lang;
            } else {
                $al .= '&amp;lang=' . $wppa_lang;
            }
        }
    }
    if (wppa('is_rootsearch')) {
        if ($key == 'js') {
            $al .= '&rootsearch=1';
        } else {
            $al .= '&amp;rootsearch=1';
        }
    }
    if (wppa('debug')) {
        $al .= '&amp;debug=' . wppa('debug');
    }
    return $al . '&amp;';
}
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');
}
Esempio n. 7
0
function wppa_comment_html($id, $comment_allowed)
{
    global $wpdb;
    global $current_user;
    global $wppa_first_comment_html;
    $result = '';
    if (wppa_in_widget()) {
        return $result;
    }
    // NOT in a widget
    // Find out who we are either logged in or not
    $vis = is_user_logged_in() ? 'display:none; ' : '';
    if (!$wppa_first_comment_html) {
        $wppa_first_comment_html = true;
        // Find user
        if (wppa_get_post('comname')) {
            wppa('comment_user', wppa_get_post('comname'));
        }
        if (wppa_get_post('comemail')) {
            wppa('comment_email', wppa_get_post('comemail'));
        } elseif (is_user_logged_in()) {
            get_currentuserinfo();
            wppa('comment_user', $current_user->display_name);
            //user_login;
            wppa('comment_email', $current_user->user_email);
        }
    }
    // Loop the comments already there
    $n_comments = 0;
    if (wppa_switch('comments_desc')) {
        $ord = 'DESC';
    } else {
        $ord = '';
    }
    $comments = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . WPPA_COMMENTS . ' WHERE photo = %s ORDER BY id ' . $ord, $id), ARRAY_A);
    wppa_dbg_q('Q-Comm');
    $com_count = count($comments);
    $color = 'darkgrey';
    if (wppa_opt('fontcolor_box')) {
        $color = wppa_opt('fontcolor_box');
    }
    if ($comments && (is_user_logged_in() || !wppa_switch('comment_view_login'))) {
        $result .= '
			<div' . ' id="wppa-comtable-wrap-' . wppa('mocc') . '"' . ' style="display:none;"' . '>' . '<table' . ' id="wppacommentstable-' . wppa('mocc') . '"' . ' class="wppa-comment-form"' . ' style="margin:0; "' . '>' . '<tbody>';
        foreach ($comments as $comment) {
            // Show a comment either when it is approved, or it is pending and mine or i am a moderator
            if ($comment['status'] == 'approved' || current_user_can('wppa_moderate') || current_user_can('wppa_comments') || ($comment['status'] == 'pending' || $comment['status'] == 'spam') && $comment['user'] == wppa('comment_user')) {
                $n_comments++;
                $result .= '
					<tr' . ' class="wppa-comment-' . $comment['id'] . '"' . ' valign="top"' . ' style="border-bottom:0 none; border-top:0 none; border-left: 0 none; border-right: 0 none; "' . ' >' . '<td' . ' valign="top"' . ' class="wppa-box-text wppa-td"' . ' style="vertical-align:top; width:30%; border-width: 0 0 0 0; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . $comment['user'] . ' ' . __('wrote:', 'wp-photo-album-plus') . '<br />' . '<span style="font-size:9px; ">' . wppa_get_time_since($comment['timestamp']) . '</span>';
                // Avatar ?
                if (wppa_opt('comment_gravatar') != 'none') {
                    // Find the default
                    if (wppa_opt('comment_gravatar') != 'url') {
                        $default = wppa_opt('comment_gravatar');
                    } else {
                        $default = wppa_opt('comment_gravatar_url');
                    }
                    // Find the avatar, init
                    $avt = false;
                    $usr = false;
                    // First try to find the user by email address ( works only if email required on comments )
                    if ($comment['email']) {
                        $usr = get_user_by('email', $comment['email']);
                    }
                    // If not found, try to find the user by login name ( works only if login name is equal to display name )
                    if (!$usr) {
                        $usr = get_user_by('login', $comment['user']);
                    }
                    // Still no user, try to find him by display name
                    if (!$usr) {
                        $usr = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE `display_name` = %s", $comment['user']));
                        // Accept this user if he is the only one with this display name
                        if (count($usr) != 1) {
                            $usr = false;
                        }
                    }
                    // If a user is found, see for local Avatar ?
                    if ($usr) {
                        $avt = str_replace("'", "\"", get_avatar($usr->ID, wppa_opt('gravatar_size'), $default));
                    }
                    // Global avatars off ? try myself
                    if (!$avt) {
                        $avt = '
										<img' . ' class="wppa-box-text wppa-td"' . ' src="http://www.gravatar.com/avatar/' . md5(strtolower(trim($comment['email']))) . '.jpg?d=' . urlencode($default) . '&s=' . wppa_opt('gravatar_size') . '"' . ' alt="' . __('Avatar', 'wp-photo-album-plus') . '"' . ' />';
                    }
                    // Compose the html
                    $result .= '
									<div class="com_avatar">' . $avt . '</div>';
                }
                $result .= '</td>';
                $txtwidth = floor(wppa_get_container_width() * 0.7) . 'px';
                $result .= '<td' . ' class="wppa-box-text wppa-td"' . ' style="width:70%; word-wrap:break-word; border-width: 0 0 0 0;' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . '<p' . ' class="wppa-comment-textarea wppa-comment-textarea-' . wppa('mocc') . '"' . ' style="' . 'margin:0;' . 'background-color:transparent;' . 'width:' . $txtwidth . ';' . 'max-height:90px;' . 'overflow:auto;' . 'word-wrap:break-word;' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . html_entity_decode(esc_js(stripslashes(wppa_convert_smilies($comment['comment']))));
                if ($comment['status'] != 'approved' && (current_user_can('wppa_moderate') || current_user_can('wppa_comments'))) {
                    if (wppa('no_esc')) {
                        $result .= wppa_moderate_links('comment', $id, $comment['id']);
                    } else {
                        $result .= wppa_html(esc_js(wppa_moderate_links('comment', $id, $comment['id'])));
                    }
                } elseif ($comment['status'] == 'pending' && $comment['user'] == wppa('comment_user')) {
                    $result .= '<br /><span style="color:red; font-size:9px;" >' . __('Awaiting moderation', 'wp-photo-album-plus') . '</span>';
                } elseif ($comment['status'] == 'spam' && $comment['user'] == wppa('comment_user')) {
                    $result .= '<br /><span style="color:red; font-size:9px;" >' . __('Marked as spam', 'wp-photo-album-plus') . '</span>';
                }
                $result .= '</p>' . '</td>' . '</tr>' . '<tr class="wppa-comment-' . $comment['id'] . '">' . '<td colspan="2" style="padding:0">' . '<hr style="background-color:' . $color . '; margin:0;" />' . '</td>' . '</tr>';
            }
        }
        $result .= '</tbody>' . '</table>' . '</div>';
    }
    // See if we are currently in the process of adding/editing this comment
    $is_current = $id == wppa('comment_photo') && wppa('comment_id');
    if ($is_current) {
        $txt = wppa('comment_text');
        $btn = __('Edit!', 'wp-photo-album-plus');
    } else {
        $txt = '';
        $btn = __('Send!', 'wp-photo-album-plus');
    }
    // Prepare the callback url
    $returnurl = wppa_get_permalink();
    $album = wppa_get_get('album');
    if ($album !== false) {
        $returnurl .= 'wppa-album=' . $album . '&';
    }
    $cover = wppa_get_get('cover');
    if ($cover) {
        $returnurl .= 'wppa-cover=' . $cover . '&';
    }
    $slide = wppa_get_get('slide');
    if ($slide !== false) {
        $returnurl .= 'wppa-slide&';
    }
    $occur = wppa_get_get('occur');
    if ($occur) {
        $returnurl .= 'wppa-occur=' . $occur . '&';
    }
    $lasten = wppa_get_get('lasten');
    if ($lasten) {
        $returnurl .= 'wppa-lasten=' . $lasten . '&';
    }
    $topten = wppa_get_get('topten');
    if ($topten) {
        $returnurl .= 'wppa-topten=' . $topten . '&';
    }
    $comten = wppa_get_get('comten');
    if ($comten) {
        $returnurl .= 'wppa-comten=' . $comten . '&';
    }
    $tag = wppa_get_get('tag');
    if ($tag) {
        $returnurl .= 'wppa-tag=' . $tag . '&';
    }
    $returnurl .= 'wppa-photo=' . $id;
    // The comment form
    if ($comment_allowed) {
        $result .= '<div' . ' id="wppa-comform-wrap-' . wppa('mocc') . '"' . ' style="display:none;"' . ' >' . '<form' . ' id="wppa-commentform-' . wppa('mocc') . '"' . ' class="wppa-comment-form"' . ' action="' . $returnurl . '"' . ' method="post"' . ' onsubmit="return wppaValidateComment( ' . wppa('mocc') . ' )"' . ' >' . wp_nonce_field('wppa-nonce-' . wppa('mocc'), 'wppa-nonce-' . wppa('mocc'), false, false) . ($album ? '<input type="hidden" name="wppa-album" value="' . $album . '" />' : '') . ($cover ? '<input type="hidden" name="wppa-cover" value="' . $cover . '" />' : '') . ($slide ? '<input type="hidden" name="wppa-slide" value="' . $slide . '" />' : '') . '<input' . ' type="hidden"' . ' name="wppa-returnurl"' . ' id="wppa-returnurl-' . wppa('mocc') . '"' . ' value="' . $returnurl . '"' . ' />' . ($is_current ? '<input' . ' type="hidden"' . ' id="wppa-comment-edit-' . wppa('mocc') . '"' . ' name="wppa-comment-edit"' . ' value="' . wppa('comment_id') . '"' . ' />' : '') . '<input type="hidden" name="wppa-occur" value="' . wppa('occur') . '" />' . '<table id="wppacommenttable-' . wppa('mocc') . '" style="margin:0;">' . '<tbody>' . '<tr valign="top" style="' . $vis . '">' . '<td class="wppa-box-text wppa-td" style="width:30%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . __('Your name:', 'wp-photo-album-plus') . '</td>' . '<td class="wppa-box-text wppa-td" style="width:70%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . '<input' . ' type="text"' . ' name="wppa-comname"' . ' id="wppa-comname-' . wppa('mocc') . '"' . ' style="width:100%; " value="' . wppa('comment_user') . '"' . ' />' . '</td>' . '</tr>';
        if (wppa_switch('comment_email_required')) {
            $result .= '<tr valign="top" style="' . $vis . '">' . '<td class="wppa-box-text wppa-td" style="width:30%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . __('Your email:', 'wp-photo-album-plus') . '</td>' . '<td class="wppa-box-text wppa-td" style="width:70%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . '<input' . ' type="text"' . ' name="wppa-comemail"' . ' id="wppa-comemail-' . wppa('mocc') . '"' . ' style="width:100%;"' . ' value="' . wppa('comment_email') . '"' . ' />' . '</td>' . '</tr>';
        }
        $result .= '<tr valign="top" style="vertical-align:top;">' . '<td valign="top" class="wppa-box-text wppa-td" style="vertical-align:top; width:30%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . __('Your comment:', 'wp-photo-album-plus') . '<br />' . wppa('comment_user') . '<br />';
        if (is_user_logged_in() && wppa_opt('comment_captcha') == 'all' || !is_user_logged_in() && wppa_opt('comment_captcha') != 'none') {
            $wid = '20%';
            if (wppa_opt('fontsize_box')) {
                $wid = wppa_opt('fontsize_box') * 1.5 . 'px';
            }
            $captkey = $id;
            if ($is_current) {
                $captkey = $wpdb->get_var($wpdb->prepare('SELECT `timestamp` FROM `' . WPPA_COMMENTS . '` WHERE `id` = %s', wppa('comment_id')));
            }
            wppa_dbg_q('Q-Com-ts');
            $result .= wppa_make_captcha($captkey) . '<input' . ' type="text"' . ' id="wppa-captcha-' . wppa('mocc') . '"' . ' name="wppa-captcha"' . ' style="width:' . $wid . ';' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' />&nbsp;';
        }
        $result .= '<input type="button" name="commentbtn" onclick="wppaAjaxComment( ' . wppa('mocc') . ', ' . $id . ' )" value="' . $btn . '" style="margin:0 4px 0 0;" />' . '<img id="wppa-comment-spin-' . wppa('mocc') . '" src="' . wppa_get_imgdir() . 'wpspin.gif" style="display:none;" />' . '</td>' . '<td valign="top" class="wppa-box-text wppa-td" style="vertical-align:top; width:70%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >';
        if (wppa_switch('comment_smiley_picker')) {
            $result .= wppa_get_smiley_picker_html('wppa-comment-' . wppa('mocc'));
        }
        $result .= '<textarea' . ' name="wppa-comment"' . ' id="wppa-comment-' . wppa('mocc') . '"' . ' style="height:60px; width:100%; "' . '>' . esc_textarea(stripslashes($txt)) . '</textarea>' . '</td>' . '</tr>' . '</tbody>' . '</table>' . '</form>' . '</div>';
    } else {
        if (wppa_switch('login_links')) {
            $result .= sprintf(__('You must <a href="%s">login</a> to enter a comment', 'wp-photo-album-plus'), site_url('wp-login.php', 'login'));
        } else {
            $result .= __('You must login to enter a comment', 'wp-photo-album-plus');
        }
    }
    $result .= '<div id="wppa-comfooter-wrap-' . wppa('mocc') . '" style="display:block;" >' . '<table id="wppacommentfooter-' . wppa('mocc') . '" class="wppa-comment-form" style="margin:0;">' . '<tbody>' . '<tr style="text-align:center;">' . '<td style="text-align:center; cursor:pointer;' . __wcs('wppa-box-text') . '" >' . '<a onclick="wppaOpenComments( ' . wppa('mocc') . ', -1 ); return false;" >';
    if ($n_comments) {
        $result .= sprintf(_n('%d comment', '%d comments', $n_comments, 'wp-photo-album-plus'), $n_comments);
    } else {
        if ($comment_allowed) {
            $result .= __('Leave a comment', 'wp-photo-album-plus');
        }
    }
    $result .= '</a>' . '</td>' . '</tr>' . '</tbody>' . '</table>' . '</div>' . '<div style="clear:both"></div>';
    return $result;
}
Esempio n. 8
0
function wppa_have_photos($xwidth = '0')
{
    global $wppa;
    if (!is_search()) {
        return false;
    }
    $width = $xwidth ? $xwidth : wppa_get_container_width();
    $wppa['searchresults'] = wppa_albums('', '', $width);
    return $wppa['any'];
}
Esempio n. 9
0
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') . '" >&laquo;</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') . '" >&lsaquo;</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') . '" >&rsaquo;</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') . '" >&raquo;</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.');
}
Esempio n. 10
0
function wppa_comment_html($id, $comment_allowed)
{
    global $wpdb;
    global $wppa;
    global $current_user;
    global $wppa_first_comment_html;
    $result = '';
    if ($wppa['in_widget']) {
        return $result;
    }
    // NOT in a widget
    // Find out who we are either logged in or not
    $vis = is_user_logged_in() ? $vis = 'display:none; ' : '';
    if (!$wppa_first_comment_html) {
        $wppa_first_comment_html = true;
        // Find user
        if (wppa_get_post('comname')) {
            $wppa['comment_user'] = wppa_get_post('comname');
        }
        if (wppa_get_post('comemail')) {
            $wppa['comment_email'] = wppa_get_post('comemail');
        } elseif (is_user_logged_in()) {
            get_currentuserinfo();
            $wppa['comment_user'] = $current_user->display_name;
            //user_login;
            $wppa['comment_email'] = $current_user->user_email;
        }
    }
    // Loop the comments already there
    $n_comments = 0;
    if (wppa_switch('comments_desc')) {
        $ord = 'DESC';
    } else {
        $ord = '';
    }
    $comments = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . WPPA_COMMENTS . ' WHERE photo = %s ORDER BY id ' . $ord, $id), ARRAY_A);
    wppa_dbg_q('Q-Comm');
    $com_count = count($comments);
    $color = 'darkgrey';
    if (wppa_opt('wppa_fontcolor_box')) {
        $color = wppa_opt('wppa_fontcolor_box');
    }
    if ($comments) {
        $result .= '<div id="wppa-comtable-wrap-' . $wppa['mocc'] . '" style="display:none;" >';
        $result .= '<table id="wppacommentstable-' . $wppa['mocc'] . '" class="wppa-comment-form" style="margin:0; "><tbody>';
        foreach ($comments as $comment) {
            // Show a comment either when it is approved, or it is pending and mine or i am a moderator
            if ($comment['status'] == 'approved' || current_user_can('wppa_moderate') || current_user_can('wppa_comments') || ($comment['status'] == 'pending' || $comment['status'] == 'spam') && $comment['user'] == $wppa['comment_user']) {
                $n_comments++;
                $result .= '<tr class="wppa-comment-' . $comment['id'] . '" valign="top" style="border-bottom:0 none; border-top:0 none; border-left: 0 none; border-right: 0 none; " >';
                $result .= '<td valign="top" class="wppa-box-text wppa-td" style="vertical-align:top; width:30%; border-width: 0 0 0 0; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >';
                $result .= $comment['user'] . ' ' . __a('wrote:');
                $result .= '<br /><span style="font-size:9px; ">' . wppa_get_time_since($comment['timestamp']) . '</span>';
                if (wppa_opt('wppa_comment_gravatar') != 'none') {
                    // Find the default
                    if (wppa_opt('wppa_comment_gravatar') != 'url') {
                        $default = wppa_opt('wppa_comment_gravatar');
                    } else {
                        $default = wppa_opt('wppa_comment_gravatar_url');
                    }
                    // Find the avatar
                    $avt = '';
                    $usr = get_user_by('login', $comment['user']);
                    if ($usr) {
                        // Local Avatar ?
                        $avt = str_replace("'", "\"", get_avatar($usr->ID, wppa_opt('wppa_gravatar_size'), $default));
                    }
                    if ($avt == '') {
                        // Global avatars off, try myself
                        $avt = '<img class="wppa-box-text wppa-td" src="http://www.gravatar.com/avatar/' . md5(strtolower(trim($comment['email']))) . '.jpg?d=' . urlencode($default) . '&s=' . wppa_opt('wppa_gravatar_size') . '" alt="' . __a('Avatar') . '" />';
                    }
                    // Compose the html
                    $result .= '<div class="com_avatar">' . $avt . '</div>';
                }
                $result .= '</td>';
                $txtwidth = floor(wppa_get_container_width() * 0.7) . 'px';
                $result .= '<td class="wppa-box-text wppa-td" style="width:70%; word-wrap:break-word; border-width: 0 0 0 0;' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . '<p class="wppa-comment-textarea wppa-comment-textarea-' . $wppa['mocc'] . '" style="margin:0; background-color:transparent; width:' . $txtwidth . '; max-height:90px; overflow:auto; word-wrap:break-word;' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . html_entity_decode(esc_js(stripslashes(wppa_convert_smilies($comment['comment']))));
                if ($comment['status'] != 'approved' && (current_user_can('wppa_moderate') || current_user_can('wppa_comments'))) {
                    if ($wppa['no_esc']) {
                        $result .= wppa_moderate_links('comment', $id, $comment['id']);
                    } else {
                        $result .= wppa_html(esc_js(wppa_moderate_links('comment', $id, $comment['id'])));
                    }
                } elseif ($comment['status'] == 'pending' && $comment['user'] == $wppa['comment_user']) {
                    $result .= '<br /><span style="color:red; font-size:9px;" >' . __a('Awaiting moderation') . '</span>';
                } elseif ($comment['status'] == 'spam' && $comment['user'] == $wppa['comment_user']) {
                    $result .= '<br /><span style="color:red; font-size:9px;" >' . __a('Marked as spam') . '</span>';
                }
                $result .= '</p>';
                $result .= '</td>';
                $result .= '</tr>';
                $result .= '<tr class="wppa-comment-' . $comment['id'] . '"><td colspan="2" style="padding:0"><hr style="background-color:' . $color . '; margin:0;" /></td></tr>';
            }
        }
        $result .= '</tbody></table>';
        $result .= '</div>';
    }
    // See if we are currently in the process of adding/editing this comment
    $is_current = $id == $wppa['comment_photo'] && $wppa['comment_id'];
    // $debugtext=' ( id='.$id.', comment_photo='.$wppa['comment_photo'].', comment_id='.$wppa['comment_id'].' )';
    if ($is_current) {
        $txt = $wppa['comment_text'];
        $btn = __a('Edit!');
    } else {
        $txt = '';
        $btn = __a('Send!');
    }
    // Prepare the callback url
    $returnurl = wppa_get_permalink();
    $album = wppa_get_get('album');
    if ($album !== false) {
        $returnurl .= 'wppa-album=' . $album . '&';
    }
    $cover = wppa_get_get('cover');
    if ($cover) {
        $returnurl .= 'wppa-cover=' . $cover . '&';
    }
    $slide = wppa_get_get('slide');
    if ($slide !== false) {
        $returnurl .= 'wppa-slide&';
    }
    $occur = wppa_get_get('occur');
    if ($occur) {
        $returnurl .= 'wppa-occur=' . $occur . '&';
    }
    $lasten = wppa_get_get('lasten');
    if ($lasten) {
        $returnurl .= 'wppa-lasten=' . $lasten . '&';
    }
    $topten = wppa_get_get('topten');
    if ($topten) {
        $returnurl .= 'wppa-topten=' . $topten . '&';
    }
    $comten = wppa_get_get('comten');
    if ($comten) {
        $returnurl .= 'wppa-comten=' . $comten . '&';
    }
    $tag = wppa_get_get('tag');
    if ($tag) {
        $returnurl .= 'wppa-tag=' . $tag . '&';
    }
    $returnurl .= 'wppa-photo=' . $id;
    // The comment form
    if ($comment_allowed) {
        $result .= '<div id="wppa-comform-wrap-' . $wppa['mocc'] . '" style="display:none;" >';
        $result .= '<form id="wppa-commentform-' . $wppa['mocc'] . '" class="wppa-comment-form" action="' . $returnurl . '" method="post" style="" onsubmit="return wppaValidateComment( ' . $wppa['mocc'] . ' )">';
        $result .= wp_nonce_field('wppa-nonce-' . wppa('mocc'), 'wppa-nonce-' . wppa('mocc'), false, false);
        //, $alb );
        if ($album) {
            $result .= '<input type="hidden" name="wppa-album" value="' . $album . '" />';
        }
        if ($cover) {
            $result .= '<input type="hidden" name="wppa-cover" value="' . $cover . '" />';
        }
        if ($slide) {
            $result .= '<input type="hidden" name="wppa-slide" value="' . $slide . '" />';
        }
        $result .= '<input type="hidden" name="wppa-returnurl" id="wppa-returnurl-' . wppa('mocc') . '" value="' . $returnurl . '" />';
        if ($is_current) {
            $result .= '<input type="hidden" id="wppa-comment-edit-' . $wppa['mocc'] . '" name="wppa-comment-edit" value="' . $wppa['comment_id'] . '" />';
        }
        $result .= '<input type="hidden" name="wppa-occur" value="' . $wppa['occur'] . '" />';
        $result .= '<table id="wppacommenttable-' . $wppa['mocc'] . '" style="margin:0;">';
        $result .= '<tbody>';
        $result .= '<tr valign="top" style="' . $vis . '">';
        $result .= '<td class="wppa-box-text wppa-td" style="width:30%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . __a('Your name:') . '</td>';
        $result .= '<td class="wppa-box-text wppa-td" style="width:70%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" ><input type="text" name="wppa-comname" id="wppa-comname-' . $wppa['mocc'] . '" style="width:100%; " value="' . $wppa['comment_user'] . '" /></td>';
        $result .= '</tr>';
        if (wppa_switch('comment_email_required')) {
            $result .= '<tr valign="top" style="' . $vis . '">';
            $result .= '<td class="wppa-box-text wppa-td" style="width:30%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . __a('Your email:') . '</td>';
            $result .= '<td class="wppa-box-text wppa-td" style="width:70%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" ><input type="text" name="wppa-comemail" id="wppa-comemail-' . $wppa['mocc'] . '" style="width:100%; " value="' . $wppa['comment_email'] . '" /></td>';
            $result .= '</tr>';
        }
        $result .= '<tr valign="top" style="vertical-align:top;">';
        $result .= '<td valign="top" class="wppa-box-text wppa-td" style="vertical-align:top; width:30%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . __a('Your comment:') . '<br />' . $wppa['comment_user'] . '<br />';
        if (wppa_switch('comment_captcha')) {
            $wid = '20%';
            if (wppa_opt('wppa_fontsize_box')) {
                $wid = wppa_opt('wppa_fontsize_box') * 1.5 . 'px';
            }
            $captkey = $id;
            if ($is_current) {
                $captkey = $wpdb->get_var($wpdb->prepare('SELECT `timestamp` FROM `' . WPPA_COMMENTS . '` WHERE `id` = %s', $wppa['comment_id']));
            }
            wppa_dbg_q('Q-Com-ts');
            $result .= wppa_make_captcha($captkey) . '<input type="text" id="wppa-captcha-' . $wppa['mocc'] . '" name="wppa-captcha" style="width:' . $wid . '; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" />&nbsp;';
        }
        // orig							$result .= '<input type="submit" name="commentbtn" value="'.$btn.'" style="margin:0;" /></td>';
        $result .= '<input type="button" name="commentbtn" onclick="wppaAjaxComment( ' . $wppa['mocc'] . ', ' . $id . ' )" value="' . $btn . '" style="margin:0 4px 0 0;" />';
        $result .= '<img id="wppa-comment-spin-' . $wppa['mocc'] . '" src="' . wppa_get_imgdir() . 'wpspin.gif" style="display:none;" />';
        $result .= '</td>';
        $result .= '<td valign="top" class="wppa-box-text wppa-td" style="vertical-align:top; width:70%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >';
        /*							if ( wppa_switch( 'use_wp_editor' ) ) {
        								$quicktags_settings = array( 'buttons' => 'strong,em,link,block,ins,ul,ol,li,code,close' );
        								ob_start();
        								wp_editor( stripslashes( $txt ), 'wppacomment'.wppa_alfa_id( $id ), array( 'wpautop' => false, 'media_buttons' => false, 'textarea_rows' => '6', 'tinymce' => false, 'quicktags' => $quicktags_settings ) );
        								$editor = ob_get_clean();
        								$result .= str_replace( "'", '"', $editor );
        							}
        							else {
        /**/
        if (wppa_switch('comment_smiley_picker')) {
            $result .= wppa_get_smiley_picker_html('wppa-comment-' . $wppa['mocc']);
        }
        $result .= '<textarea name="wppa-comment" id="wppa-comment-' . $wppa['mocc'] . '" style="height:60px; width:100%; ">' . esc_textarea(stripslashes($txt)) . '</textarea>';
        /*							}
        /* */
        $result .= '</td>';
        $result .= '</tr>';
        $result .= '</tbody>';
        $result .= '</table>';
        $result .= '</form>';
        // $result.=$debugtext;
        $result .= '</div>';
    } else {
        if (wppa_switch('login_links')) {
            $result .= sprintf(__a('You must <a href="%s">login</a> to enter a comment'), site_url('wp-login.php', 'login'));
        } else {
            $result .= __a('You must login to enter a comment');
        }
    }
    $result .= '<div id="wppa-comfooter-wrap-' . $wppa['mocc'] . '" style="display:block;" >';
    $result .= '<table id="wppacommentfooter-' . $wppa['mocc'] . '" class="wppa-comment-form" style="margin:0;">';
    $result .= '<tbody><tr style="text-align:center; "><td style="text-align:center; cursor:pointer;' . __wcs('wppa-box-text') . '" ><a onclick="wppaOpenComments( ' . $wppa['mocc'] . ', -1 ); return false;">';
    // wppaStartStop( '.$wppa['mocc'].', -1 ); return false;">';
    if ($n_comments) {
        $result .= sprintf(__a('%d comments'), $n_comments);
    } else {
        if ($comment_allowed) {
            $result .= __a('Leave a comment');
        }
    }
    $result .= '</a></td></tr></tbody></table>';
    $result .= '</div><div style="clear:both"></div>';
    return $result;
}