Making WordPress.org


Ignore:
Timestamp:
02/03/2023 06:41:44 AM (2 years ago)
Author:
coffee2code
Message:

Photo Directory: Facilitate photo attribution with copy-to-clipboard functionality for Rich Text, HTML, and plain text suggestions.

Inspired by Openverse's implementation.

Props pollyplummer, Otto42 topher1kenobe, coffee2code.
Fixes #6097.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-photos/template-parts/photo-single.php

    r11753 r12385  
    8989        </div>
    9090
     91        <div class="attribution">
     92            <h3><?php _e( 'Attribution', 'wporg-photos' ); ?></h3>
     93            <div class="attribution-label">
     94                <?php _e( "Photo attribution is not necessary, but appreciated. If you'd like to give credit to the photographer, feel free to use this text:", 'wporg-photos' ); ?>
     95            </div>
     96            <div class="attribution-text">
     97                <div class="tabs">
     98                    <button class="active"><?php _e( 'Rich Text', 'wporg-photos' ); ?></button>
     99                    <button><?php _e( 'HTML', 'wporg-photos' ); ?></button>
     100                    <button><?php _e( 'Plain text', 'wporg-photos' ); ?></button>
     101                </div>
     102                <div class="tab tab-rich-text active">
     103                <?php printf(
     104                    /* translators: 1: URL to CCO license, 2: URL to photo's page, 3: URL to contributor's profile, 4: Contributor's display name, 5: URL to Photo Directory. */
     105                    __( '<a href="%1$s">CCO</a> licensed <a href="%2$s">photo</a> by <a href="%3$s">%4$s</a> from the <a href="%5$s">WordPress Photo Directory</a>.', 'wporg-photos' ),
     106                    'https://creativecommons.org/share-your-work/public-domain/cc0/',
     107                    esc_url( get_the_permalink() ),
     108                    esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
     109                    esc_html( get_the_author_meta( 'display_name' ) ),
     110                    esc_url( home_url( '/' ) )
     111                ); ?>
     112                </div>
     113                <div class="tab tab-html">
     114                    <?php printf(
     115                        /* translators: 1: URL to CCO license, 2: URL to photo's page, 3: URL to contributor's profile, 4: Contributor's display name, 5: URL to Photo Directory. */
     116                        htmlentities( '<p class="attribution">' . __( '<a href="%1$s">CCO</a> licensed <a href="%2$s">photo</a> by <a href="%3$s">%4$s</a> from the <a href="%5$s">WordPress Photo Directory</a>.', 'wporg-photos' ) . '</p>' ),
     117                        'https://creativecommons.org/share-your-work/public-domain/cc0/',
     118                        esc_url( get_the_permalink() ),
     119                        esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
     120                        esc_html( get_the_author_meta( 'display_name' ) ),
     121                        esc_url( home_url( '/' ) )
     122                    ); ?>
     123                </div>
     124                <div class="tab tab-plain-text">
     125                <?php printf(
     126                    /* translators: 1: Contributor's display name, 4: URL to photo's page. */
     127                    __( 'CCO licensed photo by %1$s from the WordPress Photo Directory: %2$s', 'wporg-photos' ),
     128                    esc_html( get_the_author_meta( 'display_name' ) ),
     129                    esc_url( get_the_permalink() )
     130                ); ?>
     131                </div>
     132                <button class="attribution-copy"><?php _e( 'Copy to clipboard', 'wporg-photos' ); ?></button>
     133            </div>
     134        </div>
     135
    91136        <div class="photo-license">
    92137            <h3><?php _e( 'License / Usage', 'wporg-photos' ); ?></h3>
Note: See TracChangeset for help on using the changeset viewer.