本文整理汇总了PHP中wppa_get_album_name函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_get_album_name函数的具体用法?PHP wppa_get_album_name怎么用?PHP wppa_get_album_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppa_get_album_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wppa_get_statistics
function wppa_get_statistics()
{
$count = wppa_get_total_album_count();
$y_id = wppa_get_youngest_album_id();
$y_name = __(wppa_get_album_name($y_id));
$p_id = wppa_get_parentalbumid($y_id);
$p_name = __(wppa_get_album_name($p_id));
$result = '<div class="wppa-box wppa-nav" style="text-align: center; ' . __wcs('wppa-box') . __wcs('wppa-nav') . '">';
$result .= __a('There are') . ' ' . $count . ' ' . __a('photo albums. The last album added is') . ' ';
$result .= '<a href="' . wppa_get_permalink() . 'wppa-album=' . $y_id . '&wppa-cover=0&wppa-occur=1">' . $y_name . '</a>';
if ($p_id > '0') {
$result .= __a(', a subalbum of') . ' ';
$result .= '<a href="' . wppa_get_permalink() . 'wppa-album=' . $p_id . '&wppa-cover=0&wppa-occur=1">' . $p_name . '</a>';
}
$result .= '.</div>';
return $result;
}
示例2: _wppa_sidebar_page_options
//.........这里部分代码省略.........
}
while (get_option('wppa_potd_offset', '0') > $n_days) {
update_option('wppa_potd_offset', get_option('wppa_potd_offset') - $n_days);
}
while (get_option('wppa_potd_offset', '0') < '0') {
update_option('wppa_potd_offset', get_option('wppa_potd_offset') + $n_days);
}
$name = __('Day offset:', 'wp-photo-album-plus');
$desc = __('The difference between daynumber and photo order number.', 'wp-photo-album-plus');
$help = '';
$slug = 'wppa_potd_offset';
$opts = array();
$day = '0';
while ($day < $n_days) {
$opts[] = $day;
$day++;
}
$vals = $opts;
$html = '<span style="float:left;" >' . sprintf(__('Current day# = %s, offset =', 'wp-photo-album-plus'), wppa_local_date($date_key)) . '</span> ' . wppa_select($slug, $opts, $vals, $onch);
$photo_order = wppa_local_date($date_key) - get_option('wppa_potd_offset', '0');
while ($photo_order < '0') {
$photo_order += $n_days;
}
$html .= sprintf(__('Todays photo order# = %s.', 'wp-photo-album-plus'), $photo_order);
wppa_setting($slug, '11b', $name, $desc, $html, $help);
}
}
$name = __('Preview', 'wp-photo-album-plus');
$desc = __('Current "photo of the day":', 'wp-photo-album-plus');
$help = '';
$slug = 'wppa_potd_photo';
$photo = wppa_get_potd();
if ($photo) {
$html = '<div style="display:inline-block;width:25%;text-align:center;vertical-align:middle;">' . '<img src="' . wppa_fix_poster_ext(wppa_get_thumb_url($photo['id']), $photo['id']) . '" />' . '</div>' . '<div style="display:inline-block;width:75%;text-align:center;vertical-align:middle;" >' . __('Album', 'wp-photo-album-plus') . ': ' . wppa_get_album_name($photo['album']) . '<br />' . __('Uploader', 'wp-photo-album-plus') . ': ' . $photo['owner'] . '</div>';
} else {
$html = __('Not found.', 'wp-photo-album-plus');
}
wppa_setting($slug, '12', $name, $desc, $html, $help);
$name = __('Show selection', 'wp-photo-album-plus');
$desc = __('Show the photos in the current selection.', 'wp-photo-album-plus');
$help = '';
$slug = 'wppa_potd_preview';
$html = wppa_checkbox($slug, $onch);
wppa_setting($slug, '13', $name, $desc, $html, $help);
// Cose table body
echo '</tbody>';
// Table footer
echo '<tfoot style="font-weight: bold;" >' . '<tr>' . '<td>' . __('#', 'wp-photo-album-plus') . '</td>' . '<td>' . __('Name', 'wp-photo-album-plus') . '</td>' . '<td>' . __('Description', 'wp-photo-album-plus') . '</td>' . '<td>' . __('Setting', 'wp-photo-album-plus') . '</td>' . '<td>' . __('Help', 'wp-photo-album-plus') . '</td>' . '</tr>' . '</tfoot>' . '</table>';
// Diagnostic
// echo
// 'Diagnostic: wppa_potd_album = ' . get_option( 'wppa_potd_album' ) . ' wppa_potd_photo = ' . get_option( 'wppa_potd_photo' );
// Status star must be here for js
echo '<img' . ' id="img_potd_photo"' . ' src="' . wppa_get_imgdir('star.ico') . '" style="height:12px;display:none;"' . ' />';
// The potd photo pool
echo '<table class="widefat wppa-table wppa-setting-table" >';
// Table header
echo '<thead>' . '<tr>' . '<td>' . __('Photos in the current selection', 'wp-photo-album-plus') . '</td>' . '</tr>' . '</thead>';
// Table body
if (wppa_switch('potd_preview')) {
echo '<tbody>' . '<tr>' . '<td>';
// Get the photos
$alb = wppa_opt('potd_album');
$opt = wppa_is_int($alb) ? ' ' . wppa_get_photo_order($alb) . ' ' : '';
$photos = wppa_get_widgetphotos($alb, $opt);
// Count them
$cnt = count($photos);
示例3: widget
//.........这里部分代码省略.........
}
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>';
}
break;
case 'rating_count':
if ($ratcount == 'yes') {
$n = wppa_get_rating_count_by_id($image['id']);
$widget_content .= '<div>' . ($likes ? $lt['display'] : sprintf(_n('%d vote', '%d votes', $n, 'wp-photo-album-plus'), $n)) . '</div>';
}
if ($meanrat == 'yes') {
$widget_content .= '<div>' . wppa_get_rating_by_id($image['id']) . '</div>';
}
if ($viewcount == 'yes') {
$n = $image['views'];
$widget_content .= '<div>' . sprintf(_n('%d view', '%d views', $n, 'wp-photo-album-plus'), $n) . '</div>';
}
break;
示例4: wppa_get_thumb_default
//.........这里部分代码省略.........
}
}
}
// The medals if near the bottom
$result .= wppa_get_medal_html_a(array('id' => $id, 'size' => $medalsize, 'where' => 'bot'));
// Close the image container
$result .= '</div>';
/*
// The audio when popup
if ( wppa_switch( 'use_thumb_popup' ) && wppa_switch( 'thumb_audio' ) && wppa_has_audio( $id ) && ! $com_alt ) {
$result .= wppa_get_audio_html( array(
'id' => $id,
'width' => $imgwidth
));
}
*/
// Comten alt display?
if ($com_alt) {
$result .= '<div' . ' class="wppa-com-alt wppa-com-alt-' . wppa('mocc') . '"' . ' style="' . 'height:' . $imgheight . 'px;' . 'overflow:auto;' . 'margin: 0 0 8px 10px;' . 'border:1px solid ' . wppa_opt('bcolor_alt') . ';' . '"' . ' >';
$comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s AND `status` = 'approved' ORDER BY `timestamp` DESC", $id), ARRAY_A);
$first = true;
if ($comments) {
foreach ($comments as $com) {
$result .= '<h6' . ' style="' . 'font-size:10px;' . 'line-height:12px;' . 'font-weight:bold;' . 'padding:' . ($first ? '0' : '6px') . ' 0 0 6px;' . 'margin:0;float:left;' . '"' . '>' . $com['user'] . ' ' . __('wrote', 'wp-photo-album-plus') . ' ' . wppa_get_time_since($com['timestamp']) . ':' . '</h6>' . '<p' . ' style="' . 'font-size:10px;' . 'line-height:12px;' . 'padding:0 0 0 6px;' . 'text-align:left;' . 'margin:0;' . 'clear:left;' . '"' . '>' . html_entity_decode(convert_smilies(stripslashes($com['comment']))) . '</p>';
$first = false;
}
}
$result .= '</div>';
} else {
// Open the subtext container
$margtop = wppa_switch('align_thumbtext') ? '' : 'margin-top:' . -$imgmarginbottom . 'px;';
$subtextcontheight = $frameheight - max($imgwidth, $imgheight);
if (!wppa_switch('align_thumbtext')) {
$subtextcontheight += $imgmarginbottom;
}
$result .= '<div' . ' style="' . 'height:' . $subtextcontheight . 'px;' . 'width:' . $framewidth . 'px;' . 'position:absolute;' . $margtop . 'overflow:hidden;' . '" >';
// Single button voting system
if (wppa_opt('rating_max') == '1' && wppa_switch('vote_thumb')) {
$mylast = $wpdb->get_row($wpdb->prepare('SELECT * FROM `' . WPPA_RATING . '` WHERE `photo` = %s AND `user` = %s ORDER BY `id` DESC LIMIT 1', $id, wppa_get_user()), ARRAY_A);
$buttext = $mylast ? __(wppa_opt('voted_button_text'), 'wp-photo-album-plus') : __(wppa_opt('vote_button_text'), 'wp-photo-album-plus');
$result .= '<input' . ' id="wppa-vote-button-' . wppa('mocc') . '-' . $id . '"' . ' class="wppa-vote-button-thumb"' . ' style="margin:0;"' . ' type="button"' . ' onclick="wppaVoteThumb( ' . wppa('mocc') . ', ' . $id . ' )"' . ' value="' . $buttext . '"' . ' />';
}
// Name
if (wppa_switch('thumb_text_name') || wppa_switch('thumb_text_owner')) {
$result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . wppa_get_photo_name($id, wppa_switch('thumb_text_owner'), false, false, wppa_switch('thumb_text_name')) . '</div>';
}
// searching, link to album
// if ( wppa( 'src' ) || wppa( 'supersearch' ) || ( ( wppa( 'is_comten') || wppa( 'is_topten' ) || wppa( 'is_lasten' ) || wppa( 'is_featen') ) && wppa( 'start_album' ) != $thumb['album'] ) ) {
if (wppa_switch('thumb_text_virt_album') && wppa_is_virtual() && wppa('start_album') != $thumb['album']) {
$result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . '<a' . ' href="' . wppa_get_album_url($thumb['album']) . '"' . ' >' . '<span class="wppa-tnpar" >(</span>' . stripslashes(__(wppa_get_album_name($thumb['album']), 'wp-photo-album-plus')) . '<span class="wppa-tnpar" >)</span>' . '</a>' . '</div>';
}
// Share
if (wppa_switch('share_on_thumbs')) {
$result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . wppa_get_share_html($id, 'thumb') . '</div>';
}
// Delete and Edit links
if (wppa_switch('edit_thumb') && !wppa_is_user_blacklisted()) {
if (wppa_user_is('administrator') || current_user_can('wppa_moderate') || wppa_get_user() == wppa_get_photo_owner($id) && wppa_switch('upload_edit')) {
$result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . '<a' . ' style="color:red;cursor:pointer;"' . ' onclick="' . esc_attr('if ( confirm( "' . __('Are you sure you want to remove this photo?', 'wp-photo-album-plus') . '" ) ) wppaAjaxRemovePhoto( ' . wppa('mocc') . ', ' . $id . ', false ); return false;') . '"' . ' >' . __('Delete', 'wp-photo-album-plus') . '</a>' . ' ' . '<a' . ' style="color:green;cursor:pointer;"' . ' onclick="wppaEditPhoto( ' . wppa('mocc') . ', ' . $id . ' ); return false;"' . ' >' . __('Edit', 'wp-photo-album-plus') . '</a>' . '</div>';
}
}
// Description
if (wppa_switch('thumb_text_desc') || $thumb['status'] == 'pending' || $thumb['status'] == 'scheduled') {
$desc = '';
if ($thumb['status'] == 'pending' || $thumb['status'] == 'scheduled') {
$desc .= wppa_moderate_links('thumb', $id);
}
$desc .= wppa_get_photo_desc($id, wppa_switch('allow_foreign_shortcodes_thumbs'));
$result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . $desc . '</div>';
}
// Rating
if (wppa_switch('thumb_text_rating')) {
$rating = wppa_get_rating_by_id($id);
if ($rating && wppa_switch('show_rating_count')) {
$rating .= ' ( ' . wppa_get_rating_count_by_id($id) . ' )';
}
$result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . $rating . '</div>';
}
// Comcount
if (wppa_switch('thumb_text_comcount')) {
$comcount = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_COMMENTS . "` WHERE `photo` = " . $id);
if ($comcount) {
$result .= '<div' . ' class="wppa-thumb-text"' . ' style="' . __wcs('wppa-thumb-text') . '"' . ' >' . sprintf(_n('%d comment', '%d comments', $comcount, 'wp-photo-album-plus'), $comcount) . '</div>';
}
}
// Viewcount
if (wppa_switch('thumb_text_viewcount')) {
$result .= '<div' . ' class="wppa-thumb-text"' . ' style="clear:both;' . __wcs('wppa-thumb-text') . '"' . ' >' . sprintf(_n('%d view', '%d views', $thumb['views'], 'wp-photo-album-plus'), $thumb['views']) . '</div>';
}
// Close the subtext container
$result .= '</div>';
}
// if ! $com_alt
// Close the thumbframe
$result .= '</div>';
if ($com_alt) {
$result .= '</div>';
}
return $result;
}
示例5: wppa_insert_photo
function wppa_insert_photo($file = '', $alb = '', $name = '', $desc = '', $porder = '0', $id = '0', $linkurl = '', $linktitle = '')
{
global $wpdb;
global $warning_given_small;
$album = wppa_cache_album($alb);
if (!wppa_allow_uploads($alb)) {
if (is_admin() && !wppa('ajax')) {
wppa_error_message(sprintf(__('Album %s is full', 'wp-photo-album-plus'), wppa_get_album_name($alb)));
} else {
wppa_alert(sprintf(__('Album %s is full', 'wp-photo-album-plus'), wppa_get_album_name($alb)));
}
return false;
}
if ($file != '' && $alb != '') {
// Get the name if not given
if ($name == '') {
$name = basename($file);
}
// Sanitize name
$filename = wppa_sanitize_file_name($name);
$name = wppa_sanitize_photo_name($name);
// If not dups allowed and its already here, quit
if (isset($_POST['wppa-nodups']) || wppa_switch('void_dups')) {
$exists = wppa_file_is_in_album($filename, $alb);
if ($exists) {
if (isset($_POST['del-after-p'])) {
unlink($file);
$msg = __('Photo %s already exists in album number %s. Removed from depot.', 'wp-photo-album-plus');
} else {
$msg = __('Photo %s already exists in album number %s.', 'wp-photo-album-plus');
}
wppa_warning_message(sprintf($msg, $name, $alb));
return false;
}
}
// Verify file exists
if (!wppa('is_remote') && !file_exists($file)) {
if (!is_dir(dirname($file))) {
wppa_error_message('Error: Directory ' . dirname($file) . ' does not exist.');
return false;
}
if (!is_writable(dirname($file))) {
wppa_error_message('Error: Directory ' . dirname($file) . ' is not writable.');
return false;
}
wppa_error_message('Error: File ' . $file . ' does not exist.');
return false;
}
// else {
// wppa_ok_message( 'Good: File '.$file.' exists.' );
// }
// Get and verify the size
$img_size = getimagesize($file);
if ($img_size) {
if (wppa_check_memory_limit('', $img_size['0'], $img_size['1']) === false) {
wppa_error_message(sprintf(__('ERROR: Attempt to upload a photo that is too large to process (%s).', 'wp-photo-album-plus'), $name) . wppa_check_memory_limit());
wppa('ajax_import_files_error', __('Too big', 'wp-photo-album-plus'));
return false;
}
if (!$warning_given_small && ($img_size['0'] < wppa_get_minisize() && $img_size['1'] < wppa_get_minisize())) {
wppa_warning_message(__('WARNING: You are uploading photos that are too small. Photos must be larger than the thumbnail size and larger than the coverphotosize.', 'wp-photo-album-plus'));
wppa('ajax_import_files_error', __('Too small', 'wp-photo-album-plus'));
$warning_given_small = true;
}
} else {
wppa_error_message(__('ERROR: Unable to retrieve image size of', 'wp-photo-album-plus') . ' ' . $name . ' ' . __('Are you sure it is a photo?', 'wp-photo-album-plus'));
wppa('ajax_import_files_error', __('No imagesize', 'wp-photo-album-plus'));
return false;
}
// Get ext based on mimetype, regardless of ext
switch ($img_size[2]) {
// mime type
case 1:
$ext = 'gif';
break;
case 2:
$ext = 'jpg';
break;
case 3:
$ext = 'png';
break;
default:
wppa_error_message(__('Unsupported mime type encountered:', 'wp-photo-album-plus') . ' ' . $img_size[2] . '.');
return false;
}
// Get an id if not yet there
if ($id == '0') {
$id = wppa_nextkey(WPPA_PHOTOS);
}
// Get opt deflt desc if empty
if ($desc == '' && wppa_switch('apply_newphoto_desc')) {
$desc = stripslashes(wppa_opt('newphoto_description'));
}
// Reset rating
$mrat = '0';
// Find ( new ) owner
$owner = wppa_get_user();
// Validate album
if (!is_numeric($alb) || $alb < '1') {
wppa_error_message(__('Album not known while trying to add a photo', 'wp-photo-album-plus'));
//.........这里部分代码省略.........
示例6: wppa_verify_treecounts
function wppa_verify_treecounts($alb, $key, $count)
{
$treecounts = wppa_treecount_a($alb);
$need_a = false;
$need_p = false;
// Number of albums ( $count ) equal to subalbums ( 'selfalbums' ) ?
if ('albums' == $key) {
if ($treecounts['selfalbums'] != $count) {
// Faulty data
$need_a = true;
}
}
// Number of photos ( $count ) equal to photos in this album ( 'selfphotos' ( + opts ) )?
if ('photos' == $key) {
if (current_user_can('wppa_moderate')) {
if ($treecounts['selfphotos'] + $treecounts['pendphotos'] + $treecounts['scheduledphotos'] != $count) {
// Faulty data
$need_p = true;
}
} else {
if ($treecounts['selfphotos'] != $count) {
// Faulty data
$need_p = true;
}
}
}
// If no sub-albums, total number of photos should be equal to photos in this album ( 'selfphotos' )
if (!$treecounts['selfalbums'] && $treecounts['photos'] != $treecounts['selfphotos']) {
$need_p = true;
}
// Need recalc for reason albums fault?
if ($need_a) {
wppa_flush_treecounts($alb);
wppa_log('Fix', 'Treecounts albums for album #' . $alb . ' (' . wppa_get_album_name($alb) . ')');
}
// Need recalc for reason photos fault?
if ($need_p) {
wppa_flush_treecounts($albumid);
wppa_log('Fix', 'Treecounts photos for album #' . $alb . ' (' . wppa_get_album_name($alb) . ')');
}
}
示例7: wppa_do_frontend_file_upload
//.........这里部分代码省略.........
case 2:
$ext = 'jpg';
break;
case 3:
$ext = 'png';
break;
}
if (wppa_get_post('user-name')) {
$name = wppa_get_post('user-name');
} else {
$name = $file['name'];
}
$name = wppa_sanitize_photo_name($name);
$desc = balanceTags(wppa_get_post('user-desc'), true);
$linktarget = '_self';
$status = wppa_switch('upload_moderate') && !current_user_can('wppa_admin') ? 'pending' : 'publish';
$filename = wppa_sanitize_file_name($file['name']);
$id = wppa_create_photo_entry(array('album' => $alb, 'ext' => $ext, 'name' => $name, 'description' => $desc, 'status' => $status, 'filename' => $filename));
if (!$id) {
wppa_alert(__('Could not insert photo into db.', 'wp-photo-album-plus'));
return false;
} else {
wppa_save_source($file['tmp_name'], $filename, $alb);
wppa_update_album(array('id' => $alb, 'modified' => time()));
wppa_flush_treecounts($alb);
wppa_flush_upldr_cache('photoid', $id);
}
if (wppa_make_the_photo_files($file['tmp_name'], $id, $ext)) {
// Repair photoname if not standard
if (!wppa_get_post('user-name')) {
wppa_set_default_name($id, $file['name']);
}
// Custom data
if (wppa_switch('fe_custom_fields')) {
$custom_data = array('', '', '', '', '', '', '', '', '', '');
for ($i = '0'; $i < '10'; $i++) {
if (isset($_POST['wppa-user-custom-' . $i])) {
$custom_data[$i] = strip_tags($_POST['wppa-user-custom-' . $i]);
}
}
wppa_update_photo(array('id' => $id, 'custom' => serialize($custom_data)));
}
// Default tags
wppa_set_default_tags($id);
// Custom tags
$tags = wppa_get_photo_item($id, 'tags');
$oldt = $tags;
for ($i = '1'; $i < '4'; $i++) {
if (isset($_POST['wppa-user-tags-' . $i])) {
// Existing tags
$tags .= ',' . implode(',', $_POST['wppa-user-tags-' . $i]);
}
}
if (isset($_POST['wppa-new-tags'])) {
// New tags
$newt = $_POST['wppa-new-tags'];
$tags .= ',' . $newt;
} else {
$newt = '';
}
$tags = wppa_sanitize_tags(str_replace(array('\'', '"'), ',', wppa_filter_iptc(wppa_filter_exif($tags, $id), $id)));
if ($tags != $oldt) {
// Added tag(s)
wppa_update_photo(array('id' => $id, 'tags' => $tags));
}
// Index
wppa_index_add('photo', $id);
// Tags
if ($tags) {
wppa_clear_taglist();
// Forces recreation
}
// and add watermark ( optionally ) to fullsize image only
wppa_add_watermark($id);
// Also to thumbnail?
if (wppa_switch('watermark_thumbs')) {
wppa_create_thumbnail($id);
// create new thumb
}
// Is it a default coverimage?
wppa_check_coverimage($id);
// Mail
if (wppa_switch('upload_notify')) {
$to = get_bloginfo('admin_email');
$subj = sprintf(__('New photo uploaded: %s', 'wp-photo-album-plus'), $name);
$cont['0'] = sprintf(__('User %1$s uploaded photo %2$s into album %3$s', 'wp-photo-album-plus'), wppa_get_user(), $id, wppa_get_album_name($alb));
if (wppa_switch('upload_moderate') && !current_user_can('wppa_admin')) {
$cont['1'] = __('This upload requires moderation', 'wp-photo-album-plus');
$cont['2'] = '<a href="' . get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=pmod&photo=' . $id . '" >' . __('Moderate manage photo', 'wp-photo-album-plus') . '</a>';
} else {
$cont['1'] = __('Details:', 'wp-photo-album-plus');
$cont['1'] .= ' <a href="' . get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=pmod&photo=' . $id . '" >' . __('Manage photo', 'wp-photo-album-plus') . '</a>';
}
wppa_send_mail($to, $subj, $cont, $id);
}
return true;
} else {
return false;
}
}
示例8: wppa_write_photo_file
function wppa_write_photo_file($photo)
{
global $wppa_zip;
global $wppa_temp;
global $wppa_temp_idx;
if ($photo) {
$fname = WPPA_DEPOT_PATH . '/' . $photo['id'] . '.pmf';
$file = fopen($fname, 'wb');
$err = false;
if ($file) {
if (fwrite($file, "name=" . $photo['name'] . "\n") !== FALSE) {
if (fwrite($file, "desc=" . wppa_nl_to_txt($photo['description']) . "\n") !== FALSE) {
if (fwrite($file, "pord=" . $photo['p_order'] . "\n") !== FALSE) {
if (fwrite($file, "albm=" . wppa_get_album_name($photo['album'], 'raw') . "\n") !== FALSE) {
if (fwrite($file, "lnku=" . $photo['linkurl'] . "\n") !== FALSE) {
if (fwrite($file, "lnkt=" . $photo['linktitle'] . "\n") !== FALSE) {
/*
ext tinytext NOT NULL,
mean_rating tinytext NOT NULL,
linktarget tinytext NOT NULL,
owner text NOT NULL,
timestamp tinytext NOT NULL,
status tinytext NOT NULL,
rating_count bigint(20) NOT NULL default '0',
tags tinytext NOT NULL,
alt tinytext NOT NULL,
filename tinytext NOT NULL,
modified tinytext NOT NULL,
location tinytext NOT NULL,
*/
} else {
$err = true;
}
} else {
$err = true;
}
} else {
$err = true;
}
} else {
$err = true;
}
} else {
$err = true;
}
} else {
$err = true;
}
if ($err) {
wppa_error_message(sprintf(__('Cannot write to file %s.', 'wp-photo-album-plus'), $fname));
fclose($file);
return false;
} else {
fclose($file);
if ($wppa_zip) {
$wppa_zip->addFile($fname, basename($fname));
}
$wppa_temp[$wppa_temp_idx] = $fname;
$wppa_temp_idx++;
}
} else {
wppa_error_message(__('Could not open photo output file.', 'wp-photo-album-plus'));
return false;
}
} else {
wppa_error_message(__('Could not read photo data.', 'wp-photo-album-plus'));
return false;
}
return true;
}
示例9: wppa_album_photos_bulk
//.........这里部分代码省略.........
wp_die('Missing required arg in bulk change owner');
}
} else {
wp_die('Security check failure 4');
}
break;
default:
wppa_error_message('Unimplemented bulk action requested in wppa_album_photos_bulk().');
break;
}
if (!$skip) {
$count++;
}
if (wppa_is_time_up()) {
wppa_error_message(sprintf(__('Time is out after processing %d out of %d items.', 'wp-photo-album-plus'), $count, $totcount));
$abort = true;
}
if ($abort) {
break;
}
}
} else {
wppa_error_message('Unexpected error #2 in wppa_album_photos_bulk().');
}
} else {
wppa_error_message('Unexpected error #1 in wppa_album_photos_bulk().');
}
if ($count && !$abort) {
switch ($_POST['wppa-bulk-action']) {
case 'wppa-bulk-delete':
$message = sprintf(__('%d photos deleted.', 'wp-photo-album-plus'), $count);
break;
case 'wppa-bulk-move-to':
$message = sprintf(__('%1$s photos moved to album %2$s.', 'wp-photo-album-plus'), $count, $newalb . ': ' . wppa_get_album_name($newalb));
break;
case 'wppa-bulk-copy-to':
$message = sprintf(__('%1$s photos copied to album %2$s.', 'wp-photo-album-plus'), $count, $newalb . ': ' . wppa_get_album_name($newalb));
break;
case 'wppa-bulk-status':
$message = sprintf(__('Changed status to %1$s on %2$s photos.', 'wp-photo-album-plus'), $status, $count);
break;
case 'wppa-bulk-owner':
$message = sprintf(__('Changed owner to %1$s on %2$s photos.', 'wp-photo-album-plus'), $owner, $count);
break;
default:
$message = sprintf(__('%d photos processed.', 'wp-photo-album-plus'), $count);
break;
}
wppa_ok_message($message);
}
}
$pagesize = wppa_opt('photo_admin_pagesize');
$page = isset($_GET['wppa-page']) ? $_GET['wppa-page'] : '1';
$skip = ($page - '1') * $pagesize;
$limit = $pagesize < '1' ? '' : ' LIMIT ' . $skip . ',' . $pagesize;
if ($album) {
if ($album == 'search') {
$count = wppa_get_edit_search_photos('', 'count_only');
$photos = wppa_get_edit_search_photos($limit);
$link = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=edit&edit_id=' . $album . '&wppa-searchstring=' . wppa_sanitize_searchstring($_REQUEST['wppa-searchstring']) . '&bulk');
wppa_show_search_statistics();
} else {
$counts = wppa_treecount_a($album);
$count = $counts['selfphotos'] + $counts['pendphotos'];
//$wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM `'.WPPA_PHOTOS.'` WHERE `album` = %s', $album ) );
$photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `album` = %s ' . wppa_get_photo_order($album, 'norandom') . $limit, $album), ARRAY_A);
示例10: wppa_the_album_title
function wppa_the_album_title($alb, $href_title, $onclick_title, $title, $target)
{
global $wppa;
$album = wppa_cache_album($alb);
$wppa['out'] .= wppa_nltab('+') . '<h2 class="wppa-title" style="clear:none; ' . __wcs('wppa-title') . '">';
if ($href_title) {
if ($href_title == '#') {
$wppa['out'] .= wppa_nltab() . '<a onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="cursor:pointer; ' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>';
} else {
$wppa['out'] .= wppa_nltab() . '<a href="' . $href_title . '" target="' . $target . '" onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>';
}
} else {
$wppa['out'] .= wppa_get_album_name($alb);
}
if (wppa_is_album_new($alb)) {
$wppa['out'] .= wppa_nltab() . '<img src="' . WPPA_URL . '/images/new.png" title="' . __a('New!') . '" class="wppa-albumnew" style="border:none; margin:0; padding:0; box-shadow:none; " alt="' . __a('New') . '" />';
}
$wppa['out'] .= wppa_nltab('-') . '</h2>';
}
示例11: wppa_do_albumlist
//.........这里部分代码省略.........
echo $album['id'];
?>
</td>
<?php
$i = $indent;
while ($i < 5) {
echo '<td style="padding:2px;" ></td>';
$i++;
}
?>
<td><?php
echo esc_attr(__(stripslashes($album['name'])));
?>
</td>
<td><small><?php
echo esc_attr(__(stripslashes($album['description'])));
?>
</small></td>
<?php
if (current_user_can('administrator')) {
?>
<td><?php
echo $album['owner'];
?>
</td>
<?php
}
?>
<td><?php
echo $album['a_order'];
?>
</td>
<td><?php
echo wppa_get_album_name($album['a_parent'], 'extended');
?>
</td>
<?php
$url = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=edit&edit_id=' . $album['id']);
?>
<?php
$na = $counts['selfalbums'];
?>
<?php
$np = $counts['selfphotos'];
?>
<?php
$nm = $counts['pendphotos'];
?>
<?php
$ns = $counts['scheduledphotos'];
?>
<td><?php
echo $na . '/' . $np . '/' . $nm . '/' . $ns;
?>
</td>
<?php
if ($album['owner'] != '--- public ---' || wppa_user_is('administrator')) {
?>
<?php
$url = wppa_ea_url($album['id']);
?>
<td><a href="<?php
echo $url;
?>
" class="wppaedit"><?php
_e('Edit', 'wp-photo-album-plus');
示例12: 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>' . '</div>' . '<div style="float:right; width:25%;" >' . '<span style=""> ' . __('Id:', 'wp-photo-album-plus') . ' ' . $album['id'] . '</span>' . '<span style=""> - ' . __('Ord:', 'wp-photo-album-plus') . '</span>' . '<span id="wppa-album-seqno-' . $album['id'] . '" > ' . $album['a_order'] . '</span>' . '<br />' . '<a href="' . wppa_ea_url($album['id']) . '" style="position:absolute;bottom:0;" >' . __('Edit', 'wp-photo-album-plus') . '</a>' . '</div>' . '<input type="hidden" id="album-nonce-' . $album['id'] . '" value="' . wp_create_nonce('wppa_nonce_' . $album['id']) . '" />' . '<input type="hidden" class="wppa-sort-item-albums" value="' . $album['id'] . '" />' . '<input type="hidden" class="wppa-sort-seqn-albums" id="wppa-sort-seqn-albums-' . $album['id'] . '" value="' . $album['a_order'] . '" />' . '</div>';
}
?>
</div>
<div style="clear:both;"></div>
</div>
<?php
}
示例13: wppa_album_sequence
//.........这里部分代码省略.........
}
echo '<h2>' . __('Manage album order', 'wp-photo-album-plus') . ' - ' . '<small><i>' . __('Change sequence order by drag and drop', 'wp-photo-album-plus') . '</i></small>' . '</h2>';
?>
<style>
.sortable-placeholder-albums {
width: 100%;
height: 60px;
margin: 5px;
border: 1px dotted #cccccc;
border-radius:3px;
float: left;
}
.ui-state-default-albums {
position: relative;
width: 100%;
height: 60px;
margin: 5px;
border: 1px solid #cccccc;
border-radius:3px;
float: left;
}
</style>
<script>
jQuery( function() {
jQuery( "#sortable-albums" ).sortable( {
cursor: "move",
placeholder: "sortable-placeholder-albums",
stop: function( event, ui ) {
var ids = jQuery( ".wppa-sort-item-albums" );
var seq = jQuery( ".wppa-sort-seqn-albums" );
var idx = 0;
var descend = <?php
if ($is_descending) {
echo 'true';
} else {
echo 'false';
}
?>
;
while ( idx < ids.length ) {
var newvalue;
if ( descend ) newvalue = ids.length - idx;
else newvalue = idx + 1;
var oldvalue = seq[idx].value;
var album = ids[idx].value;
if ( newvalue != oldvalue ) {
wppaDoSeqUpdateAlbum( album, newvalue );
}
idx++;
}
}
} );
} );
function wppaDoSeqUpdateAlbum( album, seqno ) {
var data = 'action=wppa' +
'&wppa-action=update-album' +
'&album-id=' + album +
'&item=a_order' +
'&wppa-nonce=' + document.getElementById( 'album-nonce-' + album ).value +
'&value=' + seqno;
var xmlhttp = new XMLHttpRequest();
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
jQuery( '#wppa-album-seqno-' + album ).html( seqno );
break;
default: // Any error
jQuery( '#wppa-album-seqno-' + album ).html( '<span style="color"red" >Err:' + ArrValues[1] + '</span>' );
break;
}
}
}
xmlhttp.open( 'POST',wppaAjaxUrl,true );
xmlhttp.setRequestHeader( "Content-type","application/x-www-form-urlencoded" );
xmlhttp.send( data );
jQuery( "#wppa-sort-seqn-albums-" + album ).attr( 'value', seqno ); // set hidden value to new value to prevent duplicate action
var spinnerhtml = '<img src="' + wppaImageDirectory + 'wpspin.gif' + '" />';
jQuery( '#wppa-album-seqno-' + album ).html( spinnerhtml );
}
</script>
<div class="widefat" style="max-width:500px;" >
<div id="sortable-albums">
<?php
foreach ($albums as $album) {
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;" >' . '<img' . ' class="wppa-cover-image"' . ' src="' . wppa_fix_poster_ext(wppa_get_thumb_url(wppa_get_coverphoto_id($album['id'])), wppa_get_coverphoto_id($album['id'])) . '"' . ' style="max-height:50px; margin: 5px;"' . ' />' . '</div>' . '<div style="height:100%;width:50%;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:25%;" >' . '<span style=""> ' . __('Id:', 'wp-photo-album-plus') . ' ' . $album['id'] . '</span>' . '<span style=""> - ' . __('Ord:', 'wp-photo-album-plus') . '</span>' . '<span id="wppa-album-seqno-' . $album['id'] . '" > ' . $album['a_order'] . '</span>' . '<br />' . '<a href="' . wppa_ea_url($album['id']) . '" style="position:absolute;bottom:0;" >' . __('Edit', 'wp-photo-album-plus') . '</a>' . '</div>' . '<input type="hidden" id="album-nonce-' . $album['id'] . '" value="' . wp_create_nonce('wppa_nonce_' . $album['id']) . '" />' . '<input type="hidden" class="wppa-sort-item-albums" value="' . $album['id'] . '" />' . '<input type="hidden" class="wppa-sort-seqn-albums" id="wppa-sort-seqn-albums-' . $album['id'] . '" value="' . $album['a_order'] . '" />' . '</div>';
}
?>
</div>
<div style="clear:both;"></div>
</div>
<?php
}
示例14: 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;
}
示例15: wppa_subalbumlinks_html
function wppa_subalbumlinks_html($id, $top = true)
{
global $wpdb;
// Do they need us? Anything to display?
if (wppa_opt('cover_sublinks_display') == 'none') {
return;
}
// Display type
$display_type = wppa_opt('cover_sublinks_display');
// Link type
$link_type = wppa_opt('cover_sublinks');
// Init
$is_list = $display_type == 'list' || $display_type == 'recursivelist';
$is_recursive = $display_type == 'recursivelist';
$first = true;
// Get the children
$subs = $wpdb->get_results("SELECT * FROM `" . WPPA_ALBUMS . "` WHERE `a_parent` = " . $id . " " . wppa_get_album_order($id), ARRAY_A);
// Only if there are sub-albums
if (!empty($subs)) {
wppa_out('<div>');
// Local css
if ($top) {
if ($is_list) {
wppa_out('<style scoped="scoped" >' . 'ul, li { margin:0; }' . 'ul {' . 'list-style-type:disc;' . 'list-style-position:inside;' . 'padding:0 0 0 24px;' . '}' . 'li { cursor:pointer; }' . '</style>');
}
if ($display_type == 'microthumbs') {
wppa_out('<style scoped="scoped" >' . 'img {' . 'max-width:100px;' . 'max-height:50px;' . 'padding:1px;' . 'margin:1px;' . 'background-color:' . wppa_opt('bgcolor_img') . ';' . 'float:left;' . '}' . '</style>');
}
}
// Start list if required
if ($is_list) {
wppa_out('<ul class="wppa-cover-sublink-list" style="clear:both;" >');
} else {
wppa_out('<div style="clear:both;" ></div>');
}
// Process the sub-albums
foreach ($subs as $album) {
// 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 content 'View' link
$albumid = $album['id'];
$photocount = wppa_get_photo_count($albumid, 'use_treecounts');
// Thumbnails and covers, show sub-album covers
// in case slideshow is requested on an empty album
if (wppa_opt('cover_sublinks') == 'content' || !$photocount) {
if (wppa_switch('allow_ajax') && !$linkpage) {
$href_content = '';
$onclick_content = "wppaDoAjaxRender( " . wppa('mocc') . ", '" . wppa_get_album_url_ajax($albumid, $linkpage) . "', '" . wppa_convert_to_pretty($href_content) . "' )";
} else {
$href_content = wppa_convert_to_pretty(wppa_get_album_url($albumid, $linkpage));
$onclick_content = '';
}
} else {
if (wppa_switch('allow_ajax') && !$linkpage) {
$href_content = '';
$onclick_content = "wppaDoAjaxRender( " . wppa('mocc') . ", '" . wppa_get_slideshow_url_ajax($albumid, $linkpage) . "', '" . wppa_convert_to_pretty($href_content) . "' )";
} else {
$href_content = wppa_convert_to_pretty(wppa_get_slideshow_url($albumid, $linkpage));
$onclick_content = '';
}
}
// Do the output
$title = esc_attr(__('View the album', 'wp-photo-album-plus') . ': ' . wppa_get_album_name($album['id']));
switch ($display_type) {
case 'list':
case 'recursivelist':
if ($link_type == 'none') {
wppa_out('<li>' . wppa_get_album_name($album['id']) . '</li>');
} else {
wppa_out('<li>' . '<a' . ($href_content ? ' href="' . $href_content . '"' : '') . ($onclick_content ? ' onclick="' . $onclick_content . '"' : '') . ' title="' . $title . '"' . ' >' . wppa_get_album_name($album['id']) . '</a>' . '</li>');
}
break;
case 'enum':
if (!$first) {
wppa_out(', ');
}
if ($link_type == 'none') {
wppa_out(wppa_get_album_name($album['id']));
} else {
wppa_out('<a' . ($href_content ? ' href="' . $href_content . '"' : '') . ($onclick_content ? ' onclick="' . $onclick_content . '"' : '') . ' title="' . $title . '"' . ' >' . wppa_get_album_name($album['id']) . '</a>');
}
$first = false;
break;
case 'microthumbs':
$coverphoto_id = wppa_get_coverphoto_id($album['id']);
$src = wppa_fix_poster_ext(wppa_get_thumb_url($coverphoto_id), $coverphoto_id);
if ($link_type == 'none') {
wppa_out('<img' . ' class="wppa-cover-sublink-img"' . ' src="' . $src . '"' . ' alt="' . wppa_get_album_name($album['id']) . '"' . ' />');
} else {
wppa_out('<a' . ($href_content ? ' href="' . $href_content . '"' : '') . ($onclick_content ? ' onclick="' . $onclick_content . '"' : '') . ' title="' . $title . '"' . ' >' . '<img' . ' class="wppa-cover-sublink-img"' . ' src="' . $src . '"' . ' alt="' . wppa_get_album_name($album['id']) . '"' . ' />' . '</a>');
//.........这里部分代码省略.........