Changeset 5121 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-developers.php
- Timestamp:
- 03/08/2017 12:06:02 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-developers.php
r4620 r5121 15 15 */ 16 16 static function display() { 17 $post 18 $output = ' ';17 $post = get_post(); 18 $output = '<p>' . __( 'This is open source software. The following people have contributed to this plugin.', 'wporg-plugins' ) . '</p>'; 19 19 20 $contributors = get_terms( array( 21 'taxonomy' => 'plugin_contributors', 22 'object_ids' => array( $post->ID ), 23 'orderby' => 'term_order', 24 'fields' => 'names', 20 ob_start(); 21 the_widget( 'WordPressdotorg\Plugin_Directory\Widgets\Contributors', array(), array( 22 'before_title' => '<span class="screen-reader-text">', 23 'after_title' => '</span>', 24 'before_widget' => '', 25 'after_widget' => '', 25 26 ) ); 26 27 27 if ( ! $contributors || is_wp_error( $contributors ) ) { 28 $contributors = array(); 29 if ( $author = get_user_by( 'id', $post->post_author ) ) { 30 $contributors[] = $author->user_nicename; 31 } 32 } 33 34 $output .= '<p>' . __( 'This is open source software. The following people have contributed to this plugin.', 'wporg-plugins' ) . '</p>'; 35 36 $output .= '<ul class="plugin-developers">'; 37 foreach ( $contributors as $contributor_slug ) { 38 $contributor = get_user_by( 'slug', $contributor_slug ); 39 if ( ! $contributor ) { 40 continue; 41 } 42 43 $output .= '<li>' . get_avatar( $contributor->ID, 32 ) . '<a href="' . esc_url( 'https://profiles.wordpress.org/' . $contributor_slug ) . '">' . Template::encode( $contributor->display_name ) . '</a></li>'; 44 } 45 $output .= '</ul>'; 28 $output .= ob_get_clean(); 46 29 47 30 if ( is_user_logged_in() ) { 48 31 $subscribed = Tools::subscribed_to_plugin_commits( $post, get_current_user_id() ); 49 32 50 $subscribe_change_url = esc_url( add_query_arg( 51 array( 52 '_wpnonce' => wp_create_nonce( 'wp_rest' ), 53 ( $subscribed ? 'unsubscribe' : 'subscribe' ) => '1' 54 ), 55 home_url( 'wp-json/plugins/v1/plugin/' . $post->post_name . '/commit-subscription' ) 56 ) ); 33 $subscribe_change_url = esc_url( add_query_arg( array( 34 '_wpnonce' => wp_create_nonce( 'wp_rest' ), 35 ( $subscribed ? 'unsubscribe' : 'subscribe' ) => '1', 36 ), home_url( 'wp-json/plugins/v1/plugin/' . $post->post_name . '/commit-subscription' ) ) ); 57 37 } 58 38
Note: See TracChangeset
for help on using the changeset viewer.