Changeset 13997
- Timestamp:
- 08/26/2024 11:18:23 PM (6 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/admin.php
r13977 r13997 724 724 */ 725 725 public static function meta_box_photo( $post, $args ) { 726 self::output_photo_in_metabox( $post, [ 900, 450 ], true);726 echo Template_Tags\get_photo_as_grid_item( $post, [ 900, 450 ], 'image' ); 727 727 } 728 728 … … 772 772 773 773 // Show the photo. 774 self::output_photo_in_metabox( $photo, 'medium', false);774 echo Template_Tags\get_photo_as_grid_item( $photo, 'medium', 'edit' ); 775 775 776 776 $shown_photos++; … … 792 792 echo '</div>' . "\n"; 793 793 } 794 }795 796 /**797 * Outputs markup for a photo intended to be shown in an admin metabox.798 *799 * @param WP_Post $post Photo post object.800 * @param string|int[] $size Image size. Accepts any registered image size name, or an801 * array of width and height values in pixels (in that order).802 * @param bool $link_to_fullsize Should the image link to its full-sized version? If not, it803 * will link to edit the photo post. Default true;804 */805 protected static function output_photo_in_metabox( $post, $size, $link_to_fullsize = true ) {806 $image_id = get_post_thumbnail_id( $post );807 if ( ! $image_id ) {808 return;809 }810 811 $pending_notice = '';812 $classes = 'photo-thumbnail';813 814 if ( Photo::is_controversial( $image_id ) ) {815 $classes .= ' blurred';816 }817 818 if ( 'pending' === $post->post_status ) {819 $classes .= ' pending';820 if ( ! $link_to_fullsize ) {821 $pending_notice = '<div class="pending-notice">' . __( 'Pending', 'wporg-photos' ) . '</div>';822 }823 }824 825 if ( $link_to_fullsize ) {826 $link_url = wp_get_attachment_url( $image_id );827 $label = __( 'View full-sized version of the photo.', 'wporg-photos' );828 } else {829 $link_url = get_edit_post_link( $post );830 $label = sprintf( __( 'Edit photo post “%s”', 'wporg-photos' ), $post->post_title );831 }832 833 printf(834 '<span><a class="photos-photo-link row-title" href="%s" target="_blank" aria-label="%s"><img class="%s" src="%s" alt="" /></a>%s</span>',835 esc_url( $link_url ),836 /* translators: %s: Post title. */837 esc_attr( $label ),838 esc_attr( $classes ),839 esc_url( get_the_post_thumbnail_url( $post->ID, $size ) ),840 $pending_notice841 );842 794 } 843 795
Note: See TracChangeset
for help on using the changeset viewer.