本文整理汇总了PHP中wppa_is_video函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_is_video函数的具体用法?PHP wppa_is_video怎么用?PHP wppa_is_video使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppa_is_video函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: widget
//.........这里部分代码省略.........
} else {
$title = '';
}
$imgurl = wppa_get_thumb_url($image['id'], '', $width, $height);
} else {
$link = '';
$file = '';
$imgevents = '';
$imgstyle = 'width:' . $maxw . ';height:' . $maxh . ';';
$width = $maxw;
$height = $maxw;
// !!
$cursor = 'default';
$title = sprintf(__a('Upload at least %d photos to this album!', 'wppa_theme'), wppa_opt('wppa_min_thumbs') - $imgcount + 1);
if ($imageid) {
// The 'empty album has a cover image
$file = wppa_get_thumb_path($image['id']);
$imgstyle_a = wppa_get_imgstyle_a($image['id'], $file, $maxw, 'center', 'albthumb');
$imgstyle = $imgstyle_a['style'];
$width = $imgstyle_a['width'];
$height = $imgstyle_a['height'];
$imgurl = wppa_get_thumb_url($image['id'], '', $width, $height);
} else {
$imgurl = wppa_get_imgdir() . 'album32.png';
}
}
$imgurl = wppa_fix_poster_ext($imgurl, $image['id']);
if ($imgcount > wppa_opt('wppa_min_thumbs') || $skip == 'no') {
$widget_content .= "\n" . '<div class="wppa-widget" style="width:' . $maxw . 'px; height:' . $maxh . 'px; margin:4px; display:inline; text-align:center; float:left;">';
if ($link) {
if ($link['is_url']) {
// Is a href
$widget_content .= "\n\t" . '<a href="' . $link['url'] . '" title="' . $title . '" target="' . $link['target'] . '" >';
if (wppa_is_video($image['id'])) {
$widget_content .= wppa_get_video_html(array('id' => $image['id'], 'width' => $width, 'height' => $height, 'controls' => false, 'margin_top' => $imgstyle_a['margin-top'], 'margin_bottom' => $imgstyle_a['margin-bottom'], 'cursor' => 'pointer', 'events' => $imgevents, 'tagid' => 'i-' . $image['id'] . '-' . $wppa['mocc'], 'title' => $title));
} else {
$widget_content .= "\n\t\t" . '<img id="i-' . $image['id'] . '-' . $wppa['mocc'] . '" title="' . $title . '" src="' . $imgurl . '" width="' . $width . '" height="' . $height . '" style="' . $imgstyle . ' cursor:pointer;" ' . $imgevents . ' ' . wppa_get_imgalt($image['id']) . ' >';
}
$widget_content .= "\n\t" . '</a>';
} elseif ($link['is_lightbox']) {
$thumbs = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `album` = %s " . wppa_get_photo_order($album['id']), $album['id']), 'ARRAY_A');
if ($thumbs) {
foreach ($thumbs as $thumb) {
$title = wppa_get_lbtitle('alw', $thumb['id']);
if (wppa_is_video($thumb['id'])) {
$siz['0'] = wppa_get_videox($thumb['id']);
$siz['1'] = wppa_get_videoy($thumb['id']);
} else {
// $siz = getimagesize( wppa_get_photo_path( $thumb['id'] ) );
$siz['0'] = wppa_get_photox($thumb['id']);
$siz['1'] = wppa_get_photoy($thumb['id']);
}
$link = wppa_fix_poster_ext(wppa_get_photo_url($thumb['id'], '', $siz['0'], $siz['1']), $thumb['id']);
$is_video = wppa_is_video($thumb['id']);
$has_audio = wppa_has_audio($thumb['id']);
$widget_content .= "\n\t" . '<a href="' . $link . '"' . ($is_video ? ' data-videohtml="' . esc_attr(wppa_get_video_body($thumb['id'])) . '"' . ' data-videonatwidth="' . wppa_get_videox($thumb['id']) . '"' . ' data-videonatheight="' . wppa_get_videoy($thumb['id']) . '"' : '') . ($has_audio ? ' data-audiohtml="' . esc_attr(wppa_get_audio_body($thumb['id'])) . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('wppa_lightbox_name') . '[alw-' . $wppa['mocc'] . '-' . $album['id'] . ']"' . ' ' . wppa('lbtitle') . '="' . $title . '" >';
if ($thumb['id'] == $image['id']) {
// the cover image
if (wppa_is_video($image['id'])) {
$widget_content .= wppa_get_video_html(array('id' => $image['id'], 'width' => $width, 'height' => $height, 'controls' => false, 'margin_top' => $imgstyle_a['margin-top'], 'margin_bottom' => $imgstyle_a['margin-bottom'], 'cursor' => $cursor, 'events' => $imgevents, 'tagid' => 'i-' . $image['id'] . '-' . $wppa['mocc'], 'title' => wppa_zoom_in($image['id'])));
} else {
$widget_content .= "\n\t\t" . '<img id="i-' . $image['id'] . '-' . $wppa['mocc'] . '" title="' . wppa_zoom_in($image['id']) . '" src="' . $imgurl . '" width="' . $width . '" height="' . $height . '" style="' . $imgstyle . $cursor . '" ' . $imgevents . ' ' . wppa_get_imgalt($image['id']) . ' >';
}
}
$widget_content .= "\n\t" . '</a>';
}
开发者ID:billadams,项目名称:forever-frame,代码行数:67,代码来源:wppa-album-widget.php
示例2: wppa_get_imgstyle_a
function wppa_get_imgstyle_a($id, $file, $xmax_size, $xvalign = '', $type = '')
{
global $wppa;
$result = array('style' => '', 'width' => '', 'height' => '', 'cursor' => '', 'margin-top' => '', 'margin-bottom' => '');
// Init
wppa_cache_thumb($id);
if (!$id) {
return $result;
}
// no image: no dimensions
if ($file == '') {
return $result;
}
// no image: no dimensions
if (wppa_has_audio($id)) {
$file = wppa_fix_poster_ext($file, $id);
}
if (!wppa_is_video($id) && !is_file($file)) {
wppa_dbg_msg('Please check file ' . $file . ' it is missing while expected. Id=' . $id, 'red');
return $result;
// no file: no dimensions ( 2.3.0 )
}
if (strpos($file, '/wppa/thumbs/')) {
$image_attr = wppa_get_imagexy($id, 'thumb');
} else {
$image_attr = wppa_get_imagexy($id, 'photo');
}
// if ( wppa_is_video( $id ) ) {
// $image_attr = array( '0' => wppa_get_videox( $id ), '1' => wppa_get_videoy( $id ) );
// }
// else {
// $image_attr = array( '0' => wppa_get_photox( $id ), '1' => wppa_get_photoy( $id ) );
// }
if (!$image_attr || !isset($image_attr['0']) || !$image_attr['0'] || !isset($image_attr['1']) || !$image_attr['1']) {
// File is corrupt
wppa_dbg_msg('Please check file ' . $file . ' it is corrupted. If it is a thumbnail image,' . ' regenerate them using Table VIII-A4 of the Photo Albums -> Settings admin page.', 'red');
return $result;
}
// Adjust for 'border'
if ($type == 'fullsize' && !$wppa['in_widget']) {
switch (wppa_opt('wppa_fullimage_border_width')) {
case '':
$max_size = $xmax_size;
break;
case '0':
$max_size = $xmax_size - '2';
break;
default:
$max_size = $xmax_size - '2' - 2 * wppa_opt('wppa_fullimage_border_width');
}
} else {
$max_size = $xmax_size;
}
$ratioref = wppa_opt('wppa_maxheight') / wppa_opt('wppa_fullsize');
$max_height = round($max_size * $ratioref);
if ($type == 'fullsize') {
if ($wppa['portrait_only']) {
$width = $max_size;
$height = round($width * $image_attr[1] / $image_attr[0]);
} else {
if (wppa_is_wider($image_attr[0], $image_attr[1])) {
$width = $max_size;
$height = round($width * $image_attr[1] / $image_attr[0]);
} else {
$height = round($ratioref * $max_size);
$width = round($height * $image_attr[0] / $image_attr[1]);
}
if ($image_attr[0] < $width && $image_attr[1] < $height) {
if (!$wppa['enlarge']) {
$width = $image_attr[0];
$height = $image_attr[1];
}
}
}
} else {
if ($type == 'cover' && wppa_switch('wppa_coversize_is_height') && (wppa_opt('wppa_coverphoto_pos') == 'top' || wppa_opt('wppa_coverphoto_pos') == 'bottom')) {
$height = $max_size;
$width = round($max_size * $image_attr[0] / $image_attr[1]);
} else {
if (wppa_is_landscape($image_attr)) {
$width = $max_size;
$height = round($max_size * $image_attr[1] / $image_attr[0]);
} else {
$height = $max_size;
$width = round($max_size * $image_attr[0] / $image_attr[1]);
}
}
}
switch ($type) {
case 'cover':
if (wppa_opt('wppa_bcolor_img') != '') {
// There is a border color given
$result['style'] .= ' border: 1px solid ' . wppa_opt('wppa_bcolor_img') . ';';
} else {
// No border color: no border
$result['style'] .= ' border-width: 0px;';
}
$result['style'] .= ' width:' . $width . 'px; height:' . $height . 'px;';
if (wppa_switch('wppa_use_cover_opacity') && !is_feed()) {
$opac = wppa_opt('wppa_cover_opacity');
//.........这里部分代码省略.........
开发者ID:billadams,项目名称:forever-frame,代码行数:101,代码来源:wppa-styles.php
示例3: wppa_bestof_html
function wppa_bestof_html($args, $widget = true)
{
// Copletify args
$args = wp_parse_args((array) $args, array('page' => '0', 'count' => '1', 'sortby' => 'maxratingcount', 'display' => 'photo', 'period' => 'thisweek', 'maxratings' => 'yes', 'meanrat' => 'yes', 'ratcount' => 'yes', 'linktype' => 'none', 'size' => wppa_opt('widget_width'), 'fontsize' => wppa_opt('fontsize_widget_thumb'), 'lineheight' => wppa_opt('fontsize_widget_thumb') * 1.5, 'height' => '200'));
// Make args into seperate vars
extract($args);
// Validate args
if (!in_array($sortby, array('maxratingcount', 'meanrating', 'ratingcount'))) {
wppa_dbg_msg('Invalid arg sortby "' . $sortby . '" must be "maxratingcount", "meanrating" or "ratingcount"', 'red', 'force');
}
if (!in_array($display, array('photo', 'owner'))) {
wppa_dbg_msg('Invalid arg display "' . $display . '" must be "photo" or "owner"', 'red', 'force');
}
if (!in_array($period, array('lastweek', 'thisweek', 'lastmonth', 'thismonth', 'lastyear', 'thisyear'))) {
wppa_dbg_msg('Invalid arg period "' . $period . '" must be "lastweek", "thisweek", "lastmonth", "thismonth", "lastyear" or "thisyear"', 'red', 'force');
}
if (!$widget) {
$size = $height;
}
$result = '';
$data = wppa_get_the_bestof($count, $period, $sortby, $display);
if ($display == 'photo') {
if (is_array($data)) {
foreach (array_keys($data) as $id) {
$thumb = wppa_cache_thumb($id);
if ($thumb) {
if (wppa_is_video($id)) {
$imgsize = array(wppa_get_videox($id), wppa_get_videoy($id));
} else {
$imgsize = array(wppa_get_photox($id), wppa_get_photoy($id));
}
if ($widget) {
$maxw = $size;
$maxh = round($maxw * $imgsize['1'] / $imgsize['0']);
} else {
$maxh = $size;
$maxw = round($maxh * $imgsize['0'] / $imgsize['1']);
}
$totalh = $maxh + $lineheight;
if ($maxratings == 'yes') {
$totalh += $lineheight;
}
if ($meanrat == 'yes') {
$totalh += $lineheight;
}
if ($ratcount == 'yes') {
$totalh += $lineheight;
}
if ($widget) {
$clear = 'clear:both; ';
} else {
$clear = '';
}
$result .= "\n" . '<div' . ' class="wppa-widget"' . ' style="' . $clear . 'width:' . $maxw . 'px; height:' . $totalh . 'px; margin:4px; display:inline; text-align:center; float:left;"' . ' >';
// The medal if at the top
$result .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'top'));
// The link if any
if ($linktype != 'none') {
switch ($linktype) {
case 'owneralbums':
$href = wppa_get_permalink($page) . 'wppa-cover=1&wppa-owner=' . $thumb['owner'] . '&wppa-occur=1';
$title = __('See the authors albums', 'wp-photo-album-plus');
break;
case 'ownerphotos':
$href = wppa_get_permalink($page) . 'wppa-cover=0&wppa-owner=' . $thumb['owner'] . '&photos-only&wppa-occur=1';
$title = __('See the authors photos', 'wp-photo-album-plus');
break;
case 'upldrphotos':
$href = wppa_get_permalink($page) . 'wppa-cover=0&wppa-upldr=' . $thumb['owner'] . '&wppa-occur=1';
$title = __('See all the authors photos', 'wp-photo-album-plus');
break;
case 'ownerphotosslide':
$href = wppa_get_permalink($page) . 'wppa-cover=0&wppa-owner=' . $thumb['owner'] . '&photos-only&wppa-occur=1&slide';
$title = __('See the authors photos', 'wp-photo-album-plus');
break;
case 'upldrphotosslide':
$href = wppa_get_permalink($page) . 'wppa-cover=0&wppa-upldr=' . $thumb['owner'] . '&wppa-occur=1&slide';
$title = __('See all the authors photos', 'wp-photo-album-plus');
break;
default:
$href = '';
$title = '';
}
$result .= '<a href="' . wppa_convert_to_pretty($href) . '" title="' . $title . '" >';
}
// The image
$result .= '<img' . ' style="height:' . $maxh . 'px; width:' . $maxw . 'px;"' . ' src="' . wppa_fix_poster_ext(wppa_get_photo_url($id, '', $maxw, $maxh), $id) . '"' . ' ' . wppa_get_imgalt($id) . ' />';
// The /link
if ($linktype != 'none') {
$result .= '</a>';
}
// The medal if near the bottom
$result .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'bot'));
// The subtitles
$result .= "\n\t" . '<div style="font-size:' . $fontsize . 'px; line-height:' . $lineheight . 'px; position:absolute; width:' . $maxw . 'px; ">';
$result .= sprintf(__('Photo by: %s', 'wp-photo-album-plus'), $data[$id]['user']) . '<br />';
if ($maxratings == 'yes') {
$n = $data[$id]['maxratingcount'];
$result .= sprintf(_n('%d max rating', '%d max ratings', $n, 'wp-photo-album-plus'), $n) . '<br />';
}
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-boxes-html.php
示例4: wppa_get_imglnk_a
function wppa_get_imglnk_a($wich, $id, $lnk = '', $tit = '', $onc = '', $noalb = false, $album = '')
{
global $wpdb;
// make sure the photo data ia available
$thumb = wppa_cache_thumb($id);
if (!$thumb) {
return false;
}
// Is it a video?
$is_video = wppa_is_video($id, true);
// Photo Specific Overrule?
if ($wich == 'sphoto' && wppa_switch('sphoto_overrule') || $wich == 'mphoto' && wppa_switch('mphoto_overrule') || $wich == 'thumb' && wppa_switch('thumb_overrule') || $wich == 'topten' && wppa_switch('topten_overrule') || $wich == 'featen' && wppa_switch('featen_overrule') || $wich == 'lasten' && wppa_switch('lasten_overrule') || $wich == 'sswidget' && wppa_switch('sswidget_overrule') || $wich == 'potdwidget' && wppa_switch('potdwidget_overrule') || $wich == 'coverimg' && wppa_switch('coverimg_overrule') || $wich == 'comten' && wppa_switch('comment_overrule') || $wich == 'slideshow' && wppa_switch('slideshow_overrule') || $wich == 'tnwidget' && wppa_switch('thumbnail_widget_overrule')) {
// Look for a photo specific link
if ($thumb) {
// If it is there...
if ($thumb['linkurl']) {
// Use it. It superceeds other settings
$result['url'] = esc_attr($thumb['linkurl']);
$result['title'] = esc_attr(__(stripslashes($thumb['linktitle'])));
$result['is_url'] = true;
$result['is_lightbox'] = false;
$result['onclick'] = '';
$result['target'] = $thumb['linktarget'];
return $result;
}
}
}
$result['target'] = '_self';
$result['title'] = '';
$result['onclick'] = '';
switch ($wich) {
case 'sphoto':
$type = wppa_opt('sphoto_linktype');
$page = wppa_opt('sphoto_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('sphoto_blank')) {
$result['target'] = '_blank';
}
break;
case 'mphoto':
$type = wppa_opt('mphoto_linktype');
$page = wppa_opt('mphoto_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('mphoto_blank')) {
$result['target'] = '_blank';
}
break;
case 'thumb':
$type = wppa_opt('thumb_linktype');
$page = wppa_opt('thumb_linkpage');
if (wppa_switch('thumb_blank')) {
$result['target'] = '_blank';
}
break;
case 'topten':
$type = wppa_opt('topten_widget_linktype');
$page = wppa_opt('topten_widget_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('topten_blank')) {
$result['target'] = '_blank';
}
break;
case 'featen':
$type = wppa_opt('featen_widget_linktype');
$page = wppa_opt('featen_widget_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('featen_blank')) {
$result['target'] = '_blank';
}
break;
case 'lasten':
$type = wppa_opt('lasten_widget_linktype');
$page = wppa_opt('lasten_widget_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('lasten_blank')) {
$result['target'] = '_blank';
}
break;
case 'comten':
$type = wppa_opt('comment_widget_linktype');
$page = wppa_opt('comment_widget_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('comment_blank')) {
$result['target'] = '_blank';
}
break;
case 'sswidget':
$type = wppa_opt('slideonly_widget_linktype');
//.........这里部分代码省略.........
开发者ID:lchen01,项目名称:STEdwards,代码行数:101,代码来源:wppa-links.php
示例5: wppa_do_filmthumb
function wppa_do_filmthumb($id, $idx, $do_for_feed = false, $glue = false)
{
$thumb = wppa_cache_thumb($id);
$result = '';
$src = wppa_fix_poster_ext(wppa_get_thumb_path($thumb['id']), $thumb['id']);
$max_size = wppa_opt('thumbsize');
if (wppa_in_widget()) {
$max_size /= 2;
}
$com_alt = wppa('is_comten') && wppa_switch('comten_alt_display') && !wppa_in_widget();
$imgattr_a = wppa_get_imgstyle_a($thumb['id'], $src, $max_size, 'optional', 'fthumb');
$imgstyle = $imgattr_a['style'];
$imgwidth = $imgattr_a['width'];
$imgheight = $imgattr_a['height'];
$cursor = $imgattr_a['cursor'];
$url = wppa_fix_poster_ext(wppa_get_thumb_url($thumb['id'], '', $imgwidth, $imgheight), $thumb['id']);
$furl = str_replace('/thumbs', '', $url);
$events = wppa_get_imgevents('film', $thumb['id'], 'nopopup', $idx);
$thumbname = wppa_get_photo_name($thumb['id']);
$target = wppa_switch('film_blank') || $thumb['linktarget'] == '_blank' ? 'target="_blank" ' : '';
$psotitle = $thumb['linktitle'] ? 'title="' . esc_attr($thumb['linktitle']) . '" ' : '';
$psourl = wppa_switch('film_overrule') && $thumb['linkurl'] ? 'href="' . $thumb['linkurl'] . '" ' . $target . $psotitle : '';
$imgalt = wppa_get_imgalt($thumb['id']);
if (wppa_opt('film_linktype') == 'lightbox') {
// $title = esc_attr( wppa_zoom_in( $thumb['id'] ) );
} else {
$events .= ' onclick="wppaGotoKeepState( ' . wppa('mocc') . ', ' . $idx . ' )"';
$events .= ' ondblclick="wppaStartStop( ' . wppa('mocc') . ', -1 )"';
}
if (is_feed()) {
if ($do_for_feed) {
$style_a = wppa_get_imgstyle_a($thumb['id'], $src, '100', '4', 'thumb');
$style = $style_a['style'];
$result .= '<a href="' . get_permalink() . '">' . '<img' . ' src="' . $url . '"' . ' ' . $imgalt . ' title="' . $thumbname . '"' . ' style="' . $style . '"' . ' />' . '</a>';
}
} else {
// If ! $do_for_feed: pre-or post-ambule. To avoid dup id change it in that case
$tmp = $do_for_feed ? 'film' : 'pre';
$style = $glue ? 'style="' . wppa_get_thumb_frame_style($glue, 'film') . '"' : '';
$result .= '<div' . ' id="' . $tmp . '_wppatnf_' . $thumb['id'] . '_' . wppa('mocc') . '"' . ' class="thumbnail-frame"' . ' ' . $style . ' >';
if ($psourl) {
// True only when pso activated and data present
$result .= '<a ' . $psourl . '>';
// $psourl contains url, target and title
} elseif (wppa_opt('film_linktype') == 'lightbox' && $tmp == 'film') {
$title = wppa_get_lbtitle('slide', $thumb['id']);
$videohtml = esc_attr(wppa_get_video_body($thumb['id']));
$audiohtml = esc_attr(wppa_get_audio_body($thumb['id']));
$result .= '<a href="' . $furl . '"' . ($videohtml ? ' data-videohtml="' . $videohtml . '"' . ' data-videonatwidth="' . wppa_get_videox($thumb['id']) . '"' . ' data-videonatheight="' . wppa_get_videoy($thumb['id']) . '"' : '') . ($audiohtml ? ' data-audiohtml="' . $audiohtml . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '[occ' . wppa('mocc') . ']"' . ($title ? ' ' . wppa('lbtitle') . '="' . $title . '"' : '') . ' >';
}
if ($tmp == 'pre' && wppa_opt('film_linktype') == 'lightbox') {
$cursor = 'cursor:default;';
}
if ($tmp == 'film' && !$com_alt && !wppa_cdn('front') && !wppa_switch('lazy_or_htmlcomp')) {
$result .= '<!--';
}
if (wppa_is_video($thumb['id'])) {
$result .= wppa_get_video_html(array('id' => $thumb['id'], 'width' => $imgattr_a['width'], 'height' => $imgattr_a['height'], 'controls' => false, 'margin_top' => $imgattr_a['margin-top'], 'margin_bottom' => $imgattr_a['margin-bottom'], 'cursor' => $imgattr_a['cursor'], 'events' => $events, 'tagid' => 'wppa-' . $tmp . '-' . $idx . '-' . wppa('mocc')));
} else {
$result .= '<img' . ' id="wppa-' . $tmp . '-' . $idx . '-' . wppa('mocc') . '"' . ' class="wppa-' . $tmp . '-' . wppa('mocc') . '"' . ' src="' . $url . '"' . ' ' . $imgalt . ' style="' . $imgstyle . $cursor . '"' . ' ' . $events . ' data-title="' . ($psourl ? esc_attr($thumb['linktitle']) : '') . '"' . ' />';
}
if ($tmp == 'film' && !$com_alt && !wppa_cdn('front') && !wppa_switch('lazy_or_htmlcomp')) {
$result .= '-->';
}
if ($psourl) {
// True only when pso activated and data present
$result .= '</a>';
// $psourl contains url, target and title
} elseif (wppa_opt('film_linktype') == 'lightbox' && $tmp == 'film') {
$result .= '</a>';
}
$result .= '</div>';
}
wppa_out($result);
}
开发者ID:lchen01,项目名称:STEdwards,代码行数:75,代码来源:wppa-thumbnails.php
示例6: wppa_do_maintenance_proc
//.........这里部分代码省略.........
wppa_index_add('photo', $id);
break;
case 'wppa_apply_new_photodesc_all':
$value = $wppa_opt['wppa_newphoto_description'];
$description = trim($value);
if ($description != $photo['description']) {
// Modified photo description
$wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `description` = %s WHERE `id` = %s", $description, $id));
}
break;
case 'wppa_append_to_photodesc':
$value = trim($wppa_opt['wppa_append_text']);
if (!$value) {
return 'Unexpected error: missing text to append||' . $slug . '||Error||0';
}
$description = rtrim($photo['description'] . ' ' . $value);
if ($description != $photo['description']) {
// Modified photo description
$wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `description` = %s WHERE `id` = %s", $description, $id));
}
break;
case 'wppa_remove_from_photodesc':
$value = trim($wppa_opt['wppa_remove_text']);
if (!$value) {
return 'Unexpected error: missing text to remove||' . $slug . '||Error||0';
}
$description = rtrim(str_replace($value, '', $photo['description']));
if ($description != $photo['description']) {
// Modified photo description
$wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `description` = %s WHERE `id` = %s", $description, $id));
}
break;
case 'wppa_remove_file_extensions':
if (!wppa_is_video($id)) {
$name = str_replace(array('.jpg', '.png', '.gif', '.JPG', '.PNG', '.GIF'), '', $photo['name']);
if ($name != $photo['name']) {
// Modified photo name
$wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `name` = %s WHERE `id` = %s", $name, $id));
}
}
break;
case 'wppa_readd_file_extensions':
if (!wppa_is_video($id)) {
$name = str_replace(array('.jpg', '.png', 'gif', '.JPG', '.PNG', '.GIF'), '', $photo['name']);
if ($name == $photo['name']) {
// Name had no fileextension
$wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `name` = %s WHERE `id` = %s", $name . '.' . $photo['ext'], $id));
}
}
break;
case 'wppa_regen_thumbs':
if (!wppa_is_video($id) || file_exists(str_replace('xxx', 'jpg', wppa_get_photo_path($id)))) {
wppa_create_thumbnail($id);
}
break;
case 'wppa_rerate':
wppa_rate_photo($id);
break;
case 'wppa_recup':
$a_ret = wppa_recuperate($id);
if ($a_ret['iptcfix']) {
$wppa_session[$slug . '_fixed']++;
}
if ($a_ret['exiffix']) {
$wppa_session[$slug . '_fixed']++;
}
开发者ID:billadams,项目名称:forever-frame,代码行数:67,代码来源:wppa-maintenance.php
示例7: wppa_get_hires_url
function wppa_get_hires_url($id)
{
// video? return the poster url
if (wppa_is_video($id) || wppa_has_audio($id)) {
$url = wppa_get_photo_url($id);
$url = wppa_fix_poster_ext($url, $id);
$temp = explode('?', $url);
$url = $temp['0'];
return $url;
}
// Try CDN
if (wppa_cdn('front') && !wppa_too_old_for_cloud($id)) {
switch (wppa_cdn('front')) {
case 'cloudinary':
$url = wppa_get_cloudinary_url($id);
break;
default:
$url = '';
}
if ($url) {
return $url;
}
}
// Try the orientation corrected source url
$source_path = wppa_get_o1_source_path($id);
if (is_file($source_path)) {
// The source file is only http reacheable when it is down from wp-content
if (strpos($source_path, WPPA_CONTENT_PATH) !== false) {
return str_replace(WPPA_CONTENT_PATH, WPPA_CONTENT_URL, $source_path);
}
}
// Try the source url
$source_path = wppa_get_source_path($id);
if (is_file($source_path)) {
// The source file is only http reacheable when it is down from ABSPATH
if (strpos($source_path, WPPA_CONTENT_PATH) !== false) {
return str_replace(WPPA_CONTENT_PATH, WPPA_CONTENT_URL, $source_path);
}
}
// The medium res url
$hires_url = wppa_get_photo_url($id);
$temp = explode('?', $hires_url);
return $temp['0'];
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:44,代码来源:wppa-utils.php
示例8: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $wpdb;
wppa('in_widget', 'potd');
wppa_bump_mocc();
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();
extract($args);
$widget_title = apply_filters('widget_title', $instance['title']);
// get the photo ($image)
$image = wppa_get_potd();
// Make the HTML for current picture
$widget_content = "\n" . '<!-- WPPA+ Photo of the day Widget start -->';
$ali = wppa_opt('potd_align');
if ($ali != 'none') {
$align = 'text-align:' . $ali . ';';
} else {
$align = '';
}
$widget_content .= "\n" . '<div class="wppa-widget-photo" style="' . $align . ' padding-top:2px;position:relative;" >';
if ($image) {
$id = $image['id'];
$w = wppa_opt('potd_widget_width');
$ratio = wppa_get_photoy($id) / wppa_get_photox($id);
$h = round($w * $ratio);
$usethumb = wppa_use_thumb_file($id, wppa_opt('potd_widget_width'), '0');
$imgurl = wppa_fix_poster_ext($usethumb ? wppa_get_thumb_url($id, '', $w, $h) : wppa_get_photo_url($id, '', $w, $h), $id);
$name = wppa_get_photo_name($id);
$page = in_array(wppa_opt('potd_linktype'), wppa('links_no_page')) && !wppa_switch('potd_counter') ? '' : wppa_get_the_landing_page('potd_linkpage', __('Photo of the day', 'wp-photo-album-plus'));
$link = wppa_get_imglnk_a('potdwidget', $id);
$is_video = wppa_is_video($id);
$has_audio = wppa_has_audio($id);
if ($link['is_lightbox']) {
$lightbox = ($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') . '"' . ' data-alt="' . esc_attr(wppa_get_imgalt($id, true)) . '"';
} else {
$lightbox = '';
}
if ($link) {
if ($link['is_lightbox']) {
$cursor = ' cursor:url(' . wppa_get_imgdir() . wppa_opt('magnifier') . '),pointer;';
$title = wppa_zoom_in($id);
$ltitle = wppa_get_lbtitle('potd', $id);
} else {
$cursor = ' cursor:pointer;';
$title = $link['title'];
$ltitle = $title;
}
} else {
$cursor = ' cursor:default;';
$title = esc_attr(stripslashes(__($image['name'], 'wp-photo-album-plus')));
}
// The medal if on top
$widget_content .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'top'));
// The link, if any
if ($link) {
$widget_content .= "\n\t" . '<a href = "' . $link['url'] . '" target="' . $link['target'] . '" ' . $lightbox . ' ' . wppa('lbtitle') . '="' . $ltitle . '">';
}
// The image
if (wppa_is_video($id)) {
$widget_content .= "\n\t\t" . wppa_get_video_html(array('id' => $id, 'width' => wppa_opt('potd_widget_width'), 'title' => $title, 'controls' => wppa_opt('potd_linktype') == 'none', 'cursor' => $cursor));
} else {
$widget_content .= '<img' . ' src="' . $imgurl . '"' . ' style="width: ' . wppa_opt('potd_widget_width') . 'px;' . $cursor . '"' . ' ' . wppa_get_imgalt($id) . ($title ? 'title="' . $title . '"' : '') . ' />';
}
// Close the link
if ($link) {
$widget_content .= '</a>';
}
// The medal if at the bottom
$widget_content .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'bot'));
// The counter
if (wppa_switch('potd_counter')) {
// If we want this
$alb = wppa_get_photo_item($id, 'album');
$c = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `album` = " . $alb) - 1;
if ($c > 0) {
if (wppa_opt('potd_counter_link') == 'thumbs') {
$lnk = wppa_get_album_url($alb, $page, 'thumbs', '1');
} elseif (wppa_opt('potd_counter_link') == 'slide') {
$lnk = wppa_get_slideshow_url($alb, $page, $id, '1');
} elseif (wppa_opt('potd_counter_link') == 'single') {
$lnk = wppa_encrypt_url(get_permalink($page) . '?occur=1&photo=' . $id);
// wppa_get_image_page_url_by_id( $id, true, false, $page );
} else {
wppa_log('Err', 'Unimplemented counter link type in wppa-potd-widget: ' . wppa_opt('potd_counter_link'));
}
$widget_content .= '<a href="' . $lnk . '" >' . '<div style="font-size:12px;position:absolute;right:4px;bottom:4px;" >+' . $c . '</div>' . '</a>';
}
}
// Audio
if (wppa_has_audio($id)) {
$widget_content .= wppa_get_audio_html(array('id' => $id, 'width' => wppa_opt('potd_widget_width'), 'controls' => true));
}
} else {
// No image
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-potd-widget.php
示例9: 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
示例10: wppa_album_sequence
//.........这里部分代码省略.........
xmlhttp.onreadystatechange = function() {
if ( xmlhttp.readyState == 4 && xmlhttp.status != 404 ) {
var ArrValues = xmlhttp.responseText.split( "||" );
if ( ArrValues[0] != '' ) {
alert( 'The server returned unexpected output:\n' + ArrValues[0] );
}
switch ( ArrValues[1] ) {
case '0': // No error
var i = seqno - 1;
var descend = <?php
if ($is_descending) {
echo 'true';
} else {
echo 'false';
}
?>
;
if ( descend ) {
i = <?php
echo count($albums);
?>
- seqno;
}
jQuery( '#wppa-album-seqno-' + album ).html( seqno );
if ( wppaRenumberPending ) {
jQuery( '#wppa-pb-'+i ).css({backgroundColor:'orange'});
}
else {
jQuery( '#wppa-pb-'+i ).css({backgroundColor:'green'});
}
if ( wppaLastAlbum = album ) {
wppaRenumberBusy = false;
}
break;
default: // Any error
jQuery( '#wppa-album-seqno-' + album ).html( '<span style="color"red" >Err:' + ArrValues[1] + '</span>' );
break;
}
wppaAjaxInProgress--;
// No longer busy?
if ( wppaAjaxInProgress == 0 ) {
if ( wppaRenumberPending ) {
// Redo
wppaRenumberPending = false;
wppaDoRenumber();
}
}
}
}
xmlhttp.open( 'POST',wppaAjaxUrl,true );
xmlhttp.setRequestHeader( "Content-type","application/x-www-form-urlencoded" );
xmlhttp.send( data );
wppaAjaxInProgress++;
jQuery( "#wppa-sort-seqn-albums-" + album ).attr( 'value', seqno ); // set hidden value to new value to prevent duplicate action
var spinnerhtml = '<img src="' + wppaImageDirectory + 'spinner.gif' + '" />';
jQuery( '#wppa-album-seqno-' + album ).html( spinnerhtml );
}
</script>
<br />
<div id="wppa-progbar" style="width:100%;height:12px;" >
<?php
$c = count($albums);
$l = 100 / $c;
$i = 0;
while ($i < $c) {
echo '<div' . ' id="wppa-pb-' . $i . '"' . ' style="display:inline;float:left;background-color:green;height:12px;width:' . $l . '%;"' . ' >' . '</div>';
$i++;
}
?>
</div>
<br />
<div class="widefat" style="max-width:600px;" >
<div id="sortable-albums">
<?php
foreach ($albums as $album) {
$cover_photo_id = wppa_get_coverphoto_id($album['id']);
echo '
<div' . ' id="albumitem-' . $album['id'] . '"' . ' class="ui-state-default-albums"' . ' style="background-color:#eeeeee;cursor:move;"' . ' >' . '<div' . ' style="height:100%;width:25%;float:left;text-align:center;overflow:hidden;" >';
if (wppa_is_video($cover_photo_id)) {
echo wppa_get_video_html(array('id' => $cover_photo_id, 'height' => '50', 'margin_top' => '5', 'margin_bottom' => '5', 'controls' => false));
} else {
echo '<img' . ' class="wppa-cover-image"' . ' src="' . wppa_fix_poster_ext(wppa_get_thumb_url(wppa_get_coverphoto_id($album['id'])), $cover_photo_id) . '"' . ' style="max-height:50px; margin: 5px;"' . ' />';
}
echo '</div>' . '<div style="height:100%;width:40%;float:left;font-size:12px;overflow:hidden;" >' . '<b>' . wppa_get_album_name($album['id']) . '</b>' . '<br />' . wppa_get_album_desc($album['id']) . '</div>' . '<div style="float:right;width:10%;" >' . '<table>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('up.png') . '"' . ' title="' . esc_attr(__('To top', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).parent().prepend(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('up.png') . '"' . ' title="' . esc_attr(__('One up', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;width:24px;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).prev().before(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('down.png') . '"' . ' title="' . esc_attr(__('One down', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;width:24px;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).next().after(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('down.png') . '"' . ' title="' . esc_attr(__('To bottom', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).parent().append(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '</table
|
请发表评论