本文整理汇总了PHP中wppa_cache_thumb函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_cache_thumb函数的具体用法?PHP wppa_cache_thumb怎么用?PHP wppa_cache_thumb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppa_cache_thumb函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _wppa_edit_photo
function _wppa_edit_photo()
{
// Check input
wppa_vfy_arg('photo');
// Edit one Photo
if (isset($_GET['photo'])) {
$photo = $_GET['photo'];
$thumb = wppa_cache_thumb($photo);
if ($thumb['owner'] == wppa_get_user()) {
echo '<div class="wrap">' . '<h2>' . __('Edit photo', 'wp-photo-album-plus') . '</h2>' . wppa_album_photos('', $photo) . '</div>';
} else {
wp_die('You do not have the rights to do this');
}
} else {
echo '<div class="wrap">' . '<h2>' . __('Edit photos', 'wp-photo-album-plus') . '</h2>' . wppa_album_photos('', '', wppa_get_user()) . '</div>';
}
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:17,代码来源:wppa-photo-admin-autosave.php
示例2: _wppa_edit_photo
function _wppa_edit_photo()
{
// Check input
wppa_vfy_arg('photo');
// Edit Photo
if (isset($_GET['photo'])) {
$photo = $_GET['photo'];
$thumb = wppa_cache_thumb($photo);
if ($thumb['owner'] == wppa_get_user()) {
?>
<div class="wrap">
<h2><?php
_e('Edit photo', 'wp-photo-album-plus');
?>
</h2>
<?php
wppa_album_photos('', $photo);
?>
</div>
<?php
} else {
wp_die('You do not have the rights to do this');
}
} else {
// Edit all photos owned by current user
?>
<div class="wrap">
<h2><?php
_e('Edit photos', 'wp-photo-album-plus');
?>
</h2>
<?php
wppa_album_photos('', '', wppa_get_user());
?>
</div>
<?php
}
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:38,代码来源:wppa-photo-admin-autosave.php
示例3: 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', 'alb');
wppa_bump_mocc();
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => '', 'parent' => 'none', 'name' => 'no', 'skip' => 'yes'));
$widget_title = apply_filters('widget_title', $instance['title']);
$page = in_array(wppa_opt('album_widget_linktype'), wppa('links_no_page')) ? '' : wppa_get_the_landing_page('album_widget_linkpage', __('Photo Albums', 'wp-photo-album-plus'));
$max = wppa_opt('album_widget_count');
if (!$max) {
$max = '10';
}
$parent = $instance['parent'];
$name = $instance['name'];
$skip = $instance['skip'];
if (is_numeric($parent)) {
$albums = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_ALBUMS . '` WHERE `a_parent` = %s ' . wppa_get_album_order($parent), $parent), ARRAY_A);
} else {
switch ($parent) {
case 'all':
$albums = $wpdb->get_results('SELECT * FROM `' . WPPA_ALBUMS . '` ' . wppa_get_album_order(), ARRAY_A);
break;
case 'last':
$albums = $wpdb->get_results('SELECT * FROM `' . WPPA_ALBUMS . '` ORDER BY `timestamp` DESC', ARRAY_A);
break;
default:
wppa_dbg_msg('Error, unimplemented album selection: ' . $parent . ' in Album widget.', 'red', true);
}
}
$widget_content = "\n" . '<!-- WPPA+ album Widget start -->';
$maxw = wppa_opt('album_widget_size');
$maxh = $maxw;
if ($name == 'yes') {
$maxh += 18;
}
$count = 0;
if ($albums) {
foreach ($albums as $album) {
if ($count < $max) {
$imageid = wppa_get_coverphoto_id($album['id']);
if ($imageid) {
$image = wppa_cache_thumb($imageid);
//$wpdb->get_row( $wpdb->prepare( 'SELECT * FROM `'.WPPA_PHOTOS.'` WHERE `id` = %s', $imageid ), ARRAY_A );
} else {
$image = false;
}
$imgcount = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . WPPA_PHOTOS . ' WHERE `album` = %s', $album['id']));
$subalbumcount = wppa_has_children($album['id']);
// $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM `".WPPA_ALBUMS."` WHERE `a_parent` = %s", $album['id'] ) );
$thumb = $image;
// Make the HTML for current picture
if ($image && ($imgcount > wppa_opt('min_thumbs') || $subalbumcount)) {
$link = wppa_get_imglnk_a('albwidget', $image['id']);
$file = wppa_get_thumb_path($image['id']);
$imgevents = wppa_get_imgevents('thumb', $image['id'], true);
$imgstyle_a = wppa_get_imgstyle_a($image['id'], $file, $maxw, 'center', 'albthumb');
$imgstyle = $imgstyle_a['style'];
$width = $imgstyle_a['width'];
$height = $imgstyle_a['height'];
$cursor = $imgstyle_a['cursor'];
if (wppa_switch('show_albwidget_tooltip')) {
$title = esc_attr(strip_tags(wppa_get_album_desc($album['id'])));
} 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(__('Upload at least %d photos to this album!', 'wp-photo-album-plus'), wppa_opt('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';
}
}
if ($imageid) {
$imgurl = wppa_fix_poster_ext($imgurl, $image['id']);
}
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-album-widget.php
示例4: 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
示例5: wppa_get_photo_desc
function wppa_get_photo_desc($id, $do_shortcodes = false, $do_geo = false)
{
// Verify args
if (!is_numeric($id) || $id < '1') {
wppa_dbg_msg('Invalid arg wppa_get_photo_desc( ' . $id . ' )', 'red');
return '';
}
// Get data
$thumb = wppa_cache_thumb($id);
$desc = $thumb['description'];
// Raw data
$desc = stripslashes($desc);
// Unescape
$desc = __($desc);
// qTranslate
// To prevent recursive rendering of scripts or shortcodes:
$desc = str_replace(array('%%wppa%%', '[wppa', '[/wppa]'), array('%-wppa-%', '{wppa', '{/wppa}'), $desc);
// Geo
if ($thumb['location'] && !wppa('in_widget') && strpos(wppa_opt('custom_content'), 'w#location') !== false && $do_geo == 'do_geo') {
wppa_do_geo($id, $thumb['location']);
}
// Other keywords
if (strpos($desc, 'w#') !== false) {
// Is there any 'w#' ?
// Keywords
$desc = str_replace('w#albumname', wppa_get_album_name($thumb['album']), $desc);
$desc = str_replace('w#albumid', $thumb['album'], $desc);
$keywords = array('name', 'filename', 'owner', 'id', 'tags', 'views', 'album');
foreach ($keywords as $keyword) {
$replacement = __(trim(stripslashes($thumb[$keyword])));
if ($replacement == '') {
$replacement = '‹' . __a('none', 'wppa') . '›';
}
$desc = str_replace('w#' . $keyword, $replacement, $desc);
}
$desc = str_replace('w#url', wppa_get_lores_url($id), $desc);
$desc = str_replace('w#hrurl', esc_attr(wppa_get_hires_url($id)), $desc);
$desc = str_replace('w#tnurl', wppa_get_tnres_url($id), $desc);
$desc = str_replace('w#pl', wppa_get_source_pl($id), $desc);
// Art monkey sizes
if (strpos($desc, 'w#amx') !== false || strpos($desc, 'w#amy') !== false || strpos($desc, 'w#amfs') !== false) {
$amxy = wppa_get_artmonkey_size_a($id);
if (is_array($amxy)) {
$desc = str_replace('w#amx', $amxy['x'], $desc);
$desc = str_replace('w#amy', $amxy['y'], $desc);
$desc = str_replace('w#amfs', $amxy['s'], $desc);
} else {
$desc = str_replace('w#amx', 'N.a.', $desc);
$desc = str_replace('w#amy', 'N.a.', $desc);
$desc = str_replace('w#amfs', 'N.a.', $desc);
}
}
// Timestamps
$timestamps = array('timestamp', 'modified');
foreach ($timestamps as $timestamp) {
if ($thumb[$timestamp]) {
$desc = str_replace('w#' . $timestamp, wppa_local_date(get_option('date_format', "F j, Y,") . ' ' . get_option('time_format', "g:i a"), $thumb[$timestamp]), $desc);
} else {
$desc = str_replace('w#' . $timestamp, '‹' . __a('unknown') . '›', $desc);
}
}
// Custom data fields
if (wppa_switch('custom_fields')) {
$custom = $thumb['custom'];
$custom_data = $custom ? unserialize($custom) : array('', '', '', '', '', '', '', '', '', '');
for ($i = '0'; $i < '10'; $i++) {
if (wppa_opt('custom_caption_' . $i)) {
// Field defined
if (wppa_switch('custom_visible_' . $i)) {
// May be displayed
$desc = str_replace('w#cc' . $i, __(wppa_opt('custom_caption_' . $i)) . ':', $desc);
// Caption
$desc = str_replace('w#cd' . $i, __(stripslashes($custom_data[$i])), $desc);
// Data
} else {
// May not be displayed
$desc = str_replace('w#cc' . $i, '', $desc);
// Remove
$desc = str_replace('w#cd' . $i, '', $desc);
// Remove
}
} else {
// Field not defined
$desc = str_replace('w#cc' . $i, '', $desc);
// Remove
$desc = str_replace('w#cd' . $i, '', $desc);
// Remove
}
}
}
}
// Shortcodes
if ($do_shortcodes) {
$desc = do_shortcode($desc);
} else {
$desc = strip_shortcodes($desc);
}
// Remove shortcodes if not wanted
$desc = wppa_html($desc);
// Enable html
//.........这里部分代码省略.........
开发者ID:billadams,项目名称:forever-frame,代码行数:101,代码来源:wppa-items.php
示例6: wppa_get_cloudinary_url
function wppa_get_cloudinary_url($id, $test_only = false)
{
global $blog_id;
$thumb = wppa_cache_thumb($id);
$ext = $thumb['ext'] == 'xxx' ? 'jpg' : $thumb['ext'];
$prefix = is_multisite() && !WPPA_MULTISITE_GLOBAL ? $blog_id . '-' : '';
$size = $test_only ? 'h_32/' : '';
$s = is_ssl() ? 's' : '';
$url = 'http' . $s . '://res.cloudinary.com/' . get_option('wppa_cdn_cloud_name') . '/image/upload/' . $size . $prefix . $id . '.' . $ext;
return $url;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:11,代码来源:wppa-cloudinary.php
示例7: wppa_add_metatags
function wppa_add_metatags()
{
global $wpdb;
// Share info for sm that uses og
$id = wppa_get_get('photo');
if (!wppa_photo_exists($id)) {
$id = false;
}
if ($id) {
// SM may not accept images from the cloud.
wppa('for_sm', true);
$imgurl = wppa_get_photo_url($id);
wppa('for_sm', false);
if (wppa_is_video($id)) {
$imgurl = wppa_fix_poster_ext($imgurl, $id);
}
} else {
$imgurl = '';
}
if ($id) {
if (wppa_switch('og_tags_on')) {
$thumb = wppa_cache_thumb($id);
if ($thumb) {
$title = wppa_get_photo_name($id);
$desc = wppa_get_og_desc($id);
$url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$site = get_bloginfo('name');
$mime = wppa_get_mime_type($id);
echo '
<!-- WPPA+ Og Share data -->
<meta property="og:site_name" content="' . esc_attr(sanitize_text_field($site)) . '" />
<meta property="og:type" content="article" />
<meta property="og:url" content="' . $url . '" />
<meta property="og:title" content="' . esc_attr(sanitize_text_field($title)) . '" />';
if ($mime) {
echo '
<meta property="og:image" content="' . esc_url(sanitize_text_field($imgurl)) . '" />
<meta property="og:image:type" content="' . $mime . '" />
<meta property="og:image:width" content="' . wppa_get_photox($id) . '" />
<meta property="og:image:height" content="' . wppa_get_photoy($id) . '" />';
}
if ($desc) {
echo '
<meta property="og:description" content="' . esc_attr(sanitize_text_field($desc)) . '" />';
}
echo '
<!-- WPPA+ End Og Share data -->
';
}
}
if (wppa_switch('share_twitter') && wppa_opt('twitter_account')) {
$thumb = wppa_cache_thumb($id);
// Twitter wants at least 280px in width, and at least 150px in height
if ($thumb) {
$x = wppa_get_photo_item($id, 'photox');
$y = wppa_get_photo_item($id, 'photoy');
}
if ($thumb && $x >= 280 && $y >= 150) {
$title = wppa_get_photo_name($id);
$desc = wppa_get_og_desc($id);
$url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$site = get_bloginfo('name');
echo '
<!-- WPPA+ Twitter Share data -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="' . wppa_opt('twitter_account') . '">
<meta name="twitter:creator" content="' . wppa_opt('twitter_account') . '">
<meta name="twitter:title" content="' . esc_attr(sanitize_text_field($title)) . '">
<meta name="twitter:description" content="' . esc_attr(sanitize_text_field($desc)) . '">
<meta name="twitter:image" content="' . esc_url(sanitize_text_field($imgurl)) . '">
<!-- WPPA+ End Twitter Share data -->
';
} elseif ($thumb && $x >= 120 && $y >= 120) {
$title = wppa_get_photo_name($id);
$desc = wppa_get_og_desc($id);
$url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$site = get_bloginfo('name');
echo '
<!-- WPPA+ Twitter Share data -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="' . wppa_opt('twitter_account') . '">
<meta name="twitter:title" content="' . esc_attr(sanitize_text_field($title)) . '">
<meta name="twitter:description" content="' . esc_attr(sanitize_text_field($desc)) . '">
<meta name="twitter:image" content="' . esc_url(sanitize_text_field($imgurl)) . '">
<!-- WPPA+ End Twitter Share data -->
';
}
}
}
// To make sure we are on a page that contains at least [wppa] we check for Get var 'wppa-album'.
// This also narrows the selection of featured photos to those that exist in the current album.
$done = array();
$album = '';
if (isset($_REQUEST['album'])) {
$album = $_REQUEST['album'];
} elseif (isset($_REQUEST['wppa-album'])) {
$album = $_REQUEST['wppa-album'];
}
$album = strip_tags($album);
if (strlen($album == 12)) {
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-non-admin.php
示例8: wppa_set_owner_to_name
function wppa_set_owner_to_name($id)
{
global $wpdb;
static $usercache;
// Feature enabled?
if (wppa_switch('owner_to_name')) {
// Get photo data.
$p = wppa_cache_thumb($id);
// Find user of whose display name equals photoname
if (isset($usercache[$p['name']])) {
$user = $usercache[$p['name']];
} else {
$user = $wpdb->get_var($wpdb->prepare("SELECT `user_login` FROM `" . $wpdb->users . "` WHERE `display_name` = %s", $p['name']));
if ($user) {
$usercache[$p['name']] = $user;
} else {
$usercache[$p['name']] = false;
// NULL is equal to ! isset() !!!
}
}
if ($user) {
if ($p['owner'] != $user) {
wppa_update_photo(array('id' => $id, 'owner' => $user));
wppa_cache_thumb('invalidate', $id);
wppa_log('Obs', 'Owner of photo ' . $id . ' in album ' . wppa_get_photo_item($id, 'album') . ' set to: ' . $user);
return true;
} else {
return '0';
}
}
}
return false;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:33,代码来源:wppa-utils.php
示例9: wppa_recuperate
function wppa_recuperate($id)
{
global $thumb;
global $wpdb;
wppa_cache_thumb($id);
$iptcfix = false;
$exiffix = false;
$file = wppa_get_source_path($id);
if (!is_file($file)) {
$file = wppa_get_photo_path($id);
}
if (is_file($file)) {
// Not a dir
$attr = getimagesize($file, $info);
if (is_array($attr)) {
// Is a picturefile
if ($attr[2] == IMAGETYPE_JPEG) {
// Is a jpg
if (wppa_switch('wppa_save_iptc')) {
// Save iptc
if (isset($info["APP13"])) {
// There is IPTC data
$is_iptc = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_IPTC . "` WHERE `photo` = %s", $id));
if (!$is_iptc) {
// No IPTC yet and there is: Recuperate
wppa_import_iptc($id, $info, 'nodelete');
$iptcfix = true;
}
}
}
if (wppa_switch('wppa_save_exif')) {
// Save exif
$image_type = exif_imagetype($file);
if ($image_type == IMAGETYPE_JPEG) {
// EXIF supported by server
$is_exif = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_EXIF . "` WHERE `photo`=%s", $id));
if (!$is_exif) {
// No EXIF yet
$exif = @exif_read_data($file, 'EXIF');
//@
if (is_array($exif)) {
// There is exif data present
wppa_import_exif($id, $file, 'nodelete');
$exiffix = true;
}
}
}
}
}
}
}
return array('iptcfix' => $iptcfix, 'exiffix' => $exiffix);
}
开发者ID:billadams,项目名称:forever-frame,代码行数:53,代码来源:wppa-maintenance.php
示例10: wppa_the_coverphoto
function wppa_the_coverphoto($albumid, $image, $src, $photo_pos, $photolink, $title, $imgattr_a, $events)
{
global $wpdb;
if (!$image) {
return;
}
if (wppa_has_audio($image['id'])) {
$src = wppa_fix_poster_ext($src, $image['id']);
}
$imgattr = $imgattr_a['style'];
$imgwidth = $imgattr_a['width'];
$imgheight = $imgattr_a['height'];
$frmwidth = $imgwidth + '10';
// + 2 * 1 border + 2 * 4 padding
// Find the photo frame style
if (wppa_in_widget()) {
$photoframestyle = 'style="text-align:center; "';
} else {
switch ($photo_pos) {
case 'left':
$photoframestyle = 'style="float:left; margin-right:5px;width:' . $frmwidth . 'px;"';
break;
case 'right':
$photoframestyle = 'style="float:right; margin-left:5px;width:' . $frmwidth . 'px;"';
break;
case 'top':
$photoframestyle = 'style="text-align:center;"';
break;
case 'bottom':
$photoframestyle = 'style="text-align:center;"';
break;
default:
$photoframestyle = '';
wppa_dbg_msg('Illegal $photo_pos in wppa_the_coverphoto');
}
}
// Open the coverphoto frame
wppa_out('<div' . ' id="coverphoto_frame_' . $albumid . '_' . wppa('mocc') . '"' . ' class="coverphoto-frame" ' . $photoframestyle . ' >');
// The link from the coverphoto
if ($photolink) {
// If lightbox, we need all the album photos to set up a lightbox set
if ($photolink['is_lightbox']) {
$thumbs = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `album` = %s " . wppa_get_photo_order($albumid), $albumid), ARRAY_A);
wppa_dbg_q('Q-CovPlB');
// Report the query
wppa_cache_thumb('add', $thumbs);
// Save rsult in 2nd level cache
if ($thumbs) {
foreach ($thumbs as $thumb) {
$id = $thumb['id'];
$title = wppa_get_lbtitle('cover', $id);
if (wppa_is_video($id)) {
$siz['0'] = wppa_get_videox($id);
$siz['1'] = wppa_get_videoy($id);
} else {
$siz['0'] = wppa_get_photox($id);
$siz['1'] = wppa_get_photoy($id);
}
$link = wppa_get_photo_url($id, '', $siz['0'], $siz['1']);
if (wppa_has_audio($id)) {
$link = wppa_fix_poster_ext($link, $id);
}
$is_video = wppa_is_video($id);
$has_audio = wppa_has_audio($id);
// Open the anchor tag for lightbox
wppa_out("\n\t" . '<a' . ' href="' . $link . '"' . ($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') . '[alw-' . wppa('mocc') . '-' . $albumid . ']"' . ' ' . wppa('lbtitle') . '="' . $title . '"' . ' >');
// the cover image
if ($id == $image['id']) {
if (wppa_is_video($image['id'])) {
wppa_out('<video preload="metadata" class="image wppa-img" id="i-' . $image['id'] . '-' . wppa('mocc') . '" title="' . wppa_zoom_in($image['id']) . '" width="' . $imgwidth . '" height="' . $imgheight . '" style="' . __wcs('wppa-img') . $imgattr . $imgattr_a['cursor'] . '" ' . $events . ' >' . wppa_get_video_body($image['id']) . '</video>');
} else {
wppa_out('<img class="image wppa-img" id="i-' . $image['id'] . '-' . wppa('mocc') . '" title="' . wppa_zoom_in($image['id']) . '" src="' . $src . '" width="' . $imgwidth . '" height="' . $imgheight . '" style="' . __wcs('wppa-img') . $imgattr . $imgattr_a['cursor'] . '" ' . $events . ' ' . wppa_get_imgalt($image['id']) . ' />');
}
}
// Close the lightbox anchor tag
wppa_out("\n\t" . '</a>');
}
}
} else {
$href = $photolink['url'] == '#' ? '' : 'href="' . wppa_convert_to_pretty($photolink['url']) . '" ';
wppa_out('<a' . ' ' . $href . ' target="' . $photolink['target'] . '"' . ' title="' . $photolink['title'] . '"' . ' onclick="' . $photolink['onclick'] . '"' . ' >');
// A video?
if (wppa_is_video($image['id'])) {
wppa_out('<video preload="metadata" ' . $title . '" class="image wppa-img" width="' . $imgwidth . '" height="' . $imgheight . '" style="' . __wcs('wppa-img') . $imgattr . '" ' . $events . ' >' . wppa_get_video_body($image['id']) . '</video>');
} else {
wppa_out('<img src="' . $src . '" ' . wppa_get_imgalt($image['id']) . ' class="image wppa-img" width="' . $imgwidth . '" height="' . $imgheight . '" style="' . __wcs('wppa-img') . $imgattr . '" ' . $events . ' />');
}
wppa_out('</a>');
}
} else {
// A video?
if (wppa_is_video($image['id'])) {
wppa_out('<video preload="metadata" class="image wppa-img" width="' . $imgwidth . '" height="' . $imgheight . '" style="' . __wcs('wppa-img') . $imgattr . '" ' . $events . ' >' . wppa_get_video_body($image['id']) . '</video>');
} else {
wppa_out('<img src="' . $src . '" ' . wppa_get_imgalt($image['id']) . ' class="image wppa-img" width="' . $imgwidth . '" height="' . $imgheight . '" style="' . __wcs('wppa-img') . $imgattr . '" ' . $events . ' />');
}
}
// Close the coverphoto frame
wppa_out('</div>');
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:100,代码来源:wppa-album-covers.php
示例11: wppa_update_photo
function wppa_update_photo($args)
{
global $wpdb;
if (!is_array($args)) {
return false;
}
if (!$args['id']) {
return false;
}
$thumb = wppa_cache_thumb($args['id']);
if (!$thumb) {
return false;
}
$id = $args['id'];
// If Timestamp update, make sure modified is updated to now
if (isset($args['timestamp'])) {
$args['modified'] = time();
}
foreach (array_keys($args) as $itemname) {
$itemvalue = $args[$itemname];
$doit = false;
// Sanitize input
switch ($itemname) {
case 'id':
break;
case 'name':
$itemvalue = wppa_strip_tags($itemvalue, 'all');
$doit = true;
break;
case 'description':
$itemvalue = balanceTags($itemvalue, true);
$itemvalue = wppa_strip_tags($itemvalue, 'script&style');
$doit = true;
break;
case 'timestamp':
case 'modified':
if (!$itemvalue) {
$itemvalue = time();
}
$doit = true;
break;
case 'scheduledtm':
case 'exifdtm':
case 'page_id':
$doit = true;
break;
case 'status':
$doit = true;
break;
case 'tags':
$itemvalue = wppa_sanitize_tags($itemvalue);
$doit = true;
break;
case 'thumbx':
case 'thumby':
case 'photox':
case 'photoy':
case 'videox':
case 'videoy':
$itemvalue = intval($itemvalue);
$doit = true;
break;
case 'ext':
$doit = true;
break;
case 'filename':
$itemvalue = wppa_sanitize_file_name($itemvalue);
$doit = true;
break;
case 'custom':
case 'stereo':
$doit = true;
break;
default:
wppa_log('Error', 'Not implemented in wppa_update_photo(): ' . $itemname);
return false;
}
if ($doit) {
if ($wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `" . $itemname . "` = %s WHERE `id` = %s LIMIT 1", $itemvalue, $id))) {
wppa_cache_photo('invalidate', $id);
}
}
}
return true;
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:85,代码来源:wppa-wpdb-update.php
示例12: wppa_recuperate
function wppa_recuperate($id)
{
global $wpdb;
$thumb = wppa_cache_thumb($id);
$iptcfix = false;
$exiffix = false;
$file = wppa_get_source_path($id);
if (!is_file($file)) {
$file = wppa_get_photo_path($id);
}
if (is_file($file)) {
// Not a dir
$attr = getimagesize($file, $info);
if (is_array($attr)) {
// Is a picturefile
if ($attr[2] == IMAGETYPE_JPEG) {
// Is a jpg
// Save iptc is on?
if (wppa_switch('save_iptc')) {
// There is IPTC data
if (isset($info["APP13"])) {
// If this is a cron prcess, the table is not pre-emptied
if (wppa_is_cron()) {
// Replace or add data
wppa_import_iptc($id, $info);
} else {
wppa_import_iptc($id, $info, 'nodelete');
}
$iptcfix = true;
}
}
// Save exif is on?
if (wppa_switch('save_exif')) {
$image_type = exif_imagetype($file);
// EXIF supported by server
if ($image_type == IMAGETYPE_JPEG) {
// Get exif data
$exif = exif_read_data($file, 'EXIF');
// Exif data found
if ($exif) {
// If this is a cron prcess, the table is not pre-emptied
if (wppa_is_cron()) {
// Replace or add data
wppa_import_exif($id, $file);
} else {
wppa_import_exif($id, $file, 'nodelete');
}
$exiffix = true;
}
}
}
}
}
}
return array('iptcfix' => $iptcfix, 'exiffix' => $exiffix);
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:56,代码来源:wppa-maintenance.php
示例13: wppa_translate_photo_keywords
function wppa_translate_photo_keywords($id, $text)
{
$result = $text;
// Is there any 'w#' ?
if (strpos($result, 'w#') !== false) {
$thumb = wppa_cache_thumb($id);
// Keywords
$result = str_replace('w#albumname', wppa_get_album_name($thumb['album']), $result);
$result = str_replace('w#albumid', $thumb['album'], $result);
$keywords = array('name', 'filename', 'owner', 'id', 'tags', 'views', 'album');
foreach ($keywords as $keyword) {
$replacement = __(trim(stripslashes($thumb[$keyword])), 'wp-photo-album-plus');
if ($keyword == 'tags') {
$replacement = trim($replacement, ',');
}
if ($replacement == '') {
$replacement = '‹' . __('none', 'wp-photo-album-plus') . '›';
}
$result = str_replace('w#' . $keyword, $replacement, $result);
}
$result = str_replace('w#url', wppa_get_lores_url($id), $result);
$result = str_replace('w#hrurl', esc_attr(wppa_get_hires_url($id)), $result);
$result = str_replace('w#tnurl', wppa_get_tnres_url($id), $result);
$result = str_replace('w#pl', wppa_get_source_pl($id), $result);
$result = str_replace('w#rating', wppa_get_rating_by_id($id, 'nolabel'), $result);
$user = get_user_by('login', $thumb['owner']);
if ($user) {
$result = str_replace('w#displayname', $user->display_name, $result);
} else {
$owner = wppa_get_photo_item($id, 'owner');
if (strpos($owner, '.') == false && strpos($owner, ':') == false) {
// Not an ip, a deleted user
$result = str_replace('w#displayname', __('Nomen Nescio', 'wp-photo-album-plus'), $result);
} else {
// An ip
$result = str_replace('w#displayname', __('Anonymus', 'wp-photo-album-plus'), $result);
}
}
// Art monkey sizes
if (strpos($result, 'w#amx') !== false || strpos($result, 'w#amy') !== false || strpos($result, 'w#amfs') !== false) {
$amxy = wppa_get_artmonkey_size_a($id);
if (is_array($amxy)) {
$result = str_replace('w#amx', $amxy['x'], $result);
$result = str_replace('w#amy', $amxy['y'], $result);
$result = str_replace('w#amfs', $amxy['s'], $result);
} else {
$result = str_replace('w#amx', 'N.a.', $result);
$result = str_replace('w#amy', 'N.a.', $result);
$result = str_replace('w#amfs', 'N.a.', $result);
}
}
// Timestamps
$timestamps = array('timestamp', 'modified');
foreach ($timestamps as $timestamp) {
if ($thumb[$timestamp]) {
$result = str_replace('w#' . $timestamp, wppa_local_date(get_option('date_format', "F j, Y,") . ' ' . get_option('time_format', "g:i a"), $thumb[$timestamp]), $result);
} else {
$result = str_replace('w#' . $timestamp, '‹' . __('unknown', 'wp-photo-album-plus') . '›', $result);
}
}
// Custom data fields
if (wppa_switch('custom_fields')) {
$custom = $thumb['custom'];
$custom_data = $custom ? unserialize($custom) : array('', '', '', '', '', '', '', '', '', '');
for ($i = '0'; $i < '10'; $i++) {
if (wppa_opt('custom_caption_' . $i)) {
// Field defined
if (wppa_switch('custom_visible_' . $i)) {
// May be displayed
$result = str_replace('w#cc' . $i, __(wppa_opt('custom_caption_' . $i), 'wp-photo-album-plus') . ':', $result);
// Caption
$result = str_replace('w#cd' . $i, __(stripslashes($custom_data[$i]), 'wp-photo-album-plus'), $result);
// Data
} else {
// May not be displayed
$result = str_replace('w#cc' . $i, '', $result);
// Remove
$result = str_replace('w#cd' . $i, '', $result);
// Remove
}
} else {
// Field not defined
$result = str_replace('w#cc' . $i, '', $result);
// Remove
$result = str_replace('w#cd' . $i, '', $result);
// Remove
}
}
}
}
return $result;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:92,代码来源:wppa-items.php
示例14: wppa_get_videoy
function wppa_get_videoy($id)
{
if (!wppa_is_video($id)) {
return '0';
}
$thumb = wppa_cache_thumb($id);
if ($thumb['videoy']) {
return $thumb['videoy'];
}
return wppa_opt('video_height');
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:11,代码来源:wppa-video.php
示例15: wppa_get_the_bestof
function wppa_get_the_bestof($count, $period, $sortby, $what)
{
global $wppa_opt;
global $wpdb;
global $thumb;
// Phase 1, find the period we are talking about
// find $start and $end
switch ($period) {
case 'lastweek':
$start = wppa_get_timestamp('lastweekstart');
$end = wppa_get_timestamp('lastweekend');
break;
case 'thisweek':
$start = wppa_get_timestamp('thisweekstart');
$end = wppa_get_timestamp('thisweekend');
break;
case 'lastmonth':
$start = wppa_get_timestamp('lastmonthstart');
$end = wppa_get_timestamp('lastmonthend');
break;
case 'thismonth':
$start = wppa_get_timestamp('thismonthstart');
$end = wppa_get_timestamp('thismonthend');
break;
case 'lastyear':
$start = wppa_get_timestamp('lastyearstart');
$end = wppa_get_timestamp('lastyearend');
break;
case 'thisyear':
$start = wppa_get_timestamp('thisyearstart');
$end = wppa_get_timestamp('thisyearend');
break;
default:
return 'Unimplemented period: ' . $period;
}
// Phase 2, get the ratings of the period
// find $ratings, ordered by photo id
$ratings = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_RATING . "` WHERE `timestamp` >= %s AND `timestamp` < %s ORDER BY `photo`", $start, $end), ARRAY_A);
// Phase 3, set up an array with data we need
// There are two methods: photo oriented and owner oriented, depending on
// Each element reflects a photo ( key = photo id ) and is an array with items: maxratings, meanrating, ratings, totvalue.
$ratmax = $wppa_opt['wppa_rating_max'];
$data = array();
foreach ($ratings as $rating) {
$key = $rating['photo'];
if (!isset($data[$key])) {
$data[$key] = array();
|
请发表评论