Ticket #7251: 7251-add-simple-button.diff
File 7251-add-simple-button.diff, 1.7 KB (added by , 17 months ago) |
---|
-
plugins/plugin-directory/class-template.php
722 722 } 723 723 724 724 /** 725 * Generate a live preview (playground) link for a given plugin. 726 * 727 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 728 * @param string $landing_page The landing page for the preview. Option. Default: /wp-admin/plugins.php. 729 * @return string The preview url. 730 */ 731 public static function preview_link( $post = null, $landing_page = '/wp-admin/plugins.php' ) { 732 $post = get_post( $post ); 733 734 return sprintf( 'https://playground.wordpress.net/?plugin=%s&login=1&url=%s', esc_attr( $post->post_name ), esc_attr( $landing_page ) ); 735 } 736 737 /** 725 738 * Properly encodes a string to UTF-8. 726 739 * 727 740 * @static -
themes/pub/wporg-plugins/template-parts/plugin-single.php
40 40 41 41 <?php if ( 'publish' === get_post_status() || current_user_can( 'plugin_admin_view', $post ) ) : ?> 42 42 <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>"><?php esc_html_e( 'Download', 'wporg-plugins' ); ?></a> 43 <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::preview_link() ); ?>"><?php esc_html_e( 'Live Preview', 'wporg-plugins' ); ?></a> 43 44 <?php endif; ?> 44 45 </div> 45 46