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 $desc = balanceTags($desc, true); // Balance tags $desc = wppa_filter_iptc($desc, $id); // Render IPTC tags $desc = wppa_filter_exif($desc, $id); // Render EXIF tags $desc = make_clickable($desc); // Auto make a tags for links $desc = convert_smilies($desc); // Make smilies visible // CMTooltipGlossary on board? $desc = wppa_filter_glossary($desc); return $desc; }
function wppa_album_photos($album = '', $photo = '', $owner = '', $moderate = false) { global $wpdb; // Check input wppa_vfy_arg('wppa-page'); $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; // Edit the photos in a specific album if ($album) { // Special album case: search (see last album line in album table) 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'])); } else { $counts = wppa_treecount_a($album); $count = $counts['selfphotos'] + $counts['pendphotos']; $photos = $wpdb->get_results($wpdb->prepare("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `album` = %s " . wppa_get_photo_order($album, 'norandom') . $limit, $album), ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php' . '?page=wppa_admin_menu' . '&tab=edit' . '&edit_id=' . $album); } } elseif ($photo && !$moderate) { $count = '1'; $photos = $wpdb->get_results($wpdb->prepare("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `id` = %s", $photo), ARRAY_A); $link = ''; } elseif ($owner) { $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `owner` = %s", $owner)); $photos = $wpdb->get_results($wpdb->prepare("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `owner` = %s " . "ORDER BY `timestamp` DESC " . $limit, $owner), ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php' . '?page=wppa_edit_photo'); } elseif ($moderate) { // Can i moderate? if (!current_user_can('wppa_moderate')) { wp_die(__('You do not have the rights to do this', 'wp-photo-album-plus')); } // Moderate a single photo if ($photo) { $count = '1'; $photos = $wpdb->get_results($wpdb->prepare("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `id` = %s", $photo), ARRAY_A); $link = ''; } else { $cmt = $wpdb->get_results("SELECT `photo` " . "FROM `" . WPPA_COMMENTS . "` " . "WHERE `status` = 'pending' " . "OR `status` = 'spam'", ARRAY_A); if ($cmt) { $orphotois = ''; foreach ($cmt as $c) { $orphotois .= "OR `id` = " . $c['photo'] . " "; } } else { $orphotois = ''; } $count = $wpdb->get_var("SELECT COUNT(*) " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `status` = 'pending' " . $orphotois); $photos = $wpdb->get_results("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `status` = 'pending' " . $orphotois . " " . "ORDER BY `timestamp` DESC " . $limit, ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php' . '?page=wppa_moderate_photos'); } // No photos to moderate if (empty($photos)) { // Single photo moderate requested if ($photo) { echo '<p>' . __('This photo is no longer awaiting moderation.', 'wp-photo-album-plus') . '</p>'; } else { echo '<p>' . __('There are no photos awaiting moderation at this time.', 'wp-photo-album-plus') . '</p>'; } // If i am admin, i can edit all photos here, sorted by timestamp desc if (wppa_user_is('administrator')) { echo '<h3>' . __('Manage all photos by timestamp', 'wp-photo-album-plus') . '</h3>'; $count = $wpdb->get_var("SELECT COUNT(*) " . "FROM `" . WPPA_PHOTOS . "`"); $photos = $wpdb->get_results("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "ORDER BY `timestamp` DESC" . $limit, ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php' . '?page=wppa_moderate_photos'); } else { return; } } } else { wppa_dbg_msg('Missing required argument in wppa_album_photos() 1', 'red', 'force'); return; } // Quick edit skips a few time consuming settings like copy and move to other album $quick = isset($_REQUEST['quick']); if ($link && $quick) { $link .= '&quick'; } // In case it is a seaerch and edit, show the search statistics wppa_show_search_statistics(); // If no photos selected produce apprpriate message and quit if (empty($photos)) { // A specific photo requested if ($photo) { echo '<div id="photoitem-' . $photo . '" class="photoitem" style="width:100%; background-color: rgb( 255, 255, 224 ); border-color: rgb( 230, 219, 85 );">' . '<span style="color:red">' . sprintf(__('Photo %s has been removed.', 'wp-photo-album-plus'), $photo) . '</span>' . '</div>'; } else { // Search if (isset($_REQUEST['wppa-searchstring'])) { echo '<h3>' . __('No photos matching your search criteria.', 'wp-photo-album-plus') . '</h3>'; } else { echo '<h3>' . __('No photos yet in this album.', 'wp-photo-album-plus') . '</h3>'; } } return; } else { // Local js functions placed here as long as there is not yet a possibility to translate texts in js files ?> <script> function wppaTryMove( id, video ) { var query; if ( ! jQuery( '#target-' + id ).val() ) { alert( '<?php echo esc_js(__('Please select an album to move to first.', 'wp-photo-album-plus')); ?> ' ); return false; } if ( video ) { query = '<?php echo esc_js(__('Are you sure you want to move this video?', 'wp-photo-album-plus')); ?> '; } else { query = '<?php echo esc_js(__('Are you sure you want to move this photo?', 'wp-photo-album-plus')); ?> '; } if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'moveto', document.getElementById( 'target-' + id ) ); } } function wppaTryCopy( id, video ) { var query; if ( ! jQuery( '#target-' + id ).val() ) { alert( '<?php echo esc_js(__('Please select an album to copy to first.', 'wp-photo-album-plus')); ?> ' ); return false; } if ( video ) { query = '<?php echo esc_js(__('Are you sure you want to copy this video?', 'wp-photo-album-plus')); ?> '; } else { query = '<?php echo esc_js(__('Are you sure you want to copy this photo?', 'wp-photo-album-plus')); ?> '; } if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'copyto', document.getElementById( 'target-' + id ) ); } } function wppaTryDelete( id, video ) { var query; if ( video ) { query = '<?php echo esc_js(__('Are you sure you want to delete this video?', 'wp-photo-album-plus')); ?> '; } else { query = '<?php echo esc_js(__('Are you sure you want to delete this photo?', 'wp-photo-album-plus')); ?> '; } if ( confirm( query ) ) { wppaAjaxDeletePhoto( id ) } } function wppaTryRotLeft( id ) { var query = '<?php echo esc_js(__('Are you sure you want to rotate this photo left?', 'wp-photo-album-plus')); ?> '; if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'rotleft', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); } } function wppaTryRot180( id ) { var query = '<?php echo esc_js(__('Are you sure you want to rotate this photo 180°?', 'wp-photo-album-plus')); ?> '; if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'rot180', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); } } function wppaTryRotRight( id ) { var query = '<?php echo esc_js(__('Are you sure you want to rotate this photo right?', 'wp-photo-album-plus')); ?> '; if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'rotright', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); } } function wppaTryFlip( id ) { var query = '<?php echo esc_js(__('Are you sure you want to flip this photo?', 'wp-photo-album-plus')); ?> '; if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'flip', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); } } function wppaTryWatermark( id ) { var wmFile = jQuery( '#wmfsel_' + id ).val(); if ( wmFile == '--- none ---' ) { alert( '<?php echo esc_js(__('No watermark selected', 'wp-photo-album-plus')); ?> ' ); return; } var query = '<?php echo esc_js(__('Are you sure? Once applied it can not be removed!', 'wp-photo-album-plus')); ?> '; query += '\n'; query += '<?php echo esc_js(__('And I do not know if there is already a watermark on this photo', 'wp-photo-album-plus')); ?> '; if ( confirm( query ) ) { wppaAjaxApplyWatermark( id, document.getElementById( 'wmfsel_' + id ).value, document.getElementById( 'wmpsel_' + id ).value ); } } </script> <?php // Get the current watermark file settings $wms = array('toplft' => __('top - left', 'wp-photo-album-plus'), 'topcen' => __('top - center', 'wp-photo-album-plus'), 'toprht' => __('top - right', 'wp-photo-album-plus'), 'cenlft' => __('center - left', 'wp-photo-album-plus'), 'cencen' => __('center - center', 'wp-photo-album-plus'), 'cenrht' => __('center - right', 'wp-photo-album-plus'), 'botlft' => __('bottom - left', 'wp-photo-album-plus'), 'botcen' => __('bottom - center', 'wp-photo-album-plus'), 'botrht' => __('bottom - right', 'wp-photo-album-plus')); $temp = wppa_get_water_file_and_pos('0'); $wmfile = isset($temp['select']) ? $temp['select'] : ''; $wmpos = isset($temp['pos']) && isset($wms[$temp['pos']]) ? $wms[$temp['pos']] : ''; $mvt = esc_attr(__('Move video', 'wp-photo-album-plus')); $mpt = esc_attr(__('Move photo', 'wp-photo-album-plus')); $cvt = esc_attr(__('Copy video', 'wp-photo-album-plus')); $cpt = esc_attr(__('Copy photo', 'wp-photo-album-plus')); // Display the pagelinks wppa_admin_page_links($page, $pagesize, $count, $link); // Display all photos foreach ($photos as $photo) { // We may not use extract(), so we do something like it here manually, hence controlled. $id = $photo['id']; $timestamp = $photo['timestamp']; $modified = $photo['modified']; $owner = $photo['owner']; $crypt = $photo['crypt']; $album = $photo['album']; $name = stripslashes($photo['name']); $description = stripslashes($photo['description']); $exifdtm = $photo['exifdtm']; $views = $photo['views']; $clicks = $photo['clicks']; $p_order = $photo['p_order']; $linktarget = $photo['linktarget']; $linkurl = $photo['linkurl']; $linktitle = stripslashes($photo['linktitle']); $alt = stripslashes($photo['alt']); $filename = $photo['filename']; $videox = $photo['videox']; $videoy = $photo['videoy']; $location = $photo['location']; $status = $photo['status']; $tags = trim(stripslashes($photo['tags']), ','); $stereo = $photo['stereo']; // See if item is a multimedia item $is_multi = wppa_is_multi($id); $is_video = wppa_is_video($id); // returns array of extensions $b_is_video = empty($is_video) ? 0 : 1; // boolean $has_audio = wppa_has_audio($id); // returns array of extensions $b_has_audio = empty($has_audio) ? 0 : 1; // boolean // Various usefull vars $owner_editable = wppa_switch('photo_owner_change') && wppa_user_is('administrator'); $sortby_orderno = wppa_get_album_item($album, 'p_order_by') == '1' || wppa_get_album_item($album, 'p_order_by') == '-1'; echo "\n" . '<a id="photo_' . $id . '" ></a>'; echo '<div' . ' id="photoitem-' . $id . '"' . ' class="wppa-table-wrap"' . ' style="width:100%;position:relative;"' . ' >'; echo '<input' . ' type="hidden"' . ' id="photo-nonce-' . $id . '"' . ' value="' . wp_create_nonce('wppa_nonce_' . $id) . '"' . ' />'; echo "\n" . '<!-- Section 1 -->' . '<table' . ' class="wppa-table wppa-photo-table"' . ' style="width:100%;"' . ' >' . '<tbody>'; // -- Preview thumbnail --- echo '<tr>' . '<td>'; $src = wppa_get_thumb_url($id); $big = wppa_get_photo_url($id); if ($is_video) { reset($is_video); $big = str_replace('xxx', current($is_video), $big); echo '<a' . ' href="' . $big . '"' . ' target="_blank"' . ' title="' . esc_attr(__('Preview fullsize video', 'wp-photo-album-plus')) . '"' . ' >' . wppa_get_video_html(array('id' => $id, 'tagid' => 'video-' . $id, 'width' => '160', 'height' => '160' * wppa_get_videoy($id) / wppa_get_videox($id), 'controls' => false, 'use_thumb' => true)) . '</a>'; } else { if ($has_audio) { $big = wppa_fix_poster_ext($big, $id); $src = wppa_fix_poster_ext($src, $id); } echo '<a' . ' href="' . $big . '"' . ' target="_blank"' . ' title="' . esc_attr(__('Preview fullsize photo', 'wp-photo-album-plus')) . '"' . ' >' . '<img' . ' src="' . $src . '"' . ' alt="' . esc_attr($name) . '"' . ' style="max-width: 160px; vertical-align:middle;"' . ' />' . '</a>'; if ($has_audio) { $audio = wppa_get_audio_html(array('id' => $id, 'tagid' => 'audio-' . $id, 'width' => '160', 'controls' => true)); echo '<br />' . ($audio ? $audio : '<span style="color:red;">' . __('Audio disabled', 'wp-photo-album-plus') . '</span>'); } } echo '</td>'; echo '<td>' . 'ID = ' . $id . '. ' . __('Crypt:', 'wp-photo-album-plus') . ' ' . $crypt . '. ' . __('Filename:', 'wp-photo-album-plus') . ' ' . $filename . '. ' . __('Upload:', 'wp-photo-album-plus') . ' ' . wppa_local_date('', $timestamp) . ' ' . __('local time', 'wp-photo-album-plus') . '. ' . ($owner_editable ? '' : __('By:', 'wp-photo-album-plus') . ' ' . $owner); if ($owner_editable) { echo __('Owned by:', 'wp-photo-album-plus') . '<input' . ' type="text"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'owner\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'owner\', this )"' . ' value="' . $owner . '"' . ' />'; } echo ' ' . sprintf(__('Album: %d (%s).', 'wp-photo-album-plus'), $album, wppa_get_album_name($album)); // Modified if ($modified > $timestamp) { echo ' ' . __('Modified:', 'wp-photo-album-plus') . ' ' . wppa_local_date('', $modified) . ' ' . __('local time', 'wp-photo-album-plus'); } else { echo ' ' . __('Not modified', 'wp-photo-album-plus'); } echo '. ' . __('EXIF Date:', 'wp-photo-album-plus'); if (wppa_user_is('administrator')) { // Admin may edit exif date echo '<input' . ' type="text"' . ' style="width:125px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'exifdtm\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'exifdtm\', this )"' . ' value="' . $exifdtm . '"' . ' />'; } else { echo $exifdtm . '.'; } echo ' '; // Location if ($photo['location'] || wppa_switch('geo_edit')) { echo __('Location:', 'wp-photo-album-plus') . ' '; $loc = $location ? $location : '///'; $geo = explode('/', $loc); echo $geo['0'] . ' ' . $geo['1'] . '. '; if (wppa_switch('geo_edit')) { echo __('Lat:', 'wp-photo-album-plus') . '<input' . ' type="text"' . ' style="width:100px;"' . ' id="lat-' . $id . '"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'lat\', this );"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'lat\', this );"' . ' value="' . $geo['2'] . '"' . ' />' . __('Lon:', 'wp-photo-album-plus') . '<input type="text"' . ' style="width:100px;"' . ' id="lon-' . $id . '"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'lon\', this );"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'lon\', this );"' . ' value="' . $geo['3'] . '"' . ' />'; } } // Changeable p_order echo __('Photo sort order #:', 'wp-photo-album-plus'); if ($sortby_orderno && (!wppa_switch('porder_restricted') || wppa_user_is('administrator'))) { echo '<input' . ' type="text"' . ' id="porder-' . $id . '"' . ' value="' . $p_order . '"' . ' style="width:30px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'p_order\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'p_order\', this )"' . ' />' . ' '; } else { echo $p_order . '. '; } // Rating $entries = wppa_get_rating_count_by_id($id); if ($entries) { if (wppa_opt('rating_display_type') == 'likes') { echo __('Likes:', 'wp-photo-album-plus') . ' ' . $entries . '. '; } else { echo __('Rating:', 'wp-photo-album-plus') . ' ' . __('Entries:', 'wp-photo-album-plus') . ' ' . $entries . ', ' . __('Mean value:', 'wp-photo-album-plus') . ' ' . wppa_get_rating_by_id($id, 'nolabel') . '. '; } } else { echo __('No ratings for this photo.', 'wp-photo-album-plus') . ' '; } $dislikes = wppa_dislike_get($id); if ($dislikes) { echo '<span style="color:red" >' . sprintf(__('Disliked by %d visitors', 'wp-photo-album-plus'), $dislikes) . '. ' . '</span>'; } $pending = wppa_pendrat_get($id); if ($pending) { echo '<span style="color:orange" >' . sprintf(__('%d pending votes.', 'wp-photo-album-plus'), $pending) . ' ' . '</span>'; } // Views if (wppa_switch('track_viewcounts')) { echo __('Views', 'wp-photo-album-plus') . ': ' . $views . '. '; } // Clicks if (wppa_switch('track_clickcounts')) { echo __('Clicks', 'wp-photo-album-plus') . ': ' . $clicks . '. '; } // Status echo '<br />' . __('Status:', 'wp-photo-album-plus') . ' '; if (current_user_can('wppa_admin') || current_user_can('wppa_moderate')) { if (wppa_switch('ext_status_restricted') && !wppa_user_is('administrator')) { $dis = ' disabled="disabled"'; } else { $dis = ''; } $sel = ' selected="selected"'; echo '<select' . ' id="status-' . $id . '"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'status\', this ); wppaPhotoStatusChange( ' . $id . ' );"' . ' >' . '<option value="pending"' . ($status == 'pending' ? $sel : '') . ' >' . __('Pending', 'wp-photo-album-plus') . '</option>' . '<option value="publish"' . ($status == 'publish' ? $sel : '') . ' >' . __('Publish', 'wp-photo-album-plus') . '</option>' . '<option value="featured"' . ($status == 'featured' ? $sel : '') . $dis . ' >' . __('Featured', 'wp-photo-album-plus') . '</option>' . '<option value="gold"' . ($status == 'gold' ? $sel : '') . $dis . ' >' . __('Gold', 'wp-photo-album-plus') . '</option>' . '<option value="silver"' . ($status == 'silver' ? $sel : '') . $dis . ' >' . __('Silver', 'wp-photo-album-plus') . '</option>' . '<option value="bronze"' . ($status == 'bronze' ? $sel : '') . $dis . ' >' . __('Bronze', 'wp-photo-album-plus') . '</option>' . '<option value="scheduled"' . ($status == 'scheduled' ? $sel : '') . $dis . ' >' . __('Scheduled', 'wp-photo-album-plus') . '</option>' . '<option value="private"' . ($status == 'private' ? $sel : '') . $dis . ' >' . __('Private', 'wp-photo-album-plus') . '</option>' . '</select>' . wppa_get_date_time_select_html('photo', $id, true); } else { echo '<input' . ' type="hidden"' . ' id="status-' . $id . '"' . ' value="' . $status . '"' . ' />'; if ($status == 'pending') { _e('Pending', 'wp-photo-album-plus'); } elseif ($status == 'publish') { _e('Publish', 'wp-photo-album-plus'); } elseif ($status == 'featured') { _e('Featured', 'wp-photo-album-plus'); } elseif ($status == 'gold') { _e('Gold', 'wp-photo-album-plus'); } elseif ($status == 'silver') { _e('Silver', 'wp-photo-album-plus'); } elseif ($status == 'bronze') { _e('Bronze', 'wp-photo-album-plus'); } elseif ($status == 'scheduled') { _e('Scheduled', 'wp-photo-album-plus'); } elseif ($status == 'private') { _e('Private', 'wp-photo-album-plus'); } echo wppa_get_date_time_select_html('photo', $id, false) . '<span id="psdesc-' . $id . '" class="description" style="display:none;" >' . __('Note: Featured photos should have a descriptive name; a name a search engine will look for!', 'wp-photo-album-plus') . '</span>'; } echo ' '; // Update status field echo __('Remark:', 'wp-photo-album-plus') . ' ' . '<span' . ' id="photostatus-' . $id . '"' . ' style="font-weight:bold;color:#00AA00;"' . ' >' . ($is_video ? sprintf(__('Video %s is not modified yet', 'wp-photo-album-plus'), $id) : sprintf(__('Photo %s is not modified yet', 'wp-photo-album-plus'), $id)) . '</span>'; // New Line echo '<br />'; // --- Available files --- echo __('Available files:', 'wp-photo-album-plus') . ' '; // Source echo __('Source file:', 'wp-photo-album-plus') . ' '; $sp = wppa_get_source_path($id); if (is_file($sp)) { $ima = getimagesize($sp); echo $ima['0'] . ' x ' . $ima['1'] . ' px, ' . wppa_get_filesize($sp) . '. '; } else { echo __('Unavailable', 'wp-photo-album-plus') . '. '; } // Display echo ($is_video || $has_audio ? __('Poster file:', 'wp-photo-album-plus') : __('Display file:', 'wp-photo-album-plus')) . ' '; $dp = wppa_fix_poster_ext(wppa_get_photo_path($id), $id); if (is_file($dp)) { echo floor(wppa_get_photox($id)) . ' x ' . floor(wppa_get_photoy($id)) . ' px, ' . wppa_get_filesize($dp) . '. '; } else { echo '<span style="color:red;" >' . __('Unavailable', 'wp-photo-album-plus') . '. ' . '</span>'; } // Thumbnail if (!$is_video) { echo __('Thumbnail file:', 'wp-photo-album-plus') . ' '; $tp = wppa_fix_poster_ext(wppa_get_thumb_path($id), $id); if (is_file($tp)) { echo floor(wppa_get_thumbx($id)) . ' x ' . floor(wppa_get_thumby($id)) . ' px, ' . wppa_get_filesize($tp) . '. '; } else { echo '<span style="color:red;" >' . __('Unavailable', 'wp-photo-album-plus') . '. ' . '</span>'; } } // New line echo '<br />'; // Video if ($b_is_video) { echo __('Video size:', 'wp-photo-album-plus') . ' ' . __('Width:', 'wp-photo-album-plus') . '<input' . ' style="width:50px;margin:0 4px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'videox\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'videox\', this )"' . ' value="' . $videox . '"' . ' />' . sprintf(__('pix, (0=default:%s)', 'wp-photo-album-plus'), wppa_opt('video_width')) . __('Height:', 'wp-photo-album-plus') . '<input' . ' style="width:50px;margin:0 4px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'videoy\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'videoy\', this )"' . ' value="' . $videoy . '"' . ' />' . sprintf(__('pix, (0=default:%s)', 'wp-photo-album-plus'), wppa_opt('video_height')) . ' ' . __('Formats:', 'wp-photo-album-plus') . ' '; $c = 0; foreach ($is_video as $fmt) { echo $fmt . ' ' . __('Filesize:', 'wp-photo-album-plus') . ' ' . wppa_get_filesize(str_replace('xxx', $fmt, wppa_get_photo_path($id))); $c++; if ($c == count($is_video)) { echo '. '; } else { echo ', '; } } } // Audio if ($b_has_audio) { echo __('Formats:', 'wp-photo-album-plus') . ' '; $c = 0; foreach ($has_audio as $fmt) { echo $fmt . ' ' . __('Filesize:', 'wp-photo-album-plus') . ' ' . wppa_get_filesize(str_replace('xxx', $fmt, wppa_get_photo_path($id))); $c++; if ($c == count($is_video)) { echo '. '; } else { echo ', '; } } } echo '</td>' . '</tr>' . '</tbody>' . '</table>'; echo "\n" . '<!-- Section 2 -->'; if (wppa_switch('enable_stereo') && !$is_multi || (!$is_multi || is_file(wppa_fix_poster_ext(wppa_get_photo_path($id), $id)))) { echo '<table' . ' class="wppa-table wppa-photo-table"' . ' style="width:100%;"' . ' >' . '<tbody>' . '<tr>' . '<td>'; // Stereo if (wppa_switch('enable_stereo') && !$is_multi) { echo __('Stereophoto:', 'wp-photo-album-plus') . ' ' . '<select' . ' id="stereo-' . $id . '"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'stereo\', this )"' . ' >' . '<option value="0"' . ($stereo == '0' ? ' selected="selected"' : '') . ' >' . __('no stereo image or ready anaglyph', 'wp-photo-album-plus') . '</option>' . '<option value="1"' . ($stereo == '1' ? ' selected="selected"' : '') . ' >' . __('Left - right stereo image', 'wp-photo-album-plus') . '</option>' . '<option value="-1"' . ($stereo == '-1' ? ' selected="selected"' : '') . ' >' . __('Right - left stereo image', 'wp-photo-album-plus') . '</option>' . '</select>' . ' '; __('Images:', 'wp-photo-album-plus') . ' '; $files = glob(WPPA_UPLOAD_PATH . '/stereo/' . $id . '-*.*'); $c = 0; if (!empty($files)) { sort($files); foreach ($files as $file) { echo '<a href="' . str_replace(WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $file) . '" target="_blank" >' . basename($file) . '</a>'; $c++; if ($c == count($files)) { echo '. '; } else { echo ', '; } } } } // Watermark if (!$is_multi || is_file(wppa_fix_poster_ext(wppa_get_photo_path($id), $id))) { echo __('Watermark:', 'wp-photo-album-plus') . ' '; if (wppa_switch('watermark_on')) { $user = wppa_get_user(); if (wppa_switch('watermark_user') || current_user_can('wppa_settings')) { echo '<select' . ' id="wmfsel_' . $id . '"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'wppa_watermark_file_' . $user . '\', this );"' . ' >' . wppa_watermark_file_select() . '</select>' . __('Pos:', 'wp-photo-album-plus') . ' ' . '<select' . ' id="wmpsel_' . $id . '"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'wppa_watermark_pos_' . $user . '\', this );"' . ' >' . wppa_watermark_pos_select() . '</select>' . '<input' . ' type="button"' . ' class="button-secundary"' . ' value="' . esc_attr(__('Apply watermark', 'wp-photo-album-plus')) . '"' . ' onclick="wppaTryWatermark( ' . $id . ' )"' . ' />'; } else { echo __('File:', 'wp-photo-album-plus') . ' ' . __($wmfile, 'wp-photo-album-plus') . ' '; if ($wmfile != '--- none ---') { echo __('Pos:', 'wp-photo-album-plus') . ' ' . $wmpos; } } echo '<img' . ' id="wppa-water-spin-' . $id . '"' . ' src="' . wppa_get_imgdir() . 'spinner.gif' . '"' . ' alt="Spin"' . ' style="visibility:hidden"' . ' />'; } else { echo __('Not configured', 'wp-photo-album-plus'); } echo ' '; } echo '</td>' . '</tr>' . '</tbody>' . '</table>'; } echo "\n" . '<!-- Section 3 -->' . '<table' . ' class="wppa-table wppa-photo-table"' . ' style="width:100%;"' . ' >' . '<tbody>' . '<tr>' . '<td>'; // --- Actions --- // Rotate if (!$b_is_video) { echo '<input' . ' type="button"' . ' onclick="wppaTryRotLeft( ' . $id . ' )"' . ' value="' . esc_attr(__('Rotate left', 'wp-photo-album-plus')) . '"' . ' />' . ' ' . '<input' . ' type="button"' . ' onclick="wppaTryRot180( ' . $id . ' )"' . ' value="' . esc_attr(__('Rotate 180°', 'wp-photo-album-plus')) . '"' . ' />' . ' ' . '<input' . ' type="button"' . ' onclick="wppaTryRotRight( ' . $id . ' )"' . ' value="' . esc_attr(__('Rotate right', 'wp-photo-album-plus')) . '"' . ' />' . ' ' . '<input' . ' type="button"' . ' onclick="wppaTryFlip( ' . $id . ' )"' . ' value="' . esc_attr(__('Flip', 'wp-photo-album-plus')) . '"' . ' />' . ' '; } // Remake displayfiles if (!$is_video) { echo '<input' . ' type="button"' . ' title="' . esc_attr(__('Remake display file and thumbnail file', 'wp-photo-album-plus')) . '"' . ' onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remake\', this, ' . (wppa('front_edit') ? 'false' : 'true') . ' )"' . ' value="' . esc_attr(__('Remake files', 'wp-photo-album-plus')) . '"' . ' />' . ' '; } // Remake thumbnail if (!$is_video) { echo '<input' . ' type="button"' . ' title=' . esc_attr(__('Remake thumbnail file', 'wp-photo-album-plus')) . '"' . ' onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remakethumb\', this, ' . (wppa('front_edit') ? 'false' : 'true') . ' )"' . ' value="' . esc_attr(__('Remake thumbnail file', 'wp-photo-album-plus')) . '"' . ' />' . ' '; } // Move/copy if (!$quick) { $max = wppa_opt('photo_admin_max_albums'); if (!$max || wppa_get_total_album_count() < $max) { // If not done yet, get the album options html with the current album excluded if (!isset($album_select[$album])) { $album_select[$album] = wppa_album_select_a(array('checkaccess' => true, 'path' => wppa_switch('hier_albsel'), 'exclude' => $album, 'selected' => '0', 'addpleaseselect' => true)); } echo __('Target album for copy/move:', 'wp-photo-album-plus') . '<select' . ' id="target-' . $id . '"' . ' >' . $album_select[$album] . '</select>'; } else { echo __('Target album for copy/move:', 'wp-photo-album-plus') . '<input' . ' id="target-' . $id . '"' . ' type="number"' . ' style="height:20px;"' . ' placeholder="' . __('Album id', 'wp-photo-album-plus') . '"' . ' />'; } echo ' '; echo '<input' . ' type="button"' . ' onclick="wppaTryMove( ' . $id . ', ' . $b_is_video . ' )"' . ' value="' . ($b_is_video ? $mvt : $mpt) . '"' . ' />' . ' ' . '<input' . ' type="button"' . ' onclick="wppaTryCopy( ' . $id . ', ' . $b_is_video . ' )"' . ' value="' . ($b_is_video ? $cvt : $cpt) . '"' . ' />' . ' '; } // Delete if (!wppa('front_edit')) { echo '<input' . ' type="button"' . ' style="color:red;"' . ' onclick="wppaTryDelete( ' . $id . ', ' . $b_is_video . ' )"' . ' value="' . ($b_is_video ? esc_attr(__('Delete video', 'wp-photo-album-plus')) : esc_attr(__('Delete photo', 'wp-photo-album-plus'))) . '"' . ' />' . ' '; } // Re-upload if (wppa_user_is('administrator') || !wppa_switch('reup_is_restricted')) { echo '<input' . ' type="button"' . ' onclick="jQuery( \'#re-up-' . $id . '\' ).css( \'display\', \'inline-block\' )"' . ' value="' . esc_attr(__('Re-upload file', 'wp-photo-album-plus')) . '"' . ' />' . '<div id="re-up-' . $id . '" style="display:none" >' . '<form' . ' id="wppa-re-up-form-' . $id . '"' . ' onsubmit="wppaReUpload( event, ' . $id . ', \'' . $filename . '\' )"' . ' >' . '<input' . ' type="file"' . ' id="wppa-re-up-file-' . $id . '"' . ' />' . '<input' . ' type="submit"' . ' id="wppa-re-up-butn-' . $id . '"' . ' value="' . esc_attr(__('Upload', 'wp-photo-album-plus')) . '"' . ' />' . '</form>' . '</div>'; } // Refresh /* if ( ! wppa( 'front_edit' ) ) { echo '<input' . ' type="button"' . ' onclick="wppaReload( \'#photo_' . $id . '\')"' . ' value="' . esc_attr( __( 'Refresh page', 'wp-photo-album-plus' ) ) . '"' . ' />'; } */ echo '</td>' . '</tr>' . '</tbody>' . '</table>'; echo "\n" . '<!-- Section 4 -->' . '<table' . ' class="wppa-table wppa-photo-table"' . ' style="width:100%;"' . ' >' . '<tbody>'; // Name echo '<tr>' . '<td>' . __('Photoname:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<input' . ' type="text"' . ' style="width:100%;"' . ' id="pname-' . $id . '"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'name\', this );"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'name\', this );"' . ' value="' . esc_attr(stripslashes($name)) . '"' . ' />' . '</td>' . '<td>' . '</td>' . '</tr>'; // Description if (!wppa_switch('desc_is_restricted') || wppa_user_is('administrator')) { echo '<tr>' . '<td>' . __('Description:', 'wp-photo-album-plus') . '</td>'; if (wppa_switch('use_wp_editor')) { $alfaid = wppa_alfa_id($id); echo '<td>'; wp_editor($description, 'wppaphotodesc' . $alfaid, array('wpautop' => true, 'media_buttons' => false, 'textarea_rows' => '6', 'tinymce' => true)); echo '</td>' . '<td>' . '<input' . ' type="button"' . ' class="button-secundary"' . ' value="' . esc_attr(__('Update Photo description', 'wp-photo-album-plus')) . '"' . ' onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'description\', document.getElementById( \'wppaphotodesc' . $alfaid . '\' ), false, \'' . $alfaid . '\' )"' . ' />' . '<img' . ' id="wppa-photo-spin-' . $id . '"' . ' src="' . wppa_get_imgdir() . 'spinner.gif"' . ' style="visibility:hidden"' . ' />' . '</td>'; } else { echo '<td>' . '<textarea' . ' style="width:100%;height:60px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'description\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'description\', this )"' . ' >' . $description . '</textarea>' . '</td>' . '<td>' . '</td>'; } echo '</tr>'; } else { echo '<tr>' . '<td>' . __('Description:', 'wp-photo-album-plus') . '</td>' . '<td>' . $description . '</td>' . '<td>' . '</td>' . '</tr>'; } // Tags echo '<tr>' . '<td>' . __('Tags:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<input' . ' id="tags-' . $id . '"' . ' type="text"' . ' style="width:100%;"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'tags\', this )"' . ' value="' . $tags . '"' . ' />' . '<br />' . '<span class="description" >' . __('Separate tags with commas.', 'wp-photo-album-plus') . '</span>' . '</td>' . '<td>' . '<select' . ' onchange="wppaAddTag( this.value, \'tags-' . $id . '\' ); wppaAjaxUpdatePhoto( ' . $id . ', \'tags\', document.getElementById( \'tags-' . $id . '\' ) )"' . ' >'; $taglist = wppa_get_taglist(); if (is_array($taglist)) { echo '<option value="" >' . __('- select -', 'wp-photo-album-plus') . '</option>'; foreach ($taglist as $tag) { echo '<option value="' . $tag['tag'] . '" >' . $tag['tag'] . '</option>'; } } else { echo '<option value="0" >' . __('No tags yet', 'wp-photo-album-plus') . '</option>'; } echo '</select>' . '<br />' . '<span class="description" >' . __('Select to add', 'wp-photo-album-plus') . '</span>' . '</td>' . '</tr>'; // Custom if (wppa_switch('custom_fields')) { $custom = wppa_get_photo_item($photo['id'], 'custom'); if ($custom) { $custom_data = unserialize($custom); } else { $custom_data = array('', '', '', '', '', '', '', '', '', ''); } foreach (array_keys($custom_data) as $key) { if (wppa_opt('custom_caption_' . $key)) { echo '<tr>' . '<td>' . apply_filters('translate_text', wppa_opt('custom_caption_' . $key)) . '<small style="float:right" >' . '(w#cc' . $key . ')' . '</small>:' . '</td>' . '<td>' . '<input' . ' type="text"' . ' style="width:100%;"' . ' id="custom_' . $key . '-' . $id . '"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'custom_' . $key . '\', this );"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'custom_' . $key . '\', this );"' . ' value="' . esc_attr(stripslashes($custom_data[$key])) . '"' . '/>' . '</td>' . '<td>' . '<small>(w#cd' . $key . ')</small>' . '</td> ' . '</tr>'; } } } // -- Auto Page -- if (wppa_switch('auto_page') && (current_user_can('edit_posts') || current_user_can('edit_pages'))) { $appl = get_permalink(wppa_get_the_auto_page($id)); echo '<tr>' . '<td>' . __('Autopage Permalink:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<a href="' . $appl . '" target="_blank" >' . $appl . '</a>' . '</td>' . '<td>' . '</td>' . '</tr>'; } // -- Link url -- if (!wppa_switch('link_is_restricted') || wppa_user_is('administrator')) { echo '<tr>' . '<td>' . __('Photo specific link url:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<input' . ' type="text"' . ' id="pislink-' . $id . '"' . ' style="width:100%;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'linkurl\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linkurl\', this )"' . ' value="' . esc_attr($linkurl) . '"' . ' />' . '</td>' . '<td>' . '<select' . ' id="pistarget-' . $id . '"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linktarget\', this )"' . ' >' . '<option' . ' value="_self"' . ($linktarget == '_self' ? ' selected="selected"' : '') . ' >' . __('Same tab', 'wp-photo-album-plus') . '</option>' . '<option' . ' value="_blank"' . ($linktarget == '_blank' ? ' selected="selected"' : '') . ' >' . __('New tab', 'wp-photo-album-plus') . '</option>' . '</select>' . '<input' . ' type="button"' . ' onclick="window.open( jQuery( \'#pislink-' . $id . '\' ).val(), jQuery( \'#pistarget-' . $id . '\' ).val() );"' . ' value="' . __('Tryit!', 'wp-photo-album-plus') . '"' . ' />' . '</td>' . '</tr>'; // -- Link title -- echo '<tr>' . '<td>' . __('Photo specific link title:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<input' . ' type="text"' . ' style="width:100%;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'linktitle\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linktitle\', this )"' . ' value="' . esc_attr($linktitle) . '"' . ' />'; if (current_user_can('wppa_settings')) { echo '<br />' . '<span class="description" >' . __('If you want this link to be used, check \'PS Overrule\' checkbox in table VI.', 'wp-photo-album-plus') . '</span>'; } echo '</td>' . '<td>' . '</td>' . '</tr>'; } // -- Custom ALT field -- if (wppa_opt('alt_type') == 'custom') { echo '<tr>' . '<td>' . __('HTML Alt attribute:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<input' . ' type="text"' . ' style="width:100%;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'alt\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'alt\', this )"' . ' value="' . esc_attr($alt) . '"' . ' />' . '</td>' . '<td>' . '</td>' . '</tr>'; } // If Quick, skip the following items for speed and space if (!$quick) { // Shortcode if (current_user_can('edit_posts') || current_user_can('edit_pages')) { echo '<tr>' . '<td>' . __('Single image shortcode', 'wp-photo-album-plus') . ':' . '</td>' . '<td>' . '[wppa type="photo" photo="' . $id . '"][/wppa]' . '</td>' . '<td>' . '<small>' . sprintf(__('See %s The documentation %s for more shortcode options.', 'wp-photo-album-plus'), '<a href="http://wppa.nl/shortcode-reference/" target="_blank" >', '</a>') . '</small>' . '</td>' . '</tr>'; } // Source permalink if (is_file(wppa_get_source_path($id))) { $spl = wppa_get_source_pl($id); echo '<tr>' . '<td>' . __('Permalink', 'wp-photo-album-plus') . ':' . '</td>' . '<td>' . '<a href="' . $spl . '" target="_blank" >' . $spl . '</a>' . '</td>' . '<td>' . '</td>' . '</tr>'; } // High resolution url $hru = wppa_get_hires_url($id); echo '<tr>' . '<td>' . __('Hi resolution url', 'wp-photo-album-plus') . ':' . '</td>' . '<td>' . '<a href="' . $hru . '" target="_blank" >' . $hru . '</a>' . '</td>' . '<td>' . '</td>' . '</tr>'; // Display file if (is_file(wppa_fix_poster_ext(wppa_get_photo_path($id), $id))) { $lru = wppa_fix_poster_ext(wppa_get_lores_url($id), $id); echo '<tr>' . '<td>' . __('Display file url', 'wp-photo-album-plus') . ':' . '</td>' . '<td>' . '<a href="' . $lru . '" target="_blank" >' . $lru . '</a>' . '</td>' . '<td>' . '</td>' . '</tr>'; } // Thumbnail if (is_file(wppa_fix_poster_ext(wppa_get_thumb_path($id), $id))) { $tnu = wppa_fix_poster_ext(wppa_get_tnres_url($id), $id); echo '<tr>' . '<td>' . __('Thumbnail file url', 'wp-photo-album-plus') . ':' . '</td>' . '<td>' . '<a href="' . $tnu . '" target="_blank" >' . $tnu . '</a>' . '</td>' . '<td>' . '</td>' . '</tr>'; } } echo '</tbody>' . '</table>'; echo "\n" . '<!-- Section 5 -->'; // Comments $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s ORDER BY `timestamp` DESC", $id), ARRAY_A); if ($comments && !$quick) { echo '<table' . ' class="wppa-table wppa-photo-table"' . ' style="width:100%;"' . ' >' . '<thead>' . '<tr style="font-weight:bold;" >' . '<td style="padding:0 4px;" >#</td>' . '<td style="padding:0 4px;" >User</td>' . '<td style="padding:0 4px;" >Time since</td>' . '<td style="padding:0 4px;" >Status</td>' . '<td style="padding:0 4px;" >Comment</td>' . '</tr>' . '</thead>' . '<tbody>'; foreach ($comments as $comment) { echo ' <tr id="com-tr-' . $comment['id'] . '" > <td style="padding:0 4px;" >' . $comment['id'] . '</td> <td style="padding:0 4px;" >' . $comment['user'] . '</td> <td style="padding:0 4px;" >' . wppa_get_time_since($comment['timestamp']) . '</td>'; if (current_user_can('wppa_comments') || current_user_can('wppa_moderate') || wppa_get_user() == $photo['owner'] && wppa_switch('owner_moderate_comment')) { $p = $comment['status'] == 'pending' ? 'selected="selected" ' : ''; $a = $comment['status'] == 'approved' ? 'selected="selected" ' : ''; $s = $comment['status'] == 'spam' ? 'selected="selected" ' : ''; $t = $comment['status'] == 'trash' ? 'selected="selected" ' : ''; echo '<td style="padding:0 4px;" >' . '<select' . ' id="com-stat-' . $comment['id'] . '"' . ' style=""' . ' onchange="wppaAjaxUpdateCommentStatus( ' . $id . ', ' . $comment['id'] . ', this.value );wppaSetComBgCol(' . $comment['id'] . ');"' . ' >' . '<option value="pending" ' . $p . '>' . __('Pending', 'wp-photo-album-plus') . '</option>' . '<option value="approved" ' . $a . '>' . __('Approved', 'wp-photo-album-plus') . '</option>' . '<option value="spam" ' . $s . '>' . __('Spam', 'wp-photo-album-plus') . '</option>' . '<option value="trash" ' . $t . '>' . __('Trash', 'wp-photo-album-plus') . '</option>' . '</select >' . '</td>'; } else { echo '<td style="padding:0 4px;" >'; if ($comment['status'] == 'pending') { _e('Pending', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'approved') { _e('Approved', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'spam') { _e('Spam', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'trash') { _e('Trash', 'wp-photo-album-plus'); } echo '</td>'; } echo '<td style="padding:0 4px;" >' . $comment['comment'] . '</td> </tr>' . '<script>wppaSetComBgCol(' . $comment['id'] . ')</script>'; } echo '</tbody>' . '</table>'; } echo '<script>wppaPhotoStatusChange( ' . $id . ' )</script>' . '<div style="clear:both;"></div>' . '</div>' . '<div style="clear:both;margin-top:7px;"></div>'; } /* foreach photo */ wppa_admin_page_links($page, $pagesize, $count, $link); } /* photos not empty */ }
function wppa_album_photos($album = '', $photo = '', $owner = '', $moderate = false) { global $wpdb; // Check input wppa_vfy_arg('wppa-page'); $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'])); } else { $counts = wppa_treecount_a($album); $count = $counts['selfphotos'] + $counts['pendphotos']; $photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `album` = %s ' . wppa_get_photo_order($album, 'norandom') . $limit, $album), ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=edit&edit_id=' . $album); } } elseif ($photo && !$moderate) { $count = '1'; $photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `id` = %s', $photo), ARRAY_A); $link = ''; } elseif ($owner) { $count = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM `' . WPPA_PHOTOS . '` WHERE `owner` = %s', $owner)); $photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `owner` = %s ORDER BY `timestamp` DESC' . $limit, $owner), ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_edit_photo'); } elseif ($moderate) { if (!current_user_can('wppa_moderate')) { wp_die(__('You do not have the rights to do this', 'wp-photo-album-plus')); } if ($photo) { $count = '1'; $photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `id` = %s', $photo), ARRAY_A); $link = ''; } else { // Photos with pending comments? $cmt = $wpdb->get_results("SELECT `photo` FROM `" . WPPA_COMMENTS . "` WHERE `status` = 'pending'", ARRAY_A); if ($cmt) { $orphotois = ''; foreach ($cmt as $c) { $orphotois .= "OR `id` = " . $c['photo'] . " "; } } else { $orphotois = ''; } $count = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM `' . WPPA_PHOTOS . '` WHERE `status` = %s ' . $orphotois, 'pending')); $photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `status` = %s ' . $orphotois . ' ORDER BY `timestamp` DESC' . $limit, 'pending'), ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_moderate_photos'); } if (empty($photos)) { if ($photo) { echo '<p>' . __('This photo is no longer awaiting moderation.', 'wp-photo-album-plus') . '</p>'; } else { echo '<p>' . __('There are no photos awaiting moderation at this time.', 'wp-photo-album-plus') . '</p>'; } if (current_user_can('administrator')) { echo '<h3>' . __('Manage all photos by timestamp', 'wp-photo-album-plus') . '</h3>'; $count = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "`"); $photos = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` ORDER BY `timestamp` DESC" . $limit, ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_moderate_photos'); } else { return; } } } else { wppa_dbg_msg('Missing required argument in wppa_album_photos() 1', 'red', 'force'); } if ($link && isset($_REQUEST['quick'])) { $link .= '&quick'; } wppa_show_search_statistics(); if (empty($photos)) { if ($photo) { echo '<div id="photoitem-' . $photo . '" class="photoitem" style="width: 99%; background-color: rgb( 255, 255, 224 ); border-color: rgb( 230, 219, 85 );"> <span style="color:red">' . sprintf(__('Photo %s has been removed.', 'wp-photo-album-plus'), $photo) . '</span> </div>'; } else { if (isset($_REQUEST['wppa-searchstring'])) { echo '<h3>' . __('No photos matching your search criteria.', 'wp-photo-album-plus') . '</h3>'; } else { echo '<h3>' . __('No photos yet in this album.', 'wp-photo-album-plus') . '</h3>'; } } } else { $wms = array('toplft' => __('top - left', 'wp-photo-album-plus'), 'topcen' => __('top - center', 'wp-photo-album-plus'), 'toprht' => __('top - right', 'wp-photo-album-plus'), 'cenlft' => __('center - left', 'wp-photo-album-plus'), 'cencen' => __('center - center', 'wp-photo-album-plus'), 'cenrht' => __('center - right', 'wp-photo-album-plus'), 'botlft' => __('bottom - left', 'wp-photo-album-plus'), 'botcen' => __('bottom - center', 'wp-photo-album-plus'), 'botrht' => __('bottom - right', 'wp-photo-album-plus')); $temp = wppa_get_water_file_and_pos('0'); $wmfile = isset($temp['select']) ? $temp['select'] : ''; $wmpos = isset($temp['pos']) && isset($wms[$temp['pos']]) ? $wms[$temp['pos']] : ''; wppa_admin_page_links($page, $pagesize, $count, $link); foreach ($photos as $photo) { $is_multi = wppa_is_multi($photo['id']); $is_video = wppa_is_video($photo['id']); $has_audio = wppa_has_audio($photo['id']); ?> <a id="photo_<?php echo $photo['id']; ?> " name="photo_<?php echo $photo['id']; ?> "></a> <div class="widefat wppa-table-wrap" id="photoitem-<?php echo $photo['id']; ?> " style="width:99%; position: relative;" > <!-- Left half starts here --> <div style="width:49.5%; float:left; border-right:1px solid #ccc; margin-right:0;"> <input type="hidden" id="photo-nonce-<?php echo $photo['id']; ?> " value="<?php echo wp_create_nonce('wppa_nonce_' . $photo['id']); ?> " /> <table class="wppa-table wppa-photo-table" style="width:98%" > <tbody> <!-- Preview --> <tr> <th> <label ><?php echo 'ID = ' . $photo['id'] . '. ' . __('Preview:', 'wp-photo-album-plus'); ?> </label> <br /> <?php echo sprintf(__('Album: %d<br />(%s)', 'wp-photo-album-plus'), $photo['album'], wppa_get_album_name($photo['album'])); ?> <br /><br /> <?php if (!$is_video) { ?> <?php _e('Rotate', 'wp-photo-album-plus'); ?> <a onclick="if ( confirm( '<?php _e('Are you sure you want to rotate this photo left?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'rotleft', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); " ><?php _e('left', 'wp-photo-album-plus'); ?> </a> <a onclick="if ( confirm( '<?php _e('Are you sure you want to rotate this photo 180°?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'rot180', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); " ><?php _e('180°', 'wp-photo-album-plus'); ?> </a> <a onclick="if ( confirm( '<?php _e('Are you sure you want to rotate this photo right?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'rotright', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); " ><?php _e('right', 'wp-photo-album-plus'); ?> </a> <br /> <span style="font-size: 9px; line-height: 10px; color:#666;"> <?php if (wppa('front_edit')) { _e('If it says \'Photo rotated\', the photo is rotated.', 'wp-photo-album-plus'); } else { $refresh = '<a onclick="wppaReload()" >' . __('Refresh', 'wp-photo-album-plus') . '</a>'; echo sprintf(__('If it says \'Photo rotated\', the photo is rotated. %s the page.', 'wp-photo-album-plus'), $refresh); } ?> </span> <?php } ?> </th> <td> <?php $src = wppa_get_thumb_url($photo['id']); $big = wppa_get_photo_url($photo['id']); if ($is_video) { reset($is_video); $big = str_replace('xxx', current($is_video), $big); ?> <a href="<?php echo $big; ?> " target="_blank" title="<?php _e('Preview fullsize video', 'wp-photo-album-plus'); ?> " > <?php echo wppa_get_video_html(array('id' => $photo['id'], 'width' => '160', 'height' => '160' * wppa_get_videoy($photo['id']) / wppa_get_videox($photo['id']), 'controls' => false, 'use_thumb' => true)); ?> </a><?php } else { if ($has_audio) { $big = wppa_fix_poster_ext($big, $photo['id']); $src = wppa_fix_poster_ext($src, $photo['id']); } ?> <a href="<?php echo $big; ?> " target="_blank" title="<?php _e('Preview fullsize photo', 'wp-photo-album-plus'); ?> " > <img src="<?php echo $src; ?> " alt="<?php echo $photo['name']; ?> " style="max-width: 160px; vertical-align:middle;" /> </a><?php if ($has_audio) { $audio = wppa_get_audio_html(array('id' => $photo['id'], 'width' => '160', 'controls' => true)); ?> <br /> <?php if ($audio) { echo $audio; } else { echo '<span style="color:red;">' . __('Audio disabled', 'wp-photo-album-plus') . '</span>'; } } } ?> </td> </tr> <!-- Upload --> <tr> <th > <label><?php _e('Upload:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $timestamp = $photo['timestamp']; if ($timestamp) { echo wppa_local_date(get_option('date_format', "F j, Y,") . ' ' . get_option('time_format', "g:i a"), $timestamp) . ' ' . __('local time', 'wp-photo-album-plus') . ' '; } if ($photo['owner']) { if (wppa_switch('photo_owner_change') && wppa_user_is('administrator')) { echo '</td></tr><tr><th><label>' . __('Owned by:', 'wp-photo-album-plus') . '</label></th><td>'; echo '<input type="text" onkeyup="wppaAjaxUpdatePhoto( \'' . $photo['id'] . '\', \'owner\', this )" onchange="wppaAjaxUpdatePhoto( \'' . $photo['id'] . '\', \'owner\', this )" value="' . $photo['owner'] . '" />'; } else { echo __('By:', 'wp-photo-album-plus') . ' ' . $photo['owner']; } } ?> </td> </tr> <!-- Modified --> <tr> <th> <label><?php _e('Modified:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $modified = $photo['modified']; if ($modified > $timestamp) { echo wppa_local_date(get_option('date_format', "F j, Y,") . ' ' . get_option('time_format', "g:i a"), $modified) . ' ' . __('local time', 'wp-photo-album-plus'); } else { _e('Not modified', 'wp-photo-album-plus'); } ?> </td> </tr> <!-- EXIF Date --> <tr> <th> <label><?php _e('EXIF Date', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php if (wppa_user_is('administrator')) { echo '<input type="text" onkeyup="wppaAjaxUpdatePhoto( \'' . $photo['id'] . '\', \'exifdtm\', this )" onchange="wppaAjaxUpdatePhoto( \'' . $photo['id'] . '\', \'exifdtm\', this )" value="' . $photo['exifdtm'] . '" />'; } else { echo $photo['exifdtm']; } ?> </td> </tr> <!-- Rating --> <tr > <th > <label><?php _e('Rating:', 'wp-photo-album-plus'); ?> </label> </th> <td class="wppa-rating" > <?php $entries = wppa_get_rating_count_by_id($photo['id']); if ($entries) { echo __('Entries:', 'wp-photo-album-plus') . ' ' . $entries . '. ' . __('Mean value:', 'wp-photo-album-plus') . ' ' . wppa_get_rating_by_id($photo['id'], 'nolabel') . '.'; } else { _e('No ratings for this photo.', 'wp-photo-album-plus'); } $dislikes = wppa_dislike_get($photo['id']); if ($dislikes) { echo ' <span style="color:red" >' . sprintf(__('Disliked by %d visitors', 'wp-photo-album-plus'), $dislikes) . '</span>'; } $pending = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_RATING . "` WHERE `photo` = %s AND `status` = 'pending'", $photo['id'])); if ($pending) { echo ' <span style="color:orange" >' . sprintf(__('%d pending votes.', 'wp-photo-album-plus'), $pending) . '</span>'; } ?> </td> </tr> <!-- Views --> <tr > <th > <label><?php _e('Views', 'wp-photo-album-plus'); ?> </label> </th> <td > <?php echo $photo['views']; ?> </td> </tr> <!-- P_order --> <?php if (!wppa_switch('porder_restricted') || current_user_can('administrator')) { ?> <tr > <th > <label><?php _e('Photo sort order #:', 'wp-photo-album-plus'); ?> </label> </th> <td > <input type="text" id="porder-<?php echo $photo['id']; ?> " value="<?php echo $photo['p_order']; ?> " style="width: 50px" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'p_order', this )" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'p_order', this )" /> </td> </tr> <?php } ?> <?php if (!isset($_REQUEST['quick'])) { ?> <?php if (!isset($album_select[$photo['album']])) { $album_select[$photo['album']] = wppa_album_select_a(array('checkaccess' => true, 'path' => wppa_switch('hier_albsel'), 'exclude' => $photo['album'], 'selected' => '0', 'addpleaseselect' => true)); } ?> <!-- Move --> <tr > <th > <input type="button" style="" onclick="if( document.getElementById( 'moveto-<?php echo $photo['id']; ?> ' ).value != 0 ) { if ( confirm( '<?php _e('Are you sure you want to move this photo?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'moveto', document.getElementById( 'moveto-<?php echo $photo['id']; ?> ' ) ) } else { alert( '<?php _e('Please select an album to move the photo to first.', 'wp-photo-album-plus'); ?> ' ); return false;}" value="<?php echo esc_attr(__('Move photo to', 'wp-photo-album-plus')); ?> " /> </th> <td > <select id="moveto-<?php echo $photo['id']; ?> " style="width:100%;" ><?php echo $album_select[$photo['album']]; ?> </select> </td> </tr> <!-- Copy --> <tr > <th > <input type="button" style="" onclick="if ( document.getElementById( 'copyto-<?php echo $photo['id']; ?> ' ).value != 0 ) { if ( confirm( '<?php _e('Are you sure you want to copy this photo?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'copyto', document.getElementById( 'copyto-<?php echo $photo['id']; ?> ' ) ) } else { alert( '<?php _e('Please select an album to copy the photo to first.', 'wp-photo-album-plus'); ?> ' ); return false;}" value="<?php echo esc_attr(__('Copy photo to', 'wp-photo-album-plus')); ?> " /> </th> <td > <select id="copyto-<?php echo $photo['id']; ?> " style="width:100%;" ><?php echo $album_select[$photo['album']]; ?> </select> </td> </tr> <?php } ?> <!-- Delete --> <?php if (!wppa('front_edit')) { ?> <tr > <th style="padding-top:0; padding-bottom:4px;"> <input type="button" style="color:red;" onclick="if ( confirm( '<?php _e('Are you sure you want to delete this photo?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxDeletePhoto( <?php echo $photo['id']; ?> )" value="<?php echo esc_attr(__('Delete photo', 'wp-photo-album-plus')); ?> " /> </th> </tr> <?php } ?> <!-- Auto Page --> <?php if (wppa_switch('auto_page') && (current_user_can('edit_posts') || current_user_can('edit_pages'))) { ?> <tr style=="vertical-align:bottom;" > <th style="padding-top:0; padding-bottom:4px;"> <label> <?php _e('Autopage Permalink:', 'wp-photo-album-plus'); ?> </label> </th> <td > <?php echo get_permalink(wppa_get_the_auto_page($photo['id'])); ?> </td> </tr> <?php } ?> <!-- Link url --> <?php if (!wppa_switch('link_is_restricted') || current_user_can('administrator')) { ?> <tr > <th > <label><?php _e('Link url:', 'wp-photo-album-plus'); ?> </label> </th> <td > <input type="text" style="width:60%;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'linkurl', this )" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'linkurl', this )" value="<?php echo stripslashes($photo['linkurl']); ?> " /> <select style="float:right;" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'linktarget', this )" > <option value="_self" <?php if ($photo['linktarget'] == '_self') { echo 'selected="selected"'; } ?> ><?php _e('Same tab', 'wp-photo-album-plus'); ?> </option> <option value="_blank" <?php if ($photo['linktarget'] == '_blank') { echo 'selected="selected"'; } ?> ><?php _e('New tab', 'wp-photo-album-plus'); ?> </option> </select> </td> </tr> <!-- Link title --> <tr > <th > <label><?php _e('Link title:', 'wp-photo-album-plus'); ?> </label> </th> <td > <input type="text" style="width:97%;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'linktitle', this )" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'linktitle', this )" value="<?php echo stripslashes($photo['linktitle']); ?> " /> </td> </tr> <?php if (current_user_can('wppa_settings')) { ?> <tr style="padding-left:10px; font-size:9px; line-height:10px; color:#666;" > <td colspan="2" style="padding-top:0" > <?php _e('If you want this link to be used, check \'PS Overrule\' checkbox in table VI.', 'wp-photo-album-plus'); ?> </td> </tr> <?php } ?> <?php } ?> <!-- Alt custom field --> <?php if (wppa_opt('alt_type') == 'custom') { ?> <tr > <th > <label><?php _e('HTML Alt attribute:', 'wp-photo-album-plus'); ?> </label> </th> <td > <input type="text" style="width:100%;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'alt', this )" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'alt', this )" value="<?php echo stripslashes($photo['alt']); ?> " /> </td> </tr> <?php } ?> </tbody> </table> </div> <!-- Right half starts here --> <div style="width:50%; float:left; border-left:1px solid #ccc; margin-left:-1px;"> <table class="wppa-table wppa-photo-table" > <tbody> <!-- Filename --> <tr> <th> <label><?php _e('Filename:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php echo $photo['filename']; if (wppa_user_is('administrator') || !wppa_switch('reup_is_restricted')) { ?> <input type="button" onclick="jQuery( '#re-up-<?php echo $photo['id']; ?> ' ).css( 'display', '' );" value="<?php _e('Update file', 'wp-photo-album-plus'); ?> " /> <?php } ?> </td> </tr> <?php if (wppa_user_is('administrator') || !wppa_switch('reup_is_restricted')) { ?> <tr id="re-up-<?php echo $photo['id']; ?> " style="display:none" > <th> </th> <td> <form id="wppa-re-up-form-<?php echo $photo['id']; ?> " onsubmit="wppaReUpload( event,<?php echo $photo['id']; ?> , '<?php echo $photo['filename']; ?> ' )" > <input type="file" id="wppa-re-up-file-<?php echo $photo['id']; ?> " /> <input type="submit" id="wppa-re-up-butn-<?php echo $photo['id']; ?> " value="<?php _e('Upload', 'wp-photo-album-plus'); ?> " /> </form> </td> </tr> <?php } ?> <!--- Video sizes --> <?php if ($is_video) { ?> <tr> <th> <label><?php _e('Video size:', 'wp-photo-album-plus'); ?> </th> <td> <table class="wppa-subtable" > <tr> <td> <?php _e('Width:', 'wp-photo-album-plus'); ?> </td> <td> <input style="width:50px;margin:0 4px;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'videox', this ); " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'videox', this ); " value="<?php echo $photo['videox']; ?> " /><?php echo sprintf(__('pix, (0=default:%s)', 'wp-photo-album-plus'), wppa_opt('video_width')); ?> </td> </tr> <tr> <td> <?php _e('Height:', 'wp-photo-album-plus'); ?> </td> <td> <input style="width:50px;margin:0 4px;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'videoy', this ); " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'videoy', this ); " value="<?php echo $photo['videoy']; ?> " /><?php echo sprintf(__('pix, (0=default:%s)', 'wp-photo-album-plus'), wppa_opt('video_height')); ?> </td> </tr> </table> </td> </tr> <tr> <th> <label><?php _e('Formats:', 'wp-photo-album-plus'); ?> </th> <td> <table class="wppa-subtable" > <?php foreach ($is_video as $fmt) { echo '<tr>' . '<td>' . $fmt . '</td>' . '<td>' . __('Filesize:', 'wp-photo-album-plus') . '</td>' . '<td>' . wppa_get_filesize(str_replace('xxx', $fmt, wppa_get_photo_path($photo['id']))) . '</td>' . '</tr>'; } ?> </table> </td> </tr> <?php } ?> <!-- Audio --> <?php if ($has_audio) { ?> <tr> <th> <label><?php _e('Formats:', 'wp-photo-album-plus'); ?> </th> <td> <table class="wppa-subtable" > <?php foreach ($has_audio as $fmt) { echo '<tr>' . '<td>' . $fmt . '</td>' . '<td>' . __('Filesize:', 'wp-photo-album-plus') . '</td>' . '<td>' . wppa_get_filesize(str_replace('xxx', $fmt, wppa_get_photo_path($photo['id']))) . '</td>' . '</tr>'; } ?> </table> </td> </tr> <?php } ?> <!-- Filesizes --> <tr> <th> <label><?php $is_video || $has_audio ? _e('Poster:', 'wp-photo-album-plus') : _e('Photo sizes:', 'wp-photo-album-plus'); ?> </label> </th> <td> <table class="wppa-subtable" > <tr> <td> <?php _e('Source file:', 'wp-photo-album-plus'); ?> </td> <?php $sp = wppa_get_source_path($photo['id']); if (is_file($sp)) { $ima = getimagesize($sp); ?> <td> <?php echo $ima['0'] . ' x ' . $ima['1'] . ' px.'; ?> </td> <td> <?php echo wppa_get_filesize($sp); ?> </td> <td> <a style="cursor:pointer; font-weight:bold;" title="<?php _e('Remake display file and thumbnail file', 'wp-photo-album-plus'); ?> " onclick="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'remake', this )"><?php _e('Remake files', 'wp-photo-album-plus'); ?> </a> </td> <?php } else { ?> <td> <span style="color:orange;"><?php _e('Unavailable', 'wp-photo-album-plus'); ?> </span> </td> <td> </td> <td> </td> <?php } ?> </tr> <tr> <td> <?php _e('Display file:', 'wp-photo-album-plus'); ?> </td> <?php $dp = wppa_fix_poster_ext(wppa_get_photo_path($photo['id']), $photo['id']); if (is_file($dp)) { ?> <td> <?php echo floor(wppa_get_photox($photo['id'])) . ' x ' . floor(wppa_get_photoy($photo['id'])) . ' px.'; ?> </td> <td> <?php echo wppa_get_filesize($dp); ?> </td> <td> </td> <?php } else { ?> <td> <span style="color:red;"><?php _e('Unavailable', 'wp-photo-album-plus'); ?> </span> </td> <td> </td> <td> </td> <?php } ?> </tr> <tr> <td> <?php _e('Thumbnail file:', 'wp-photo-album-plus'); ?> </td> <?php $tp = wppa_fix_poster_ext(wppa_get_thumb_path($photo['id']), $photo['id']); if (is_file($tp)) { ?> <td> <?php echo floor(wppa_get_thumbx($photo['id'])) . ' x ' . floor(wppa_get_thumby($photo['id'])) . ' px.'; ?> </td> <td> <?php echo wppa_get_filesize($tp); ?> </td> <?php } else { ?> <td> <span style="color:red;"><?php _e('Unavailable', 'wp-photo-album-plus'); ?> </span> </td> <td> </td> <?php } ?> <td> <a style="cursor:pointer; font-weight:bold;" title="<?php _e('Remake thumbnail file', 'wp-photo-album-plus'); ?> " onclick="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'remakethumb', this )"><?php _e('Remake', 'wp-photo-album-plus'); ?> </a> </td> </tr> </table> </td> </tr> <!-- Stereo --> <?php if (wppa_switch('enable_stereo')) { ?> <tr> <th> <label><?php _e('Stereophoto:', 'wp-photo-album-plus'); ?> </label> </th> <td> <select id="stereo-<?php echo $photo['id']; ?> " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'stereo', this )" > <option value="0" <?php if ($photo['stereo'] == '0') { echo 'selected="selected" '; } ?> ><?php _e('no stereo image or ready anaglyph', 'wp-photo-album-plus'); ?> </option> <option value="1" <?php if ($photo['stereo'] == '1') { echo 'selected="selected" '; } ?> ><?php _e('Left - right stereo image', 'wp-photo-album-plus'); ?> </option> <option value="-1" <?php if ($photo['stereo'] == '-1') { echo 'selected="selected" '; } ?> ><?php _e('Right - left stereo image', 'wp-photo-album-plus'); ?> </option> <select> <td> </tr> <tr> <th> <label><?php _e('Images:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $files = glob(WPPA_UPLOAD_PATH . '/stereo/' . $photo['id'] . '-*.*'); if (!empty($files)) { sort($files); $c = 0; echo '<table><tbody>'; foreach ($files as $file) { if (!$c) { echo '<tr>'; } if (is_file($file)) { echo '<td style="padding:0;" ><a href="' . str_replace(WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $file) . '" target="_blank" >' . basename($file) . '</a></td>'; } if (strpos(basename($file), '_flat')) { $c++; } $c = ($c + 1) % 2; if (!$c) { echo '</tr>'; } } if ($c) { echo '<td style="padding:0;" ></td></tr>'; } echo '</tbody></table>'; } ?> </td> </tr> <?php } ?> <!-- Location --> <?php if ($photo['location'] || wppa_switch('geo_edit')) { ?> <tr> <th> <label><?php _e('Location:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $loc = $photo['location'] ? $photo['location'] : '///'; $geo = explode('/', $loc); echo $geo['0'] . ' ' . $geo['1'] . ' '; if (wppa_switch('geo_edit')) { ?> <?php _e('Lat:', 'wp-photo-album-plus'); ?> <input type="text" style="width:100px;" id="lat-<?php echo $photo['id']; ?> " onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'lat', this );" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'lat', this );" value="<?php echo $geo['2']; ?> " /> <?php _e('Lon:', 'wp-photo-album-plus'); ?> <input type="text" style="width:100px;" id="lon-<?php echo $photo['id']; ?> " onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'lon', this );" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'lon', this );" value="<?php echo $geo['3']; ?> " /> <?php if (!wppa('front_edit')) { ?> <span class="description"><br /><?php _e('Refresh the page after changing to see the degrees being updated', 'wp-photo-album-plus'); ?> </span> <?php } ?> <?php } ?> </td> </tr> <?php } ?> <!-- Name --> <tr > <th > <label><?php _e('Photoname:', 'wp-photo-album-plus'); ?> </label> </th> <?php if (wppa_switch('use_wp_editor')) { ?> <td> <input type="text" style="width:100%;" id="pname-<?php echo $photo['id']; ?> " value="<?php echo esc_attr(stripslashes($photo['name'])); ?> " /> <input type="button" class="button-secundary" value="<?php _e('Update Photo name', 'wp-photo-album-plus'); ?> " onclick="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'name', document.getElementById( 'pname-<?php echo $photo['id']; ?> ' ) );" /> </td> <?php } else { ?> <td> <input type="text" style="width:100%;" id="pname-<?php echo $photo['id']; ?> " onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'name', this );" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'name', this );" value="<?php echo esc_attr(stripslashes($photo['name'])); ?> " /> </td> <?php } ?> </tr> <!-- Description --> <?php if (!wppa_switch('desc_is_restricted') || wppa_user_is('administrator')) { ?> <tr> <th> <label><?php _e('Description:', 'wp-photo-album-plus'); ?> </label> </th> <?php if (wppa_switch('use_wp_editor')) { ?> <td> <?php $alfaid = wppa_alfa_id($photo['id']); // $quicktags_settings = array( 'buttons' => 'strong,em,link,block,ins,ul,ol,li,code,close' ); wp_editor(stripslashes($photo['description']), 'wppaphotodesc' . $alfaid, array('wpautop' => true, 'media_buttons' => false, 'textarea_rows' => '6', 'tinymce' => true)); //, 'quicktags' => $quicktags_settings ) ); ?> <input type="button" class="button-secundary" value="<?php _e('Update Photo description', 'wp-photo-album-plus'); ?> " onclick="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'description', document.getElementById( 'wppaphotodesc'+'<?php echo $alfaid; ?> ' ), false, '<?php echo $alfaid; ?> ' )" /> <img id="wppa-photo-spin-<?php echo $photo['id']; ?> " src="<?php echo wppa_get_imgdir() . 'wpspin.gif'; ?> " style="visibility:hidden" /> </td> <?php } else { ?> <td> <textarea style="width: 100%; height:120px;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'description', this )" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'description', this )" ><?php echo stripslashes($photo['description']); ?> </textarea> </td> <?php } ?> </tr> <?php } else { ?> <tr> <th> <label><?php _e('Description:', 'wp-photo-album-plus'); ?> </label> </th> <td> <div style="width: 100%; height:120px; overflow:auto;" ><?php echo stripslashes($photo['description']); ?> </div> </td> </tr> <?php } ?> <!-- Custom --> <?php if (wppa_switch('custom_fields')) { $custom = wppa_get_photo_item($photo['id'], 'custom'); if ($custom) { $custom_data = unserialize($custom); } else { $custom_data = array('', '', '', '', '', '', '', '', '', ''); } foreach (array_keys($custom_data) as $key) { if (wppa_opt('custom_caption_' . $key)) { ?> <tr> <th> <label><?php echo wppa_opt('custom_caption_' . $key) . ':<br /><small>(w#cc' . $key . ')</small>'; ?> </label> </th> <td> <?php echo '<small>(w#cd' . $key . ')</small>'; ?> <input type="text" style="width:85%; float:right;" id="pname-<?php echo $photo['id']; ?> " onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'custom_<?php echo $key; ?> ', this );" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'custom_<?php echo $key; ?> ', this );" value="<?php echo esc_attr(stripslashes($custom_data[$key])); ?> " /> </td> </tr> <?php } } } ?> <!-- Tags --> <tr style="vertical-align:middle;" > <th > <label ><?php _e('Tags:', 'wp-photo-album-plus'); ?> </label> <span class="description" > <br /> </span> </th> <td > <input id="tags-<?php echo $photo['id']; ?> " type="text" style="width:100%;" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'tags', this )" value="<?php echo stripslashes(trim($photo['tags'], ',')); ?> " /> <span class="description" > <?php _e('Separate tags with commas.', 'wp-photo-album-plus'); ?> <?php _e('Examples:', 'wp-photo-album-plus'); ?> <select onchange="wppaAddTag( this.value, 'tags-<?php echo $photo['id']; ?> ' ); wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'tags', document.getElementById( 'tags-<?php echo $photo['id']; ?> ' ) )" > <?php $taglist = wppa_get_taglist(); if (is_array($taglist)) { echo '<option value="" >' . __('- select -', 'wp-photo-album-plus') . '</option>'; foreach ($taglist as $tag) { echo '<option value="' . $tag['tag'] . '" >' . $tag['tag'] . '</option>'; } } else { echo '<option value="0" >' . __('No tags yet', 'wp-photo-album-plus') . '</option>'; } ?> </select> <?php _e('Select to add', 'wp-photo-album-plus'); ?> </span> </td> </tr> <!-- Status --> <tr style="vertical-align:middle;" > <th> <label ><?php _e('Status:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php if ((current_user_can('wppa_admin') || current_user_can('wppa_moderate')) && !isset($_REQUEST['quick'])) { ?> <table> <tr> <td> <select id="status-<?php echo $photo['id']; ?> " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'status', this ); wppaPhotoStatusChange( <?php echo $photo['id']; ?> ); "> <option value="pending" <?php if ($photo['status'] == 'pending') { echo 'selected="selected"'; } ?> ><?php _e('Pending', 'wp-photo-album-plus'); ?> </option> <option value="publish" <?php if ($photo['status'] == 'publish') { echo 'selected="selected"'; } ?> ><?php _e('Publish', 'wp-photo-album-plus'); ?> </option> <?php if (wppa_switch('ext_status_restricted') && !wppa_user_is('administrator')) { $dis = ' disabled'; } else { $dis = ''; } ?> <option value="featured" <?php if ($photo['status'] == 'featured') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Featured', 'wp-photo-album-plus'); ?> </option> <option value="gold" <?php if ($photo['status'] == 'gold') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Gold', 'wp-photo-album-plus'); ?> </option> <option value="silver" <?php if ($photo['status'] == 'silver') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Silver', 'wp-photo-album-plus'); ?> </option> <option value="bronze" <?php if ($photo['status'] == 'bronze') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Bronze', 'wp-photo-album-plus'); ?> </option> <option value="scheduled" <?php if ($photo['status'] == 'scheduled') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Scheduled', 'wp-photo-album-plus'); ?> </option> <option value="private" <?php if ($photo['status'] == 'private') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Private', 'wp-photo-album-plus'); ?> </option> </select> </td> <td class="wppa-datetime-<?php echo $photo['id']; ?> " > <?php echo wppa_get_date_time_select_html('photo', $photo['id'], true); ?> </td> </tr> </table> <?php } else { ?> <input type="hidden" id="status-<?php echo $photo['id']; ?> " value="<?php echo $photo['status']; ?> " /> <table> <tr> <td> <?php if ($photo['status'] == 'pending') { _e('Pending', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'publish') { _e('Publish', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'featured') { _e('Featured', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'gold') { _e('Gold', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'silver') { _e('Silver', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'bronze') { _e('Bronze', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'scheduled') { _e('Scheduled', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'private') { _e('Private', 'wp-photo-album-plus'); } ?> </td> <td class="wppa-datetime-<?php echo $photo['id']; ?> " > <?php echo wppa_get_date_time_select_html('photo', $photo['id'], false); ?> </td> </tr> </table> <?php } ?> <span id="psdesc-<?php echo $photo['id']; ?> " class="description" style="display:none;" ><?php _e('Note: Featured photos should have a descriptive name; a name a search engine will look for!', 'wp-photo-album-plus'); ?> </span> </td> </tr> <!-- Watermark --> <?php if (!$is_video || is_file(wppa_fix_poster_ext(wppa_get_photo_path($photo['id']), $photo['id']))) { ?> <tr style="vertical-align:middle;" > <th > <label><?php _e('Watermark:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $user = wppa_get_user(); if (wppa_switch('watermark_on')) { if (wppa_switch('watermark_user') || current_user_can('wppa_settings')) { echo __('File:', 'wppa', 'wp-photo-album-plus') . ' '; ?> <select id="wmfsel_<?php echo $photo['id']; ?> " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'wppa_watermark_file_<?php echo $user; ?> ', this );" > <?php echo wppa_watermark_file_select(); ?> </select> <?php echo '<br />' . __('Pos:', 'wp-photo-album-plus') . ' '; ?> <select id="wmpsel_<?php echo $photo['id']; ?> " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'wppa_watermark_pos_<?php echo $user; ?> ', this );" > <?php echo wppa_watermark_pos_select(); ?> </select> <input type="button" class="button-secundary" value="<?php _e('Apply watermark', 'wp-photo-album-plus'); ?> " onclick="if ( confirm( '<?php echo esc_js(__('Are you sure? Once applied it can not be removed!', 'wp-photo-album-plus')) . '\\n\\n' . esc_js(__('And I do not know if there is already a watermark on this photo', 'wp-photo-album-plus')); ?> ' ) ) wppaAjaxApplyWatermark( <?php echo $photo['id']; ?> , document.getElementById( 'wmfsel_<?php echo $photo['id']; ?> ' ).value, document.getElementById( 'wmpsel_<?php echo $photo['id']; ?> ' ).value )" /> <?php } else { echo __('File:', 'wppa', 'wp-photo-album-plus') . ' ' . __($wmfile, 'wp-photo-album-plus'); if ($wmfile != '--- none ---') { echo ' ' . __('Pos:', 'wp-photo-album-plus') . ' ' . $wmpos; } } ?> <img id="wppa-water-spin-<?php echo $photo['id']; ?> " src="<?php echo wppa_get_imgdir() . 'wpspin.gif'; ?> " style="visibility:hidden" /><?php } else { _e('Not configured', 'wp-photo-album-plus'); } ?> </td> </tr> <?php } ?> <!-- Remark --> <tr style="vertical-align: middle;" > <th > <label style="color:#070"><?php _e('Remark:', 'wp-photo-album-plus'); ?> </label> </th> <td id="photostatus-<?php echo $photo['id']; ?> " style="padding-left:10px; width: 400px;"> <?php if (wppa_is_video($photo['id'])) { echo sprintf(__('Video %s is not modified yet', 'wp-photo-album-plus'), $photo['id']); } else { echo sprintf(__('Photo %s is not modified yet', 'wp-photo-album-plus'), $photo['id']); } ?> </td> </tr> </tbody> </table> <script type="text/javascript">wppaPhotoStatusChange( <?php echo $photo['id']; ?> )</script> </div> <div style="clear:both;"></div> <?php if (!isset($_REQUEST['quick'])) { ?> <div class="wppa-links" > <table style="width:100%" > <tbody> <?php if (current_user_can('edit_posts') || current_user_can('edit_pages')) { ?> <tr> <td><?php _e('Single image shortcode', 'wp-photo-album-plus'); ?> :</td> <td><?php echo esc_js('[wppa type="photo" photo="' . $photo['id'] . '" size="' . wppa_opt('fullsize') . '"][/wppa]'); ?> </td> </tr> <?php } ?> <?php if (is_file(wppa_get_source_path($photo['id']))) { ?> <tr> <td><?php _e('Permalink', 'wp-photo-album-plus'); ?> :</td> <td><?php echo wppa_get_source_pl($photo['id']); ?> </td> </tr> <?php } ?> <tr> <td><?php _e('Hi resolution url', 'wp-photo-album-plus'); ?> :</td> <td><?php echo wppa_get_hires_url($photo['id']); ?> </td> </tr> <?php if (is_file(wppa_get_photo_path($photo['id']))) { ?> <tr> <td><?php _e('Display file url', 'wp-photo-album-plus'); ?> :</td> <td><?php echo wppa_get_lores_url($photo['id']); ?> </td> </tr> <?php } ?> <?php if (is_file(wppa_get_thumb_path($photo['id']))) { ?> <tr> <td><?php _e('Thumbnail file url', 'wp-photo-album-plus'); ?> :</td> <td><?php echo wppa_get_tnres_url($photo['id']); ?> </td> </tr> <?php } ?> </tbody> </table> </div> <?php } ?> </div> <!-- Comments --> <?php $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s ORDER BY `timestamp` DESC", $photo['id']), ARRAY_A); if ($comments) { ?> <div class="widefat" style="width:99%; font-size:11px;" > <table class="wppa-table widefat wppa-setting-table" > <thead> <tr style="font-weight:bold;" > <td style="padding:0 4px;" >#</td> <td style="padding:0 4px;" >User</td> <td style="padding:0 4px;" >Time since</td> <td style="padding:0 4px;" >Status</td> <td style="padding:0 4px;" >Comment</td> </tr> </thead> <tbody> <?php foreach ($comments as $comment) { echo ' <tr> <td style="padding:0 4px;" >' . $comment['id'] . '</td> <td style="padding:0 4px;" >' . $comment['user'] . '</td> <td style="padding:0 4px;" >' . wppa_get_time_since($comment['timestamp']) . '</td>'; if (current_user_can('wppa_comments') || current_user_can('wppa_moderate') || wppa_get_user() == $photo['owner'] && wppa_switch('owner_moderate_comment')) { $p = $comment['status'] == 'pending' ? 'selected="selected" ' : ''; $a = $comment['status'] == 'approved' ? 'selected="selected" ' : ''; $s = $comment['status'] == 'spam' ? 'selected="selected" ' : ''; $t = $comment['status'] == 'trash' ? 'selected="selected" ' : ''; echo ' <td style="padding:0 4px;" > <select style="height: 20px; font-size: 11px; padding:0;" onchange="wppaAjaxUpdateCommentStatus( ' . $photo['id'] . ', ' . $comment['id'] . ', this.value )" > <option value="pending" ' . $p . '>' . __('Pending', 'wp-photo-album-plus') . '</option> <option value="approved" ' . $a . '>' . __('Approved', 'wp-photo-album-plus') . '</option> <option value="spam" ' . $s . '>' . __('Spam', 'wp-photo-album-plus') . '</option> <option value="trash" ' . $t . '>' . __('Trash', 'wp-photo-album-plus') . '</option> </select > </td> '; } else { echo '<td style="padding:0 4px;" >'; if ($comment['status'] == 'pending') { _e('Pending', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'approved') { _e('Approved', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'spam') { _e('Spam', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'trash') { _e('Trash', 'wp-photo-album-plus'); } echo '</td>'; } echo '<td style="padding:0 4px;" >' . $comment['comment'] . '</td> </tr> '; } ?> </tbody> </table> </div> <?php } ?> <!-- </div> --> <div style="clear:both;margin-top:7px;"></div> <?php } /* foreach photo */ wppa_admin_page_links($page, $pagesize, $count, $link); } /* photos not empty */ }
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; }