• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wppa_get_thumb_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wppa_get_thumb_path函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_get_thumb_path函数的具体用法?PHP wppa_get_thumb_path怎么用?PHP wppa_get_thumb_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wppa_get_thumb_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wppa_get_video_html

function wppa_get_video_html($args)
{
    global $wppa;
    extract(wp_parse_args((array) $args, array('id' => '0', 'width' => '0', 'height' => '0', 'controls' => true, 'margin_top' => '0', 'margin_bottom' => '0', 'tagid' => 'video-' . $wppa['mocc'], 'cursor' => '', 'events' => '', 'title' => '', 'preload' => 'metadata', 'onclick' => '', 'lb' => false, 'class' => '', 'style' => '', 'use_thumb' => false, 'autoplay' => false)));
    // No id? no go
    if (!$id) {
        return '';
    }
    // Not a video? no go
    if (!wppa_is_video($id)) {
        return '';
    }
    extract(wp_parse_args((array) wppa_is_video($id), array('mp4' => false, 'ogv' => false, 'webm' => false)));
    // Prepare attributes
    $w = $width ? ' width:' . $width . 'px;' : '';
    $h = $height ? ' height:' . $height . 'px;' : '';
    $t = $margin_top ? ' margin-top:' . $margin_top . 'px;' : '';
    $b = $margin_bottom ? ' margin-bottom:' . $margin_bottom . 'px;' : '';
    $ctrl = $controls ? ' controls' : '';
    $tit = $title ? ' title="' . $title . '"' : '';
    $onc = $onclick ? ' onclick="' . $onclick . '"' : '';
    $cls = $class ? ' class="' . $class . '"' : '';
    $style = $style ? rtrim(trim($style), ';') . ';' : '';
    $play = $autoplay ? ' autoplay' : '';
    // See if there is a poster image
    $poster_photo_path = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
    $poster_thumb_path = wppa_fix_poster_ext(wppa_get_thumb_path($id), $id);
    $poster_photo = is_file($poster_photo_path) ? ' poster="' . wppa_fix_poster_ext(wppa_get_photo_url($id), $id) . '"' : '';
    $poster_thumb = is_file($poster_thumb_path) ? ' poster="' . wppa_fix_poster_ext(wppa_get_thumb_url($id), $id) . '"' : '';
    $poster = '';
    // Init to none
    // Thumbnail?
    if ($use_thumb) {
        $poster = $poster_thumb;
    } else {
        $poster = $poster_photo;
    }
    // If the poster exists and no controls, we need no preload at all.
    if ($poster && !$controls) {
        $preload = 'none';
    }
    // Do we have html5 video tag supported filetypes on board?
    if ($mp4 || $ogv || $webm) {
        // Assume the browser supports html5
        $result = '<video id="' . $tagid . '" ' . $ctrl . $play . ' style="' . $style . $w . $h . $t . $b . $cursor . '" ' . $events . ' ' . $tit . $onc . $poster . ' preload="' . $preload . '"' . $cls . ' >';
        $result .= wppa_get_video_body($id, false, $width, $height);
        // Close the video tag
        $result .= '</video>';
    }
    // Done
    return $result;
}
开发者ID:billadams,项目名称:forever-frame,代码行数:52,代码来源:wppa-video.php


示例2: wppa_import_photos


