Making WordPress.org


Ignore:
Timestamp:
07/22/2024 05:56:46 PM (2 years ago)
Author:
ryelle
Message:

Plugin Directory: Use the shared favorite button for favoriting plugins.

Merge https://github.com/WordPress/wordpress.org/pull/350

File:
1 edited

Legend:

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

    r13586 r13913  
    3838                                </div>
    3939
    40 
    4140                                <div>
    4241                                        <?php if ( get_query_var( 'plugin_advanced' ) ) : ?>
     
    5049                        </div>
    5150                        <div class="plugin-actions">
    52                                 <?php the_plugin_favorite_button(); ?>
     51                                <?php
     52                                $buttons = '<!-- wp:wporg/favorite-button /-->';
    5353
    54                                 <?php if ( 'publish' === get_post_status() || current_user_can( 'plugin_admin_view', $post ) ) : ?>
    55                                         <div class="is-small">
    56                                                 <a class="plugin-download wp-block-button__link download-button" href="<?php echo esc_url( Template::download_link() ); ?>"><?php esc_html_e( 'Download', 'wporg-plugins' ); ?></a>
    57                                         </div>
    58                                 <?php endif; ?>
    59                                 <?php if ( Template::is_preview_available() ) : ?>
    60                                         <div class="is-small">
    61                                                 <a class="plugin-preview wp-block-button__link is-small download-button" target="_blank" href="<?php echo esc_attr( add_query_arg( array( 'preview' => 1 ), get_the_permalink() ) ); ?>"><?php esc_html_e( 'Live Preview', 'wporg-plugins' ); ?></a>
    62                                         </div>
    63                                 <?php elseif ( Template::preview_link() && Template::is_preview_available( $post, 'edit' ) ) : ?>
    64                                         <div class="is-small">
    65                                                 <a class="plugin-preview wp-block-button__link is-small download-button" target="_blank" href="<?php echo esc_attr( add_query_arg( array( 'preview' => 1 ), get_the_permalink() ) ); ?>"><?php esc_html_e( 'Test Preview', 'wporg-plugins' ); ?></a>
    66                                         </div>
    67                                 <?php endif; ?>
     54                                if ( 'publish' === get_post_status() || current_user_can( 'plugin_admin_view', $post ) ) {
     55                                        $buttons .= sprintf(
     56                                                '<!-- wp:button {"className":"is-small plugin-download download-button"} -->
     57                                                <div class="wp-block-button is-small plugin-download download-button"><a class="wp-block-button__link wp-element-button" href="%1$s">%2$s</a></div>
     58                                                <!-- /wp:button -->',
     59                                                esc_url( Template::download_link() ),
     60                                                esc_html__( 'Download', 'wporg-plugins' )
     61                                        );
     62                                }
     63                                if ( Template::is_preview_available() ) {
     64                                        $buttons .= sprintf(
     65                                                '<!-- wp:button {"className":"is-small is-style-outline plugin-preview download-button"} -->
     66                                                <div class="wp-block-button is-small is-style-outline plugin-preview download-button"><a class="wp-block-button__link wp-element-button" href="%1$s">%2$s</a></div>
     67                                                <!-- /wp:button -->',
     68                                                esc_attr( add_query_arg( array( 'preview' => 1 ), get_the_permalink() ) ),
     69                                                esc_html__( 'Live Preview', 'wporg-plugins' )
     70                                        );
     71                                } elseif ( Template::preview_link() && Template::is_preview_available( $post, 'edit' ) ) {
     72                                        $buttons .= sprintf(
     73                                                '<!-- wp:button {"className":"is-small is-style-outline plugin-preview download-button"} -->
     74                                                <div class="wp-block-button is-small is-style-outline plugin-preview download-button"><a class="wp-block-button__link wp-element-button" href="%1$s">%2$s</a></div>
     75                                                <!-- /wp:button -->',
     76                                                esc_attr( add_query_arg( array( 'preview' => 1 ), get_the_permalink() ) ),
     77                                                esc_html__( 'Test Preview', 'wporg-plugins' )
     78                                        );
     79                                }
     80                                echo do_blocks( $buttons ); // phpcs:ignore -- Output escaped while building string.
     81                                ?>
    6882                        </div>
    6983                </div>
Note: See TracChangeset for help on using the changeset viewer.