//.........这里部分代码省略.........
                // See if a metafile exists
                //$meta = substr( $file, 0, strlen( $file ) - 3 ).'pmf';
                $meta = wppa_strip_ext($unsanitized_path_name) . '.PMF';
                if (!is_file($meta)) {
                    $meta = wppa_strip_ext($unsanitized_path_name) . '.pmf';
                }
                // find all data: name, desc, porder form metafile
                if (is_file($meta)) {
                    $alb = wppa_get_album_id(wppa_get_meta_album($meta));
                    $name = wppa_get_meta_name($meta);
                    $desc = wppa_txt_to_nl(wppa_get_meta_desc($meta));
                    $porder = wppa_get_meta_porder($meta);
                    $linkurl = wppa_get_meta_linkurl($meta);
                    $linktitle = wppa_get_meta_linktitle($meta);
                } else {
                    $alb = $album;
                    // default album
                    $name = '';
                    // default name
                    $desc = '';
                    // default description
                    $porder = '0';
                    // default p_order
                    $linkurl = '';
                    $linktitle = '';
                }
                // If there is a video or audio with the same name, this is the poster.
                $is_poster = wppa_file_is_in_album(wppa_strip_ext(basename($file)) . '.xxx', $alb);
                if ($is_poster) {
                    // Delete possible poster sourcefile
                    wppa_delete_source(basename($file), $alb);
                    // Remove possible existing posters, the file-extension may be different as before
                    $old_photo = wppa_strip_ext(wppa_get_photo_path($is_poster));
                    $old_thumb = wppa_strip_ext(wppa_get_thumb_path($is_poster));
                    foreach ($wppa_supported_photo_extensions as $pext) {
                        if (is_file($old_photo . '.' . $pext)) {
                            unlink($old_photo . '.' . $pext);
                        }
                        if (is_file($old_thumb . '.' . $pext)) {
                            unlink($old_thumb . '.' . $pext);
                        }
                    }
                    // Clear sizes on db
                    wppa_update_photo(array('thumbx' => '0', 'thumby' => '0', 'photox' => '0', 'photoy' => '0'));
                    // Make new files
                    $bret = wppa_make_the_photo_files($file, $is_poster, strtolower(wppa_get_ext(basename($file))));
                    if ($bret) {
                        // Success
                        if (wppa('ajax')) {
                            wppa('ajax_import_files_done', true);
                        }
                        wppa_save_source($file, basename($file), $alb);
                        wppa_make_o1_source($is_poster);
                        $pcount++;
                        $totpcount += $bret;
                        if ($delp) {
                            unlink($file);
                        }
                    } else {
                        // Failed
                        if (!wppa('ajax')) {
                            wppa_error_message('Failed to add poster for item ' . $is_poster);
                        }
                        if ($delf) {
                            unlink($file);
                        }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:67,代码来源:wppa-import.php


示例3: wppa_use_thumb_file

function wppa_use_thumb_file($id, $width = '0', $height = '0')
{
    if (!wppa_switch('use_thumbs_if_fit')) {
        return false;
    }
    if ($width <= 1.0 && $height <= 1.0) {
        return false;
    }
    // should give at least one dimension and not when fractional
    $file = wppa_get_thumb_path($id);
    if (file_exists($file)) {
        $size = wppa_get_imagexy($id, 'thumb');
    } else {
        return false;
    }
    if (!is_array($size)) {
        return false;
    }
    if ($width > 0 && $size[0] < $width) {
        return false;
    }
    if ($height > 0 && $size[1] < $height) {
        return false;
    }
    return true;
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:26,代码来源:wppa-functions.php


示例4: wppa_do_maintenance_proc


//.........这里部分代码省略.........
                            if ($a_ret['exiffix']) {
                                $wppa_session[$slug . '_fixed']++;
                            }
                            break;
                        case 'wppa_file_system':
                            $fs = get_option('wppa_file_system');
                            if ($fs == 'to-tree' || $fs == 'to-flat') {
                                if ($fs == 'to-tree') {
                                    $from = 'flat';
                                    $to = 'tree';
                                } else {
                                    $from = 'tree';
                                    $to = 'flat';
                                }
                                // Media files
                                if (wppa_is_multi($id)) {
                                    // Can NOT use wppa_has_audio() or wppa_is_video(), they use wppa_get_photo_path() without fs switch!!
                                    $exts = array_merge($wppa_supported_video_extensions, $wppa_supported_audio_extensions);
                                    $pathfrom = wppa_get_photo_path($id, $from);
                                    $pathto = wppa_get_photo_path($id, $to);
                                    //	wppa_log( 'dbg', 'Trying: '.$pathfrom );
                                    foreach ($exts as $ext) {
                                        if (is_file(str_replace('.xxx', '.' . $ext, $pathfrom))) {
                                            //	wppa_log( 'dbg',  str_replace( '.xxx', '.'.$ext, $pathfrom ).' -> '.str_replace( '.xxx', '.'.$ext, $pathto ));
                                            @rename(str_replace('.xxx', '.' . $ext, $pathfrom), str_replace('.xxx', '.' . $ext, $pathto));
                                        }
                                    }
                                }
                                // Poster / photo
                                if (file_exists(wppa_fix_poster_ext(wppa_get_photo_path($id, $from), $id))) {
                                    @rename(wppa_fix_poster_ext(wppa_get_photo_path($id, $from), $id), wppa_fix_poster_ext(wppa_get_photo_path($id, $to), $id));
                                }
                                // Thumbnail
                                if (file_exists(wppa_fix_poster_ext(wppa_get_thumb_path($id, $from), $id))) {
                                    @rename(wppa_fix_poster_ext(wppa_get_thumb_path($id, $from), $id), wppa_fix_poster_ext(wppa_get_thumb_path($id, $to), $id));
                                }
                            }
                            break;
                        case 'wppa_cleanup':
                            $photo_files = glob(WPPA_UPLOAD_PATH . '/' . $id . '.*');
                            // Remove dirs
                            if ($photo_files) {
                                foreach (array_keys($photo_files) as $key) {
                                    if (is_dir($photo_files[$key])) {
                                        unset($photo_files[$key]);
                                    }
                                }
                            }
                            // files left? process
                            if ($photo_files) {
                                foreach ($photo_files as $photo_file) {
                                    $basename = basename($photo_file);
                                    $ext = substr($basename, strpos($basename, '.') + '1');
                                    if (!$wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `id` = %s", $id))) {
                                        // no db entry for this photo
                                        if (wppa_is_id_free(WPPA_PHOTOS, $id)) {
                                            if (wppa_create_photo_entry(array('id' => $id, 'album' => $orphan_album, 'ext' => $ext, 'filename' => $basename))) {
                                                // Can create entry
                                                $wppa_session[$slug . '_fixed']++;
                                                // Bump counter
                                                wppa_log('Debug', 'Lost photo file ' . $photo_file . ' recovered');
                                            } else {
                                                wppa_log('Debug', 'Unable to recover lost photo file ' . $photo_file . ' Create photo entry failed');
                                            }
                                        } else {
                                            wppa_log('Debug', 'Could not recover lost photo file ' . $photo_file . ' The id is not free');
开发者ID:billadams,项目名称:forever-frame,代码行数:67,代码来源:wppa-maintenance.php


示例5: widget

 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     global $wpdb;
     global $wppa_opt;
     global $wppa;
     require_once dirname(__FILE__) . '/wppa-links.php';
     require_once dirname(__FILE__) . '/wppa-styles.php';
     require_once dirname(__FILE__) . '/wppa-functions.php';
     require_once dirname(__FILE__) . '/wppa-thumbnails.php';
     require_once dirname(__FILE__) . '/wppa-boxes-html.php';
     require_once dirname(__FILE__) . '/wppa-slideshow.php';
     wppa_initialize_runtime();
     $wppa['in_widget'] = 'lasten';
     $wppa['mocc']++;
     extract($args);
     $instance = wp_parse_args((array) $instance, array('title' => '', 'album' => '', 'albumenum' => '', 'timesince' => 'yes', 'display' => 'thumbs'));
     $widget_title = apply_filters('widget_title', $instance['title']);
     $page = in_array($wppa_opt['wppa_lasten_widget_linktype'], $wppa['links_no_page']) ? '' : wppa_get_the_landing_page('wppa_lasten_widget_linkpage', __a('Last Ten Uploaded Photos'));
     //		$page 		= $wppa_opt['wppa_lasten_widget_linkpage'];
     $max = $wppa_opt['wppa_lasten_count'];
     $album = $instance['album'];
     $timesince = $instance['timesince'];
     $display = $instance['display'];
     $albumenum = $instance['albumenum'];
     $generic = $album == '-2';
     if ($generic) {
         $album = '0';
         $max += '1000';
     }
     if ($album == '-99') {
         $album = implode("' OR `album` = '", explode(',', $albumenum));
     }
     // If you want only 'New' photos in the selection, the period must be <> 0;
     if (wppa_switch('wppa_lasten_limit_new') && wppa_opt('wppa_max_photo_newtime')) {
         $newtime = " `timestamp` >= " . (time() - wppa_opt('wppa_max_photo_newtime'));
         if ($album) {
             $q = "SELECT * FROM `" . WPPA_PHOTOS . "` WHERE (" . $newtime . ") AND ( `album` = '" . $album . "' ) AND ( `status` <> 'pending' AND `status` <> 'scheduled' ) ORDER BY `timestamp` DESC LIMIT " . $max;
         } else {
             $q = "SELECT * FROM `" . WPPA_PHOTOS . "` WHERE (" . $newtime . ") AND `status` <> 'pending' AND `status` <> 'scheduled' ORDER BY `timestamp` DESC LIMIT " . $max;
         }
     } else {
         if ($album) {
             $q = "SELECT * FROM `" . WPPA_PHOTOS . "` WHERE ( `album` = '" . $album . "' ) AND ( `status` <> 'pending' AND `status` <> 'scheduled' ) ORDER BY `timestamp` DESC LIMIT " . $max;
         } else {
             $q = "SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status` <> 'pending' AND `status` <> 'scheduled' ORDER BY `timestamp` DESC LIMIT " . $max;
         }
     }
     // echo $q;
     $thumbs = $wpdb->get_results($q, ARRAY_A);
     $widget_content = "\n" . '<!-- WPPA+ LasTen Widget start -->';
     $maxw = $wppa_opt['wppa_lasten_size'];
     $maxh = $maxw;
     $lineheight = $wppa_opt['wppa_fontsize_widget_thumb'] * 1.5;
     $maxh += $lineheight;
     if ($timesince == 'yes') {
         $maxh += $lineheight;
     }
     $count = '0';
     if ($thumbs) {
         foreach ($thumbs as $image) {
             global $thumb;
             $thumb = $image;
             if ($generic && wppa_is_separate($thumb['album'])) {
                 continue;
             }
             // Make the HTML for current picture
             if ($display == 'thumbs') {
                 $widget_content .= "\n" . '<div class="wppa-widget" style="width:' . $maxw . 'px; height:' . $maxh . 'px; margin:4px; display:inline; text-align:center; float:left;">';
             } else {
                 $widget_content .= "\n" . '<div class="wppa-widget" >';
             }
             if ($image) {
                 $no_album = !$album;
                 if ($no_album) {
                     $tit = __a('View the most recent uploaded photos', 'wppa_theme');
                 } else {
                     $tit = esc_attr(wppa_qtrans(stripslashes($image['description'])));
                 }
                 $link = wppa_get_imglnk_a('lasten', $image['id'], '', $tit, '', $no_album, $albumenum);
                 $file = wppa_get_thumb_path($image['id']);
                 $imgstyle_a = wppa_get_imgstyle_a($image['id'], $file, $maxw, 'center', 'ltthumb');
                 $imgurl = wppa_get_thumb_url($image['id'], '', $imgstyle_a['width'], $imgstyle_a['height']);
                 $imgevents = wppa_get_imgevents('thumb', $image['id'], true);
                 $title = $link ? esc_attr(stripslashes($link['title'])) : '';
                 $widget_content .= wppa_get_the_widget_thumb('lasten', $image, $album, $display, $link, $title, $imgurl, $imgstyle_a, $imgevents);
                 $widget_content .= "\n\t" . '<div style="font-size:' . $wppa_opt['wppa_fontsize_widget_thumb'] . 'px; line-height:' . $lineheight . 'px;">';
                 if ($timesince == 'yes') {
                     $widget_content .= "\n\t" . '<div>' . wppa_get_time_since($image['timestamp']) . '</div>';
                 }
                 $widget_content .= '</div>';
             } else {
                 // No image
                 $widget_content .= __a('Photo not found.', 'wppa_theme');
             }
             $widget_content .= "\n" . '</div>';
             $count++;
             if ($count == $wppa_opt['wppa_lasten_count']) {
                 break;
             }
//.........这里部分代码省略.........
开发者ID:billadams,项目名称:forever-frame,代码行数:101,代码来源:wppa-lasten-widget.php


示例6: wppa_create_thumbnail

function wppa_create_thumbnail($id, $use_source = true)
{
    // Find file to make thumbnail from
    $source_path = wppa_fix_poster_ext(wppa_get_source_path($id), $id);
    // Use source if requested and available
    if ($use_source) {
        if (!wppa_switch('watermark_thumbs') && is_file($source_path)) {
            $file = $source_path;
            // Use sourcefile
        } else {
            $file = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
            // Use photofile
        }
        // Non standard orientation files: never use source
        $orient = wppa_get_exif_orientation($file);
        if ($orient > '1') {
            $file = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
            // Use photofile
        }
    } else {
        $file = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
        // Use photofile
    }
    // Max side
    $max_side = wppa_get_minisize();
    // Check file
    if (!file_exists($file)) {
        return false;
    }
    // No file, fail
    $img_attr = getimagesize($file);
    if (!$img_attr) {
        return false;
    }
    // Not an image, fail
    // Retrieve aspect
    $asp_attr = explode(':', wppa_opt('thumb_aspect'));
    // Get output path
    $thumbpath = wppa_get_thumb_path($id);
    if (wppa_get_ext($thumbpath) == 'xxx') {
        // Video poster
        $thumbpath = wppa_strip_ext($thumbpath) . '.jpg';
    }
    // Source size
    $src_size_w = $img_attr[0];
    $src_size_h = $img_attr[1];
    // Temp convert width if stereo
    if (wppa_get_photo_item($id, 'stereo')) {
        $src_size_w /= 2;
    }
    // Mime type and thumb type
    $mime = $img_attr[2];
    $type = $asp_attr[2];
    // Source native aspect
    $src_asp = $src_size_h / $src_size_w;
    // Required aspect
    if ($type == 'none') {
        $dst_asp = $src_asp;
    } else {
        $dst_asp = $asp_attr[0] / $asp_attr[1];
    }
    // Convert back width if stereo
    if (wppa_get_photo_item($id, 'stereo')) {
        $src_size_w *= 2;
    }
    // Create the source image
    switch ($mime) {
        // mime type
        case 1:
            // gif
            $temp = @imagecreatefromgif($file);
            if ($temp) {
                $src = imagecreatetruecolor($src_size_w, $src_size_h);
                imagecopy($src, $temp, 0, 0, 0, 0, $src_size_w, $src_size_h);
                imagedestroy($temp);
            } else {
                $src = false;
            }
            break;
        case 2:
            // jpeg
            if (!function_exists('wppa_imagecreatefromjpeg')) {
                wppa_log('Error', 'Function wppa_imagecreatefromjpeg does not exist.');
            }
            $src = @wppa_imagecreatefromjpeg($file);
            break;
        case 3:
            // png
            $src = @imagecreatefrompng($file);
            break;
    }
    if (!$src) {
        wppa_log('Error', 'Image file ' . $file . ' is corrupt while creating thmbnail');
        return true;
    }
    // Compute the destination image size
    if ($dst_asp < 1.0) {
        // Landscape
        $dst_size_w = $max_side;
        $dst_size_h = round($max_side * $dst_asp);
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-photo-files.php


示例7: widget


//.........这里部分代码省略.........
     if ($meanrat) {
         $maxh += $lineheight;
     }
     if ($ratcount) {
         $maxh += $lineheight;
     }
     if ($viewcount) {
         $maxh += $lineheight;
     }
     if ($showowner) {
         $maxh += $lineheight;
     }
     if ($showalbum) {
         $maxh += $lineheight;
     }
     if ($thumbs) {
         foreach ($thumbs as $image) {
             $thumb = $image;
             // Make the HTML for current picture
             if ($display == 'thumbs') {
                 $widget_content .= "\n" . '<div class="wppa-widget" style="width:' . $maxw . 'px; height:' . $maxh . 'px; margin:4px; display:inline; text-align:center; float:left;">';
             } else {
                 $widget_content .= "\n" . '<div class="wppa-widget" >';
             }
             if ($image) {
                 $no_album = !$album;
                 if ($no_album) {
                     $tit = __('View the top rated photos', 'wp-photo-album-plus');
                 } else {
                     $tit = esc_attr(__(stripslashes($image['description'])));
                 }
                 $compressed_albumenum = wppa_compress_enum($albenum);
                 $link = wppa_get_imglnk_a('topten', $image['id'], '', $tit, '', $no_album, $compressed_albumenum);
                 $file = wppa_get_thumb_path($image['id']);
                 $imgstyle_a = wppa_get_imgstyle_a($image['id'], $file, $maxw, 'center', 'ttthumb');
                 $imgurl = wppa_get_thumb_url($image['id'], '', $imgstyle_a['width'], $imgstyle_a['height']);
                 $imgevents = wppa_get_imgevents('thumb', $image['id'], true);
                 $title = $link ? esc_attr(stripslashes($link['title'])) : '';
                 $widget_content .= wppa_get_the_widget_thumb('topten', $image, $album, $display, $link, $title, $imgurl, $imgstyle_a, $imgevents);
                 $widget_content .= "\n\t" . '<div style="font-size:' . wppa_opt('fontsize_widget_thumb') . 'px; line-height:' . $lineheight . 'px;">';
                 // Display (owner) ?
                 if ($showowner) {
                     $widget_content .= '<div>(' . $image['owner'] . ')</div>';
                 }
                 // Display (album) ?
                 if ($showalbum) {
                     $href = wppa_convert_to_pretty(wppa_encrypt_url(wppa_get_album_url($image['album'], $albumlinkpage, 'content', '1')));
                     $widget_content .= '<div>(<a href="' . $href . '" >' . wppa_get_album_name($image['album']) . '</a>)</div>';
                 }
                 // Display the rating
                 if ($likes) {
                     $lt = wppa_get_like_title_a($image['id']);
                 }
                 switch ($instance['sortby']) {
                     case 'mean_rating':
                         if ($meanrat == 'yes') {
                             $widget_content .= '<div>' . wppa_get_rating_by_id($image['id']) . '</div>';
                         }
                         if ($ratcount == 'yes') {
                             $n = wppa_get_rating_count_by_id($image['id']);
                             $widget_content .= '<div>' . sprintf(_n('%d vote', '%d votes', $n, 'wp-photo-album-plus'), $n) . '</div>';
                         }
                         if ($viewcount == 'yes') {
                             $n = $image['views'];
                             $widget_content .= '<div>' . sprintf(_n('%d view', '%d views', $n, 'wp-photo-album-plus'), $n) . '</div>';
                         }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:67,代码来源:wppa-topten-widget.php


示例8: widget

 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     global $wpdb;
     require_once dirname(__FILE__) . '/wppa-links.php';
     require_once dirname(__FILE__) . '/wppa-styles.php';
     require_once dirname(__FILE__) . '/wppa-functions.php';
     require_once dirname(__FILE__) . '/wppa-thumbnails.php';
     require_once dirname(__FILE__) . '/wppa-boxes-html.php';
     require_once dirname(__FILE__) . '/wppa-slideshow.php';
     wppa_initialize_runtime();
     wppa('in_widget', 'com');
     wppa_bump_mocc();
     // Hide widget if not logged in and login required to see comments
     if (wppa_switch('comment_view_login') && !is_user_logged_in()) {
         return;
     }
     extract($args);
     $page = in_array(wppa_opt('comment_widget_linktype'), wppa('links_no_page')) ? '' : wppa_get_the_landing_page('wppa_comment_widget_linkpage', __('Recently commented photos', 'wp-photo-album-plus'));
     $max = wppa_opt('comten_count');
     $widget_title = apply_filters('widget_title', $instance['title']);
     $photo_ids = wppa_get_comten_ids($max);
     $widget_content = "\n" . '<!-- WPPA+ Comment Widget start -->';
     $maxw = wppa_opt('comten_size');
     $maxh = $maxw + 18;
     if ($photo_ids) {
         foreach ($photo_ids as $id) {
             // Make the HTML for current comment
             $widget_content .= "\n" . '<div class="wppa-widget" style="width:' . $maxw . 'px; height:' . $maxh . 'px; margin:4px; display:inline; text-align:center; float:left;">';
             $image = wppa_cache_thumb($id);
             if ($image) {
                 $link = wppa_get_imglnk_a('comten', $id, '', '', true);
                 $file = wppa_get_thumb_path($id);
                 $imgstyle_a = wppa_get_imgstyle_a($id, $file, $maxw, 'center', 'comthumb');
                 $imgstyle = $imgstyle_a['style'];
                 $width = $imgstyle_a['width'];
                 $height = $imgstyle_a['height'];
                 $cursor = $imgstyle_a['cursor'];
                 $imgurl = wppa_get_thumb_url($id, '', $width, $height);
                 $imgevents = wppa_get_imgevents('thumb', $id, true);
                 $title = '';
                 $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s ORDER BY `timestamp` DESC", $id), ARRAY_A);
                 if ($comments) {
                     $first_comment = $comments['0'];
                     foreach ($comments as $comment) {
                         $title .= $comment['user'] . ' ' . __('wrote', 'wp-photo-album-plus') . ' ' . wppa_get_time_since($comment['timestamp']) . ":\n";
                         $title .= $comment['comment'] . "\n\n";
                     }
                 }
                 $title = esc_attr(strip_tags(trim($title)));
                 $album = '0';
                 $display = 'thumbs';
                 $widget_content .= wppa_get_the_widget_thumb('comten', $image, $album, $display, $link, $title, $imgurl, $imgstyle_a, $imgevents);
             } else {
                 $widget_content .= __('Photo not found.', 'wp-photo-album-plus');
             }
             $widget_content .= "\n\t" . '<span style="font-size:' . wppa_opt('fontsize_widget_thumb') . 'px; cursor:pointer;" title="' . esc_attr($first_comment['comment']) . '" >' . $first_comment['user'] . '</span>';
             $widget_content .= "\n" . '</div>';
         }
     } else {
         $widget_content .= 'There are no commented photos (yet).';
     }
     $widget_content .= '<div style="clear:both"></div>';
     $widget_content .= "\n" . '<!-- WPPA+ comment Widget end -->';
     echo "\n" . $before_widget;
     if (!empty($widget_title)) {
         echo $before_title . $widget_title . $after_title;
     }
     echo $widget_content . $after_widget;
     wppa('in_widget', false);
 }
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:71,代码来源:wppa-comment-widget.php


示例9: wppa_ajax_callback


//.........这里部分代码省略.........
            if ($pending) {
                if (!$hascommented) {
                    echo '0||900||' . __('Please enter a comment.', 'wp-photo-album-plus');
                    wppa_exit();
                } else {
                    $wpdb->query($wpdb->prepare("UPDATE `" . WPPA_RATING . "` SET `status` = 'publish' WHERE `photo` = %s AND `user` = %s", $photo, $user));
                }
            }
            if (wppa_switch('vote_needs_comment')) {
                $ratingstatus = $hascommented ? 'publish' : 'pending';
            } else {
                $ratingstatus = 'publish';
            }
            // When done, we have to echo $occur.'||'.$photo.'||'.$index.'||'.$myavgrat.'||'.$allavgrat.'||'.$discount.||.$hascommented.||.$message;
            // So we have to do: process rating and find new $myavgrat, $allavgrat and $discount ( $occur, $photo and $index are known )
            // Case 0: Illegal second vote. Frontend takes care of this, but a hacker could enter an ajaxlink manually
            if ($mylast && (!(wppa_switch('rating_change') || wppa_switch('rating_multi')) || $mylast['value'] < '0' || $mylast['value'] > '0' && $rating == '-1')) {
                echo '0||109||' . __('Security check failure.', 'wp-photo-album-plus');
                wppa_exit();
            }
            // Case 1: value = -1 this is a legal dislike vote
            if ($rating == '-1') {
                // Add my dislike
                $iret = wppa_create_rating_entry(array('photo' => $photo, 'value' => $rating, 'user' => $user, 'status' => $ratingstatus));
                if (!$iret) {
                    echo '0||101||' . $errtxt;
                    wppa_exit();
                    // Fail on storing vote
                }
                // Add points
                wppa_add_credit_points(wppa_opt('cp_points_rating'), __('Photo rated', 'wp-photo-album-plus'), $photo, $rating);
                wppa_dislike_check($photo);
                // Check for email to be sent every .. dislikes
                if (!is_file(wppa_get_thumb_path($photo))) {
                    // Photo is removed
                    echo $occur . '||' . $photo . '||' . $index . '||-1||-1|0||' . wppa_opt('dislike_delete');
                    wppa_exit();
                }
            } elseif (!$mylast) {
                // Add my vote
                $iret = wppa_create_rating_entry(array('photo' => $photo, 'value' => $rating, 'user' => $user, 'status' => $ratingstatus));
                if (!$iret) {
                    echo '0||102||' . $errtxt;
                    wppa_exit();
                    // Fail on storing vote
                }
                // Add points
                wppa_add_credit_points(wppa_opt('cp_points_rating'), __('Photo rated', 'wp-photo-album-plus'), $photo, $rating);
            } elseif (wppa_switch('rating_change')) {
                // Votechanging is allowed
                $iret = $wpdb->query($wpdb->prepare('UPDATE `' . WPPA_RATING . '` SET `value` = %s WHERE `photo` = %s AND `user` = %s LIMIT 1', $rating, $photo, $user));
                if ($iret === false) {
                    echo '0||103||' . $errtxt;
                    wppa_exit();
                    // Fail on update
                }
            } elseif (wppa_switch('rating_multi')) {
                // Rating multi is allowed
                $iret = wppa_create_rating_entry(array('photo' => $photo, 'value' => $rating, 'user' => $user, 'status' => $ratingstatus));
                if (!$iret) {
                    echo '0||104||' . $errtxt;
                    wppa_exit();
                    // Fail on storing vote
                }
            } else {
                // Should never get here....
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:67,代码来源:wppa-ajax.php


示例10: wppa_album_cover_longdesc

function wppa_album_cover_longdesc($albumid, $multicolresp = false)
{
    global $cover_count_key;
    global $wpdb;
    $album = wppa_cache_album($albumid);
    if ($multicolresp) {
        $mcr = 'mcr-';
    } else {
        $mcr = '';
    }
    $coverphoto = wppa_get_coverphoto_id($albumid);
    $image = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `id` = %s", $coverphoto), ARRAY_A);
    $photocount = wppa_get_photo_count($albumid, true);
    $albumcount = wppa_get_album_count($albumid, true);
    $mincount = wppa_get_mincount();
    $title = '';
    $linkpage = '';
    $href_title = '';
    $href_slideshow = '';
    $href_content = '';
    $onclick_title = '';
    $onclick_slideshow = '';
    $onclick_content = '';
    // See if there is substantial content to the album
    $has_content = $albumcount > '0' || $photocount > $mincount;
    // What is the albums title linktype
    $linktype = $album['cover_linktype'];
    if (!$linktype) {
        $linktype = 'content';
    }
    // Default
    // What is the albums title linkpage
    $linkpage = $album['cover_linkpage'];
    if ($linkpage == '-1') {
        $linktype = 'none';
    }
    // for backward compatibility
    // Find the cover title href, onclick and title
    $title_attr = wppa_get_album_title_attr_a($albumid, $linktype, $linkpage, $has_content, $coverphoto, $photocount);
    $href_title = $title_attr['href'];
    $onclick_title = $title_attr['onclick'];
    $title = $title_attr['title'];
    // Find the slideshow link and onclick
    $href_slideshow = wppa_convert_to_pretty(wppa_get_slideshow_url($albumid, $linkpage));
    if (wppa_switch('allow_ajax') && !$linkpage) {
        $onclick_slideshow = "wppaDoAjaxRender( " . wppa('mocc') . ", '" . wppa_get_slideshow_url_ajax($albumid, $linkpage) . "', '" . wppa_convert_to_pretty($href_slideshow) . "' )";
        $href_slideshow = "#";
    }
    // Find the content 'View' link
    $href_content = wppa_convert_to_pretty(wppa_get_album_url($albumid, $linkpage));
    if (wppa_switch('allow_ajax') && !$linkpage) {
        $onclick_content = "wppaDoAjaxRender( " . wppa('mocc') . ", '" . wppa_get_album_url_ajax($albumid, $linkpage) . "', '" . wppa_convert_to_pretty($href_content) . "' )";
        $href_content = "#";
    }
    // Find the coverphoto link
    if ($coverphoto) {
        $photolink = wppa_get_imglnk_a('coverimg', $coverphoto, $href_title, $title, $onclick_title, '', $albumid);
    } else {
        $photolink = false;
    }
    // Find the coverphoto details
    if ($coverphoto) {
        $path = wppa_get_thumb_path($coverphoto);
        $imgattr_a = wppa_get_imgstyle_a($coverphoto, $path, wppa_opt('smallsize'), '', 'cover');
        $src = wppa_get_thumb_url($coverphoto, '', $imgattr_a['width'], $imgattr_a['height']);
    } else {
        $path = '';
        $imgattr_a = false;
        $src = '';
    }
    // Feed?
    if (is_feed()) {
        $events = '';
    } else {
        $events = wppa_get_imgevents('cover');
    }
    $photo_pos = wppa('coverphoto_pos');
    $style = __wcs('wppa-box') . __wcs('wppa-' . wppa('alt'));
    if (is_feed()) {
        $style .= ' padding:7px;';
    }
    $wid = wppa_get_cover_width('cover');
    $style .= 'width: ' . $wid . 'px;';
    if ($cover_count_key == 'm') {
        $style .= 'margin-left: 8px;';
    } elseif ($cover_count_key == 'r') {
        $style .= 'float:right;';
    } else {
        $style .= 'clear:both;';
    }
    wppa_step_covercount('cover');
    $target = wppa_switch('allow_ajax') ? '_self' : $photolink['target'];
    // Open the album box
    wppa_out('<div' . ' id="album-' . $albumid . '-' . wppa('mocc') . '"' . ' class="' . 'wppa-album-cover-longdesc ' . 'album ' . 'wppa-box ' . 'wppa-cover-box ' . 'wppa-cover-box-' . $mcr . wppa('mocc') . ' ' . 'wppa-' . wppa('alt') . '"' . ' style="' . $style . __wcs('wppa-cover-box') . '"' . ' >');
    // First The Cover photo?
    if ($photo_pos == 'left' || $photo_pos == 'top') {
        wppa_the_coverphoto($albumid, $image, $src, $photo_pos, $photolink, $title, $imgattr_a, $events);
    }
    // Open the Cover text frame
    $textframestyle = wppa_get_text_frame_style($photo_pos, 'cover');
//.........这里部分代码省略.........
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:101,代码来源:wppa-album-covers.php


示例11: wppa_get_picture_html

function wppa_get_picture_html($args)
{
    // Init
    $defaults = array('id' => '0', 'type' => '', 'class' => '');
    $args = wp_parse_args($args, $defaults);
    $id = strval(intval($args['id']));
    $type = $args['type'];
    $class = $args['class'];
    // Check existance of required args
    foreach (array('id', 'type') as $item) {
        if (!$args[$item]) {
            wppa_dbg_msg('Missing ' . $item . ' in call to wppa_get_picture_html()', 'red', 'force');
            return false;
        }
    }
    // Check validity of args
    if (!wppa_photo_exists($id)) {
        wppa_dbg_msg('Photo ' . $id . ' does not exist in call to wppa_get_picture_html(). Type = ' . $type, 'red', 'force');
        return false;
    }
    $types = array('sphoto', 'mphoto', 'xphoto', 'cover', 'thumb', 'ttthumb', 'comthumb', 'fthumb', 'twthumb', 'ltthumb', 'albthumb');
    if (!in_array($type, $types)) {
        wppa_dbg_msg('Unimplemented type ' . $type . ' in call to wppa_get_picture_html()', 'red', 'force');
        return false;
    }
    // Get other data
    $link = wppa_get_imglnk_a($type, $id);
    $isthumb = strpos($type, 'thumb') !== false;
    $file = wppa_fix_poster_ext($isthumb ? wppa_get_thumb_path($id) : wppa_get_photo_path($id), $id);
    $href = wppa_fix_poster_ext($isthumb ? wppa_get_thumb_url($id) : wppa_get_photo_url($id), $id);
    $autocol = wppa('auto_colwidth') || wppa('fullsize') > 0 && wppa('fullsize') <= 1.0;
    $title = $link ? esc_attr($link['title']) : esc_attr(stripslashes(wppa_get_photo_name($id)));
    $alt = wppa_get_imgalt($id);
    // Find image style
    switch ($type) {
        case 'sphoto':
            $style = 'width:100%;margin:0;';
            if (!wppa_in_widget()) {
                switch (wppa_opt('fullimage_border_width')) {
                    case '':
                        $style .= 'padding:0;' . 'border:none;';
                        break;
                    case '0':
                        $style .= 'padding:0;' . 'border:1px solid ' . wppa_opt('bcolor_fullimg') . ';' . 'box-sizing:border-box;';
                        break;
                    default:
                        $style .= 'padding:' . (wppa_opt('fullimage_border_width') - '1') . 'px;' . 'border:1px solid ' . wppa_opt('bcolor_fullimg') . ';' . 'box-sizing:border-box;' . 'background-color:' . wppa_opt('bgcolor_fullimg') . ';';
                        // If we do round corners...
                        if (wppa_opt('bradius') > '0') {
                            // then also here
                            $style .= 'border-radius:' . wppa_opt('fullimage_border_width') . 'px;';
                        }
                }
            }
            break;
        case 'mphoto':
        case 'xphoto':
            $style = 'width:100%;margin:0;padding:0;border:none;';
            break;
        default:
            wppa_dbg_msg('Style for type ' . $type . ' is not implemented yet in wppa_get_picture_html()', 'red', 'force');
            return false;
    }
    if ($link['is_lightbox']) {
        $style .= 'cursor:url( ' . wppa_get_imgdir() . wppa_opt('magnifier') . ' ),pointer;';
        $title = wppa_zoom_in($id);
    }
    // Create the html
    $result = '';
    // The link
    if ($link) {
        // Link is lightbox
        if ($link['is_lightbox']) {
            $lbtitle = wppa_get_lbtitle($type, $id);
            $videobody = esc_attr(wppa_get_video_body($id));
            $audiobody = esc_attr(wppa_get_audio_body($id));
            $videox = wppa_get_videox($id);
            $videoy = wppa_get_videoy($id);
            $result .= '<a' . ' href="' . $link['url'] . '"' . ($lbtitle ? ' ' . wppa('lbtitle') . '="' . $lbtitle . '"' : '') . ($videobody ? ' data-videohtml="' . $videobody . '"' : '') . ($audiobody ? ' data-audiohtml="' . $audiobody . '"' : '') . ($videox ? ' data-videonatwidth="' . $videox . '"' : '') . ($videoy ? ' data-videonatheight="' . $videoy . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '"' . ($link['target'] ? ' target="' . $link['target'] . '"' : '') . ' class="thumb-img"' . ' id="a-' . $id . '-' . wppa('mocc') . '"' . ' data-alt="' . esc_attr(wppa_get_imgalt($id, true)) . '"' . ' >';
        } else {
            $result .= '<a' . (wppa_is_mobile() ? ' ontouchstart="wppaStartTime();" ontouchend="wppaTapLink(\'' . $id . '\',\'' . $link['url'] . '\');" ' : ' onclick="_bumpClickCount( \'' . $id . '\' );window.open(\'' . $link['url'] . '\', \'' . $link['target'] . '\' )"') . ' title="' . $link['title'] . '"' . ' class="thumb-img"' . ' id="a-' . $id . '-' . wppa('mocc') . '"' . ' >';
        }
    }
    // The image
    // Video?
    if (wppa_is_video($id)) {
        $result .= wppa_get_video_html(array('id' => $id, 'controls' => !$link, 'style' => $style, 'class' => $class));
    } else {
        $result .= '<img' . ' id="ph-' . $id . '-' . wppa('mocc') . '"' . ' src="' . $href . '"' . ' ' . wppa_get_imgalt($id) . ($class ? ' class="' . $class . '" ' : '') . ($title ? ' title="' . $title . '" ' : '') . ' style="' . $style . '"' . ' />';
    }
    // Close the link
    if ($link) {
        $result .= '</a>';
    }
    // Add audio?			sphoto
    if (wppa_has_audio($id)) {
        $result .= '<div style="position:relative;z-index:11;" >';
        // Find style for audio controls
        switch ($type) {
            case 'sphoto':
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-picture.php


示例12: wppa_album_photos


//.........这里部分代码省略.........
                ?>
											</td>
											<td>
												<?php 
                echo wppa_get_filesize($dp);
                ?>
											</td>
											<td>
											</td>
												<?php 
            } else {
                ?>
											<td>
												<span style="color:red;"><?php 
                _e('Unavailable', 'wp-photo-album-plus');
                ?>
</span>
											</td>
											<td>
											</td>
											<td>
											</td>
												<?php 
            }
            ?>
										</tr>
										<tr>
											<td>
												<?php 
            _e('Thumbnail file:', 'wp-photo-album-plus');
            ?>
											</td>
												<?php 
            $tp = wppa_fix_poster_ext(wppa_get_thumb_path($photo['id']), $photo['id']);
            if (is_file($tp)) {
                ?>
											<td>
												<?php 
                echo floor(wppa_get_thumbx($photo['id'])) . ' x ' . floor(wppa_get_thumby($photo['id'])) . ' px.';
                ?>
											</td>
											<td>
												<?php 
                echo wppa_get_filesize($tp);
                ?>
											</td>
												<?php 
            } else {
                ?>
											<td>
												<span style="color:red;"><?php 
                _e('Unavailable', 'wp-photo-album-plus');
                ?>
</span>
											</td>
											<td>
											</td>
												<?php 
            }
            ?>
											<td>
												<a style="cursor:pointer; font-weight:bold;" title="<?php 
            _e('Remake thumbnail file', 'wp-photo-album-plus');
            ?>
" onclick="wppaAjaxUpdatePhoto( <?php 
            echo $photo['id'];
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:67,代码来源:wppa-photo-admin-autosave.php


示例13: wppa_album_photos


//.........这里部分代码省略.........
                    _e('Scheduled', 'wp-photo-album-plus');
                } elseif ($status == 'private') {
                    _e('Private', 'wp-photo-album-plus');
                }
                echo wppa_get_date_time_select_html('photo', $id, false) . '<span id="psdesc-' . $id . '" class="description" style="display:none;" >' . __('Note: Featured photos should have a descriptive name; a name a search engine will look for!', 'wp-photo-album-plus') . '</span>';
            }
            echo ' ';
            // Update status field
            echo __('Remark:', 'wp-photo-album-plus') . ' ' . '<span' . ' id="photostatus-' . $id . '"' . ' style="font-weight:bold;color:#00AA00;"' . ' >' . ($is_video ? sprintf(__('Video %s is not modified yet', 'wp-photo-album-plus'), $id) : sprintf(__('Photo %s is not modified yet', 'wp-photo-album-plus'), $id)) . '</span>';
            // New Line
            echo '<br />';
            // --- Available files ---
            echo __('Available files:', 'wp-photo-album-plus') . ' ';
            // Source
            echo __('Source file:', 'wp-photo-album-plus') . ' ';
            $sp = wppa_get_source_path($id);
            if (is_file($sp)) {
                $ima = getimagesize($sp);
                echo $ima['0'] . ' x ' . $ima['1'] . '  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wppa_get_thumb_url函数代码示例发布时间:2022-05-23
下一篇:
PHP wppa_get_the_landing_page函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap